On 6/3/25 5:59 AM, Klaus Jensen wrote:
From: Klaus Jensen <k.jen...@samsung.com>

Commit cd59f50ab017 ("hw/nvme: always initialize a subsystem") causes
the controller to always set the CMIC.MCTRS ("Multiple Controllers")
bit. While spec-compliant, this is a deviation from the previous
behavior where this was only set if an nvme-subsys device was explicitly
created (to configure a subsystem with multiple controllers/namespaces).

Revert the behavior to only set CMIC.MCTRS if an nvme-subsys device is
created explicitly.

Reported-by: Alan Adamson <alan.adam...@oracle.com>
Fixes: cd59f50ab017 ("hw/nvme: always initialize a subsystem")
Signed-off-by: Klaus Jensen <k.jen...@samsung.com>
---

Reviewed-by: Alan Adamson <alan.adam...@oracle.com>

Tested-by: Alan Adamson <alan.adam...@oracle.com>


                                Before Fix                                      With Klaus's Fix subsys with 1 controller        # nvme id-ctrl /dev/nvme0n1 | grep cmic         # nvme id-ctrl /dev/nvme0n1 | grep cmic                                 cmic      : 0x2                                 cmic      : 0x2

subsys with 2 controllers       # nvme id-ctrl /dev/nvme0n1 | grep cmic         # nvme id-ctrl /dev/nvme0n1 | grep cmic                                 cmic      : 0x2                                 cmic      : 0x2                                 # nvme id-ctrl /dev/nvme0n2 | grep cmic         # nvme id-ctrl /dev/nvme0n2 | grep cmic                                 cmic      : 0x2                                 cmic      : 0x2

no subsys with 2 controllers    # nvme id-ctrl /dev/nvme0n1 | grep cmic         # nvme id-ctrl /dev/nvme0n1 | grep cmic                                 cmic      : 0x2                                 cmic      : 0x0                                 # nvme id-ctrl /dev/nvme1n1 | grep cmic         # nvme id-ctrl /dev/nvme1n1 | grep cmic                                 cmic      : 0x2                                 cmic      : 0x0


A bug in the Linux Atomic Write feature resulted in the atomic_write_max_bytes being set
to zero when cmic=0x2.

# uname -a
Linux localhost.localdomain 6.15.0-rc3+ #1 SMP PREEMPT_DYNAMIC Tue Apr 22 14:34:09 PDT 2025 x86_64 x86_64 x86_64 GNU/Linux
# nvme id-ctrl /dev/nvme0n1 | grep cmic
cmic      : 0
# cat /sys/block/nvme0n1/queue/atomic_write_max_bytes
0

With this fix:

# nvme id-ctrl /dev/nvme0n1
cmic      : 0
# cat /sys/block/nvme0n1/queue/atomic_write_max_bytes
8192



Reply via email to