From: "Kip Walker" <kwalker@broadcom.com>
To: linux-mips@linux-mips.org
Subject: 64-bit little endian semaphore bug
Date: Fri, 08 Nov 2002 15:37:38 -0800 [thread overview]
Message-ID: <3DCC4AC2.EC7BD4E1@broadcom.com> (raw)
[-- 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;
}
next reply other threads:[~2002-11-08 22:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-08 23:37 Kip Walker [this message]
2002-11-09 19:42 ` 64-bit little endian semaphore bug Ralf Baechle
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=3DCC4AC2.EC7BD4E1@broadcom.com \
--to=kwalker@broadcom.com \
--cc=linux-mips@linux-mips.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 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.