Re: [PATCH/RFC 7/7] kernel: Force ACCESS_ONCE to work only on scalar types
From: David Howells
Date: Mon Nov 24 2014 - 15:05:24 EST
Christian Borntraeger <borntraeger@xxxxxxxxxx> wrote:
> Looks really nice, but does not work with ACCESS_ONCE is on the left-hand side:
>
>
> include/linux/rculist.h: In function 'hlist_add_before_rcu':
> ./arch/x86/include/asm/barrier.h:127:18: error: lvalue required as left operand of assignment
> ACCESS_ONCE(*p) = (v); \
>
> Alexei's variant is also broken:
>
> include/linux/cgroup.h: In function 'task_css':
> include/linux/compiler.h:381:40: error: invalid operands to binary + (have 'struct css_set *' and 'struct css_set * volatile')
> #define ACCESS_ONCE(x) (((typeof(x))0) + *(volatile typeof(x) *)&(x))
>
> Anyone with a new propopal? ;-) ^
Reserve ACCESS_ONCE() for reading and add an ASSIGN_ONCE() or something like
that for writing?
David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/