From: Christoph Hellwig <hch@lst.de>
To: John Meneghini <jmeneghi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>,
kbusch@kernel.org, sagi@grimberg.me,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
emilne@redhat.com, jrani@purestorage.com, randyj@purestorage.com,
chaitanyak@nvidia.com, hare@kernel.org
Subject: Re: [PATCH v7 1/1] nvme-multipath: implement "queue-depth" iopolicy
Date: Mon, 24 Jun 2024 10:46:27 +0200 [thread overview]
Message-ID: <20240624084627.GA20032@lst.de> (raw)
In-Reply-To: <d4ae4b0a-b3a4-40db-87e3-c9a493408172@redhat.com>
On Thu, Jun 20, 2024 at 01:54:29PM -0400, John Meneghini wrote:
>>> +static void nvme_subsys_iopolicy_update(struct nvme_subsystem *subsys,
>>> + int iopolicy)
>>> +{
>>> + struct nvme_ctrl *ctrl;
>>> + int old_iopolicy = READ_ONCE(subsys->iopolicy);
>>> +
>>> + if (old_iopolicy == iopolicy)
>>> + return;
>>> +
>>> + WRITE_ONCE(subsys->iopolicy, iopolicy);
>>
>> What is the atomicy model here? There doesn't seem to be any
>> global lock protecting it? Maybe move it into the
>> nvme_subsystems_lock critical section?
>
> Good question. I didn't write this code. Yes, I agree this looks racy.
> Updates to the subsys->iopolicy variable are not atomic. They don't need to
> be. The process of changing the iopolicy doesn't need to be synchronized
> and each CPU's cache will be updated lazily. This was done to avoid the
> expense of adding (another) atomic read the io path.
Looks like all sysfs ->store calls for the same attribute are protected
by of->mutex in kernfs_fop_write_iter and we should actually be fine
here. Sorry for the noise.
>> pr_notice("%s: changing iopolicy from %s to %s\n",
>> subsys->subnqn,
>> nvme_iopolicy_names[old_iopolicy],
>> nvme_iopolicy_names[iopolicy]);
>
> How about:
>
> pr_notice("Changed iopolicy from %s to %s for subsysnqn %s\n",
> nvme_iopolicy_names[old_iopolicy],
> nvme_iopolicy_names[iopolicy],
> subsys->subnqn);
Having the identification as the prefixe seems easier to parse
and grep for.
next prev parent reply other threads:[~2024-06-24 8:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 16:35 [PATCH v7 0/1] nvme: queue-depth multipath iopolicy John Meneghini
2024-06-19 16:35 ` [PATCH v7 1/1] nvme-multipath: implement "queue-depth" iopolicy John Meneghini
2024-06-20 6:56 ` Christoph Hellwig
2024-06-20 14:41 ` John Meneghini
2024-06-20 17:54 ` John Meneghini
2024-06-24 8:46 ` Christoph Hellwig [this message]
2024-06-24 17:50 ` John Meneghini
2024-06-24 17:54 ` Christoph Hellwig
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=20240624084627.GA20032@lst.de \
--to=hch@lst.de \
--cc=chaitanyak@nvidia.com \
--cc=emilne@redhat.com \
--cc=hare@kernel.org \
--cc=jmeneghi@redhat.com \
--cc=jrani@purestorage.com \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=randyj@purestorage.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.