From: Ming Lei <ming.lei@redhat.com>
To: Kanchan Joshi <joshi.k@samsung.com>
Cc: Christoph Hellwig <hch@lst.de>, Keith Busch <kbusch@kernel.org>,
linux-nvme@lists.infradead.org, Sagi Grimberg <sagi@grimberg.me>,
Guangwu Zhang <guazhang@redhat.com>,
Anuj Gupta <anuj20.g@samsung.com>
Subject: Re: [PATCH] nvme: core: don't hold rcu read lock in nvme_ns_chr_uring_cmd_iopoll
Date: Wed, 9 Aug 2023 15:53:35 +0800 [thread overview]
Message-ID: <ZNNF/2NEPYCeiXlM@fedora> (raw)
In-Reply-To: <20230809065920.GA19415@green245>
On Wed, Aug 09, 2023 at 12:29:20PM +0530, Kanchan Joshi wrote:
> On Wed, Aug 09, 2023 at 10:04:40AM +0800, Ming Lei wrote:
> > Now nvme_ns_chr_uring_cmd_iopoll() has switched to request based io
> > polling, and the associated NS is guaranteed to be live in case of
> > io polling, so request is guaranteed to be valid because blk-mq uses
> > pre-allocated request pool.
> >
> > Remove the rcu read lock in nvme_ns_chr_uring_cmd_iopoll(), which
> > isn't needed any more after switching to request based io polling.
>
> > Fix "BUG: sleeping function called from invalid context" because
> > set_page_dirty_lock() from blk_rq_unmap_user() may sleep.
> >
> > Fixes: 585079b6e425 ("nvme: wire up async polling for io passthrough commands")
> > Reported-by: Guangwu Zhang <guazhang@redhat.com>
>
> Thanks Ming. Looks fine, but any link to this report?
> I don't see this breaking in my tests. So I wonder how to reproduce and
> improve the coverage.
It is reported in RH BZ2227639, and follows the stack trace:
[ 3286.960425] BUG: sleeping function called from invalid context at include/linux/pagemap.h:914
[ 3286.960434] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 530910, name: fio
[ 3286.960440] preempt_count: 1, expected: 0
[ 3286.960443] RCU nest depth: 1, expected: 0
[ 3286.960446] 3 locks held by fio/530910:
[ 3286.960450] #0: ffff8881108e40b0 (&ctx->uring_lock){+.+.}-{3:3}, at: __do_sys_io_uring_enter+0x535/0x980
[ 3286.960476] #1: ffffffff9b72a320 (rcu_read_lock){....}-{1:2}, at: nvme_ns_chr_uring_cmd_iopoll+0x5/0x270 [nvme_core]
[ 3286.960530] #2: ffff88837937b098 (&nvmeq->cq_poll_lock){+.+.}-{2:2}, at: nvme_poll+0x129/0x180 [nvme]
[ 3286.960553] Preemption disabled at:
[ 3286.960555] [<0000000000000000>] 0x0
[ 3286.960691] CPU: 1 PID: 530910 Comm: fio Kdump: loaded Tainted: G W L X ------- --- 5.14.0-345.el9.x86_64+debug #1
[ 3286.960700] Hardware name: Dell Inc. PowerEdge R640/06DKY5, BIOS 2.15.1 06/15/2022
[ 3286.960704] Call Trace:
[ 3286.960707] <TASK>
[ 3286.960720] dump_stack_lvl+0x57/0x81
[ 3286.960734] __might_resched.cold+0x222/0x26b
[ 3286.960756] set_page_dirty_lock+0x1d/0x130
[ 3286.960773] __bio_release_pages+0x266/0x470
[ 3286.960811] blk_rq_unmap_user+0x2a8/0x660
[ 3286.960824] ? lock_acquire+0x1d8/0x640
[ 3286.960839] ? sched_clock_cpu+0x15/0x1b0
[ 3286.960850] ? find_held_lock+0x33/0x120
[ 3286.960870] ? __pfx_blk_rq_unmap_user+0x10/0x10
[ 3286.960876] ? __lock_release+0x4c1/0xa00
[ 3286.960894] ? __pfx___lock_release+0x10/0x10
[ 3286.960908] ? mark_held_locks+0xa5/0xf0
[ 3286.960938] nvme_uring_cmd_end_io+0x204/0x300 [nvme_core]
[ 3286.960974] ? __pfx_nvme_uring_cmd_end_io+0x10/0x10 [nvme_core]
[ 3286.961020] __blk_mq_end_request+0xf6/0x4c0
[ 3286.961042] nvme_poll_cq+0x71e/0xe40 [nvme]
[ 3286.961102] nvme_poll+0x134/0x180 [nvme]
[ 3286.961121] blk_mq_poll_classic+0x179/0x420
[ 3286.961153] bio_poll+0x1f5/0x440
[ 3286.961182] nvme_ns_chr_uring_cmd_iopoll+0x16f/0x270 [nvme_core]
Thanks,
Ming
next prev parent reply other threads:[~2023-08-09 7:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20230809020844epcas5p30e520491fa59ab8c20836d4275931e8f@epcas5p3.samsung.com>
2023-08-09 2:04 ` [PATCH] nvme: core: don't hold rcu read lock in nvme_ns_chr_uring_cmd_iopoll Ming Lei
2023-08-09 6:59 ` Kanchan Joshi
2023-08-09 7:53 ` Ming Lei [this message]
2023-08-10 6:34 ` Kanchan Joshi
2023-08-10 8:14 ` Ming Lei
2023-08-11 14:12 ` Jens Axboe
2023-08-11 14:12 ` Jens Axboe
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=ZNNF/2NEPYCeiXlM@fedora \
--to=ming.lei@redhat.com \
--cc=anuj20.g@samsung.com \
--cc=guazhang@redhat.com \
--cc=hch@lst.de \
--cc=joshi.k@samsung.com \
--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