xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Andre Przywara <andre.przywara@arm.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: Xen Linux deadlock
Date: Wed, 7 Jun 2017 17:51:58 +0200	[thread overview]
Message-ID: <029a288a-2e80-5eae-202c-9eb166055e87@suse.com> (raw)
In-Reply-To: <22b46162-435c-d971-5fa7-684c71950a62@arm.com>

On 07/06/17 17:05, Andre Przywara wrote:
> Hi,
> 
> when booting Linux 4.12-rc4 as Dom0 under a recent Xen HV I saw the
> following lockdep splat after running xencommons start:
> 
> root@junor1:~# bash /etc/init.d/xencommons start
> Setting domain 0 name, domid and JSON config...
> [  247.979498] ======================================================
> [  247.985688] WARNING: possible circular locking dependency detected
> [  247.991882] 4.12.0-rc4-00022-gc4b25c0 #575 Not tainted
> [  247.997040] ------------------------------------------------------
> [  248.003232] xenbus/91 is trying to acquire lock:
> [  248.007875]  (&u->msgbuffer_mutex){+.+.+.}, at: [<ffff00000863e904>]
> xenbus_dev_queue_reply+0x3c/0x230
> [  248.017163]
> [  248.017163] but task is already holding lock:
> [  248.023096]  (xb_write_mutex){+.+...}, at: [<ffff00000863a940>]
> xenbus_thread+0x5f0/0x798
> [  248.031267]
> [  248.031267] which lock already depends on the new lock.
> [  248.031267]
> [  248.039615]
> [  248.039615] the existing dependency chain (in reverse order) is:
> [  248.047176]
> [  248.047176] -> #1 (xb_write_mutex){+.+...}:
> [  248.052943]        __lock_acquire+0x1728/0x1778
> [  248.057498]        lock_acquire+0xc4/0x288
> [  248.061630]        __mutex_lock+0x84/0x868
> [  248.065755]        mutex_lock_nested+0x3c/0x50
> [  248.070227]        xs_send+0x164/0x1f8
> [  248.074015]        xenbus_dev_request_and_reply+0x6c/0x88
> [  248.079427]        xenbus_file_write+0x260/0x420
> [  248.084073]        __vfs_write+0x48/0x138
> [  248.088113]        vfs_write+0xa8/0x1b8
> [  248.091983]        SyS_write+0x54/0xb0
> [  248.095768]        el0_svc_naked+0x24/0x28
> [  248.099897]
> [  248.099897] -> #0 (&u->msgbuffer_mutex){+.+.+.}:
> [  248.106088]        print_circular_bug+0x80/0x2e0
> [  248.110730]        __lock_acquire+0x1768/0x1778
> [  248.115288]        lock_acquire+0xc4/0x288
> [  248.119417]        __mutex_lock+0x84/0x868
> [  248.123545]        mutex_lock_nested+0x3c/0x50
> [  248.128016]        xenbus_dev_queue_reply+0x3c/0x230
> [  248.133005]        xenbus_thread+0x788/0x798
> [  248.137306]        kthread+0x110/0x140
> [  248.141087]        ret_from_fork+0x10/0x40
> [  248.145214]
> [  248.145214] other info that might help us debug this:
> [  248.145214]
> [  248.153383]  Possible unsafe locking scenario:
> [  248.153383]
> [  248.159403]        CPU0                    CPU1
> [  248.163960]        ----                    ----
> [  248.168518]   lock(xb_write_mutex);
> [  248.172045]                                lock(&u->msgbuffer_mutex);
> [  248.178500]                                lock(xb_write_mutex);
> [  248.184514]   lock(&u->msgbuffer_mutex);
> [  248.188470]
> [  248.188470]  *** DEADLOCK ***
> [  248.188470]
> [  248.194578] 2 locks held by xenbus/91:
> [  248.198360]  #0:  (xs_response_mutex){+.+...}, at:
> [<ffff00000863a7b0>] xenbus_thread+0x460/0x798
> [  248.207218]  #1:  (xb_write_mutex){+.+...}, at: [<ffff00000863a940>]
> xenbus_thread+0x5f0/0x798
> [  248.215818]
> [  248.215818] stack backtrace:
> [  248.220293] CPU: 0 PID: 91 Comm: xenbus Not tainted
> 4.12.0-rc4-00022-gc4b25c0 #575
> [  248.227858] Hardware name: ARM Juno development board (r1) (DT)
> [  248.233792] Call trace:
> [  248.236289] [<ffff00000808a748>] dump_backtrace+0x0/0x270
> [  248.241707] [<ffff00000808aa94>] show_stack+0x24/0x30
> [  248.246782] [<ffff0000084caa98>] dump_stack+0xb8/0xf0
> [  248.251859] [<ffff000008139068>] print_circular_bug+0x1f8/0x2e0
> [  248.257787] [<ffff00000813c090>] __lock_acquire+0x1768/0x1778
> [  248.263548] [<ffff00000813c90c>] lock_acquire+0xc4/0x288
> [  248.268882] [<ffff000008bdb28c>] __mutex_lock+0x84/0x868
> [  248.274219] [<ffff000008bdbaac>] mutex_lock_nested+0x3c/0x50
> [  248.279889] [<ffff00000863e904>] xenbus_dev_queue_reply+0x3c/0x230
> [  248.286081] [<ffff00000863aad8>] xenbus_thread+0x788/0x798
> [  248.291585] [<ffff000008108070>] kthread+0x110/0x140
> [  248.296572] [<ffff000008083710>] ret_from_fork+0x10/0x40
> 
> Apparently it's not easily reproducible, but Julien confirmed that the
> dead lock condition as reported above is indeed in the Linux code.
> 
> Does anyone has an idea of how to fix this?

Shouldn't be too hard. The xb_write_mutex can be dropped earlier in the
critical path. I'll send a patch.


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

      reply	other threads:[~2017-06-07 15:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-07 15:05 Xen Linux deadlock Andre Przywara
2017-06-07 15:51 ` Juergen Gross [this message]

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=029a288a-2e80-5eae-202c-9eb166055e87@suse.com \
    --to=jgross@suse.com \
    --cc=andre.przywara@arm.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=julien.grall@arm.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;
as well as URLs for NNTP newsgroup(s).