mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dipankar Sarma <dipankar@in.ibm.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: maneesh@in.ibm.com, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@zip.com.au>
Subject: Re: [long]2.5.44-mm3 UP went into unexpected trashing
Date: Fri, 25 Oct 2002 17:57:05 +0530	[thread overview]
Message-ID: <20021025175705.A14451@in.ibm.com> (raw)
In-Reply-To: <20021025002228.A14712C2DD@lists.samba.org>; from rusty@rustcorp.com.au on Fri, Oct 25, 2002 at 09:35:17AM +1000

On Fri, Oct 25, 2002 at 09:35:17AM +1000, Rusty Russell wrote:
> In message <20021024211633.A21583@in.ibm.com> you write:
> > AFAICS, find_first_bit() needs to be fixed to return "size" if the
> > bitmask is all zeros.
> 
> Yes, the x86 one looks wrong.  Other archs seem to get this correct.
> 

I tested this code in userspace and seems to do the right thing - return
"size" if no bit is set. But I can't find a larger_cpu_mask patch to
test with -mm5. Should I forward port the one from -mm4 experimental or
is there a new version available somewhere ?

Thanks
-- 
Dipankar Sarma  <dipankar@in.ibm.com> http://lse.sourceforge.net
Linux Technology Center, IBM Software Lab, Bangalore, India.

bitops_fix.patch
----------------

diff -urN linux-2.5.44-mm5/include/asm-i386/bitops.h linux-2.5.44-mm5-fix/include/asm-i386/bitops.h
--- linux-2.5.44-mm5/include/asm-i386/bitops.h	Sat Oct 19 09:32:01 2002
+++ linux-2.5.44-mm5-fix/include/asm-i386/bitops.h	Fri Oct 25 15:19:54 2002
@@ -306,18 +306,23 @@
 	int res;
 
 	/* This looks at memory. Mark it volatile to tell gcc not to move it around */
-	__asm__ __volatile__(
-		"xorl %%eax,%%eax\n\t"
-		"repe; scasl\n\t"
-		"jz 1f\n\t"
-		"leal -4(%%edi),%%edi\n\t"
-		"bsfl (%%edi),%%eax\n"
-		"1:\tsubl %%ebx,%%edi\n\t"
-		"shll $3,%%edi\n\t"
-		"addl %%edi,%%eax"
-		:"=a" (res), "=&c" (d0), "=&D" (d1)
-		:"1" ((size + 31) >> 5), "2" (addr), "b" (addr));
-	return res;
+        __asm__ __volatile__(
+                "movl %%edi,%%esi\n\t"
+                "movl %%ecx,%%edx\n\t"
+                "repe; scasl\n\t"
+                "subl %%ecx,%%edx\n\t"
+                "movl %%edx,%%ecx\n\t"
+                "shll $5,%%edx\n\t"
+                "movl (%%esi,%%ecx,4),%%edi\n\t"
+                "movl %%ebx,%%eax\n\t"
+                "testl %%edi,%%edi\n\t"
+                "jz 1f\n\t"
+                "bsfl %%edi,%%eax\n\t"
+                "addl %%edx,%%eax\n\t"
+                "1:\t"
+                :"=a" (res), "=&c" (d0), "=&D" (d1)
+                :"1" ((size - 1) >> 5), "2" (addr), "b" (size));
+        return res;
 }
 
 /**

  reply	other threads:[~2002-10-25 12:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-24  7:47 Helge Hafting
2002-10-24  7:58 ` Andrew Morton
2002-10-24  8:17   ` Andrew Morton
2002-10-24  9:35     ` Dipankar Sarma
2002-10-24 11:45     ` Maneesh Soni
2002-10-24 11:47       ` Ed Tomlinson
2002-10-24 12:38         ` Dipankar Sarma
2002-10-24 15:31           ` Dipankar Sarma
2002-10-24 15:46             ` Dipankar Sarma
2002-10-24 23:35               ` Rusty Russell
2002-10-25 12:27                 ` Dipankar Sarma [this message]
     [not found]                   ` <3DB98823.67FDBEF3@digeo.com>
     [not found]                     ` <20021025235222.A25786@in.ibm.com>
2002-10-26 15:54                       ` Dipankar Sarma
2002-10-29 12:53                         ` Ed Tomlinson
2002-10-24 12:46         ` Maneesh Soni

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=20021025175705.A14451@in.ibm.com \
    --to=dipankar@in.ibm.com \
    --cc=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maneesh@in.ibm.com \
    --cc=rusty@rustcorp.com.au \
    /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

Powered by JetHome