um: this_cpu_cmpxchg16b_emu
Richard Weinberger
maintainerHi,
This patch implements this_cpu_cmpxchg16b_emu() for UML.
As I'm not an amd64 assembly guru I'm not sure whether the assembly part is correct.
Can someone please review it?
Especially I'm unsure which register have to be saved before each call to C functions.
Thanks,
//richard
Quoted 1 line
From
202b0efe024d7c0500e7c11f0aa105f7a1fafb9bMon Sep 17 00:00:00 2001
From: Richard Weinberger <[email protected]>
Date: Mon, 11 Apr 2011 19:22:38 +0200
Subject: [PATCH] um: Implement this_cpu_cmpxchg16b_emu()
Commit 8a5ec0ba "Lockless (and preemptless) fastpaths for slub" makes use of this_cpu_cmpxchg_double() which needs this_cpu_cmpxchg16b_emu() on x86_64.
User Mode Linux has to serve this function too.
--- arch/um/sys-x86_64/Makefile | 2 +- arch/um/sys-x86_64/cmpxchg16b_emu.S | 72 ++++++++++++++++++++++++++++++++ arch/um/sys-x86_64/cmpxchg16b_helper.c | 22 ++++++++++ 3 files changed, 95 insertions(+), 1 deletions(-) create mode 100644 arch/um/sys-x86_64/cmpxchg16b_emu.S create mode 100644 arch/um/sys-x86_64/cmpxchg16b_helper.c
arch/um/sys-x86_64/Makefile +1 -1
@@ -6,7 +6,7 @@ obj-y = bug.o bugs.o delay.o fault.o ldt.o mem.o ptrace.o ptrace_user.o \ setjmp.o signal.o stub.o stub_segv.o syscalls.o syscall_table.o \ - sysrq.o ksyms.o tls.o + sysrq.o ksyms.o tls.o cmpxchg16b_emu.o cmpxchg16b_helper.o subarch-obj-y = lib/csum-partial_64.o lib/memcpy_64.o lib/thunk_64.o \ lib/rwsem_64.o
arch/um/sys-x86_64/cmpxchg16b_emu.S new file +72 -0
72 lines not on this page · raw message
arch/um/sys-x86_64/cmpxchg16b_helper.c new file +22 -0
@@ -0,0 +1,22 @@ +/* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +* +* Copyright 2011 Richard Weinberger <[email protected]> +* +*/ + +#include <linux/linkage.h> +#include <asm/system.h> + +asmlinkage unsigned long arch_local_irq_save_asm (void ) +{ +return arch_local_irq_save (); +} + +asmlinkage void arch_local_irq_restore_asm(unsigned long flags) +{ +arch_local_irq_restore (flags); +}
Signature · 1 line
1.7.4.2
Quoted 1 line · Richard Weinberger
This patch implements
this_cpu_cmpxchg16b_emu()for UML.
Is this really necessary? Just undefine CONFIG_CMPXCHG_LOCAL for UML and the asm code will not be used.
Richard Weinberger
maintainerAm Dienstag 12 April 2011, 20:10:37 schrieb Christoph Lameter:
Quoted 5 lines · Richard Weinberger
Quoted 1 line
This patch implements
this_cpu_cmpxchg16b_emu()for UML.Is this really necessary? Just undefine
CONFIG_CMPXCHG_LOCALfor UML and the asm code will not be used.
UML includes arch/x86/Kconfig.cpu which defines CONFIG_CMPXCHG_LOCAL automatically. Just disabling CONFIG_CMPXCHG_LOCAL for UML is IMHO not very nice. When chpxchg is available also UML should use it...
Thanks,
//richard
Quoted 10 lines · Richard Weinberger
Am Dienstag 12 April 2011, 20:10:37 schrieb Christoph Lameter:
Quoted 5 lines · Richard Weinberger
Quoted 1 line
This patch implements
this_cpu_cmpxchg16b_emu()for UML.Is this really necessary? Just undefine
CONFIG_CMPXCHG_LOCALfor UML and the asm code will not be used.UML includes
arch/x86/Kconfig.cpuwhich definesCONFIG_CMPXCHG_LOCALautomatically. Just disablingCONFIG_CMPXCHG_LOCALfor UML is IMHO not very nice. When chpxchg is available also UML should use it...
Ugh... I'd really like to avoid things like this for UML. Is there any SLUB performance sensitive workload running on UML? I've never seen any UML in production environment. Wouldn't it be better to keep things simple?
Thanks.
Signature · 1 line
tejun
Quoted 10 lines · Richard Weinberger
Quoted 10 lines
Am Dienstag 12 April 2011, 20:10:37 schrieb Christoph Lameter:
Quoted 5 lines · Richard Weinberger
Quoted 1 line
This patch implements
this_cpu_cmpxchg16b_emu()for UML.Is this really necessary? Just undefine
CONFIG_CMPXCHG_LOCALfor UML and the asm code will not be used.UML includes
arch/x86/Kconfig.cpuwhich definesCONFIG_CMPXCHG_LOCALautomatically. Just disablingCONFIG_CMPXCHG_LOCALfor UML is IMHO not very nice. When chpxchg is available also UML should use it...
Quoted 4 lines · Tejun Heo
Ugh... I'd really like to avoid things like this for UML. Is there any SLUB performance sensitive workload running on UML? I've never seen any UML in production environment. Wouldn't it be better to keep things simple?
Yes, it would be. :-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Richard Weinberger
maintainerAm Dienstag 12 April 2011, 21:22:47 schrieb Pekka Enberg:
Quoted 12 lines · Richard Weinberger
Quoted 10 lines
Quoted 10 lines
Am Dienstag 12 April 2011, 20:10:37 schrieb Christoph Lameter:
Quoted 5 lines · Richard Weinberger
Quoted 1 line
This patch implements
this_cpu_cmpxchg16b_emu()for UML.Is this really necessary? Just undefine
CONFIG_CMPXCHG_LOCALfor UML and the asm code will not be used.UML includes
arch/x86/Kconfig.cpuwhich definesCONFIG_CMPXCHG_LOCALautomatically. Just disablingCONFIG_CMPXCHG_LOCALfor UML is IMHO not very nice. When chpxchg is available also UML should use it...
Quoted 7 lines
Quoted 4 lines · Tejun Heo
Ugh... I'd really like to avoid things like this for UML. Is there any SLUB performance sensitive workload running on UML? I've never seen any UML in production environment. Wouldn't it be better to keep things simple?
Yes, it would be. :-)
Okay. Then let's keep it simple. :-)
I'll disable CONFIG_CMPXCHG_LOCAL for UML.
Has someone looked at my this_cpu_cmpxchg16b_emu() implementation, is it correct? Especially the call to C stuff.
I've tested it, it works fine.
Thanks,
//richard