Re: [PATCH RFC 07/11] dyndbg: use READ_ONCE()/WRITE_ONCE() to access descriptor flags
From: Gary Guo
Date: Sun Oct 11 2026 - 12:06:48 EST
On Sun Oct 11, 2026 at 1:52 PM BST, Thomas Weißschuh wrote:
> The descriptor flags are accessed concurrently. Use
> READ_ONCE()/WRITE_ONCE() to keep their contents consistent.
>
> Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
>
> ---
> I am not entirely sure about this. We are only using single bits, so
> torn reads/writes should not matter. But LKMM has no guidance on this as
> far as I can see. Also for Rust this seems to be necessary.
Code should assume plain writes to be atomic. Concurrently accessed data should
use READ_ONCE/WRITE_ONCE so you're right on this one.
I think this patch should be merged with the bitfield definition change, though.
Best,
Gary
> ---
> include/linux/dynamic_debug.h | 6 +++---
> lib/dynamic_debug.c | 24 +++++++++++++-----------
> 2 files changed, 16 insertions(+), 14 deletions(-)
>