From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: xen-devel@lists.xenproject.org, linux-block@vger.kernel.org,
"Boris Ostrovsky" <boris.ostrovsky@oracle.com>,
"Juergen Gross" <jgross@suse.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Christoph Hellwig" <hch@lst.de>
Subject: Re: [BUG report] Deadlock in xen-blkfront upon device hot-unplug
Date: Thu, 15 Jul 2021 15:17:37 +0200 [thread overview]
Message-ID: <87k0lr1zta.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20210715124622.GA32693@lst.de>
Christoph Hellwig <hch@lst.de> writes:
> On Thu, Jul 15, 2021 at 11:16:30AM +0200, Vitaly Kuznetsov wrote:
>> I'm observing a deadlock every time I try to unplug a xen-blkfront
>> device. With 5.14-rc1+ the deadlock looks like:
>
> I did actually stumble over this a few days ago just from code
> inspection. Below is what I come up with, can you give it a spin?
This eliminates the deadlock, thanks! Unfortunately, this reveals the
same issue I observed when I just dropped taking the mutex from
blkfront_closing():
[ 66.455122] general protection fault, probably for non-canonical address 0xf1af5e354e6da159: 0000 [#1] SMP PTI
[ 66.462802] CPU: 4 PID: 145 Comm: xenwatch Not tainted 5.14.0-rc1+ #370
[ 66.467486] Hardware name: Xen HVM domU, BIOS 4.2.amazon 08/24/2006
[ 66.472817] RIP: 0010:del_timer+0x1f/0x80
[ 66.476570] Code: 71 af a3 00 eb c1 31 c0 c3 66 90 0f 1f 44 00 00 41 55 41 54 45 31 e4 55 48 83 ec 10 65 48 8b 04 25 28 00 00 00 48 89 44 24 08 <48> 8b 47 08 48 85 c0 74 2d 48 89 e6 48 89 fd e8 dd e8 ff ff 48 89
[ 66.493967] RSP: 0018:ffffb5c10426bcd8 EFLAGS: 00010086
[ 66.499416] RAX: a49b3c9544841100 RBX: f1af5e354e6da101 RCX: 0000000000005ebf
[ 66.506386] RDX: 0000000000005ec0 RSI: 0000000000000001 RDI: f1af5e354e6da151
[ 66.512799] RBP: ffffb5c10426bd30 R08: 0000000000000001 R09: 0000000000000001
[ 66.518372] R10: 0000000000000001 R11: 0000000000000002 R12: 0000000000000000
[ 66.523681] R13: ffff9aba8df63e40 R14: 0000000000000000 R15: ffff9aba86f40000
[ 66.529365] FS: 0000000000000000(0000) GS:ffff9af609200000(0000) knlGS:0000000000000000
[ 66.536187] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 66.540806] CR2: 00007ff024600130 CR3: 000000010117a006 CR4: 00000000001706e0
[ 66.546345] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 66.552322] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 66.558501] Call Trace:
[ 66.561449] try_to_grab_pending+0x13f/0x2e0
[ 66.565658] cancel_delayed_work+0x2e/0xd0
[ 66.570012] blk_mq_stop_hw_queues+0x2d/0x50
[ 66.574110] blkfront_remove+0x30/0x130 [xen_blkfront]
[ 66.579049] xenbus_dev_remove+0x6d/0xf0
[ 66.582473] __device_release_driver+0x180/0x240
[ 66.586963] device_release_driver+0x26/0x40
[ 66.591050] bus_remove_device+0xef/0x160
[ 66.594805] device_del+0x18c/0x3e0
[ 66.598570] ? xenbus_probe_devices+0x120/0x120
[ 66.602987] ? klist_iter_exit+0x14/0x20
[ 66.606915] device_unregister+0x13/0x60
[ 66.611135] xenbus_dev_changed+0x174/0x1e0
[ 66.615104] xenwatch_thread+0x94/0x190
[ 66.619028] ? do_wait_intr_irq+0xb0/0xb0
[ 66.623052] ? xenbus_dev_request_and_reply+0x90/0x90
[ 66.628218] kthread+0x149/0x170
[ 66.631509] ? set_kthread_struct+0x40/0x40
[ 66.635355] ret_from_fork+0x22/0x30
[ 66.639162] Modules linked in: vfat fat i2c_piix4 xfs libcrc32c crct10dif_pclmul crc32_pclmul crc32c_intel xen_blkfront ghash_clmulni_intel ena
[ 66.650868] ---[ end trace 7fa9da1e39697767 ]---
[ 66.655490] RIP: 0010:del_timer+0x1f/0x80
[ 66.659813] Code: 71 af a3 00 eb c1 31 c0 c3 66 90 0f 1f 44 00 00 41 55 41 54 45 31 e4 55 48 83 ec 10 65 48 8b 04 25 28 00 00 00 48 89 44 24 08 <48> 8b 47 08 48 85 c0 74 2d 48 89 e6 48 89 fd e8 dd e8 ff ff 48 89
[ 66.681045] RSP: 0018:ffffb5c10426bcd8 EFLAGS: 00010086
[ 66.685888] RAX: a49b3c9544841100 RBX: f1af5e354e6da101 RCX: 0000000000005ebf
[ 66.692153] RDX: 0000000000005ec0 RSI: 0000000000000001 RDI: f1af5e354e6da151
[ 66.698778] RBP: ffffb5c10426bd30 R08: 0000000000000001 R09: 0000000000000001
[ 66.705175] R10: 0000000000000001 R11: 0000000000000002 R12: 0000000000000000
[ 66.711696] R13: ffff9aba8df63e40 R14: 0000000000000000 R15: ffff9aba86f40000
[ 66.718035] FS: 0000000000000000(0000) GS:ffff9af609200000(0000) knlGS:0000000000000000
[ 66.725210] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 66.730291] CR2: 00007ff024600130 CR3: 000000010117a006 CR4: 00000000001706e0
[ 66.736235] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 66.742373] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 66.749026] BUG: sleeping function called from invalid context at include/linux/percpu-rwsem.h:49
[ 66.756118] in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 145, name: xenwatch
[ 66.763473] INFO: lockdep is turned off.
[ 66.767428] irq event stamp: 24256
[ 66.770900] hardirqs last enabled at (24255): [<ffffffff90c32aeb>] _raw_spin_unlock_irqrestore+0x4b/0x5d
[ 66.779620] hardirqs last disabled at (24256): [<ffffffff900fe21c>] try_to_grab_pending+0x15c/0x2e0
[ 66.787763] softirqs last enabled at (24196): [<ffffffff900e0b11>] __irq_exit_rcu+0xe1/0x100
[ 66.794519] softirqs last disabled at (24191): [<ffffffff900e0b11>] __irq_exit_rcu+0xe1/0x100
[ 66.801953] CPU: 4 PID: 145 Comm: xenwatch Tainted: G D 5.14.0-rc1+ #370
[ 66.809315] Hardware name: Xen HVM domU, BIOS 4.2.amazon 08/24/2006
[ 66.814924] Call Trace:
[ 66.817461] dump_stack_lvl+0x6a/0x9a
[ 66.821171] ___might_sleep.cold+0xb6/0xc6
[ 66.825436] exit_signals+0x1c/0x2d0
[ 66.829328] do_exit+0xc7/0xbb0
[ 66.832364] ? kthread+0x149/0x170
[ 66.835039] rewind_stack_do_exit+0x17/0x20
[ 66.838710] RIP: 0000:0x0
[ 66.841671] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
[ 66.847271] RSP: 0000:0000000000000000 EFLAGS: 00000000 ORIG_RAX: 0000000000000000
[ 66.854271] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
[ 66.860672] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[ 66.866687] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
[ 66.872966] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
[ 66.878410] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
--
Vitaly
next prev parent reply other threads:[~2021-07-15 13:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-15 9:16 [BUG report] Deadlock in xen-blkfront upon device hot-unplug Vitaly Kuznetsov
2021-07-15 12:46 ` Christoph Hellwig
2021-07-15 13:17 ` Vitaly Kuznetsov [this message]
2021-07-15 13:46 ` Christoph Hellwig
2021-07-15 14:09 ` Vitaly Kuznetsov
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=87k0lr1zta.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=boris.ostrovsky@oracle.com \
--cc=hch@lst.de \
--cc=jgross@suse.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-block@vger.kernel.org \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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