From: "Jan Beulich" Subject: Re: [PATCH] Avoid premature update of M2P in set_typed_p2m_entry Date: Fri, 06 Jun 2014 08:55:18 +0100 Message-ID: <5391900602000078000188F6@mail.emea.novell.com> References: <1402008904-22944-1-git-send-email-mukesh.rathor@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Wsozg-0007wX-5c for xen-devel@lists.xenproject.org; Fri, 06 Jun 2014 07:55:20 +0000 In-Reply-To: <1402008904-22944-1-git-send-email-mukesh.rathor@oracle.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Mukesh Rathor , Tim Deegan Cc: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org >>> On 06.06.14 at 00:55, wrote: > @@ -832,6 +827,11 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn, mfn_t mfn, > gdprintk(XENLOG_ERR, > "p2m_set_entry failed! mfn=%08lx rc:%d\n", > mfn_x(get_gfn_query_unlocked(p2m->domain, gfn, &ot)), rc); > + else if ( p2m_is_ram(ot) ) > + { > + ASSERT(mfn_valid(omfn)); > + set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY); > + } The only possible concern here is that all other code paths in p2m.c do the M2P updates under lock. Tim - is that a requirement (formally the M2P isn't really considered serialized by P2M locking I think)? Yet then again, even if it isn't, the placement here might sooner or later result in a Coverity warning (recognizing that all other paths do the update with a lock held)... Jan