nvme: check MUD support before firmware commit
PATCH 1/1 nvme: check MUD support before firmware commit
From: Guzebing <[email protected]>
Firmware Commit returns the Multiple Update Detected value in the command completion. nvme-cli currently identifies the controller after the command completes to decide whether to print that value.
That post-command Identify is fragile for immediate activation. A possible Linux race looks like:
nvme-cli thread nvme driver AEN work
--------------- --------------------
libnvme_exec_admin_passthru()
-> Firmware Commit succeeds
nvme_handle_aen_notice()
-> FW_ACT_STARTING
-> nvme_change_ctrl_state(RESETTING)
-> nvme_fw_act_work()
-> nvme_quiesce_io_queues()
-> wait for activation
fw_commit_print_mud()
-> fw_commit_support_mud()
-> nvme_identify_ctrl()
-> admin ioctl passthru
-> nvme_user_cmd*()
-> blk_mq_alloc_request()
-> __nvme_check_ready()
rejects user admin command while resettingnvme-cli then prints "identify-ctrl: ..." after the successful fw-commit output. The extra error makes it unclear whether Firmware Commit itself failed, even though the command completion was already successful.
The post-command Identify can also observe the wrong capability. MUD is a bit in the Firmware Commit completion, so it should be interpreted using the controller capability that applied when that command was processed. If the old firmware does not report support for firmware image overlap but the new firmware does, a post-activation Identify can make nvme-cli interpret the old command completion using the new firmware capability.
Read and cache SMUD before submitting Firmware Commit, and use the cached value to decide whether to print the completion MUD value. This ties MUD reporting to the firmware revision that accepted the command and avoids a post-success Identify during firmware activation.
--- nvme.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
nvme.c +6 -3
@@ -5341,9 +5341,9 @@ static bool fw_commit_support_mud(struct libnvme_transport_handle *hdl)return false; } -static void fw_commit_print_mud (struct libnvme_transport_handle *hdl,__u64 result) +static void fw_commit_print_mud (bool mud_supported,__u64 result) { -if (!fw_commit_support_mud (hdl)) +if (!mud_supported)return ; printf("Multiple Update Detected (MUD) Value: %#" PRIx64 "\n",
@@ -5403,6 +5403,7 @@ static int fw_commit(int argc, char **argv, struct command *acmd, struct pluginstruct libnvme_passthru_cmd cmd;int err;nvme_print_flags_t flags; +bool mud_supported;struct config {bool ish;
@@ -5471,6 +5472,8 @@ static int fw_commit(int argc, char **argv, struct command *acmd, struct pluginreturn -EINVAL ; } + mud_supported =fw_commit_support_mud (hdl); +nvme_init_fw_commit (&cmd, cfg.slot, cfg.action, cfg.bpid);if (cfg.ish) {if (libnvme_transport_handle_is_mi (hdl))
@@ -5489,7 +5492,7 @@ static int fw_commit(int argc, char **argv, struct command *acmd, struct pluginif (cfg.action ==6 || cfg.action ==7 )printf (" bpid:%d" , cfg.bpid);printf ("\n" ); -fw_commit_print_mud (hdl, cmd.result); +fw_commit_print_mud (mud_supported, cmd.result);return err; }
Signature · 1 line
2.20.1
Quoted 28 lines · guzebing
From: Guzebing <[email protected]>
Firmware Commit returns the Multiple Update Detected value in the command completion. nvme-cli currently identifies the controller after the command completes to decide whether to print that value.
That post-command Identify is fragile for immediate activation. A possible Linux race looks like:
nvme-cli thread nvme driver AEN work --------------- -------------------- libnvme_exec_admin_passthru() -> Firmware Commit succeeds nvme_handle_aen_notice() -> FW_ACT_STARTING -> nvme_change_ctrl_state(RESETTING) -> nvme_fw_act_work() -> nvme_quiesce_io_queues() -> wait for activation fw_commit_print_mud() -> fw_commit_support_mud() -> nvme_identify_ctrl() -> admin ioctl passthru -> nvme_user_cmd*() -> blk_mq_alloc_request() -> __nvme_check_ready() rejects user admin command while resetting
Quoted 4 lines
nvme-cli then prints "identify-ctrl: ..." after the successful fw-commit output. The extra error makes it unclear whether Firmware Commit itself failed, even though the command completion was already successful.
Seems the changes good but to make sure let me confirm below if possible.
1. Is this failure really caused?
2. Is there any log or issue report information?
3. Not necessary to care the case as the old firmware not supported MUD but only the new firmware supported MUD? (I think so but let me double check.)
Quoted 35 lines
From: "Tokunori Ikegami"<[email protected]>
Date: Wed, May 20, 2026, 06:50
Subject: Re: [PATCH nvme-cli] nvme: check MUD support before firmware commit
To: "guzebing"<[email protected]>, <[email protected]>
Cc: "Daniel Wagner"<[email protected]>, "Guzebing"<[email protected]>Quoted 28 lines · guzebing
From: Guzebing <[email protected]>
Firmware Commit returns the Multiple Update Detected value in the command completion. nvme-cli currently identifies the controller after the command completes to decide whether to print that value.
That post-command Identify is fragile for immediate activation. A possible Linux race looks like:
nvme-cli thread nvme driver AEN work --------------- --------------------
libnvme_exec_admin_passthru()
-> Firmware Commit succeeds
nvme_handle_aen_notice()
->FW_ACT_STARTING
->nvme_change_ctrl_state(RESETTING)->nvme_fw_act_work()
->nvme_quiesce_io_queues()-> wait for activationfw_commit_print_mud()
->fw_commit_support_mud()
->nvme_identify_ctrl()
-> admin ioctl passthru
-> nvme_user_cmd*()
->blk_mq_alloc_request()
->__nvme_check_ready()
rejects user admin command while resetting
Quoted 6 lines
Quoted 4 lines
nvme-cli then prints "identify-ctrl: ..." after the successful fw-commit output. The extra error makes it unclear whether Firmware Commit itself failed, even though the command completion was already successful.
Seems the changes good but to make sure let me confirm below if possible.
1. Is this failure really caused?
Yes, we observed this in our production environment last week. For the SOLIDIGM SB5PH27X076T Gen5 NVMe device, when upgrading the firmware from G70YG472 to G70YG473, nvme-cli printed the following error after Firmware Commit:
identify-ctrl: No such device or address
It reproduced 100% in our environment for this device and this firmware update path. I suspect this is because the firmware activation takes long enough for the post-command Identify Controller command to hit the controller reset window.
After applying this patch, the extra identify-ctrl error after the successful Firmware Commit disappeared.
Environment:
- kernel: Linux 6.12
- OS: Debian 13.2
- nvme-cli: 2.13
Quoted 1 line
2. Is there any log or issue report information?
There is no public issue report yet.
The user-visible nvme-cli output was:
Success committing firmware action:3 slot:1
identify-ctrl: No such device or address
We did not find any kernel error messages in dmesg around the failure. The only user-visible error was printed by nvme-cli.
Quoted 4 lines
3. Not necessary to care the case as the old firmware not supported MUD but only the new firmware supported MUD? (I think so but let me double check.)
Tokunori Ikegami
Reviewed-byQuoted 11 lines · 顾泽兵
Yes, we observed this in our production environment last week. For the SOLIDIGM SB5PH27X076T Gen5 NVMe device, when upgrading the firmware from G70YG472 to G70YG473, nvme-cli printed the following error after Firmware Commit:
identify-ctrl: No such device or address
It reproduced 100% in our environment for this device and this firmware update path. I suspect this is because the firmware activation takes long enough for the post-command Identify Controller command to hit the controller reset window.
Quoted 7 lines
After applying this patch, the extra identify-ctrl error after the successful Firmware Commit disappeared.
Environment:
- kernel: Linux 6.12
- OS: Debian 13.2
- nvme-cli: 2.13
Understood.
Quoted 9 lines
There is no public issue report yet.
The user-visible nvme-cli output was:
Success committing firmware action:3 slot:1
identify-ctrl: No such device or addressWe did not find any kernel error messages in dmesg around the failure. The only user-visible error was printed by nvme-cli.
Noted this also. Thank you.
Hi Daniel,
Just a gentle ping on this patch.
Tokunori has reviewed it, and I wanted to check whether there are any remaining concerns or whether it can be picked up.
Thanks,
Guzebing
Quoted 1 line · 顾泽兵
Just a gentle ping on this patch.
Ah sorry, I missed it. In the meantime the patch is merged.
Thanks,
Daniel