Skip to contentSkip to conversation

powerpc: Don't do runtime futex_cmpxchg test

PATCH Superseded Aneesh Kumar K.V 3 participants 4 messages Feb 26, 2018 – Feb 28, 2018 PowerPC

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powerpc: Don't do runtime futex_cmpxchg test

futex_detect_cmpxchg() does a cmpxchg_futex_value_locked on a NULL user addr to runtime detect whether architecture implements atomic cmpxchg for futex. POWER do implement the feature and hence we can enable the config instead of depending on runtime detection.

We could possible enable this on everything. For now limitted to book3s_64

---
 arch/powerpc/platforms/Kconfig.cputype | 1 +
 1 file changed, 1 insertion(+)
arch/powerpc/platforms/Kconfig.cputype +1 -0
index a429d859f15d..31bc2bd5dfd1 100644
@@ -75,6 +75,7 @@ config PPC_BOOK3S_64
 	select ARCH_SUPPORTS_NUMA_BALANCING
 	select IRQ_WORK
 	select HAVE_KERNEL_XZ
+	select HAVE_FUTEX_CMPXCHG if FUTEX
 
 config PPC_BOOK3E_64
 	bool "Embedded processors"
Signature · 1 line
2.14.3
#1 lore raw

On 27 Feb. 2018 00:34, "Aneesh Kumar K.V" <[email protected]> wrote:

futex_detect_cmpxchg() does a cmpxchg_futex_value_locked on a NULL user addr to
runtime detect whether architecture implements atomic cmpxchg for futex. POWER
do implement the feature and hence we can enable the config instead of depending
on runtime detection.

We could possible enable this on everything. For now limitted to book3s_64

I think everything implements it? Might as well do it all at once.

I wouldn't mind putting in an explicit null dereference test if we take this out.

Thanks,
Nick

---
 arch/powerpc/platforms/Kconfig.cputype | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/arch/powerpc/platforms/Kconfig.cputype
index a429d859f15d..31bc2bd5dfd1 100644

arch/powerpc/platforms/Kconfig.cputype +1 -0
@@ -75,6 +75,7 @@ config PPC_BOOK3S_64
        select ARCH_SUPPORTS_NUMA_BALANCING
        select IRQ_WORK
        select HAVE_KERNEL_XZ
+       select HAVE_FUTEX_CMPXCHG if FUTEX
 
 config PPC_BOOK3E_64
        bool "Embedded processors"

--
2.14.3

#2 lore raw
Quoted 11 lines · Nicholas Piggin

On 27 Feb. 2018 00:34, "Aneesh Kumar K.V" <[email protected]> wrote:

futex_detect_cmpxchg() does a cmpxchg_futex_value_locked on a NULL user addr to
runtime detect whether architecture implements atomic cmpxchg for futex. POWER
do implement the feature and hence we can enable the config instead of depending
on runtime detection.

Quoted 7 lines

We could possible enable this on everything. For now limitted to book3s_64

I think everything implements it? Might as well do it all at once.

I wouldn't mind putting in an explicit null dereference test if we take this out.

If the config is not selected we do that with futex_detect_cmpxchg() right? Or are you suggesting something else?

Quoted 26 lines

Thanks,
Nick

---
 arch/powerpc/platforms/Kconfig.cputype | 1 +
 1 file changed, 1 insertion(+)
arch/powerpc/platforms/Kconfig.cputype +1 -1
index a429d859f15d..31bc2bd5dfd1 100644
@@ -75,6 +75,7 @@ config PPC_BOOK3S_64
        select ARCH_SUPPORTS_NUMA_BALANCING
        select IRQ_WORK
        select HAVE_KERNEL_XZ
+       select HAVE_FUTEX_CMPXCHG if FUTEX
 
 config PPC_BOOK3E_64
        bool "Embedded processors"
--

2.14.3

#3 lore raw
In reply to Aneesh Kumar K.V
Quoted 17 lines · Aneesh Kumar K.V

futex_detect_cmpxchg() does a cmpxchg_futex_value_locked on a NULL user addr to runtime detect whether architecture implements atomic cmpxchg for futex. POWER do implement the feature and hence we can enable the config instead of depending on runtime detection.

We could possible enable this on everything. For now limitted to book3s_64

---
 arch/powerpc/platforms/Kconfig.cputype | 1 +
 1 file changed, 1 insertion(+)
arch/powerpc/platforms/Kconfig.cputype +0 -0
index a429d859f15d..31bc2bd5dfd1 100644

arch/powerpc/platforms/Kconfig.cputype config PPC_BOOK3S_64 · line 78

Quoted 4 lines
arch/powerpc/platforms/Kconfig.cputype +1 -0
@@ -75,6 +75,7 @@ config PPC_BOOK3S_64
 	select ARCH_SUPPORTS_NUMA_BALANCING
 	select IRQ_WORK
 	select HAVE_KERNEL_XZ
+	select HAVE_FUTEX_CMPXCHG if FUTEX

I'd rather it was under config PPC with an if BOOK3S_64 check. Just so that all those top-level style configs are in once place.

eg.

config PPC

	...
	select HAVE_FUTEX_CMPXCHG if FUTEX && PPC_BOOK3S_64

cheers