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


Groups > linux.kernel > #1272319

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

From David Laight <David.Laight@ACULAB.COM>
Newsgroups linux.kernel
Subject RE: next build: 235 warnings 3 failures (next/next-20151117)
Date 2015-11-18 17:00 +0100
Message-ID <qwdjk-4US-9@gated-at.bofh.it> (permalink)
References (4 earlier) <qw80i-1y5-5@gated-at.bofh.it> <qw9Sp-2Jt-1@gated-at.bofh.it> <qwa27-2NS-23@gated-at.bofh.it> <qwcQi-4HC-25@gated-at.bofh.it> <qwcZZ-4Lu-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Will Deacon [mailto:will.deacon@arm.com]
> Sent: 18 November 2015 15:37
> On Wed, Nov 18, 2015 at 03:21:19PM +0000, David Laight wrote:
> > From: Will Deacon
> > > Sent: 18 November 2015 12:28
> > > On Wed, Nov 18, 2015 at 12:11:25PM +0000, David Laight wrote:
> > > > From: Will Deacon
> > > > >   http://lists.infradead.org/pipermail/linux-arm-kernel/2015-November/386094.html
> > > >
> > > > That patch forces a memory write-read and returns uninitialised stack
> > > > for short reads.
> > >
> > > Really? The disassembly looks fine to me. Do you have a concrete example
> > > of where you think it goes wrong, please?
> > >
> > > > Who knows what happens on big-endian systems.
> > >
> > > The same thing as READ_ONCE? I'll test it there to make sure, but I
> > > don't see a problem.
> >
> > Ah, god, it is absolutely horrid. But probably right :-(
> 
> Yeah, I wasn't pretending it was nice :) FWIW, I've given it a reasonable
> testing in both little-endian and big-endian configurations and it seems
> to be happy.

I was missing the fact that the *(int_type *)&union is always reading
the full union.
The next version of the compiler might decide to barf at the code
that appears to be reading beyond the end of the union.

> > Do all the lda variants zero extend to 64 bits ?
> 
> Yes.
> 
> > If so maybe you could use a single 64 bit variable for the result of the read
> > and then cast it to typeof(*p) to get the required sign extension for
> > small integer types.
> 
> That was the original proposal from Arnd, but I want this to work with
> structures smaller than 64-bit (e.g. arch_spinlock_t), so that's why
> I decided to follow the approach laid down by READ_ONCE.

That would still be ok.
You'd have something that is effectively:
	_u64 val = *p;
	return typeof(*p)val;
The compiler might mask unsigned values - but it may be able to
determine it isn't needed (which is probably true of your version).
For signed types both versions require the compile sign-extend
the value.

	David

--
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 | Next — Previous 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