Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-04 Thread Sinan Kaya
On 4/4/2018 3:50 PM, Arnd Bergmann wrote: > On Wed, Apr 4, 2018 at 7:48 PM, Sinan Kaya wrote: >> On 4/4/2018 11:55 AM, Arnd Bergmann wrote: >>> Yes, exactly, plus the same for write and in/out of course. >> >> I was looking at this... >> >> inb() and outb() seem to be

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-04 Thread Sinan Kaya
On 4/4/2018 3:50 PM, Arnd Bergmann wrote: > On Wed, Apr 4, 2018 at 7:48 PM, Sinan Kaya wrote: >> On 4/4/2018 11:55 AM, Arnd Bergmann wrote: >>> Yes, exactly, plus the same for write and in/out of course. >> >> I was looking at this... >> >> inb() and outb() seem to be calling writeb(). It gets

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-04 Thread Arnd Bergmann
On Wed, Apr 4, 2018 at 7:48 PM, Sinan Kaya wrote: > On 4/4/2018 11:55 AM, Arnd Bergmann wrote: >> Yes, exactly, plus the same for write and in/out of course. > > I was looking at this... > > inb() and outb() seem to be calling writeb(). It gets the wmb/barrier >

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-04 Thread Arnd Bergmann
On Wed, Apr 4, 2018 at 7:48 PM, Sinan Kaya wrote: > On 4/4/2018 11:55 AM, Arnd Bergmann wrote: >> Yes, exactly, plus the same for write and in/out of course. > > I was looking at this... > > inb() and outb() seem to be calling writeb(). It gets the wmb/barrier > automatically > when we fix

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-04 Thread Sinan Kaya
On 4/4/2018 11:55 AM, Arnd Bergmann wrote: > Yes, exactly, plus the same for write and in/out of course. I was looking at this... inb() and outb() seem to be calling writeb(). It gets the wmb/barrier automatically when we fix writeb(). Did I miss something? -- Sinan Kaya Qualcomm Datacenter

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-04 Thread Sinan Kaya
On 4/4/2018 11:55 AM, Arnd Bergmann wrote: > Yes, exactly, plus the same for write and in/out of course. I was looking at this... inb() and outb() seem to be calling writeb(). It gets the wmb/barrier automatically when we fix writeb(). Did I miss something? -- Sinan Kaya Qualcomm Datacenter

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-04 Thread Sinan Kaya
On 4/4/2018 11:55 AM, Arnd Bergmann wrote: > On Wed, Apr 4, 2018 at 5:52 PM, Sinan Kaya wrote: >> On 4/3/2018 6:29 PM, Palmer Dabbelt wrote: >>> >> >> Are we looking for something like this? > > Yes, exactly, plus the same for write and in/out of course. > OK. I just

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-04 Thread Sinan Kaya
On 4/4/2018 11:55 AM, Arnd Bergmann wrote: > On Wed, Apr 4, 2018 at 5:52 PM, Sinan Kaya wrote: >> On 4/3/2018 6:29 PM, Palmer Dabbelt wrote: >>> >> >> Are we looking for something like this? > > Yes, exactly, plus the same for write and in/out of course. > OK. I just wanted to double check

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-04 Thread Arnd Bergmann
On Wed, Apr 4, 2018 at 5:52 PM, Sinan Kaya wrote: > On 4/3/2018 6:29 PM, Palmer Dabbelt wrote: >> > > Are we looking for something like this? Yes, exactly, plus the same for write and in/out of course. > diff --git a/inc > #ifndef readb > #define readb readb > -static

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-04 Thread Arnd Bergmann
On Wed, Apr 4, 2018 at 5:52 PM, Sinan Kaya wrote: > On 4/3/2018 6:29 PM, Palmer Dabbelt wrote: >> > > Are we looking for something like this? Yes, exactly, plus the same for write and in/out of course. > diff --git a/inc > #ifndef readb > #define readb readb > -static inline u8 readb(const

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-04 Thread Sinan Kaya
On 4/3/2018 6:29 PM, Palmer Dabbelt wrote: > On Tue, 03 Apr 2018 05:56:18 PDT (-0700), Arnd Bergmann wrote: >> On Tue, Apr 3, 2018 at 2:44 PM, Sinan Kaya wrote: >>> On 4/3/2018 7:13 AM, Arnd Bergmann wrote: On Tue, Apr 3, 2018 at 12:49 PM, Mark Rutland

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-04 Thread Sinan Kaya
On 4/3/2018 6:29 PM, Palmer Dabbelt wrote: > On Tue, 03 Apr 2018 05:56:18 PDT (-0700), Arnd Bergmann wrote: >> On Tue, Apr 3, 2018 at 2:44 PM, Sinan Kaya wrote: >>> On 4/3/2018 7:13 AM, Arnd Bergmann wrote: On Tue, Apr 3, 2018 at 12:49 PM, Mark Rutland wrote: > Hi, > > On Fri,

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-03 Thread Palmer Dabbelt
On Tue, 03 Apr 2018 05:56:18 PDT (-0700), Arnd Bergmann wrote: On Tue, Apr 3, 2018 at 2:44 PM, Sinan Kaya wrote: On 4/3/2018 7:13 AM, Arnd Bergmann wrote: On Tue, Apr 3, 2018 at 12:49 PM, Mark Rutland wrote: Hi, On Fri, Mar 30, 2018 at 11:58:13AM

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-03 Thread Palmer Dabbelt
On Tue, 03 Apr 2018 05:56:18 PDT (-0700), Arnd Bergmann wrote: On Tue, Apr 3, 2018 at 2:44 PM, Sinan Kaya wrote: On 4/3/2018 7:13 AM, Arnd Bergmann wrote: On Tue, Apr 3, 2018 at 12:49 PM, Mark Rutland wrote: Hi, On Fri, Mar 30, 2018 at 11:58:13AM -0400, Sinan Kaya wrote: The default

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-03 Thread Sinan Kaya
On 4/3/2018 8:56 AM, Arnd Bergmann wrote: > On Tue, Apr 3, 2018 at 2:44 PM, Sinan Kaya wrote: >> On 4/3/2018 7:13 AM, Arnd Bergmann wrote: >>> On Tue, Apr 3, 2018 at 12:49 PM, Mark Rutland wrote: Hi, On Fri, Mar 30, 2018 at 11:58:13AM

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-03 Thread Sinan Kaya
On 4/3/2018 8:56 AM, Arnd Bergmann wrote: > On Tue, Apr 3, 2018 at 2:44 PM, Sinan Kaya wrote: >> On 4/3/2018 7:13 AM, Arnd Bergmann wrote: >>> On Tue, Apr 3, 2018 at 12:49 PM, Mark Rutland wrote: Hi, On Fri, Mar 30, 2018 at 11:58:13AM -0400, Sinan Kaya wrote: > The default

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-03 Thread Arnd Bergmann
On Tue, Apr 3, 2018 at 2:44 PM, Sinan Kaya wrote: > On 4/3/2018 7:13 AM, Arnd Bergmann wrote: >> On Tue, Apr 3, 2018 at 12:49 PM, Mark Rutland wrote: >>> Hi, >>> >>> On Fri, Mar 30, 2018 at 11:58:13AM -0400, Sinan Kaya wrote: The default

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-03 Thread Arnd Bergmann
On Tue, Apr 3, 2018 at 2:44 PM, Sinan Kaya wrote: > On 4/3/2018 7:13 AM, Arnd Bergmann wrote: >> On Tue, Apr 3, 2018 at 12:49 PM, Mark Rutland wrote: >>> Hi, >>> >>> On Fri, Mar 30, 2018 at 11:58:13AM -0400, Sinan Kaya wrote: The default implementation of mapping readX() to __raw_readX() is

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-03 Thread Sinan Kaya
On 4/3/2018 7:13 AM, Arnd Bergmann wrote: > On Tue, Apr 3, 2018 at 12:49 PM, Mark Rutland wrote: >> Hi, >> >> On Fri, Mar 30, 2018 at 11:58:13AM -0400, Sinan Kaya wrote: >>> The default implementation of mapping readX() to __raw_readX() is wrong. >>> readX() has stronger

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-03 Thread Sinan Kaya
On 4/3/2018 7:13 AM, Arnd Bergmann wrote: > On Tue, Apr 3, 2018 at 12:49 PM, Mark Rutland wrote: >> Hi, >> >> On Fri, Mar 30, 2018 at 11:58:13AM -0400, Sinan Kaya wrote: >>> The default implementation of mapping readX() to __raw_readX() is wrong. >>> readX() has stronger ordering semantics.

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-03 Thread Arnd Bergmann
On Tue, Apr 3, 2018 at 12:49 PM, Mark Rutland wrote: > Hi, > > On Fri, Mar 30, 2018 at 11:58:13AM -0400, Sinan Kaya wrote: >> The default implementation of mapping readX() to __raw_readX() is wrong. >> readX() has stronger ordering semantics. Compiler is allowed to reorder

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-03 Thread Arnd Bergmann
On Tue, Apr 3, 2018 at 12:49 PM, Mark Rutland wrote: > Hi, > > On Fri, Mar 30, 2018 at 11:58:13AM -0400, Sinan Kaya wrote: >> The default implementation of mapping readX() to __raw_readX() is wrong. >> readX() has stronger ordering semantics. Compiler is allowed to reorder >> __raw_readX(). > >

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-03 Thread Mark Rutland
Hi, On Fri, Mar 30, 2018 at 11:58:13AM -0400, Sinan Kaya wrote: > The default implementation of mapping readX() to __raw_readX() is wrong. > readX() has stronger ordering semantics. Compiler is allowed to reorder > __raw_readX(). Could you please specify what the compiler is potentially

Re: [PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-04-03 Thread Mark Rutland
Hi, On Fri, Mar 30, 2018 at 11:58:13AM -0400, Sinan Kaya wrote: > The default implementation of mapping readX() to __raw_readX() is wrong. > readX() has stronger ordering semantics. Compiler is allowed to reorder > __raw_readX(). Could you please specify what the compiler is potentially

[PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-03-30 Thread Sinan Kaya
The default implementation of mapping readX() to __raw_readX() is wrong. readX() has stronger ordering semantics. Compiler is allowed to reorder __raw_readX(). In the abscence of a read barrier or when using a strongly ordered architecture, readX() should at least have a compiler barrier in it to

[PATCH v2 2/2] io: prevent compiler reordering on the default readX() implementation

2018-03-30 Thread Sinan Kaya
The default implementation of mapping readX() to __raw_readX() is wrong. readX() has stronger ordering semantics. Compiler is allowed to reorder __raw_readX(). In the abscence of a read barrier or when using a strongly ordered architecture, readX() should at least have a compiler barrier in it to