From: Tim Deegan Subject: Re: get_gfn_query() locking Date: Tue, 30 Oct 2012 09:36:26 +0000 Message-ID: <20121030093626.GB34613@ocelot.phlegethon.org> References: <508FAA9402000078000A5612@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <508FAA9402000078000A5612@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Andres Lagar-Cavilla , xen-devel List-Id: xen-devel@lists.xenproject.org At 09:23 +0000 on 30 Oct (1351588996), Jan Beulich wrote: > while looking at how "X86/vMCE: handle broken page occurred > before migration" uses the p2m code, I wondered whether the > comment > > * N.B. get_gfn_query() is the _only_ one guaranteed not to take the > * p2m lock; none of the others can be called with the p2m or paging > * lock held. */ > > isn't stale Yes, it seems to be stale. I think that even with the originally proposed fine-grained p2m locking it would have been possible for this to take the p2m lock. :( > - afaict with get_gfn_type_access() passing "1" for the > "locked" parameter of __get_gfn_type_access(), there's no way > to avoid the locking without using __get_gfn_type_access() > directly. get_gfn_query_unlocked() is the way to do lookups without the lock, but of course if you do that then you've no guarantee that the mfn it returns won't get freed under your feet. > And then again, with the p2m lock being recursive these > days, I don't think there's any harm calling the other methods > here with that lock held. True, but it wouldn't be safe to call it with the paging lock held. OTOH since we're not seeing any crashes from the lock-ordering constraints maybe we don't do that. Andres, what do you think? Can we just drop/amend that comment? Tim.