From: "Andres Lagar-Cavilla" <andres@lagarcavilla.org>
To: "Hao, Xudong" <xudong.hao@intel.com>
Cc: Keir Fraser <keir@xen.org>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
Tim Deegan <tim@xen.org>, "JBeulich@suse.com" <jbeulich@suse.com>,
"Zhang, Xiantao" <xiantao.zhang@intel.com>
Subject: Re: Deadlocks by p2m_lock and event_lock
Date: Tue, 13 Mar 2012 08:27:19 -0700 [thread overview]
Message-ID: <b21d1229b3492b8026e40151a231fc13.squirrel@webmail.lagarcavilla.org> (raw)
In-Reply-To: <403610A45A2B5242BD291EDAE8B37D300FCE7398@SHSMSX102.ccr.corp.intel.com>
> Hi, Tim and Andres
> The patch fix part of this issue. In handle_mmio, function hvmemul_do_io()
> is called and p2m lock was held again by calling get_gfn_unshare(), still
> trigger a deadlocks.
>
> (XEN) Xen call trace:
> (XEN) [<ffff82c4801261a3>] _spin_lock+0x1b/0xa8
> (XEN) [<ffff82c4801070d3>] notify_via_xen_event_channel+0x21/0x106
> (XEN) [<ffff82c4801b6883>] hvm_buffered_io_send+0x1f1/0x21b
> (XEN) [<ffff82c4801bbd3a>] stdvga_intercept_mmio+0x491/0x4c7
> (XEN) [<ffff82c4801b5d58>] hvm_io_intercept+0x218/0x244
> (XEN) [<ffff82c4801aa931>] hvmemul_do_io+0x55a/0x716
> (XEN) [<ffff82c4801aab1a>] hvmemul_do_mmio+0x2d/0x2f
> (XEN) [<ffff82c4801ab239>] hvmemul_write+0x181/0x1a2
> (XEN) [<ffff82c4801963f0>] x86_emulate+0xcad3/0xfbdf
> (XEN) [<ffff82c4801a9d2e>] hvm_emulate_one+0x120/0x1af
> (XEN) [<ffff82c4801b63cb>] handle_mmio+0x4e/0x1d1
> (XEN) [<ffff82c4801afd72>] hvm_hap_nested_page_fault+0x210/0x37f
> (XEN) [<ffff82c4801d2419>] vmx_vmexit_handler+0x1523/0x17d0
>
> Thanks,
Thanks for the report, very useful. I'll look into it
Andres
> -Xudong
>
>> -----Original Message-----
>> From: Tim Deegan [mailto:tim@xen.org]
>> Sent: Saturday, March 10, 2012 12:56 AM
>> To: Andres Lagar-Cavilla
>> Cc: Hao, Xudong; Keir Fraser; xen-devel@lists.xensource.com; Zhang,
>> Xiantao;
>> JBeulich@suse.com
>> Subject: Re: [Xen-devel] Deadlocks by p2m_lock and event_lock
>>
>> At 08:29 -0800 on 09 Mar (1331281767), Andres Lagar-Cavilla wrote:
>> > >> I don't know about the event lock, but it seems unwise to call in
>> > >> to handle_mmio with a gfn lock held. How about fixing the other
>> path?
>> > >>
>> > >> diff -r 04673ecb9d78 xen/arch/x86/hvm/hvm.c
>> > >> --- a/xen/arch/x86/hvm/hvm.c Thu Mar 08 16:40:05 2012 +0000
>> > >> +++ b/xen/arch/x86/hvm/hvm.c Fri Mar 09 11:15:25 2012 +0000
>> > >> @@ -1324,10 +1324,11 @@ int hvm_hap_nested_page_fault(unsigned l
>> > >> if ( (p2mt == p2m_mmio_dm) ||
>> > >> (access_w && (p2mt == p2m_ram_ro)) )
>> > >> {
>> > >> + put_gfn(p2m->domain, gfn);
>> > >> if ( !handle_mmio() )
>> > >> hvm_inject_exception(TRAP_gp_fault, 0, 0);
>> > >> rc = 1;
>> > >> - goto out_put_gfn;
>> > >> + goto out;
>> > >> }
>> > >>
>> > >> #ifdef __x86_64__
>> > >> @@ -1379,6 +1380,7 @@ int hvm_hap_nested_page_fault(unsigned l
>> > >>
>> > >> out_put_gfn:
>> > >> put_gfn(p2m->domain, gfn);
>> > >> +out:
>> > >> if ( paged )
>> > >> p2m_mem_paging_populate(v->domain, gfn);
>> > >> if ( req_ptr )
>> > >
>> > > Yes, that's fine to release the p2m lock earlier than handle_mmio.
>> >
>> > Ack
>>
>> OK, applied.
>>
>> Tim.
>
next prev parent reply other threads:[~2012-03-13 15:27 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-09 10:58 Deadlocks by p2m_lock and event_lock Hao, Xudong
2012-03-09 11:20 ` Tim Deegan
2012-03-09 11:44 ` Hao, Xudong
2012-03-09 16:29 ` Andres Lagar-Cavilla
2012-03-09 16:55 ` Tim Deegan
2012-03-13 7:51 ` Hao, Xudong
2012-03-13 15:27 ` Andres Lagar-Cavilla [this message]
2012-03-13 18:26 ` Andres Lagar-Cavilla
2012-03-14 9:20 ` Jan Beulich
2012-03-14 14:18 ` Andres Lagar-Cavilla
2012-03-13 18:45 ` Andres Lagar-Cavilla
2012-03-14 7:12 ` Hao, Xudong
2012-03-14 8:28 ` Zhang, Yang Z
2012-03-14 14:20 ` Andres Lagar-Cavilla
2012-03-14 15:10 ` Andres Lagar-Cavilla
2012-03-15 2:19 ` Hao, Xudong
2012-03-15 3:37 ` Andres Lagar-Cavilla
2012-03-15 10:44 ` Tim Deegan
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=b21d1229b3492b8026e40151a231fc13.squirrel@webmail.lagarcavilla.org \
--to=andres@lagarcavilla.org \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=tim@xen.org \
--cc=xen-devel@lists.xensource.com \
--cc=xiantao.zhang@intel.com \
--cc=xudong.hao@intel.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 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).