All of lore.kernel.org
 help / color / mirror / Atom feed
From: wenbo.wang@memblaze.com (Wenbo Wang)
Subject: [PATCH] NVMe: do not touch sq door bell if nvmeq has been suspended
Date: Sat, 6 Feb 2016 14:32:24 +0000	[thread overview]
Message-ID: <BJXPR01MB19916231021454BD8731EBDE0D30@BJXPR01MB199.CHNPR01.prod.partner.outlook.cn> (raw)
In-Reply-To: <20160203163808.GC23910@localhost.localdomain>

Keith,

Is the following solution OK?
synchronize_rcu guarantee that no queue_rq is running concurrently with device disable code. Together with your another patch (adding blk_sync_queue), both sync/async path shall be handled correctly.

Do you think synchronize_rcu shall be added to blk_sync_queue?

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 4c0622f..bfe9132 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -865,7 +865,9 @@ void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async)
        if (!async) {
                int cpu = get_cpu();
                if (cpumask_test_cpu(cpu, hctx->cpumask)) {
+                       rcu_read_lock();
                        __blk_mq_run_hw_queue(hctx);
+                       rcu_read_unlock();
                        put_cpu();
                        return;
                }

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 8b1a725..d1e5e63 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1861,6 +1861,7 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
                nvme_disable_io_queues(dev);
                nvme_disable_admin_queue(dev, shutdown);
        }
+       synchronize_rcu();
        nvme_dev_unmap(dev);

        for (i = dev->queue_count - 1; i >= 0; i--)

-----Original Message-----
From: Keith Busch [mailto:keith.busch@intel.com] 
Sent: Thursday, February 4, 2016 12:38 AM
To: Wenbo Wang
Cc: Jens Axboe; Wenbo Wang; linux-kernel at vger.kernel.org; linux-nvme at lists.infradead.org; Wenwei.Tao
Subject: Re: [PATCH] NVMe: do not touch sq door bell if nvmeq has been suspended

On Wed, Feb 03, 2016@04:35:03PM +0000, Wenbo Wang wrote:
> For async io (executed by run_work worker) it should work. However for sync io in blk_mq_run_hw_queue, this seems not help, there is still a window.

Alright, for lack of a better way to sync a stopped queue, the driver's indication looks like the best we can do at this point.

  reply	other threads:[~2016-02-06 14:32 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01 15:42 [PATCH] NVMe: do not touch sq door bell if nvmeq has been suspended Wenbo Wang
2016-02-01 15:42 ` Wenbo Wang
2016-02-01 15:59 ` Busch, Keith
2016-02-01 15:59   ` Busch, Keith
2016-02-01 16:17   ` Wenbo Wang
2016-02-01 16:17     ` Wenbo Wang
2016-02-01 16:54 ` Jens Axboe
2016-02-01 16:54   ` Jens Axboe
2016-02-02  7:15   ` Wenbo Wang
2016-02-02 12:41     ` Sagi Grimberg
2016-02-02 12:41       ` Sagi Grimberg
2016-02-02 14:27       ` Keith Busch
2016-02-02 14:27         ` Keith Busch
2016-02-02 14:33         ` Sagi Grimberg
2016-02-02 14:33           ` Sagi Grimberg
2016-02-02 14:46           ` Keith Busch
2016-02-02 14:46             ` Keith Busch
2016-02-02 17:20             ` Sagi Grimberg
2016-02-02 17:20               ` Sagi Grimberg
2016-02-03  0:49               ` Wenbo Wang
2016-02-02 17:25     ` Keith Busch
2016-02-02 17:25       ` Keith Busch
2016-02-03  0:19       ` Wenbo Wang
2016-02-03 14:41     ` Keith Busch
2016-02-03 14:41       ` Keith Busch
2016-02-03 16:35       ` Wenbo Wang
2016-02-03 16:38         ` Keith Busch
2016-02-03 16:38           ` Keith Busch
2016-02-06 14:32           ` Wenbo Wang [this message]
2016-02-07 13:41             ` Sagi Grimberg
2016-02-07 13:41               ` Sagi Grimberg
2016-02-08 15:01             ` Keith Busch
2016-02-08 15:01               ` Keith Busch
2016-02-09 11:22               ` Wenbo Wang
2016-02-09 22:55                 ` Keith Busch
2016-02-09 22:55                   ` Keith Busch

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=BJXPR01MB19916231021454BD8731EBDE0D30@BJXPR01MB199.CHNPR01.prod.partner.outlook.cn \
    --to=wenbo.wang@memblaze.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 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.