From: Nilay Shroff <nilay@linux.ibm.com>
To: Sagi Grimberg <sagi@grimberg.me>, dwagner@suse.de, hare@suse.de
Cc: kbusch@kernel.org, hch@lst.de, axboe@fb.com,
gjoyce@linux.ibm.com, linux-nvme@lists.infradead.org
Subject: Re: [PATCHv6 RFC 1/3] nvme-multipath: Add visibility for round-robin io-policy
Date: Tue, 24 Dec 2024 17:01:35 +0530 [thread overview]
Message-ID: <4474cc50-8a23-45c1-880f-e077c11ed8dd@linux.ibm.com> (raw)
In-Reply-To: <1e07dbd6-3d3b-4c73-aa60-159ade59fcb2@grimberg.me>
On 12/24/24 16:31, Sagi Grimberg wrote:
>
>
>
> On 13/12/2024 6:18, Nilay Shroff wrote:
>> This patch helps add nvme native multipath visibility for round-robin
>> io-policy. It creates a "multipath" sysfs directory under head gendisk
>> device node directory and then from "multipath" directory it adds a link
>> to each namespace path device the head node refers.
>>
>> For instance, if we have a shared namespace accessible from two different
>> controllers/paths then we create a soft link to each path device from head
>> disk node as shown below:
>>
>> $ ls -l /sys/block/nvme1n1/multipath/
>> nvme1c1n1 -> ../../../../../pci052e:78/052e:78:00.0/nvme/nvme1/nvme1c1n1
>> nvme1c3n1 -> ../../../../../pci058e:78/058e:78:00.0/nvme/nvme3/nvme1c3n1
>>
>> In the above example, nvme1n1 is head gendisk node created for a shared
>> namespace and the namespace is accessible from nvme1c1n1 and nvme1c3n1
>> paths.
>>
>> For round-robin I/O policy, we could easily infer from the above output
>> that I/O workload targeted to nvme1n1 would toggle across paths nvme1c1n1
>> and nvme1c3n1.
>>
>> Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
>> ---
>> drivers/nvme/host/core.c | 3 ++
>> drivers/nvme/host/multipath.c | 81 +++++++++++++++++++++++++++++++++++
>> drivers/nvme/host/nvme.h | 18 ++++++--
>> drivers/nvme/host/sysfs.c | 14 ++++++
>> 4 files changed, 112 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
>> index d169a30eb935..df4cc8a27385 100644
>> --- a/drivers/nvme/host/core.c
>> +++ b/drivers/nvme/host/core.c
>> @@ -3982,6 +3982,9 @@ static void nvme_ns_remove(struct nvme_ns *ns)
>> if (!nvme_ns_head_multipath(ns->head))
>> nvme_cdev_del(&ns->cdev, &ns->cdev_device);
>> +
>> + nvme_mpath_remove_sysfs_link(ns);
>> +
>> del_gendisk(ns->disk);
>> mutex_lock(&ns->ctrl->namespaces_lock);
>> diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
>> index a85d190942bd..8e2865df2f33 100644
>> --- a/drivers/nvme/host/multipath.c
>> +++ b/drivers/nvme/host/multipath.c
>> @@ -686,6 +686,8 @@ static void nvme_mpath_set_live(struct nvme_ns *ns)
>> kblockd_schedule_work(&head->partition_scan_work);
>> }
>> + nvme_mpath_add_sysfs_link(ns->head);
>
> Why do you add the link in set_live? Why not always set this link? it is after all, another
> path to the device?
>
It's because we would be able to create the link from head disk node to a device path node
only after the head node comes alive (i.e. head disk node entry is created under sysfs).
For instance, in the below example,
$ ls -l /sys/block/nvme1n1/multipath/
nvme1c1n1 -> ../../../../../pci052e:78/052e:78:00.0/nvme/nvme1/nvme1c1n1
nvme1c3n1 -> ../../../../../pci058e:78/058e:78:00.0/nvme/nvme3/nvme1c3n1
The nvme1n1 (head disk node) is added under sysfs (/sys/block/nvme1n1) from
the following code path:
nvme_mpath_set_live()
-> device_add_disk()
-> add_disk_fwnode()
-> device_add()
From device_add() we add the head disk node entry under sysfs.
So it's essential for us to only add the link in nvme_mpath_set_live() after
the head disk node comes live. Hope it clarifies. Please let me know if you've
any further query.
Thanks,
--Nilay
next prev parent reply other threads:[~2024-12-24 11:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-13 4:18 [PATCHv6 RFC 0/3] Add visibility for native NVMe multipath using sysfs Nilay Shroff
2024-12-13 4:18 ` [PATCHv6 RFC 1/3] nvme-multipath: Add visibility for round-robin io-policy Nilay Shroff
2024-12-24 11:01 ` Sagi Grimberg
2024-12-24 11:31 ` Nilay Shroff [this message]
2024-12-13 4:18 ` [PATCHv6 RFC 2/3] nvme-multipath: Add visibility for numa io-policy Nilay Shroff
2024-12-24 11:18 ` Sagi Grimberg
2024-12-13 4:18 ` [PATCHv6 RFC 3/3] nvme-multipath: Add visibility for queue-depth io-policy Nilay Shroff
2024-12-24 11:18 ` Sagi Grimberg
2025-01-08 16:47 ` [PATCHv6 RFC 0/3] Add visibility for native NVMe multipath using sysfs Keith Busch
2025-01-10 15:47 ` Keith Busch
2025-01-12 12:18 ` Nilay Shroff
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=4474cc50-8a23-45c1-880f-e077c11ed8dd@linux.ibm.com \
--to=nilay@linux.ibm.com \
--cc=axboe@fb.com \
--cc=dwagner@suse.de \
--cc=gjoyce@linux.ibm.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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