Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1240032

Re: [PATCH 1/2] block: generic request_queue reference counting

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Dan Williams <dan.j.williams@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] block: generic request_queue reference counting
Date Tue, 06 Oct 2015 01:50:02 +0200
Message-ID <qgnG2-5Gc-3@gated-at.bofh.it> (permalink)
References <qedKO-5VS-13@gated-at.bofh.it> <qedKP-5VS-41@gated-at.bofh.it> <qfLho-122-5@gated-at.bofh.it>
X-Original-To Christoph Hellwig <hch@lst.de>
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=rKxJ3ImLGL6gIYQL6K/Q83+Ckv+wNAhPmHbcfOGaD9o=; b=T6YfXuR5zile3CFrgqTQrb4tFSDPeJj7WXOrh+Gz3P0lXIhKPvVB6MqamzG8ljkYWC Ix5zwPpGSiun5NcX54gvVArW8eMgnWj18uLm2+HrW0S/K2fc9pgiPuXj/kJ7PDIRbZuC vjUIqMnxbcxWBE3+bTWsGUM1ZPzqQ4iv/vh+BuT/7b01T2gv4EKxZVwwWANKux1sxNty +aZoxxyies8hFvlqi6XxSSk6JHwYZLgymFJ7Xt3Znnk1E+VL1Uu5xHKg5TZ8hWexXLgV lHbX2RU8/o471tcO5f/JYvc/hJG1reK9WgbKr41kUvUK/6GBqH3NX130LRDi3l9AGRK9 +rdA==
X-Gm-Message-State ALoCoQlt5csEA+l8xEKusuqarQz+rrNk/ICzX5u++IbAJI6D3L+lEps4hUewnteWAjZbpFq6Icjn
MIME-Version 1.0
X-Received by 10.180.96.166 with SMTP id dt6mr14822669wib.38.1444088643065; Mon, 05 Oct 2015 16:44:03 -0700 (PDT)
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 84
Organization linux.* mail to news gateway
X-Original-Cc Jens Axboe <axboe@kernel.dk>, Keith Busch <keith.busch@intel.com>, Ross Zwisler <ross.zwisler@linux.intel.com>, "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
X-Original-Date Mon, 5 Oct 2015 16:44:03 -0700
X-Original-Message-ID <CAPcyv4hNALF0n2a=WH_1rhUmXoB_ckH4_RK1_rskN6-q6wAErA@mail.gmail.com>
X-Original-References <20150930002927.37133.331.stgit@dwillia2-desk3.jf.intel.com> <20150930004130.37133.73852.stgit@dwillia2-desk3.jf.intel.com> <20151004064013.GC13199@lst.de>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1240032

Show key headers only | View raw


