diff mbox series

[V2] powerpc: Don't do runtime futex_cmpxchg test

Message ID 20180226140950.12111-1-aneesh.kumar@linux.vnet.ibm.com (mailing list archive)
State Changes Requested
Headers show
Series [V2] powerpc: Don't do runtime futex_cmpxchg test | expand

Commit Message

Aneesh Kumar K.V Feb. 26, 2018, 2:09 p.m. UTC
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

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/Kconfig.cputype | 1 +
 1 file changed, 1 insertion(+)

Comments

Nicholas Piggin Feb. 26, 2018, 10:16 p.m. UTC | #1
On 27 Feb. 2018 00:34, "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
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



Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/Kconfig.cputype | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/platforms/Kconfig.cputype
b/arch/powerpc/platforms/Kconfig.cputype
index a429d859f15d..31bc2bd5dfd1 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -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
<div dir="auto"><div><div class="gmail_extra"><div class="gmail_quote">On 27 Feb. 2018 00:34, &quot;Aneesh Kumar K.V&quot; &lt;<a href="mailto:aneesh.kumar@linux.vnet.ibm.com">aneesh.kumar@linux.vnet.ibm.com</a>&gt; wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">futex_detect_cmpxchg() does a cmpxchg_futex_value_locked on a NULL user addr to<br>
runtime detect whether architecture implements atomic cmpxchg for futex. POWER<br>
do implement the feature and hence we can enable the config instead of depending<br>
on runtime detection.<br>
<br>
We could possible enable this on everything. For now limitted to book3s_64<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">I think everything implements it? Might as well do it all at once.</div><div dir="auto"><br></div><div dir="auto">I wouldn&#39;t mind putting in an explicit null dereference test if we take this out.</div><div dir="auto"><br></div><div dir="auto">Thanks,</div><div dir="auto">Nick</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Signed-off-by: Aneesh Kumar K.V &lt;<a href="mailto:aneesh.kumar@linux.vnet.ibm.com">aneesh.kumar@linux.vnet.ibm.<wbr>com</a>&gt;<br>
---<br>
 arch/powerpc/platforms/<wbr>Kconfig.cputype | 1 +<br>
 1 file changed, 1 insertion(+)<br>
<br>
diff --git a/arch/powerpc/platforms/<wbr>Kconfig.cputype b/arch/powerpc/platforms/<wbr>Kconfig.cputype<br>
index a429d859f15d..31bc2bd5dfd1 100644<br>
--- a/arch/powerpc/platforms/<wbr>Kconfig.cputype<br>
+++ b/arch/powerpc/platforms/<wbr>Kconfig.cputype<br>
@@ -75,6 +75,7 @@ config PPC_BOOK3S_64<br>
        select ARCH_SUPPORTS_NUMA_BALANCING<br>
        select IRQ_WORK<br>
        select HAVE_KERNEL_XZ<br>
+       select HAVE_FUTEX_CMPXCHG if FUTEX<br>
<br>
 config PPC_BOOK3E_64<br>
        bool &quot;Embedded processors&quot;<br>
<font color="#888888">--<br>
2.14.3<br>
<br>
</font></blockquote></div><br></div></div></div>
Aneesh Kumar K.V Feb. 27, 2018, 4 a.m. UTC | #2
Nicholas Piggin <nicholas.piggin@gmail.com> writes:

> On 27 Feb. 2018 00:34, "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
> 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.

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

>
> Thanks,
> Nick
>
>
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
>  arch/powerpc/platforms/Kconfig.cputype | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/powerpc/platforms/Kconfig.cputype
> b/arch/powerpc/platforms/Kconfig.cputype
> index a429d859f15d..31bc2bd5dfd1 100644
> --- a/arch/powerpc/platforms/Kconfig.cputype
> +++ b/arch/powerpc/platforms/Kconfig.cputype
> @@ -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
Michael Ellerman Feb. 28, 2018, 10:44 a.m. UTC | #3
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> writes:

> 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
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
>  arch/powerpc/platforms/Kconfig.cputype | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
> index a429d859f15d..31bc2bd5dfd1 100644
> --- a/arch/powerpc/platforms/Kconfig.cputype
> +++ b/arch/powerpc/platforms/Kconfig.cputype
> @@ -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
diff mbox series

Patch

diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index a429d859f15d..31bc2bd5dfd1 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -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"