On Tue, Dec 27, 2016 at 11:24 AM, Linus Torvalds
[off-list ref] wrote:
Oops. I should include the actual patch I was talking about too, shouldn't I?
And that patch was completely buggy. The mask for the "and" was computed as
+ : "Ir" (1 << nr) : "memory");
but that clears every bit *except* for the one we actually want to
clear. I even posted the code it generates:
lock; andb $1,(%rdi) #, MEM[(volatile long int *)_7]
js .L114 #,
which is obviously crap.
The mask needs to be inverted, of course, and the constraint should be
"ir" (not "Ir" - the "I" is for shift constants) so it should be
+ : "ir" ((char) ~(1 << nr)) : "memory");
new patch attached (but still entirely untested, so caveat emptor).
This patch at least might have a chance in hell of working. Let's see..
Linus