On Sat, Oct 3, 2015 at 11:40 PM, Christoph Hellwig <hch@lst.de> wrote:
> On Tue, Sep 29, 2015 at 08:41:31PM -0400, Dan Williams wrote:
>> Allow pmem, and other synchronous/bio-based block drivers, to fallback
>> on a per-cpu reference count managed by the core for tracking queue
>> live/dead state.
>>
>> The existing per-cpu reference count for the blk_mq case is promoted to
>> be used in all block i/o scenarios.  This involves initializing it by
>> default, waiting for it to drop to zero at exit, and holding a live
>> reference over the invocation of q->make_request_fn() in
>> generic_make_request().  The blk_mq code continues to take its own
>> reference per blk_mq request and retains the ability to freeze the
>> queue, but the check that the queue is frozen is moved to
>> generic_make_request().
>>
>> This fixes crash signatures like the following:
>>
>>  BUG: unable to handle kernel paging request at ffff880140000000
>>  [..]
>>  Call Trace:
>>   [<ffffffff8145e8bf>] ? copy_user_handle_tail+0x5f/0x70
>>   [<ffffffffa004e1e0>] pmem_do_bvec.isra.11+0x70/0xf0 [nd_pmem]
>>   [<ffffffffa004e331>] pmem_make_request+0xd1/0x200 [nd_pmem]
>>   [<ffffffff811c3162>] ? mempool_alloc+0x72/0x1a0
>>   [<ffffffff8141f8b6>] generic_make_request+0xd6/0x110
>>   [<ffffffff8141f966>] submit_bio+0x76/0x170
>>   [<ffffffff81286dff>] submit_bh_wbc+0x12f/0x160
>>   [<ffffffff81286e62>] submit_bh+0x12/0x20
>>   [<ffffffff813395bd>] jbd2_write_superblock+0x8d/0x170
>>   [<ffffffff8133974d>] jbd2_mark_journal_empty+0x5d/0x90
>>   [<ffffffff813399cb>] jbd2_journal_destroy+0x24b/0x270
>>   [<ffffffff810bc4ca>] ? put_pwq_unlocked+0x2a/0x30
>>   [<ffffffff810bc6f5>] ? destroy_workqueue+0x225/0x250
>>   [<ffffffff81303494>] ext4_put_super+0x64/0x360
>>   [<ffffffff8124ab1a>] generic_shutdown_super+0x6a/0xf0
>>
>> Cc: Jens Axboe <axboe@kernel.dk>
>> Cc: Keith Busch <keith.busch@intel.com>
>> Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
>> Suggested-by: Christoph Hellwig <hch@lst.de>
>> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>> ---
>>  block/blk-core.c       |   71 +++++++++++++++++++++++++++++++++++++------
>>  block/blk-mq-sysfs.c   |    6 ----
>>  block/blk-mq.c         |   80 ++++++++++++++----------------------------------
>>  block/blk-sysfs.c      |    3 +-
>>  block/blk.h            |   14 ++++++++
>>  include/linux/blk-mq.h |    1 -
>>  include/linux/blkdev.h |    2 +
>>  7 files changed, 102 insertions(+), 75 deletions(-)
>>
>> diff --git a/block/blk-core.c b/block/blk-core.c
>> index 2eb722d48773..6062550baaef 100644
>> --- a/block/blk-core.c
>> +++ b/block/blk-core.c
>> @@ -554,19 +554,17 @@ void blk_cleanup_queue(struct request_queue *q)
>>        * Drain all requests queued before DYING marking. Set DEAD flag to
>>        * prevent that q->request_fn() gets invoked after draining finished.
>>        */
>> -     if (q->mq_ops) {
>> -             blk_mq_freeze_queue(q);
>> -             spin_lock_irq(lock);
>> -     } else {
>> -             spin_lock_irq(lock);
>> +     blk_freeze_queue(q);
>> +     spin_lock_irq(lock);
>> +     if (!q->mq_ops)
>>               __blk_drain_queue(q, true);
>> -     }
>
> __blk_drain_queue really ought to be moved into blk_freeze_queue so it
> has equivlaent functionality for mq vs !mq.  But maybe that can be a
> separate patch.

It's not clear why the cleanup path is gating __blk_drain_queue on
->mq_ops?  __blk_drain_queue already gets called from
blkcg_init_queue().  Also, it seems blk_get_flush_queue() is already
handling the mq_ops vs !mp_ops case, but I'd have to take a closer
look.  Definitely seems like follow-on patch material...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] block drivers + dax vs driver unbind Dan Williams <dan.j.williams@intel.com> - 2015-09-30 02:50 +0200
  [PATCH 2/2] block, dax: fix lifetime of in-kernel dax mappings Dan Williams <dan.j.williams@intel.com> - 2015-09-30 02:50 +0200
    Re: [PATCH 2/2] block, dax: fix lifetime of in-kernel dax mappings Dave Chinner <david@fromorbit.com> - 2015-10-01 01:40 +0200
      Re: [PATCH 2/2] block, dax: fix lifetime of in-kernel dax mappings Dan Williams <dan.j.williams@intel.com> - 2015-10-01 02:20 +0200
      Re: [PATCH 2/2] block, dax: fix lifetime of in-kernel dax mappings Dan Williams <dan.j.williams@intel.com> - 2015-10-06 04:00 +0200
        Re: [PATCH 2/2] block, dax: fix lifetime of in-kernel dax mappings Dave Chinner <david@fromorbit.com> - 2015-10-06 23:20 +0200
  [PATCH 1/2] block: generic request_queue reference counting Dan Williams <dan.j.williams@intel.com> - 2015-09-30 02:50 +0200
    Re: [PATCH 1/2] block: generic request_queue reference counting Christoph Hellwig <hch@lst.de> - 2015-10-04 08:50 +0200
      Re: [PATCH 1/2] block: generic request_queue reference counting Dan Williams <dan.j.williams@intel.com> - 2015-10-06 01:50 +0200
    Re: [PATCH 1/2] block: generic request_queue reference counting Ming Lei <tom.leiming@gmail.com> - 2015-10-04 10:00 +0200
      Re: [PATCH 1/2] block: generic request_queue reference counting Dan Williams <dan.j.williams@intel.com> - 2015-10-06 01:30 +0200
        Re: [PATCH 1/2] block: generic request_queue reference counting Ming Lei <tom.leiming@gmail.com> - 2015-10-06 12:50 +0200
          Re: [PATCH 1/2] block: generic request_queue reference counting Dan Williams <dan.j.williams@intel.com> - 2015-10-06 18:10 +0200

csiph-web