From: "Jan Beulich" Subject: Re: [V12 PATCH 3/4] pvh dom0: Add and remove foreign pages Date: Thu, 15 May 2014 09:02:00 +0100 Message-ID: <5374909802000078000126CD@mail.emea.novell.com> References: <1399683043-29112-1-git-send-email-mukesh.rathor@oracle.com> <1399683043-29112-4-git-send-email-mukesh.rathor@oracle.com> <5370BFC60200007800011554@mail.emea.novell.com> <20140512180238.328745d9@mantra.us.oracle.com> <5371E1560200007800011AA2@mail.emea.novell.com> <20140513175559.635cea57@mantra.us.oracle.com> <5373305C0200007800011FEB@mail.emea.novell.com> <20140514185917.6c185e9b@mantra.us.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 1Wkqc7-00013e-MN for xen-devel@lists.xenproject.org; Thu, 15 May 2014 08:02:03 +0000 In-Reply-To: <20140514185917.6c185e9b@mantra.us.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 Cc: George.Dunlap@eu.citrix.com, tim@xen.org, eddie.dong@intel.com, keir.xen@gmail.com, jun.nakajima@intel.com, xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org >>> On 15.05.14 at 03:59, wrote: > Code wise several options, but seems mem_event.c would be the best > place to put checks (would ENOSYS be more appropriate?): I'd prefer -EOPNOTSUPP as you did. > +++ b/xen/arch/x86/mm/mem_event.c > @@ -538,6 +538,13 @@ int mem_event_domctl(struct domain *d, xen_domctl_mem_event > case XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE: > { > struct p2m_domain *p2m = p2m_get_hostp2m(d); > + struct domain *hwdom = rcu_lock_domain_by_id(hardware_domid); > + > + rcu_unlock_domain(hwdom); Why not simply look at hardware_domain? But I think that's wrong anyway, and you want to look at current->domain instead. And even that would still assume that a guest controlled by other than Dom0 would only ever have operations like this carried out by its controlling domain - i.e. perhaps you need to check both. > BTW, how come you let these get away without "fixme" tags :).. : > > /* Only HAP is supported */ > if ( !hap_enabled(d) ) > break; > > /* Currently only EPT is supported */ > if ( !cpu_has_vmx ) I don't think I was involved in the addition of these features. Jan