Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1271408

Re: next build: 235 warnings 3 failures (next/next-20151117)

From Will Deacon <will.deacon@arm.com>
Newsgroups linux.kernel
Subject Re: next build: 235 warnings 3 failures (next/next-20151117)
Date 2015-11-17 17:50 +0100
Message-ID <qvRC9-7wq-3@gated-at.bofh.it> (permalink)
References <qvKhk-2Hb-21@gated-at.bofh.it> <qvKhk-2Hb-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Arnd,

On Tue, Nov 17, 2015 at 09:57:30AM +0100, Arnd Bergmann wrote:
> On Monday 16 November 2015 19:05:05 Olof's autobuilder wrote:
> > 
> > Errors:
> > 
> >         arm64.allmodconfig:
> > arch/arm64/include/asm/barrier.h:71:3: error: read-only variable '___p1' used as 'asm' output
> > arch/arm64/include/asm/barrier.h:75:3: error: read-only variable '___p1' used as 'asm' output
> > arch/arm64/include/asm/barrier.h:79:3: error: read-only variable '___p1' used as 'asm' output
> > arch/arm64/include/asm/barrier.h:83:3: error: read-only variable '___p1' used as 'asm' output
> > arch/arm64/include/asm/barrier.h:71:3: error: read-only variable '___p1' used as 'asm' output
> > arch/arm64/include/asm/barrier.h:75:3: error: read-only variable '___p1' used as 'asm' output
> > arch/arm64/include/asm/barrier.h:79:3: error: read-only variable '___p1' used as 'asm' output
> > arch/arm64/include/asm/barrier.h:83:3: error: read-only variable '___p1' used as 'asm' output
> > arch/arm64/include/asm/barrier.h:71:3: error: read-only variable '___p1' used as 'asm' output
> 
> The patch below seems to fix it. Please review/apply.
> 
> 8<----
> Subject: ARM64: make smp_load_acquire() work with const arguments
> 
> smp_load_acquire() uses typeof() to declare a local variable for temporarily
> storing the output of the memory access. This fails when the argument is
> constant, because the assembler complains about using a constant register
> as output:
> 
>  arch/arm64/include/asm/barrier.h:71:3: error: read-only variable '___p1'
>  used as 'asm' output

Do you know the usage in the kernel causing this warning?

> This changes the implementation to use an 'unsigned long' for the temporary value
> and only cast it to the original type in the end.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h
> index 624f9679f4b0..05fa329467f6 100644
> --- a/arch/arm64/include/asm/barrier.h
> +++ b/arch/arm64/include/asm/barrier.h
> @@ -64,7 +64,7 @@ do {									\
>  
>  #define smp_load_acquire(p)						\
>  ({									\
> -	typeof(*p) ___p1;						\
> +	unsigned long ___p1;						\
>  	compiletime_assert_atomic_type(*p);				\
>  	switch (sizeof(*p)) {						\
>  	case 1:								\
> @@ -84,7 +84,7 @@ do {									\
>  			: "=r" (___p1) : "Q" (*p) : "memory");		\
>  		break;							\
>  	}								\
> -	___p1;								\
> +	(typeof(*p))___p1;								\

My worry about having the cast here is if somebody decides to
smp_load_acquire from a packed 64-bit structure (e.g. some sort of lock),
then we'll get a conversion to non-scalar type error from the compiler.

Will
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: next build: 235 warnings 3 failures (next/next-20151117) Arnd Bergmann <arnd@arndb.de> - 2015-11-17 10:00 +0100
  Re: next build: 235 warnings 3 failures (next/next-20151117) Will Deacon <will.deacon@arm.com> - 2015-11-17 17:50 +0100
    Re: next build: 235 warnings 3 failures (next/next-20151117) Eric Dumazet <eric.dumazet@gmail.com> - 2015-11-17 18:10 +0100
    Re: next build: 235 warnings 3 failures (next/next-20151117) Arnd Bergmann <arnd@arndb.de> - 2015-11-17 18:10 +0100
      Re: next build: 235 warnings 3 failures (next/next-20151117) Will Deacon <will.deacon@arm.com> - 2015-11-17 18:20 +0100
        Re: next build: 235 warnings 3 failures (next/next-20151117) Arnd Bergmann <arnd@arndb.de> - 2015-11-17 20:20 +0100
          Re: next build: 235 warnings 3 failures (next/next-20151117) Will Deacon <will.deacon@arm.com> - 2015-11-18 11:20 +0100
            RE: next build: 235 warnings 3 failures (next/next-20151117) David Laight <David.Laight@ACULAB.COM> - 2015-11-18 13:20 +0100
              Re: next build: 235 warnings 3 failures (next/next-20151117) Will Deacon <will.deacon@arm.com> - 2015-11-18 13:30 +0100
                RE: next build: 235 warnings 3 failures (next/next-20151117) David Laight <David.Laight@ACULAB.COM> - 2015-11-18 16:30 +0100
                Re: next build: 235 warnings 3 failures (next/next-20151117) Will Deacon <will.deacon@arm.com> - 2015-11-18 16:40 +0100
                RE: next build: 235 warnings 3 failures (next/next-20151117) David Laight <David.Laight@ACULAB.COM> - 2015-11-18 17:00 +0100
          RE: next build: 235 warnings 3 failures (next/next-20151117) David Laight <David.Laight@ACULAB.COM> - 2015-11-18 11:30 +0100

csiph-web