Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: James Hogan <james.hogan@mips.com>
To: Ben Hutchings <ben@decadent.org.uk>
Cc: Ralf Baechle <ralf@linux-mips.org>, <linux-mips@linux-mips.org>,
	Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
Subject: Re: [RFC PATCH] MIPS: cmpxchg64() and HAVE_VIRT_CPU_ACCOUNTING_GEN don't work for 32-bit SMP
Date: Mon, 13 Nov 2017 18:19:46 +0000	[thread overview]
Message-ID: <20171113181945.GC31917@jhogan-linux.mipstec.com> (raw)
In-Reply-To: <20171004024614.GC2971@decadent.org.uk>

On Wed, Oct 04, 2017 at 03:46:14AM +0100, Ben Hutchings wrote:
> __cmpxchg64_local_generic() is atomic only w.r.t tasks and interrupts
> on the same CPU (that's what the 'local' means).  We can't use it to
> implement cmpxchg64() in SMP configurations.
> 
> So, for 32-bit SMP configurations:
> 
> - Don't define cmpxchg64()
> - Don't enable HAVE_VIRT_CPU_ACCOUNTING_GEN, which requires it
> 
> Fixes: e2093c7b03c1 ("MIPS: Fall back to generic implementation of ...")
> Fixes: bb877e96bea1 ("MIPS: Add support for full dynticks CPU time accounting")
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

Thanks, looks reasonable to me

Applied

Cheers
James

> ---
>  arch/mips/Kconfig               | 2 +-
>  arch/mips/include/asm/cmpxchg.h | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index cb7fcc4216fd..1e23f8455b7d 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -64,7 +64,7 @@ config MIPS
>  	select HAVE_PERF_EVENTS
>  	select HAVE_REGS_AND_STACK_ACCESS_API
>  	select HAVE_SYSCALL_TRACEPOINTS
> -	select HAVE_VIRT_CPU_ACCOUNTING_GEN
> +	select HAVE_VIRT_CPU_ACCOUNTING_GEN if 64BIT || !SMP
>  	select IRQ_FORCED_THREADING
>  	select MODULES_USE_ELF_RELA if MODULES && 64BIT
>  	select MODULES_USE_ELF_REL if MODULES
> diff --git a/arch/mips/include/asm/cmpxchg.h b/arch/mips/include/asm/cmpxchg.h
> index 903f3bf48419..ae2b4583b486 100644
> --- a/arch/mips/include/asm/cmpxchg.h
> +++ b/arch/mips/include/asm/cmpxchg.h
> @@ -202,8 +202,10 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
>  #else
>  #include <asm-generic/cmpxchg-local.h>
>  #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
> +#ifndef CONFIG_SMP
>  #define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n))
>  #endif
> +#endif
>  
>  #undef __scbeqz
>  

WARNING: multiple messages have this Message-ID (diff)
From: James Hogan <james.hogan@mips.com>
To: Ben Hutchings <ben@decadent.org.uk>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	linux-mips@linux-mips.org,
	Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
Subject: Re: [RFC PATCH] MIPS: cmpxchg64() and HAVE_VIRT_CPU_ACCOUNTING_GEN don't work for 32-bit SMP
Date: Mon, 13 Nov 2017 18:19:46 +0000	[thread overview]
Message-ID: <20171113181945.GC31917@jhogan-linux.mipstec.com> (raw)
Message-ID: <20171113181946.sKIhIGh0CC9u0ZE0DWUFq33dB7sg8U-6WWyqHmNLYFI@z> (raw)
In-Reply-To: <20171004024614.GC2971@decadent.org.uk>

On Wed, Oct 04, 2017 at 03:46:14AM +0100, Ben Hutchings wrote:
> __cmpxchg64_local_generic() is atomic only w.r.t tasks and interrupts
> on the same CPU (that's what the 'local' means).  We can't use it to
> implement cmpxchg64() in SMP configurations.
> 
> So, for 32-bit SMP configurations:
> 
> - Don't define cmpxchg64()
> - Don't enable HAVE_VIRT_CPU_ACCOUNTING_GEN, which requires it
> 
> Fixes: e2093c7b03c1 ("MIPS: Fall back to generic implementation of ...")
> Fixes: bb877e96bea1 ("MIPS: Add support for full dynticks CPU time accounting")
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

Thanks, looks reasonable to me

Applied

Cheers
James

> ---
>  arch/mips/Kconfig               | 2 +-
>  arch/mips/include/asm/cmpxchg.h | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index cb7fcc4216fd..1e23f8455b7d 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -64,7 +64,7 @@ config MIPS
>  	select HAVE_PERF_EVENTS
>  	select HAVE_REGS_AND_STACK_ACCESS_API
>  	select HAVE_SYSCALL_TRACEPOINTS
> -	select HAVE_VIRT_CPU_ACCOUNTING_GEN
> +	select HAVE_VIRT_CPU_ACCOUNTING_GEN if 64BIT || !SMP
>  	select IRQ_FORCED_THREADING
>  	select MODULES_USE_ELF_RELA if MODULES && 64BIT
>  	select MODULES_USE_ELF_REL if MODULES
> diff --git a/arch/mips/include/asm/cmpxchg.h b/arch/mips/include/asm/cmpxchg.h
> index 903f3bf48419..ae2b4583b486 100644
> --- a/arch/mips/include/asm/cmpxchg.h
> +++ b/arch/mips/include/asm/cmpxchg.h
> @@ -202,8 +202,10 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
>  #else
>  #include <asm-generic/cmpxchg-local.h>
>  #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
> +#ifndef CONFIG_SMP
>  #define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n))
>  #endif
> +#endif
>  
>  #undef __scbeqz
>  

  reply	other threads:[~2017-11-13 18:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-04  2:46 [RFC PATCH] MIPS: cmpxchg64() and HAVE_VIRT_CPU_ACCOUNTING_GEN don't work for 32-bit SMP Ben Hutchings
2017-11-13 18:19 ` James Hogan [this message]
2017-11-13 18:19   ` James Hogan

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=20171113181945.GC31917@jhogan-linux.mipstec.com \
    --to=james.hogan@mips.com \
    --cc=ben@decadent.org.uk \
    --cc=dengcheng.zhu@imgtec.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox