* [PATCH 3/3] 64-bit futexes: x86 support
@ 2008-05-31 1:27 Ulrich Drepper
2008-05-31 2:25 ` Linus Torvalds
2008-06-02 8:22 ` Ingo Molnar
0 siblings, 2 replies; 10+ messages in thread
From: Ulrich Drepper @ 2008-05-31 1:27 UTC (permalink / raw)
To: linux-kernel; +Cc: akpm, mtk.manpages, torvalds
This patch adds 64-bit futex support for x86. As explained in the
introduction, this requires a new system call. The remaining changes are
similarly to the x86-64 changes: enable support for FUTEX_WAKE_OP.
[Sorry Andrew, but syscalls unfortunately have to be added at the end.
So you'll have to live with the conflicts.]
arch/x86/ia32/ia32entry.S | 1
arch/x86/ia32/sys_ia32.c | 46 ++++++++++++++++++++++++++++++
arch/x86/kernel/sys_i386_32.c | 48 ++++++++++++++++++++++++++++++++
arch/x86/kernel/syscall_table_32.S | 1
include/asm-x86/futex.h | 55 +++++++++++++++++++++++++++++++++++--
include/asm-x86/types.h | 2 -
include/asm-x86/unistd_32.h | 1
scripts/checksyscalls.sh | 1
8 files changed, 151 insertions(+), 4 deletions(-)
Signed-off-by: Ulrich Drepper <drepper@redhat.com>
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index b5e329d..776b6a2 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -731,4 +731,5 @@ ia32_sys_call_table:
.quad sys32_fallocate
.quad compat_sys_timerfd_settime /* 325 */
.quad compat_sys_timerfd_gettime
+ .quad sys32_futex64
ia32_syscall_end:
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index f00afdf..f5a6403 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -24,6 +24,7 @@
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/file.h>
+#include <linux/futex.h>
#include <linux/signal.h>
#include <linux/syscalls.h>
#include <linux/times.h>
@@ -865,3 +866,48 @@ asmlinkage long sys32_fallocate(int fd, int mode, unsigned offset_lo,
return sys_fallocate(fd, mode, ((u64)offset_hi << 32) | offset_lo,
((u64)len_hi << 32) | len_lo);
}
+
+/* For the futex syscall with 64-bit values we would need more than the six
+ available syscall parameters. Pass the parameters in memory instead. */
+struct futex_arg_struct {
+ u32 uaddr;
+ int op;
+ u64 val;
+ u32 utime;
+ u32 uaddr2;
+ u64 val3;
+};
+
+asmlinkage long sys32_futex64(struct futex_arg_struct __user *arg)
+{
+ struct futex_arg_struct a;
+ struct compat_timespec *utime;
+ struct timespec ts;
+ ktime_t t, *tp = NULL;
+ u32 val2 = 0;
+ int cmd;
+
+ if (copy_from_user(&a, arg, sizeof(a)))
+ return -EFAULT;
+
+ cmd = a.op & FUTEX_CMD_MASK;
+ utime = (struct compat_timespec __user *) (u64) a.utime;
+
+ if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI ||
+ cmd == FUTEX_WAIT_BITSET)) {
+ if (get_compat_timespec(&ts, utime))
+ return -EFAULT;
+ if (!timespec_valid(&ts))
+ return -EINVAL;
+
+ t = timespec_to_ktime(ts);
+ if (cmd == FUTEX_WAIT)
+ t = ktime_add_safe(ktime_get(), t);
+ tp = &t;
+ }
+ if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE)
+ val2 = a.utime;
+
+ return do_futex((void __user *) (u64) a.uaddr, a.op, a.val, tp,
+ (void __user *) (u64) a.uaddr2, val2, a.val3);
+}
diff --git a/arch/x86/kernel/sys_i386_32.c b/arch/x86/kernel/sys_i386_32.c
index d2ab52c..a28da03 100644
--- a/arch/x86/kernel/sys_i386_32.c
+++ b/arch/x86/kernel/sys_i386_32.c
@@ -244,3 +244,51 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[])
: "0" (__NR_execve),"ri" (filename),"c" (argv), "d" (envp) : "memory");
return __res;
}
+
+
+/* For the futex syscall with 64-bit values we would need more than the six
+ available syscall parameters. Pass the parameters in memory instead. */
+struct futex_arg_struct {
+ void __user *uaddr;
+ int op;
+ u64 val;
+ struct timespec __user *utime;
+ void __user *uaddr2;
+ u64 val3;
+};
+
+asmlinkage long sys_futex64(struct futex_arg_struct __user *arg)
+{
+ struct futex_arg_struct a;
+ struct timespec ts;
+ ktime_t t, *tp = NULL;
+ u32 val2 = 0;
+ int cmd;
+
+ if (copy_from_user(&a, arg, sizeof(a)))
+ return -EFAULT;
+
+ cmd = a.op & FUTEX_CMD_MASK;
+
+ if (a.utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI ||
+ cmd == FUTEX_WAIT_BITSET)) {
+ if (copy_from_user(&ts, a.utime, sizeof(ts)) != 0)
+ return -EFAULT;
+ if (!timespec_valid(&ts))
+ return -EINVAL;
+
+ t = timespec_to_ktime(ts);
+ if (cmd == FUTEX_WAIT)
+ t = ktime_add_safe(ktime_get(), t);
+ tp = &t;
+ }
+ /*
+ * requeue parameter in 'utime' if cmd == FUTEX_REQUEUE.
+ * number of waiters to wake in 'utime' if cmd == FUTEX_WAKE_OP.
+ */
+ if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE ||
+ cmd == FUTEX_WAKE_OP)
+ val2 = (u32) (unsigned long) a.utime;
+
+ return do_futex(a.uaddr, a.op, a.val, tp, a.uaddr2, val2, a.val3);
+}
diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S
index adff556..5b1b5d9 100644
--- a/arch/x86/kernel/syscall_table_32.S
+++ b/arch/x86/kernel/syscall_table_32.S
@@ -326,3 +326,4 @@ ENTRY(sys_call_table)
.long sys_fallocate
.long sys_timerfd_settime /* 325 */
.long sys_timerfd_gettime
+ .long sys_futex64
diff --git a/include/asm-x86/unistd_32.h b/include/asm-x86/unistd_32.h
index 8317d94..8be8e19 100644
--- a/include/asm-x86/unistd_32.h
+++ b/include/asm-x86/unistd_32.h
@@ -332,6 +332,7 @@
#define __NR_fallocate 324
#define __NR_timerfd_settime 325
#define __NR_timerfd_gettime 326
+#define __NR_futex64 327
#ifdef __KERNEL__
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
index 366f8c7..a03b34c 100755
--- a/scripts/checksyscalls.sh
+++ b/scripts/checksyscalls.sh
@@ -98,6 +98,7 @@ cat << EOF
#define __IGNORE_setgid32
#define __IGNORE_setfsuid32
#define __IGNORE_setfsgid32
+#define __IGNORE_futex64
/* sync_file_range had a stupid ABI. Allow sync_file_range2 instead */
#ifdef __NR_sync_file_range2
--- a/include/asm-x86/types.h 2008-05-28 15:57:16.000000000 -0700
+++ b/include/asm-x86/types.h 2008-05-28 15:57:39.000000000 -0700
@@ -30,10 +30,8 @@
typedef u32 dma_addr_t;
#endif
-#ifdef CONFIG_X86_64
typedef u64 futex_val_t;
#define __have_futex_val_t
-#endif
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
--- a/include/asm-x86/futex.h 2008-05-28 16:09:03.000000000 -0700
+++ b/include/asm-x86/futex.h 2008-05-28 16:09:20.000000000 -0700
@@ -46,7 +46,34 @@
oldval = oldvaltemp; \
} while (0)
-#ifndef CONFIG_X86_32
+#ifdef CONFIG_X86_32
+#define __futex_atomic64_op(insns, ret, oldval, uaddr, oparg) \
+ do { \
+ u32 oldvaltemp1, oldvaltemp2; \
+ int tem2; \
+ asm volatile("1:\tmovl %3, %0\n" \
+ "2:\tmovl %4, %1\n" \
+ "\tmovl\t%0, %5\n" \
+ "\tmovl\t%1, %6\n" \
+ "\t" insns "\n" \
+ "3:\tlock; cmpxchg8b %3\n" \
+ "\tjnz\t1b\n" \
+ "4:\t.section .fixup,\"ax\"\n" \
+ "5:\tmov\t%5, %1\n" \
+ "\tjmp\t4b\n" \
+ "\t.previous\n" \
+ _ASM_EXTABLE(1b, 5b) \
+ _ASM_EXTABLE(2b, 5b) \
+ _ASM_EXTABLE(3b, 5b) \
+ : "=&a" (oldvaltemp1), "=&d" (oldvaltmep2),\
+ "=&r" (ret), \
+ "+m" (((u32 __user *) uaddr)[0]), \
+ "+m" (((u32 __user *) uaddr)[1]), \
+ "=&b" (tem), "=&c" (tem2) \
+ : "r" (oparg), "i" (-EFAULT), "2" (0)); \
+ oldval = (((u64) oldvaltemp2) << 32) | oldvaltemp1; \
+ } while (0)
+#else
#define __futex_atomic64_op1(insn, ret, oldval, uaddr, oparg) \
asm volatile("1:\t" insn "\n" \
"2:\t.section .fixup,\"ax\"\n" \
@@ -97,6 +124,12 @@ static inline int futex_atomic_op_inuser
if (op != FUTEX_OP_SET && boot_cpu_data.x86 == 3)
return -ENOSYS;
#endif
+#ifdef CONFIG_X86_32
+ /* Not all 32-bit machines support 8-byte cmpxchg. We just
+ unconditionally perform a runtime check for the feature. */
+ if ((op & FUTEX_FLAG_64) && !boot_cpu_has(X86_FEATURE_CX8))
+ return -ENOSYS;
+#endif
pagefault_disable();
@@ -117,7 +150,25 @@ static inline int futex_atomic_op_inuser
case FUTEX_OP_XOR:
__futex_atomic_op2("xorl %4, %3", ret, oldval, uaddr, oparg);
break;
-#ifndef CONFIG_X86_32
+#ifdef CONFIG_X86_32
+ case FUTEX_OP64_SET:
+ __futex_atomic64_op("movl %7, %5\n\txorl %6, %6",
+ ret, oldval, uaddr, oparg);
+ break;
+ case FUTEX_OP64_ADD:
+ __futex_atomic64_op("addl %7, %5\n\tadcl $0, %6", ret, oldval,
+ uaddr, oparg);
+ break;
+ case FUTEX_OP64_OR:
+ __futex_atomic64_op("orl %7, %5", ret, oldval, uaddr, oparg);
+ break;
+ case FUTEX_OP64_ANDN:
+ __futex_atomic64_op("andl %7, %5", ret, oldval, uaddr, ~oparg);
+ break;
+ case FUTEX_OP64_XOR:
+ __futex_atomic64_op("xorl %7, %5", ret, oldval, uaddr, oparg);
+ break;
+#else
case FUTEX_OP64_SET:
__futex_atomic64_op1("xchgq %q0, %q2",
ret, oldval, uaddr, oparg);
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] 64-bit futexes: x86 support
2008-05-31 1:27 [PATCH 3/3] 64-bit futexes: x86 support Ulrich Drepper
@ 2008-05-31 2:25 ` Linus Torvalds
2008-05-31 3:18 ` Ulrich Drepper
2008-06-02 8:22 ` Ingo Molnar
1 sibling, 1 reply; 10+ messages in thread
From: Linus Torvalds @ 2008-05-31 2:25 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: linux-kernel, akpm, mtk.manpages
On Fri, 30 May 2008, Ulrich Drepper wrote:
>
> +#ifdef CONFIG_X86_32
> + /* Not all 32-bit machines support 8-byte cmpxchg. We just
> + unconditionally perform a runtime check for the feature. */
> + if ((op & FUTEX_FLAG_64) && !boot_cpu_has(X86_FEATURE_CX8))
> + return -ENOSYS;
> +#endif
Also, doesn't this mean that effectively you have given up on any CPU
before the Pentium entirely?
Not that I want to take the patches _anyway_, but it seems doubly stupid.
Those things are going to be UP machines, so you could have just emulated
it with no correctness issues by disabling preemption.
Linus
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] 64-bit futexes: x86 support
2008-05-31 2:25 ` Linus Torvalds
@ 2008-05-31 3:18 ` Ulrich Drepper
2008-05-31 3:59 ` Linus Torvalds
0 siblings, 1 reply; 10+ messages in thread
From: Ulrich Drepper @ 2008-05-31 3:18 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, akpm, mtk.manpages
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Linus Torvalds wrote:
> Also, doesn't this mean that effectively you have given up on any CPU
> before the Pentium entirely?
Yes, but only for the speed-up. Not for the functionality. All
programs will work just fine.
> Not that I want to take the patches _anyway_, but it seems doubly stupid.
> Those things are going to be UP machines, so you could have just emulated
> it with no correctness issues by disabling preemption.
First, you're thinking too much in kernel terms. At userlevel I cannot
disable interrupts etc. I cannot read 64 bits atomically on those
processors. Second, the old implementation is not significantly slower
in normal programs on UP machines. It's really not a big issue.
In any case, robbing 64-bit architectures of the possible performance
gain just because there are ancient versions which cannot do it is just
plain stupid. I know you cannot suggest that.
- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkhAw5QACgkQ2ijCOnn/RHTRRwCgv37woIjA5RJji4XamBQVqCyF
VMwAoIauSEdAlfK4pBJhMkIKirwEBw0z
=rDJc
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] 64-bit futexes: x86 support
2008-05-31 3:18 ` Ulrich Drepper
@ 2008-05-31 3:59 ` Linus Torvalds
2008-05-31 4:25 ` Ulrich Drepper
0 siblings, 1 reply; 10+ messages in thread
From: Linus Torvalds @ 2008-05-31 3:59 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: linux-kernel, akpm, mtk.manpages
On Fri, 30 May 2008, Ulrich Drepper wrote:
>
> In any case, robbing 64-bit architectures of the possible performance
> gain just because there are ancient versions which cannot do it is just
> plain stupid. I know you cannot suggest that.
I'm suggesting that there are better approaches than forcing yet another
new interface onto this thing. As mentioned, the kernel has had 32-bit
rwsemaphores for a long time. Yes, there is "extra information" outside
the 32-bit field, but I suspect you simply haven't looked hard enough at
just using the existing futex code.
You certainly didn't even read - or understand - my emails, since you
thought I was talking about regular semaphores and ignored the "rw" part
entirely (not to mention the fact that I talked about reader counts etc,
which is why I think you didn't even read the email).
Linus
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] 64-bit futexes: x86 support
2008-05-31 3:59 ` Linus Torvalds
@ 2008-05-31 4:25 ` Ulrich Drepper
2008-05-31 4:34 ` Linus Torvalds
0 siblings, 1 reply; 10+ messages in thread
From: Ulrich Drepper @ 2008-05-31 4:25 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, akpm, mtk.manpages
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Linus Torvalds wrote:
> I'm suggesting that there are better approaches than forcing yet another
> new interface onto this thing. As mentioned, the kernel has had 32-bit
> rwsemaphores for a long time. Yes, there is "extra information" outside
> the 32-bit field, but I suspect you simply haven't looked hard enough at
> just using the existing futex code.
I guess have to expect to expect to be insulted by you. What else is
new? I think it's safe to say that nobody has looked more deeply at the
implementation possibilities with futexes. I don't know how many
different primitives I've written over the years. If you think you can
do it better, well, that's then a challenge to you. Come up with
something better.
The rwlocks cannot be handled as efficiently with 32-bit futexes.
I stand by that. Proof me wrong. You don't have to write code, just
describe it. But don't publish it if
- - the uncontended reader *unconditionally* uses more than one memory
access (atomic of course)
- - the contended readers uses the one access above plus one or two
compare-and-exchange depending on the rwlock preferring readers or
writers. The last compare-and-exchange has to be repeated for
spurious wakeups which are highly unlikely since we only wake what
is ready to use.
- - the uncontended writer needs more than one single compare-and-exchange
plus one memory read plus one write (both not atomic)
- - the contended writer needs more than the above plus one additional
compare-and-exchange for every time we delay in futex_wait (again,
highly unlikely to have spurious wakeups)
- - the unlock operation needs more than one read plus either one
(repeated) compare-and-exchange or another atomic operation plus one
memory write for writer locks
- - you can handle timedlock variants which don't manage to get the lock
efficiently without waking up anyone else
That's it.
And just to point out some more fun: in a highly contended case this is
a performance killer (MESI protocol states):
core #1 core #2
instr cache state instr cache state
load -> S
store -> M
-> S load -> S
store -> M
I.e., of the cache line with the rwlock is in one core's cache and you
first load a value from that cache line just to modify it right after
that, you're paying a terrible price.
Have fun coming up with something which is as good or better. But shall
we say there is a deadline? Otherwise we'd wait too long.
- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkhA0zUACgkQ2ijCOnn/RHRI2QCbBGCcjES6qMJYay1WRVLdSAAk
lHEAnA754SGDsjuzvCYg2ZBrEUIktxYV
=NYYc
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] 64-bit futexes: x86 support
2008-05-31 4:25 ` Ulrich Drepper
@ 2008-05-31 4:34 ` Linus Torvalds
2008-05-31 4:45 ` Ulrich Drepper
0 siblings, 1 reply; 10+ messages in thread
From: Linus Torvalds @ 2008-05-31 4:34 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: linux-kernel, akpm, mtk.manpages
On Fri, 30 May 2008, Ulrich Drepper wrote:
>
> I guess have to expect to expect to be insulted by you.
Guess why? What comes around goes around.
You just dismissed (without apparently even understanding them) my
concerns about a patch that comes out of the blue, when I ask whether you
really looked into trying to do it other ways.
You didn't even post the code that would _use_ this. You just blindly
claim that you're the only one who can know things like this and can do
serialization, and that your way is the only approach.
Color me not impressed.
I did not insult you until you didn't even understand my first email. We
have had an efficient 32-bit rwlock in the kernel for a long time. So I
(quite naturally) questioned your statement (that had no backing up
what-so-ever) that it cannot be done.
Sure, futex use and user space is not the same as the kernel code. It's
possible that you really do need 64-bit futexes. But quite frankly, the
only thing you have proven so far is that you're an ass.
Linus
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] 64-bit futexes: x86 support
2008-05-31 4:34 ` Linus Torvalds
@ 2008-05-31 4:45 ` Ulrich Drepper
2008-05-31 7:47 ` David Miller
0 siblings, 1 reply; 10+ messages in thread
From: Ulrich Drepper @ 2008-05-31 4:45 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, akpm, mtk.manpages
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Linus Torvalds wrote:
> You just blindly
> claim that you're the only one who can know things like this and can do
> serialization, and that your way is the only approach.
Nonsense. As you wrote yourself, you're only guessing about your
approaches. You didn't check what we currently do (which is the extra
data stored protected by locks) and you suggest this scheme.
Then you suggest hand-wavingly other schemes and I explain why they
cannot work as efficiently. I never doubted that they cannot work at
all. If performance wouldn't be important I would not have to change
the current implementation which works semantically just fine.
> Sure, futex use and user space is not the same as the kernel code. It's
> possible that you really do need 64-bit futexes. But quite frankly, the
> only thing you have proven so far is that you're an ass.
Well, I don't know what you're reading into what I wrote. I've only
explained what is wrong with each of your proposals and arguments. If
pointing out the flaws makes me an ass then so be it.
- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkhA2AcACgkQ2ijCOnn/RHTiPQCgzWqXP1EW8HID9FuzbgQa70fL
THsAoLJvUKJO+hqFM3Hd3cHlOCIKhRoF
=ab2b
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] 64-bit futexes: x86 support
2008-05-31 4:45 ` Ulrich Drepper
@ 2008-05-31 7:47 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2008-05-31 7:47 UTC (permalink / raw)
To: drepper; +Cc: torvalds, linux-kernel, akpm, mtk.manpages
From: Ulrich Drepper <drepper@redhat.com>
Date: Fri, 30 May 2008 21:45:59 -0700
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Linus Torvalds wrote:
> > You just blindly
> > claim that you're the only one who can know things like this and can do
> > serialization, and that your way is the only approach.
>
> Nonsense.
No, Ulrich. Eveyone who ever tries to work with you, and
comes away frustrated, has this exact impression.
Whether it's intentional or not, that doesn't matter, people
perceive you as an arrogant know it all who is extremely
difficult to work with. And you can be sure that projects
that you are the primary maintainer of, such as GLIBC, suffer
because of it.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] 64-bit futexes: x86 support
2008-05-31 1:27 [PATCH 3/3] 64-bit futexes: x86 support Ulrich Drepper
2008-05-31 2:25 ` Linus Torvalds
@ 2008-06-02 8:22 ` Ingo Molnar
2008-06-02 18:43 ` Ingo Molnar
1 sibling, 1 reply; 10+ messages in thread
From: Ingo Molnar @ 2008-06-02 8:22 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: linux-kernel, akpm, mtk.manpages, torvalds, x86
* Ulrich Drepper <drepper@redhat.com> wrote:
> This patch adds 64-bit futex support for x86. As explained in the
> introduction, this requires a new system call. The remaining changes
> are similarly to the x86-64 changes: enable support for FUTEX_WAKE_OP.
great work - the first two patches look good and we've created a new
-tip topic branch for it, tip/core/futex-64bit.
but this 32-bit x86 patch has problems, it needed 3 fixes to even build
(see below), then it stopped with various failures related to the
assembly constraints:
kernel/futex.c: In function 'do_futex':
include/asm/futex.h:155: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
[...]
Ingo
-------------------->
Subject: 64 bit futexes: fixes
From: Ingo Molnar <mingo@elte.hu>
Date: Mon Jun 02 10:07:08 CEST 2008
- various build fixes on 32-bit.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/sys_i386_32.c | 1 +
include/asm-x86/futex.h | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
Index: linux/arch/x86/kernel/sys_i386_32.c
===================================================================
--- linux.orig/arch/x86/kernel/sys_i386_32.c
+++ linux/arch/x86/kernel/sys_i386_32.c
@@ -18,6 +18,7 @@
#include <linux/file.h>
#include <linux/utsname.h>
#include <linux/ipc.h>
+#include <linux/futex.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
Index: linux/include/asm-x86/futex.h
===================================================================
--- linux.orig/include/asm-x86/futex.h
+++ linux/include/asm-x86/futex.h
@@ -65,7 +65,7 @@
_ASM_EXTABLE(1b, 5b) \
_ASM_EXTABLE(2b, 5b) \
_ASM_EXTABLE(3b, 5b) \
- : "=&a" (oldvaltemp1), "=&d" (oldvaltmep2),\
+ : "=&a" (oldvaltemp1), "=&d" (oldvaltemp2),\
"=&r" (ret), \
"+m" (((u32 __user *) uaddr)[0]), \
"+m" (((u32 __user *) uaddr)[1]), \
@@ -127,7 +127,7 @@ static inline int futex_atomic_op_inuser
#ifdef CONFIG_X86_32
/* Not all 32-bit machines support 8-byte cmpxchg. We just
unconditionally perform a runtime check for the feature. */
- if ((op & FUTEX_FLAG_64) && !boot_cpu_has(X86_FEATURE_CX8))
+ if ((op & FUTEX_64_FLAG) && !boot_cpu_has(X86_FEATURE_CX8))
return -ENOSYS;
#endif
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] 64-bit futexes: x86 support
2008-06-02 8:22 ` Ingo Molnar
@ 2008-06-02 18:43 ` Ingo Molnar
0 siblings, 0 replies; 10+ messages in thread
From: Ingo Molnar @ 2008-06-02 18:43 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: linux-kernel, akpm, mtk.manpages, torvalds, x86
* Ingo Molnar <mingo@elte.hu> wrote:
> > This patch adds 64-bit futex support for x86. As explained in the
> > introduction, this requires a new system call. The remaining
> > changes are similarly to the x86-64 changes: enable support for
> > FUTEX_WAKE_OP.
>
> great work - the first two patches look good and we've created a new
> -tip topic branch for it, tip/core/futex-64bit.
the topic is not yet offered for linux-next though, until the API
discussion with Linus is resolved one way or another :-)
Ingo
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-06-02 18:44 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-31 1:27 [PATCH 3/3] 64-bit futexes: x86 support Ulrich Drepper
2008-05-31 2:25 ` Linus Torvalds
2008-05-31 3:18 ` Ulrich Drepper
2008-05-31 3:59 ` Linus Torvalds
2008-05-31 4:25 ` Ulrich Drepper
2008-05-31 4:34 ` Linus Torvalds
2008-05-31 4:45 ` Ulrich Drepper
2008-05-31 7:47 ` David Miller
2008-06-02 8:22 ` Ingo Molnar
2008-06-02 18:43 ` Ingo Molnar
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.