On Sun Oct 11, 2026 at 1:52 PM BST, Thomas Weißschuh wrote:
> Keeping the flags as part of the bitfield prevents the usage of
> READ_ONCE()/WRITE_ONCE() with it. It also makes access from Rust
> awkward.
>
> Make it a dedicated field.
>
> The new field will stay in the exact same location in the parent
> structure.

Incorrect.

>
> No functional change.
>
> Signed-off-by: Thomas Weißschuh <[email protected]>
> ---
>  include/linux/dynamic_debug.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
> index 0b34343df594..b1ff7c0e9a5f 100644
> --- a/include/linux/dynamic_debug.h
> +++ b/include/linux/dynamic_debug.h
> @@ -51,7 +51,7 @@ struct _ddebug {
>  #else
>  #define _DPRINTK_FLAGS_DEFAULT 0
>  #endif
> -     u32 flags:8;
> +     u8 flags;

This will change the layout of the struct, because it'll no longer be merged
with the previous bitfields.

The layout change can be avoided by make lineno + class explicitly take 3 bytes.
Perhaps reduce lineno to u16 and have class be a standalone u8? No kernel source
file (apart from pre-generated AMDGPU headers, which doesn't use dyndbg anyway)
have more than 65535 lines.

Alternatively we can just say the layout change is fine, as for 64-bit platforms
with jump label patching, there's padding in the struct anyway so this doesn't
grow the full struct size.

Anyhow this needs to be noted explicitly.

Best,
Gary

>  #ifdef CONFIG_JUMP_LABEL
>       union {
>               struct static_key_true dd_key_true;



Reply via email to