[PATCH 2/4] nvme: trace the Set Features Save bit from the right position
Guixin Liu
kanie at linux.alibaba.com
Tue Dec 1 03:53:43 PST 2026
The Save (SV) bit of Set Features is CDW10 bit 31. The trace parser
masks byte 3 of CDW10 with 0x8, which selects the reserved bit 27
instead, so the trace shows sv=0 for commands that save the feature
and a nonzero sv when a reserved bit is set.
Mask with 0x80 instead.
Fixes: a7b5e8d864b3 ("nvme: add set feature tracing support")
Cc: stable at vger.kernel.org
Signed-off-by: Guixin Liu <kanie at linux.alibaba.com>
---
Reproduced in a QEMU/KVM guest with nvmet-tcp loopback: send Set
Features (fid 0x0b) via NVME_IOCTL_ADMIN_CMD with CDW10 0x8000000b,
0x0000000b and 0x0800000b, and read the nvme_setup_cmd tracepoint.
Unpatched: sv=0x0 for the SV-set command and sv=0x8 for the
reserved-bit command. Patched: sv=0x80 and sv=0x0; the plain command
stays sv=0x0. fid 0x07 is rejected unconditionally by
nvme_admin_cmd_allowed(), so the test uses 0x0b.
drivers/nvme/host/trace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/host/trace.c b/drivers/nvme/host/trace.c
index ad25ad1e40412..699c577818925 100644
--- a/drivers/nvme/host/trace.c
+++ b/drivers/nvme/host/trace.c
@@ -77,7 +77,7 @@ static const char *nvme_trace_admin_set_features(struct trace_seq *p,
{
const char *ret = trace_seq_buffer_ptr(p);
u8 fid = cdw10[0];
- u8 sv = cdw10[3] & 0x8;
+ u8 sv = cdw10[3] & 0x80;
u32 cdw11 = get_unaligned_le32(cdw10 + 4);
trace_seq_printf(p, "fid=0x%x, sv=0x%x, cdw11=0x%x", fid, sv, cdw11);
--
2.43.7
More information about the Linux-nvme
mailing list