Re: [PATCH v9 1/2] arch/*: Add CONFIG_ARCH_HAVE_CMPXCHG64

2018-05-16 Thread Christoph Hellwig
> +config ARCH_HAVE_CMPXCHG64
> + bool

64-bit architectures must support this as long is 64-bits wide.

So this should have a

default y if 64BIT

which also means you only need to explicitly select in on 32-bit
architectures that support 64-bit cmpxchg.


Re: [PATCH v9 1/2] arch/*: Add CONFIG_ARCH_HAVE_CMPXCHG64

2018-05-15 Thread Bart Van Assche
On Tue, 2018-05-15 at 12:54 +1000, Michael Ellerman wrote:
> Bart Van Assche  writes:
> > 
> > +---
> > +| arch |status|
> > +---
> > +|   alpha: |  ok  |
> > +| arc: | TODO |
> > +| arm: |!thumb|
> > +|   arm64: |  ok  |
> > +| c6x: | TODO |
> > +|   h8300: | TODO |
> > +| hexagon: | TODO |
> > +|ia64: |  ok  |
> > +|m68k: |  ok  |
> > +|  microblaze: | TODO |
> > +|mips: |64-bit|
> > +|   nios2: | TODO |
> > +|openrisc: | TODO |
> > +|  parisc: |  ok  |
> > +| powerpc: |64-bit|
> 
> I think that is correct for powerpc, we don't have a 32-bit
> implementation and there's no fallback it seems.
> 
> > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> > --- a/arch/powerpc/Kconfig
> > +++ b/arch/powerpc/Kconfig
> > @@ -150,6 +150,7 @@ config PPC
> > select ARCH_HAS_UBSAN_SANITIZE_ALL
> > select ARCH_HAS_ZONE_DEVICE if PPC_BOOK3S_64
> > select ARCH_HAVE_NMI_SAFE_CMPXCHG
> > +   select ARCH_HAVE_CMPXCHG64
> 
> So shouldn't this should be:
> 
> + select ARCH_HAVE_CMPXCHG64  if PPC64
> 
> And it should be sorted alphabetically, ie. above the previous NMI entry.

Hello Michael,

Thanks, I will make these changes.

Bart.






Re: [PATCH v9 1/2] arch/*: Add CONFIG_ARCH_HAVE_CMPXCHG64

2018-05-15 Thread Andrea Parri
Hi Bart,

On Mon, May 14, 2018 at 11:46:33AM -0700, Bart Van Assche wrote:

[...]

> diff --git a/Documentation/features/locking/cmpxchg64/arch-support.txt 
> b/Documentation/features/locking/cmpxchg64/arch-support.txt
> new file mode 100644
> index ..65b3290ce5d5
> --- /dev/null
> +++ b/Documentation/features/locking/cmpxchg64/arch-support.txt
> @@ -0,0 +1,31 @@
> +#
> +# Feature name:  cmpxchg64
> +# Kconfig:   ARCH_HAVE_CMPXCHG64
> +# description:   arch supports the cmpxchg64() API
> +#
> +---
> +| arch |status|
> +---
> +|   alpha: |  ok  |
> +| arc: | TODO |
> +| arm: |!thumb|
> +|   arm64: |  ok  |
> +| c6x: | TODO |
> +|   h8300: | TODO |
> +| hexagon: | TODO |
> +|ia64: |  ok  |
> +|m68k: |  ok  |
> +|  microblaze: | TODO |
> +|mips: |64-bit|
> +|   nios2: | TODO |
> +|openrisc: | TODO |
> +|  parisc: |  ok  |
> +| powerpc: |64-bit|
> +|s390: |  ok  |
> +|  sh: | TODO |
> +|   sparc: |  ok  |
> +|  um: | TODO |
> +|   unicore32: | TODO |
> +| x86: |  ok  |
> +|  xtensa: |  ok  |
> +---

nds32 and riscv seem to be missing from the table. I'd also suggest
sticking to the three entries documented in

  Documentation/features/arch-support.txt
  
and using the header comment to provide any additional information.

A script that refreshes the arch support status file in place (from
the Kconfig files) is currently available in linux-next: c.f.,

  Documentation/features/scripts/features-refresh.sh

  Andrea


Re: [PATCH v9 1/2] arch/*: Add CONFIG_ARCH_HAVE_CMPXCHG64

2018-05-14 Thread Michael Ellerman
Hi Bart,

Bart Van Assche  writes:
>
...
> diff --git a/Documentation/features/locking/cmpxchg64/arch-support.txt 
> b/Documentation/features/locking/cmpxchg64/arch-support.txt
> new file mode 100644
> index ..65b3290ce5d5
> --- /dev/null
> +++ b/Documentation/features/locking/cmpxchg64/arch-support.txt
> @@ -0,0 +1,31 @@
> +#
> +# Feature name:  cmpxchg64
> +# Kconfig:   ARCH_HAVE_CMPXCHG64
> +# description:   arch supports the cmpxchg64() API
> +#
> +---
> +| arch |status|
> +---
> +|   alpha: |  ok  |
> +| arc: | TODO |
> +| arm: |!thumb|
> +|   arm64: |  ok  |
> +| c6x: | TODO |
> +|   h8300: | TODO |
> +| hexagon: | TODO |
> +|ia64: |  ok  |
> +|m68k: |  ok  |
> +|  microblaze: | TODO |
> +|mips: |64-bit|
> +|   nios2: | TODO |
> +|openrisc: | TODO |
> +|  parisc: |  ok  |
> +| powerpc: |64-bit|

I think that is correct for powerpc, we don't have a 32-bit
implementation and there's no fallback it seems.

> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -150,6 +150,7 @@ config PPC
>   select ARCH_HAS_UBSAN_SANITIZE_ALL
>   select ARCH_HAS_ZONE_DEVICE if PPC_BOOK3S_64
>   select ARCH_HAVE_NMI_SAFE_CMPXCHG
> + select ARCH_HAVE_CMPXCHG64

So shouldn't this should be:

+   select ARCH_HAVE_CMPXCHG64  if PPC64

And it should be sorted alphabetically, ie. above the previous NMI entry.

cheers


Re: [PATCH v9 1/2] arch/*: Add CONFIG_ARCH_HAVE_CMPXCHG64

2018-05-14 Thread Geert Uytterhoeven
Hi Bart,

On Mon, May 14, 2018 at 10:42 PM, Bart Van Assche
 wrote:
> On Mon, 2018-05-14 at 11:50 -0700, Max Filippov wrote:
>> On Mon, May 14, 2018 at 11:46 AM, Bart Van Assche
>>  wrote:
>> > The next patch in this series introduces a call to cmpxchg64()
>> > in the block layer core for those architectures on which this
>> > functionality is available. Make it possible to test whether
>> > cmpxchg64() is available by introducing CONFIG_ARCH_HAVE_CMPXCHG64.
>> >
>> > ---
>>
>> [...]
>>
>> > diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
>> > index c921e8bccdc8..8234278a821d 100644
>> > --- a/arch/xtensa/Kconfig
>> > +++ b/arch/xtensa/Kconfig
>> > @@ -23,6 +23,7 @@ config XTENSA
>> > select HAVE_DMA_CONTIGUOUS
>> > select HAVE_EXIT_THREAD
>> > select HAVE_FUNCTION_TRACER
>> > +   select ARCH_HAVE_CMPXCHG64
>>
>> This breaks alphabetical sorting of Kconfig entries.
>
> Hello Max,
>
> Thanks for the feedback. Do you perhaps know whether keeping names in
> alphabetical order is a requirement for arch/xtensa/Kconfig only or
> whether this is required for all arch/*/Kconfig files?

