Jui-Hao Chiang
2010-Dec-23 00:45 UTC
[Xen-devel] {PATCH] Add p2m_lock in set_shared_p2m_entry
Without the lock, set_shared_p2m_entry() will BUG when xen is compiled with debug=y Singed-off-by: Jui-Hao Chiang <juihaochiang <at> gmail.com> --- a/xen/arch/x86/mm/p2m.c Tue Dec 21 18:10:46 2010 +0000 +++ b/xen/arch/x86/mm/p2m.c Thu Dec 23 16:40:41 2010 +0800 @@ -2665,7 +2665,9 @@ set_shared_p2m_entry(struct p2m_domain * set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY); P2M_DEBUG("set shared %lx %lx\n", gfn, mfn_x(mfn)); + p2m_lock(p2m); rc = set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_shared); + p2m_unlock(p2m); if ( 0 == rc ) gdprintk(XENLOG_ERR, "set_mmio_p2m_entry: set_p2m_entry failed! mfn=%08lx\n" _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Tim Deegan
2011-Jan-04 11:23 UTC
Re: [Xen-devel] {PATCH] Add p2m_lock in set_shared_p2m_entry
At 00:45 +0000 on 23 Dec (1293065108), Jui-Hao Chiang wrote:> Without the lock, set_shared_p2m_entry() will BUG when xen is compiled with debug=yThanks. I''ll have to make a slightly more complex fix, as set_shared_p2m_entry() can be called (via p2m_teardown() and mem_sharing_unshare_page()) with the p2m lock already held. :( That''s a sign of a deeper illness which will probably lead to deadlocks elsewhere. I intend to give the MM locking (p2m, shadow, hap, log-dirty and page-sharing locks) a good kicking some time soon, maybe after 4.1 is released. Cheers, Tim.> Singed-off-by: Jui-Hao Chiang <juihaochiang <at> gmail.com<http://gmail.com>> > > --- a/xen/arch/x86/mm/p2m.c Tue Dec 21 18:10:46 2010 +0000 > +++ b/xen/arch/x86/mm/p2m.c Thu Dec 23 16:40:41 2010 +0800 > @@ -2665,7 +2665,9 @@ set_shared_p2m_entry(struct p2m_domain * > set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY); > > P2M_DEBUG("set shared %lx %lx\n", gfn, mfn_x(mfn)); > + p2m_lock(p2m); > rc = set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_shared); > + p2m_unlock(p2m); > if ( 0 == rc ) > gdprintk(XENLOG_ERR, > "set_mmio_p2m_entry: set_p2m_entry failed! mfn=%08lx\n"> _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel-- Tim Deegan <Tim.Deegan@citrix.com> Principal Software Engineer, Xen Platform Team Citrix Systems UK Ltd. (Company #02937203, SL9 0BG) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jui-Hao Chiang
2011-Jan-06 14:52 UTC
Re: [Xen-devel] {PATCH] Add p2m_lock in set_shared_p2m_entry
Hi, Tim Thanks. I''ll have to make a slightly more complex fix, as> set_shared_p2m_entry() can be called (via p2m_teardown() and > mem_sharing_unshare_page()) with the p2m lock already held. :( > >Actually our original problem is the mem_sharing_share_pages() doesn''t hold the p2m lock when calling set_shared_p2m_entry(), which causes the share operation to die.> That''s a sign of a deeper illness which will probably lead to deadlocks > elsewhere. I intend to give the MM locking (p2m, shadow, hap, log-dirty > and page-sharing locks) a good kicking some time soon, maybe after 4.1 > is released. > >Just saw your patch http://xenbits.xensource.com/xen-unstable.hg?rev/a8d69de8eb31. Thanks, Jui-Hao _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel