lkml.org 
[lkml]   [2020]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [patch V4 part 1 06/36] compiler: Simple READ/WRITE_ONCE() implementations
    From
    Date


    On 5/5/20 3:16 PM, Thomas Gleixner wrote:
    > READ/WRITE_ONCE_NOCHECK() is required for atomics in code which cannot be
    > instrumented like the x86 int3 text poke code. As READ/WRITE_ONCE() is
    > undergoing a rewrite, provide __{READ,WRITE}_ONCE_SCALAR().
    >
    > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    > Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    > ---
    > include/linux/compiler.h | 8 ++++++++
    > 1 file changed, 8 insertions(+)

    Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>

    alex.

    > --- a/include/linux/compiler.h
    > +++ b/include/linux/compiler.h
    > @@ -313,6 +313,14 @@ unsigned long read_word_at_a_time(const
    > __u.__val; \
    > })
    >
    > +#define __READ_ONCE_SCALAR(x) \
    > + (*(const volatile typeof(x) *)&(x))
    > +
    > +#define __WRITE_ONCE_SCALAR(x, val) \
    > +do { \
    > + *(volatile typeof(x) *)&(x) = val; \
    > +} while (0)
    > +
    > /**
    > * data_race - mark an expression as containing intentional data races
    > *
    >

    \
     
     \ /
      Last update: 2020-05-06 15:13    [W:2.789 / U:0.068 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site