Skip to contentSkip to conversation

drop the multi-controller AWUPF check

PATCH In review Christoph Hellwig 6 participants 8 messages Jul 14, 2025 – Jul 22, 2025 NVMe

lore
Share & tools
lore

Christoph Hellwig

author maintainer
#0 lore raw

It turns out the nvme atomic write detection is so messy that all our checks for consistency between controllers in a subsystem caused other issues.

Drop the check for now to avoid regressions in released kernels, and give us a clean slate for looking into restricting what atomic writes we allow.

Diffstat:

 core.c |    9 ---------
 1 file changed, 9 deletions(-)
author maintainer
#1 lore raw

PATCH 1/1 nvme: revert the cross-controller atomic write size validation

This was originally added by commit 8695f060a029 ("nvme: all namespaces in a subsystem must adhere to a common atomic write size") to check the all controllers in a subsystem report the same atomic write size, but the check wasn't quite correct and caused problems for devices with multiple namespaces that report different LBA sizes. Commit f46d273449ba ("nvme: fix atomic write size validation") tried to fix this, but then caused problems for namespace rediscovery after a format with an LBA size change that changes the AWUPF value.

This drop the validation and essentially revers those two commits while keeping the cleanup that went in between the two. We'll need to figure out how to properly check for the mouse trap that nvme left us, but for now revert the check to keep devices working for users who couldn't care less about the atomic write feature.

Fixes 8695f060a029 ("nvme: all namespaces in a subsystem must adhere to a common atomic write size")
Fixes f46d273449ba ("nvme: fix atomic write size validation")
---
 drivers/nvme/host/core.c | 9 ---------
 1 file changed, 9 deletions(-)
drivers/nvme/host/core.c +0 -9
index 1d2240494f3d..fdd2334dacca 100644
@@ -3537,15 +3537,6 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl)
 		if (ret)
 			goto out_free;
 	}
-
-	if (le16_to_cpu(id->awupf) != ctrl->subsys->awupf) {
-		dev_err_ratelimited(ctrl->device,
-			"inconsistent AWUPF, controller not added (%u/%u).\n",
-			le16_to_cpu(id->awupf), ctrl->subsys->awupf);
-		ret = -EINVAL;
-		goto out_free;
-	}
-
 	memcpy(ctrl->subsys->firmware_rev, id->fr,
 	       sizeof(ctrl->subsys->firmware_rev));
 
Signature · 1 line
2.47.2
maintainer Reviewed-by on v1 1/1
#2 lore raw

Re: [PATCH] nvme: revert the cross-controller atomic write size validation

Quoted 9 lines · Christoph Hellwig

This was originally added by commit 8695f060a029 ("nvme: all namespaces in a subsystem must adhere to a common atomic write size") to check the all controllers in a subsystem report the same atomic write size, but the check wasn't quite correct and caused problems for devices with multiple namespaces that report different LBA sizes. Commit f46d273449ba ("nvme: fix atomic write size validation") tried to fix this, but then caused problems for namespace rediscovery after a format with an LBA size change that changes the AWUPF value.

Quoted 5 lines

This drop the validation and essentially revers those two commits while keeping the cleanup that went in between the two. We'll need to figure out how to properly check for the mouse trap that nvme left us, but for now revert the check to keep devices working for users who couldn't care less about the atomic write feature.

Looks good.

Reviewed-by on v1 1/1
#3 lore raw

Re: [PATCH] nvme: revert the cross-controller atomic write size validation

In reply to Christoph Hellwig
Quoted 15 lines · Christoph Hellwig

This was originally added by commit 8695f060a029 ("nvme: all namespaces in a subsystem must adhere to a common atomic write size") to check the all controllers in a subsystem report the same atomic write size, but the check wasn't quite correct and caused problems for devices with multiple namespaces that report different LBA sizes. Commit f46d273449ba ("nvme: fix atomic write size validation") tried to fix this, but then caused problems for namespace rediscovery after a format with an LBA size change that changes the AWUPF value.

This drop the validation and essentially revers those two commits while keeping the cleanup that went in between the two. We'll need to figure out how to properly check for the mouse trap that nvme left us, but for now revert the check to keep devices working for users who couldn't care less about the atomic write feature.

Quoted 4 lines
Fixes 8695f060a029 ("nvme: all namespaces in a subsystem must adhere to a common atomic write size")
Fixes f46d273449ba ("nvme: fix atomic write size validation")

---

Quoted 23 lines
  drivers/nvme/host/core.c | 9 ---------
  1 file changed, 9 deletions(-)
drivers/nvme/host/core.c +0 -9
index 1d2240494f3d..fdd2334dacca 100644
@@ -3537,15 +3537,6 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl)
  		if (ret)
  			goto out_free;
  	}
-
-	if (le16_to_cpu(id->awupf) != ctrl->subsys->awupf) {
-		dev_err_ratelimited(ctrl->device,
-			"inconsistent AWUPF, controller not added (%u/%u).\n",
-			le16_to_cpu(id->awupf), ctrl->subsys->awupf);
-		ret = -EINVAL;
-		goto out_free;
-	}
-
  	memcpy(ctrl->subsys->firmware_rev, id->fr,
  	       sizeof(ctrl->subsys->firmware_rev));
 
Reviewed-by Tested-by on v1 1/1
#4 lore raw

Re: [PATCH] nvme: revert the cross-controller atomic write size validation

In reply to Christoph Hellwig
Quoted 15 lines · Christoph Hellwig

This was originally added by commit 8695f060a029 ("nvme: all namespaces in a subsystem must adhere to a common atomic write size") to check the all controllers in a subsystem report the same atomic write size, but the check wasn't quite correct and caused problems for devices with multiple namespaces that report different LBA sizes. Commit f46d273449ba ("nvme: fix atomic write size validation") tried to fix this, but then caused problems for namespace rediscovery after a format with an LBA size change that changes the AWUPF value.

This drop the validation and essentially revers those two commits while keeping the cleanup that went in between the two. We'll need to figure out how to properly check for the mouse trap that nvme left us, but for now revert the check to keep devices working for users who couldn't care less about the atomic write feature.

Quoted 3 lines
Fixes 8695f060a029 ("nvme: all namespaces in a subsystem must adhere to a common atomic write size")
Fixes f46d273449ba ("nvme: fix atomic write size validation")

[root@localhost ~]# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda           8:0    0   40G  0 disk

├─sda1        8:1    0    1G  0 part /boot
└─sda2        8:2    0   39G  0 part
  └─ol-root 252:0    0   39G  0 lvm  /

sr0          11:0    1 1024M  0 rom
nvme2n1     259:1    0  250G  0 disk
nvme2n2     259:3    0  250G  0 disk
nvme2n3     259:5    0  250G  0 disk
nvme2n4     259:8    0  250G  0 disk
nvme2n5     259:9    0  250G  0 disk
[root@localhost ~]# cat testxx.sh
set -x

nvme id-ctrl /dev/$1 | grep cmic
nvme id-ctrl /dev/$1 | grep awun
nvme id-ctrl /dev/$1 | grep awupf

nvme id-ns /dev/$1 | grep nawupf
cat /sys/block/$1/queue/atomic_write_max_bytes [root@localhost ~]# sh testxx.sh nvme2n1
+ nvme id-ctrl /dev/nvme2n1
+ grep cmic
cmic      : 0x2
+ nvme id-ctrl /dev/nvme2n1
+ grep awun
awun      : 31
+ nvme id-ctrl /dev/nvme2n1
+ grep awupf
awupf     : 15
+ nvme id-ns /dev/nvme2n1
+ grep nawupf
nawupf  : 0
+ cat /sys/block/nvme2n1/queue/atomic_write_max_bytes 4096
[root@localhost ~]# sh testxx.sh nvme2n2
+ nvme id-ctrl /dev/nvme2n2
+ grep cmic
cmic      : 0x2
+ nvme id-ctrl /dev/nvme2n2
+ grep awun
awun      : 15
+ nvme id-ctrl /dev/nvme2n2
+ grep awupf
awupf     : 7
+ nvme id-ns /dev/nvme2n2
+ grep nawupf
nawupf  : 0
+ cat /sys/block/nvme2n2/queue/atomic_write_max_bytes 4096
[root@localhost ~]# sh testxx.sh nvme2n3
+ nvme id-ctrl /dev/nvme2n3
+ grep cmic
cmic      : 0x2
+ grep awun
+ nvme id-ctrl /dev/nvme2n3
awun      : 31
+ nvme id-ctrl /dev/nvme2n3
+ grep awupf
awupf     : 31
+ grep nawupf
+ nvme id-ns /dev/nvme2n3
nawupf  : 0
+ cat /sys/block/nvme2n3/queue/atomic_write_max_bytes 4096
[root@localhost ~]# sh testxx.sh nvme2n4
+ nvme id-ctrl /dev/nvme2n4
+ grep cmic
cmic      : 0x2
+ nvme id-ctrl /dev/nvme2n4
+ grep awun
awun      : 15
+ nvme id-ctrl /dev/nvme2n4
+ grep awupf
awupf     : 15
+ nvme id-ns /dev/nvme2n4
+ grep nawupf
nawupf  : 15
+ cat /sys/block/nvme2n4/queue/atomic_write_max_bytes 8192
[root@localhost ~]# sh testxx.sh nvme2n5
+ nvme id-ctrl /dev/nvme2n5
+ grep cmic
cmic      : 0x2
+ nvme id-ctrl /dev/nvme2n5
+ grep awun
awun      : 15
+ nvme id-ctrl /dev/nvme2n5
+ grep awupf
awupf     : 15
+ nvme id-ns /dev/nvme2n5
+ grep nawupf
nawupf  : 63
+ cat /sys/block/nvme2n5/queue/atomic_write_max_bytes 32768
[root@localhost ~]# dmesg | grep -i nvme
[    2.613613] nvme nvme2: pci function 0000:00:06.0 [    2.615487] nvme nvme0: pci function 0000:00:04.0 [    2.617269] nvme nvme1: pci function 0000:00:05.0 [    2.618234] nvme nvme3: pci function 0000:00:07.0 [    2.707583] nvme nvme0: 1/0/0 default/read/poll queues [    2.711550] nvme nvme2: 1/0/0 default/read/poll queues [    2.727280] nvme nvme0: Ignoring bogus Namespace Identifiers [    2.728661] nvme nvme1: 1/0/0 default/read/poll queues [    2.730096] nvme nvme2: Ignoring bogus Namespace Identifiers [    2.742041] nvme nvme1: Ignoring bogus Namespace Identifiers [    2.752341] nvme nvme3: 1/0/0 default/read/poll queues [    2.755530] nvme nvme3: Ignoring bogus Namespace Identifiers [    2.755774] nvme nvme3: Ignoring bogus Namespace Identifiers [root@localhost ~]#

Reviewed-by on v1 1/1
#5 lore raw

Re: [PATCH] nvme: revert the cross-controller atomic write size validation

In reply to Christoph Hellwig
Quoted 10 lines · Christoph Hellwig

This was originally added by commit 8695f060a029 ("nvme: all namespaces in a subsystem must adhere to a common atomic write size") to check the all controllers in a subsystem report the same atomic write size, but the check wasn't quite correct and caused problems for devices with multiple namespaces that report different LBA sizes. Commit f46d273449ba ("nvme: fix atomic write size validation") tried to fix this, but then caused problems for namespace rediscovery after a format with an LBA size change that changes the AWUPF value.

This drop the validation and essentially revers those two commits while

s/This drop/This drops ?
s/revers/reverts ?

Quoted 10 lines

keeping the cleanup that went in between the two. We'll need to figure out how to properly check for the mouse trap that nvme left us, but for now revert the check to keep devices working for users who couldn't care less about the atomic write feature.

Fixes 8695f060a029 ("nvme: all namespaces in a subsystem must adhere to a common atomic write size")
Fixes f46d273449ba ("nvme: fix atomic write size validation")

---

Looks good.

-ck

author maintainer
#6 lore raw

Re: [PATCH] nvme: revert the cross-controller atomic write size validation

Quoted 2 lines · Chaitanya Kulkarni

s/This drop/This drops ?
s/revers/reverts ?

Thanks,

I've fixed these up.

Reviewed-by on v1 1/1
#7 lore raw

Re: [PATCH] nvme: revert the cross-controller atomic write size validation

In reply to Christoph Hellwig
Quoted 15 lines · Christoph Hellwig

This was originally added by commit 8695f060a029 ("nvme: all namespaces in a subsystem must adhere to a common atomic write size") to check the all controllers in a subsystem report the same atomic write size, but the check wasn't quite correct and caused problems for devices with multiple namespaces that report different LBA sizes. Commit f46d273449ba ("nvme: fix atomic write size validation") tried to fix this, but then caused problems for namespace rediscovery after a format with an LBA size change that changes the AWUPF value.

This drop the validation and essentially revers those two commits while keeping the cleanup that went in between the two. We'll need to figure out how to properly check for the mouse trap that nvme left us, but for now revert the check to keep devices working for users who couldn't care less about the atomic write feature.

Quoted 7 lines
Fixes 8695f060a029 ("nvme: all namespaces in a subsystem must adhere to a common atomic write size")
Fixes f46d273449ba ("nvme: fix atomic write size validation")
---
  drivers/nvme/host/core.c | 9 ---------
  1 file changed, 9 deletions(-)

Yes, please. It had been a annoying me for quite some time, glad to see it go.

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke                  Kernel Storage Architect
[email protected]                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich