* 64-bit little endian semaphore bug
@ 2002-11-08 23:37 Kip Walker
2002-11-09 19:42 ` Ralf Baechle
0 siblings, 1 reply; 2+ messages in thread
From: Kip Walker @ 2002-11-08 23:37 UTC (permalink / raw)
To: linux-mips
[-- Attachment #1: Type: text/plain, Size: 530 bytes --]
In the 64-bit kernel, the semaphore structure (like the 32-bit kernel)
has waking and count fields swizzled so they line up the same in a
64-bit double word for either endian. However, the semaphore-helper.h
function waking_non_zero_interruptible still has specialized code for
little-endian manipulation of the fields as though they are swapped.
Patch is attached, and fixes a pipe deadlock I was seeing (both the
reader and writer were down'ing the semaphore).
patch is against 2.5, but should be clean against 2.4 also.
Kip
[-- Attachment #2: semhelp.patch --]
[-- Type: text/plain, Size: 1434 bytes --]
Index: include/asm-mips64/semaphore-helper.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips64/semaphore-helper.h,v
retrieving revision 1.10
diff -u -r1.10 semaphore-helper.h
--- include/asm-mips64/semaphore-helper.h 19 Aug 2002 23:25:28 -0000 1.10
+++ include/asm-mips64/semaphore-helper.h 8 Nov 2002 22:32:46 -0000
@@ -66,8 +66,6 @@
{
long ret, tmp;
-#ifdef __MIPSEB__
-
__asm__ __volatile__(
".set\tpush\t\t\t# waking_non_zero_interruptible\n\t"
".set\tnoat\n\t"
@@ -87,38 +85,6 @@
".set\tpop"
: "=&r" (ret), "=&r" (tmp), "=m" (*sem)
: "r" (signal_pending(tsk)), "i" (-EINTR));
-
-#elif defined(__MIPSEL__)
-
- __asm__ __volatile__(
- ".set\tpush\t\t\t# waking_non_zero_interruptible\n\t"
- ".set\t noat\n"
- "0:\tlld\t%1, %2\n\t"
- "li\t%0, 0\n\t"
- "blez\t%1, 1f\n\t"
- "dli\t$1, 0x0000000100000000\n\t"
- "dsubu\t%1, %1, $1\n\t"
- "li\t%0, 1\n\t"
- "b\t2f\n"
- "1:\tbeqz\t%3, 2f\n\t"
- "li\t%0, %4\n\t"
- /*
- * It would be nice to assume that sem->count
- * is != -1, but we will guard against that case
- */
- "daddiu\t$1, %1, 1\n\t"
- "dsll32\t$1, $1, 0\n\t"
- "dsrl32\t$1, $1, 0\n\t"
- "dsrl32\t%1, %1, 0\n\t"
- "dsll32\t%1, %1, 0\n\t"
- "or\t%1, %1, $1\n"
- "2:\tscd\t%1, %2\n\t"
- "beqz\t %1, 0b\n\t"
- ".set\tpop"
- : "=&r" (ret), "=&r" (tmp), "=m" (*sem)
- : "r" (signal_pending(tsk)), "i" (-EINTR));
-
-#endif
return ret;
}
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: 64-bit little endian semaphore bug
2002-11-08 23:37 64-bit little endian semaphore bug Kip Walker
@ 2002-11-09 19:42 ` Ralf Baechle
0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2002-11-09 19:42 UTC (permalink / raw)
To: Kip Walker; +Cc: linux-mips
On Fri, Nov 08, 2002 at 03:37:38PM -0800, Kip Walker wrote:
> In the 64-bit kernel, the semaphore structure (like the 32-bit kernel)
> has waking and count fields swizzled so they line up the same in a
> 64-bit double word for either endian. However, the semaphore-helper.h
> function waking_non_zero_interruptible still has specialized code for
> little-endian manipulation of the fields as though they are swapped.
>
> Patch is attached, and fixes a pipe deadlock I was seeing (both the
> reader and writer were down'ing the semaphore).
>
> patch is against 2.5, but should be clean against 2.4 also.
Patch is ok. I tweaked it slightly to make the 2.4 and 2.5 versions
identical.
General request to everybody - cc me on all patches that you wish to
submit even if you're posting them to some list.
Ralf
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-11-09 19:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-08 23:37 64-bit little endian semaphore bug Kip Walker
2002-11-09 19:42 ` Ralf Baechle
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.