From: alan.adamson@oracle.com
To: Christoph Hellwig <hch@lst.de>
Cc: "kbusch@kernel.org" <kbusch@kernel.org>,
Sagi Grimberg <sagi@grimberg.me>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
Yi Zhang <yi.zhang@redhat.com>,
John Garry <john.g.garry@oracle.com>
Subject: Re: fix atomic limits check
Date: Mon, 23 Jun 2025 10:24:50 -0700 [thread overview]
Message-ID: <1802de7c-1f2b-4c84-9f99-a38625c3715f@oracle.com> (raw)
In-Reply-To: <20250623133309.GA27241@lst.de>
On 6/23/25 6:33 AM, Christoph Hellwig wrote:
> On Wed, Jun 18, 2025 at 11:30:20AM -0700, alan.adamson@oracle.com wrote:
>>> Can you double check this really is your CTLR2? At least for me
>>> the async probing reorders nvme devices quite a lot with qemu.
>>>
>> CTRL 0 (nvme0) - AWUN=31 AWUPF=15 nvme1n2
>> CTRL 1 (nvme1) - AWUN=31 AWUPF=31 nvme1n1
>> CTRL 2 (nvme2) - AWUN=15 AWUPF=7 nvme1n3
>> CTRL 3 (nvme3) - AWUN=15 AWUPF=15
> Do you mean AWUN or AWUPF? Because AWUN is totally irrelevant and
> not even parsed by Linux.
The above configuration is the HW/QEMU configuration. Both AWUN and
AWUPF are setup.
>
>> I rebooted and it probed differently. Now CTRL2 is nvme1n3. We know
>> CTRL2 is the same as nvme1n3 because awun and awupf from nvme id-ctrl
>> matches the qemu config (atomic.awun=15,atomic.awupf=7) for CTRL2 (nvme2).
>>
>> # nvme id-ctrl /dev/nvme1n3 | grep awun
>> awun : 15
>> # nvme id-ctrl /dev/nvme1n3 | grep awupf
>> awupf : 7
>> # cat /sys/block/nvme1n3/queue/atomic_write_max_bytes
>> 8192
> The code in nvme_configure_atomic_write calculates the values pretty
> much directly from (N)AWUPF, so I don't see how it would get things
> wrong. Can you run your patched qemu setup with this debug printk
> patch?
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 3da5ac71a9b0..245397b217f4 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2033,6 +2033,8 @@ static u32 nvme_configure_atomic_write(struct nvme_ns *ns,
> atomic_bs = (1 + le16_to_cpu(id->nawupf)) * bs;
> if (id->nabspf)
> boundary = (le16_to_cpu(id->nabspf) + 1) * bs;
> + dev_info(ns->ctrl->device, "NAWUPF: %u, atomic_bs: %u\n",
> + le16_to_cpu(id->nabspf), atomic_bs);
> } else {
> /*
> * Use the controller wide atomic write unit. This sucks
> @@ -2042,6 +2044,8 @@ static u32 nvme_configure_atomic_write(struct nvme_ns *ns,
> * values for different controllers in the subsystem.
> */
> atomic_bs = (1 + ns->ctrl->subsys->awupf) * bs;
> + dev_info(ns->ctrl->device, "AWUPF: %u, atomic_bs: %u\n",
> + ns->ctrl->subsys->awupf, atomic_bs);
> }
>
> lim->atomic_write_hw_max = atomic_bs;
Here you go:
CTRL 0 (nvme0) - AWUN=31 AWUPF=15 nvme0n1
CTRL 1 (nvme1) - AWUN=31 AWUPF=31 nvme0n3
CTRL 2 (nvme2) - AWUN=15 AWUPF=7 nvme0n2
CTRL 3 (nvme3) - AWUN=15 AWUPF=15
NS - NAWUN=31 NAWUPF=15 nvme0n4
NS - NAWUN=127 NAWUPF=63 nvme0n5
[root@localhost ~]# nvme id-ctrl /dev/nvme0n1 | grep awupf
awupf : 15
[root@localhost ~]# cat /sys/block/nvme0n1/queue/atomic_write_max_bytes
8192
[root@localhost ~]# nvme id-ctrl /dev/nvme0n2 | grep awupf
awupf : 7
[root@localhost ~]# cat /sys/block/nvme0n2/queue/atomic_write_max_bytes
8192
[root@localhost ~]# nvme id-ctrl /dev/nvme0n3 | grep awupf
awupf : 31
[root@localhost ~]# cat /sys/block/nvme0n3/queue/atomic_write_max_bytes
8192
[root@localhost ~]# nvme id-ns /dev/nvme0n4 | grep nawupf
nawupf : 15
[root@localhost ~]# cat /sys/block/nvme0n4/queue/atomic_write_max_bytes
8192
[root@localhost ~]# nvme id-ns /dev/nvme0n5 | grep nawupf
nawupf : 63
[root@localhost ~]# cat /sys/block/nvme0n5/queue/atomic_write_max_bytes
32768
[root@localhost ~]#
[root@localhost ~]# dmesg | grep nvme | grep atomic_bs
[ 2.831882] nvme nvme0: AWUPF: 15, atomic_bs: 8192
[ 2.840480] nvme nvme2: AWUPF: 15, atomic_bs: 8192
[ 2.842418] nvme nvme1: AWUPF: 15, atomic_bs: 8192
[ 2.861119] nvme nvme3: NAWUPF: 0, atomic_bs: 8192
[ 2.862427] nvme nvme3: NAWUPF: 0, atomic_bs: 32768
[root@localhost ~]#
next prev parent reply other threads:[~2025-06-23 21:44 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-11 5:54 fix atomic limits check Christoph Hellwig
2025-06-11 5:54 ` [PATCH 1/2] nvme: refactor the atomic write unit detection Christoph Hellwig
2025-06-13 7:52 ` John Garry
2025-06-11 5:54 ` [PATCH 2/2] nvme: fix atomic write boundary validation Christoph Hellwig
2025-06-13 3:04 ` Yi Zhang
2025-06-13 8:03 ` John Garry
2025-06-16 5:31 ` Christoph Hellwig
2025-06-16 7:42 ` John Garry
2025-06-16 11:36 ` Christoph Hellwig
2025-06-16 10:19 ` John Garry
2025-06-16 11:37 ` Christoph Hellwig
2025-06-16 11:49 ` John Garry
2025-06-17 7:36 ` John Garry
2025-06-13 21:22 ` fix atomic limits check alan.adamson
2025-06-16 5:36 ` Christoph Hellwig
2025-06-17 17:40 ` alan.adamson
2025-06-18 5:32 ` Christoph Hellwig
2025-06-18 16:07 ` alan.adamson
[not found] ` <20250618171750.GA29321@lst.de>
2025-06-18 18:30 ` alan.adamson
2025-06-23 13:33 ` Christoph Hellwig
2025-06-23 17:24 ` alan.adamson [this message]
2025-06-24 13:10 ` Christoph Hellwig
2025-06-24 16:38 ` alan.adamson
2025-06-25 6:39 ` Christoph Hellwig
2025-06-17 4:56 ` Christoph Hellwig
2025-06-17 16:38 ` Luis Chamberlain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1802de7c-1f2b-4c84-9f99-a38625c3715f@oracle.com \
--to=alan.adamson@oracle.com \
--cc=hch@lst.de \
--cc=john.g.garry@oracle.com \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
--cc=yi.zhang@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).