Re: [PATCH v6 3/5] riscv: ptrace support for hardware break/watchpoints

Chen Pei <[email protected]> Wed, 5 Aug 2026 21:22:52 +0800
Newsgroups org.infradead.lists.linux-riscv,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
> +struct __riscv_hwdebug_state {
> +	unsigned long addr;
> +	unsigned long type;
> +	unsigned long len;
> +	unsigned long ctrl;
> +} __packed;

Hi Himanshu,

Two suggestions about the new UAPI structure added in this patch.

1) Consider __u64 instead of 'unsigned long': its size differs
   between rv32 and rv64, so the layout would not be stable across
   32-bit and 64-bit userspace (e.g. a future COMPAT path). __u64
   keeps the layout identical for both.

2) With all members the same width there is no interior padding, so
   __packed can be dropped.

The struct user_hwdebug_state above already uses fixed-width types;
defining this one the same way would be consistent.

Best regards,
Pei

-- 
Chen Pei <[email protected]>

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv