lkml.org 
[lkml]   [2002]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [long]2.5.44-mm3 UP went into unexpected trashing
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;
}

/**
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:30    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site