On 2022/08/16 16:48, Herbert Xu wrote: > On Tue, Aug 16, 2022 at 03:28:50PM +0900, Hector Martin wrote: >> >> This is the same reason I argued queue_work() itself needs to have a >> similar guarantee, even when it doesn't queue work (and I updated the >> doc to match). If test_and_set_bit() is used in this kind of context >> often in the kernel, clearly the current implementation/doc clashes with >> that. > > Kernel code all over the place rely on the fact that test_and_set_bit > provides a memory barrier. So this bug that you've discovered is > not at all isolated to the workqeueue system. It'll break the kernel > in lots of places in exactly the same way. Now I'm surprised this isn't failing all over the place, given that... these things are annoyingly subtle. Still would want Will & Peter to chime in, of course. >> As I said, I don't have any particular beef in this fight, but this is >> horribly broken on M1/2 right now, so I'll send a patch to change the >> bitops instead and you all can fight it out over which way is correct :) > > Please do. Already did, but I just realized I forgot to Cc you. Sorry about that, hope you can pick it up through the MLs: https://lore.kernel.org/asahi/20220816070311.89186-1-marcan@xxxxxxxxx/T/#u - Hector