Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: ednadols@linux.microsoft.com (Edmund Nadolski)
Subject: [PATCH, RFC 1/2] nvme: change locking for the per-subsystem controller list
Date: Wed, 8 May 2019 09:47:42 -0700	[thread overview]
Message-ID: <6b9497da-a1d1-84ed-f59c-ef602297a2aa@linux.microsoft.com> (raw)
In-Reply-To: <20190508075508.28552-1-hch@lst.de>

On 5/8/19 12:55 AM, Christoph Hellwig wrote:
> Life becomes a lot simpler if we just use the global
> nvme_subsystems_lock to protect this list.  Given that it is only
> accessed during controller probing and removal that isn't a scalability
> problem either.
> 
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
>   drivers/nvme/host/core.c | 30 ++++++++++++------------------
>   1 file changed, 12 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index eebaeadaa800..4f4ffcce7416 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2346,13 +2346,11 @@ static int nvme_active_ctrls(struct nvme_subsystem *subsys)
>   	int count = 0;
>   	struct nvme_ctrl *ctrl;
>   
> -	mutex_lock(&subsys->lock);
>   	list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) {
>   		if (ctrl->state != NVME_CTRL_DELETING &&
>   		    ctrl->state != NVME_CTRL_DEAD)
>   			count++;
>   	}
> -	mutex_unlock(&subsys->lock);
>   
>   	return count;
>   }

Would lockdep_assert_held(&nvme_subsystems_lock); be beneficial here?

Thanks,
Ed

  parent reply	other threads:[~2019-05-08 16:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08  7:55 [PATCH, RFC 1/2] nvme: change locking for the per-subsystem controller list Christoph Hellwig
2019-05-08  7:55 ` [PATCH, RFC 2/2] nvme: validate cntlid during controller initialisation Christoph Hellwig
2019-05-08 14:28   ` Keith Busch
2019-05-09  6:15     ` Christoph Hellwig
2019-05-08 18:51   ` Chaitanya Kulkarni
2019-05-09  6:16     ` Christoph Hellwig
2019-05-08 16:47 ` Edmund Nadolski [this message]
2019-05-09  6:17   ` [PATCH, RFC 1/2] nvme: change locking for the per-subsystem controller list Christoph Hellwig
2019-05-09 21:43     ` Edmund Nadolski
2019-05-08 22:42 ` Chaitanya Kulkarni
2019-05-09  5:13   ` 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=6b9497da-a1d1-84ed-f59c-ef602297a2aa@linux.microsoft.com \
    --to=ednadols@linux.microsoft.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