Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nilay Shroff <nilay@linux.ibm.com>
To: Chaitanya Kulkarni <chaitanyak@nvidia.com>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>
Cc: "hch@lst.de" <hch@lst.de>,
	"kbusch@kernel.org" <kbusch@kernel.org>,
	"sagi@grimberg.me" <sagi@grimberg.me>,
	"gjoyce@linux.ibm.com" <gjoyce@linux.ibm.com>,
	"axboe@fb.com" <axboe@fb.com>
Subject: Re: [PATCH v2] nvme: find numa distance only if controller has valid numa id
Date: Tue, 16 Apr 2024 12:23:01 +0530	[thread overview]
Message-ID: <391005cb-2a3d-426e-b539-30faf23c6efc@linux.ibm.com> (raw)
In-Reply-To: <a31a6787-16cb-4dfb-afa4-f24d66faab3f@nvidia.com>



On 4/16/24 08:06, Chaitanya Kulkarni wrote:
> On 4/15/24 07:22, Nilay Shroff wrote:
>> On system where native nvme multipath is configured and iopolicy
>> is set to numa but the nvme controller numa node id is undefined
>> or -1 (NUMA_NO_NODE) then avoid calculating node distance for
>> finding optimal io path. In such case we may access numa distance
>> table with invalid index and that may potentially refer to incorrect
>> memory. So this patch ensures that if the nvme controller numa node
>> id is -1 then instead of calculating node distance for finding optimal
>> io path, we set the numa node distance of such controller to default 10
>> (LOCAL_DISTANCE).
>>
>> Link: https://lore.kernel.org/all/20240413090614.678353-1-nilay@linux.ibm.com/
>> Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
>> ---
>> Changes from v1:
>> 	Formatting cleanups (Christoph)
>>
>>   drivers/nvme/host/multipath.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
>> index 5397fb428b24..08e598c87b08 100644
>> --- a/drivers/nvme/host/multipath.c
>> +++ b/drivers/nvme/host/multipath.c
>> @@ -247,7 +247,8 @@ static struct nvme_ns *__nvme_find_path(struct nvme_ns_head *head, int node)
>>   		if (nvme_path_is_disabled(ns))
>>   			continue;
>>   
>> -		if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_NUMA)
>> +		if (ns->ctrl->numa_node != NUMA_NO_NODE &&
>> +				READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_NUMA)
> 
> unless something is wrong when I apply this patch, above line should be
> kept under 80 char ?
> 
> something like following totally untested :-
> 
> diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
> index 5397fb428b24..d16e976ae1a4 100644
> --- a/drivers/nvme/host/multipath.c
> +++ b/drivers/nvme/host/multipath.c
> @@ -247,7 +247,8 @@ static struct nvme_ns *__nvme_find_path(struct 
> nvme_ns_head *head, int node)
>                  if (nvme_path_is_disabled(ns))
>                          continue;
> 
> -               if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_NUMA)
> +               if (ns->ctrl->numa_node != NUMA_NO_NODE &&
> +                   READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_NUMA)
>                          distance = node_distance(node, 
> ns->ctrl->numa_node);
>                  else
>                          distance = LOCAL_DISTANCE;
> 
> -ck
> 
> 
I don't know but checkpatch.pl didn't complain about my patch overshooting 
80 chars width. Anyways, I will reformat the patch and resend.

Thanks,
--Nilay




  reply	other threads:[~2024-04-16  6:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15 14:22 [PATCH v2] nvme: find numa distance only if controller has valid numa id Nilay Shroff
2024-04-16  2:36 ` Chaitanya Kulkarni
2024-04-16  6:53   ` Nilay Shroff [this message]
2024-04-16  9:06     ` Chaitanya Kulkarni

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=391005cb-2a3d-426e-b539-30faf23c6efc@linux.ibm.com \
    --to=nilay@linux.ibm.com \
    --cc=axboe@fb.com \
    --cc=chaitanyak@nvidia.com \
    --cc=gjoyce@linux.ibm.com \
    --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