It's a good practice anyway, as it reduces the probability of merge conflicts.

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH v9 1/2] arch/*: Add CONFIG_ARCH_HAVE_CMPXCHG64

2018-05-14 Thread Bart Van Assche
On Mon, 2018-05-14 at 11:50 -0700, Max Filippov wrote:
> On Mon, May 14, 2018 at 11:46 AM, Bart Van Assche
>  wrote:
> > The next patch in this series introduces a call to cmpxchg64()
> > in the block layer core for those architectures on which this
> > functionality is available. Make it possible to test whether
> > cmpxchg64() is available by introducing CONFIG_ARCH_HAVE_CMPXCHG64.
> > 
> > ---
> 
> [...]
> 
> > diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
> > index c921e8bccdc8..8234278a821d 100644
> > --- a/arch/xtensa/Kconfig
> > +++ b/arch/xtensa/Kconfig
> > @@ -23,6 +23,7 @@ config XTENSA
> > select HAVE_DMA_CONTIGUOUS
> > select HAVE_EXIT_THREAD
> > select HAVE_FUNCTION_TRACER
> > +   select ARCH_HAVE_CMPXCHG64
> 
> This breaks alphabetical sorting of Kconfig entries.

Hello Max,

Thanks for the feedback. Do you perhaps know whether keeping names in
alphabetical order is a requirement for arch/xtensa/Kconfig only or
whether this is required for all arch/*/Kconfig files?

Bart.

Re: [PATCH v9 1/2] arch/*: Add CONFIG_ARCH_HAVE_CMPXCHG64

2018-05-14 Thread Max Filippov
On Mon, May 14, 2018 at 11:46 AM, Bart Van Assche
 wrote:
> The next patch in this series introduces a call to cmpxchg64()
> in the block layer core for those architectures on which this
> functionality is available. Make it possible to test whether
> cmpxchg64() is available by introducing CONFIG_ARCH_HAVE_CMPXCHG64.
>
> ---

[...]

> diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
> index c921e8bccdc8..8234278a821d 100644
> --- a/arch/xtensa/Kconfig
> +++ b/arch/xtensa/Kconfig
> @@ -23,6 +23,7 @@ config XTENSA
> select HAVE_DMA_CONTIGUOUS
> select HAVE_EXIT_THREAD
> select HAVE_FUNCTION_TRACER
> +   select ARCH_HAVE_CMPXCHG64

This breaks alphabetical sorting of Kconfig entries.

> select HAVE_FUTEX_CMPXCHG if !MMU
> select HAVE_HW_BREAKPOINT if PERF_EVENTS
> select HAVE_IRQ_TIME_ACCOUNTING

-- 
Thanks.
-- Max