mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] bitmap double fault, gdt
Date: Mon, 2 Feb 2004 20:42:34 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.44.0402021958130.16648-200000@localhost.localdomain> (raw)

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1953 bytes --]

With 2.6.2-rc1-mm3 I started getting occasional double faults when idle.
Seemed to be irqbalance (with NR_CPUS 2) using new bitmap_parse calling
bitmap_shift_right: collapse when it reloads %esp with 0 before return.

Google tells me that there were compiler code generation problems
around here before, but I didn't track down quite what: are we sure
they've been eliminated?  Disassembly of bitmap_shift_right attached,
that's with an RH 3.2.3-20 gcc, but I see similar code from more recent
SuSE 3.3.2 gcc: sub $0x4,%esp ... sub %eax,%esp ... lea 0x1b(%esp,1),%esi

CONFIG_CPU_PENTIUMIII=y; and I do have CONFIG_FRAME_POINTER=y, but
it looks like that makes no difference, that this alloca kind of code
uses frame pointer anyway.  I've tried but failed to produce similar
disassembly compiling outside the kernel, despite using kernel cflags.

If you think there is still a code generation problem here with popular
versions of gcc, perhaps we should stop that variable stack declaration?

Hugh

--- 2.6.2-rc2-mm2/lib/bitmap.c	2004-01-25 18:04:19.000000000 +0000
+++ linux/lib/bitmap.c	2004-01-30 20:44:44.000000000 +0000
@@ -12,6 +12,8 @@
 #include <asm/bitops.h>
 #include <asm/uaccess.h>
 
+#define MAX_BITMAP_BITS	512U	/* for ia64 NR_CPUS maximum */
+
 int bitmap_empty(const unsigned long *bitmap, int bits)
 {
 	int k, lim = bits/BITS_PER_LONG;
@@ -73,8 +75,9 @@
 			const unsigned long *src, int shift, int bits)
 {
 	int k;
-	DECLARE_BITMAP(__shr_tmp, bits);
+	DECLARE_BITMAP(__shr_tmp, MAX_BITMAP_BITS);
 
+	BUG_ON(bits > MAX_BITMAP_BITS);
 	bitmap_clear(__shr_tmp, bits);
 	for (k = 0; k < bits - shift; ++k)
 		if (test_bit(k + shift, src))
@@ -87,8 +90,9 @@
 			const unsigned long *src, int shift, int bits)
 {
 	int k;
-	DECLARE_BITMAP(__shl_tmp, bits);
+	DECLARE_BITMAP(__shl_tmp, MAX_BITMAP_BITS);
 
+	BUG_ON(bits > MAX_BITMAP_BITS);
 	bitmap_clear(__shl_tmp, bits);
 	for (k = bits; k >= shift; --k)
 		if (test_bit(k - shift, src))

[-- Attachment #2: bitmap_shift_right disassembly --]
[-- Type: TEXT/PLAIN, Size: 3611 bytes --]

00000180 <bitmap_shift_right>:
 180:	55                   	push   %ebp
 181:	89 e5                	mov    %esp,%ebp
 183:	57                   	push   %edi
 184:	56                   	push   %esi
 185:	53                   	push   %ebx
 186:	83 ec 04             	sub    $0x4,%esp
 189:	8b 5d 14             	mov    0x14(%ebp),%ebx
 18c:	89 65 f0             	mov    %esp,0xfffffff0(%ebp)
 18f:	89 da                	mov    %ebx,%edx
 191:	83 c2 1f             	add    $0x1f,%edx
 194:	8d 43 3e             	lea    0x3e(%ebx),%eax
 197:	0f 48 d0             	cmovs  %eax,%edx
 19a:	c1 fa 05             	sar    $0x5,%edx
 19d:	c1 e2 02             	shl    $0x2,%edx
 1a0:	8d 42 10             	lea    0x10(%edx),%eax
 1a3:	29 c4                	sub    %eax,%esp
 1a5:	8d 74 24 1b          	lea    0x1b(%esp,1),%esi
 1a9:	83 e6 f0             	and    $0xfffffff0,%esi
 1ac:	89 d1                	mov    %edx,%ecx
 1ae:	31 c0                	xor    %eax,%eax
 1b0:	c1 e9 02             	shr    $0x2,%ecx
 1b3:	89 f7                	mov    %esi,%edi
 1b5:	f3 ab                	repz stos %eax,%es:(%edi)
 1b7:	f6 c2 02             	test   $0x2,%dl
 1ba:	74 02                	je     1be <bitmap_shift_right+0x3e>
 1bc:	66 ab                	stos   %ax,%es:(%edi)
 1be:	f6 c2 01             	test   $0x1,%dl
 1c1:	74 01                	je     1c4 <bitmap_shift_right+0x44>
 1c3:	aa                   	stos   %al,%es:(%edi)
 1c4:	8b 7d 10             	mov    0x10(%ebp),%edi
 1c7:	89 d8                	mov    %ebx,%eax
 1c9:	31 d2                	xor    %edx,%edx
 1cb:	29 f8                	sub    %edi,%eax
 1cd:	39 c2                	cmp    %eax,%edx
 1cf:	7d 2a                	jge    1fb <bitmap_shift_right+0x7b>
 1d1:	89 c1                	mov    %eax,%ecx
 1d3:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 1d9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,1),%edi
 1e0:	8b 7d 10             	mov    0x10(%ebp),%edi
 1e3:	8d 04 17             	lea    (%edi,%edx,1),%eax
 1e6:	8b 7d 0c             	mov    0xc(%ebp),%edi
 1e9:	0f a3 07             	bt     %eax,(%edi)
 1ec:	19 c0                	sbb    %eax,%eax
 1ee:	85 c0                	test   %eax,%eax
 1f0:	74 04                	je     1f6 <bitmap_shift_right+0x76>
 1f2:	f0 0f ab 16          	lock bts %edx,(%esi)
 1f6:	42                   	inc    %edx
 1f7:	39 ca                	cmp    %ecx,%edx
 1f9:	7c e5                	jl     1e0 <bitmap_shift_right+0x60>
 1fb:	89 d8                	mov    %ebx,%eax
 1fd:	8d 53 3e             	lea    0x3e(%ebx),%edx
 200:	83 c0 1f             	add    $0x1f,%eax
 203:	0f 48 c2             	cmovs  %edx,%eax
 206:	c1 f8 05             	sar    $0x5,%eax
 209:	c1 e0 02             	shl    $0x2,%eax
 20c:	89 c1                	mov    %eax,%ecx
 20e:	c1 e9 02             	shr    $0x2,%ecx
 211:	8b 7d 08             	mov    0x8(%ebp),%edi
 214:	f3 a5                	repz movsl %ds:(%esi),%es:(%edi)
 216:	a8 02                	test   $0x2,%al
 218:	74 02                	je     21c <bitmap_shift_right+0x9c>
 21a:	66 a5                	movsw  %ds:(%esi),%es:(%edi)
 21c:	a8 01                	test   $0x1,%al
 21e:	74 01                	je     221 <bitmap_shift_right+0xa1>
 220:	a4                   	movsb  %ds:(%esi),%es:(%edi)
 221:	8b 65 f0             	mov    0xfffffff0(%ebp),%esp
 224:	8d 65 f4             	lea    0xfffffff4(%ebp),%esp
 227:	5b                   	pop    %ebx
 228:	5e                   	pop    %esi
 229:	5f                   	pop    %edi
 22a:	5d                   	pop    %ebp
 22b:	c3                   	ret    

                 reply	other threads:[~2004-02-02 20:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44.0402021958130.16648-200000@localhost.localdomain \
    --to=hugh@veritas.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®