From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Tian, Kevin" Subject: Re: [RFC PATCH V3 12/12] xen/vm_event: Check for VM_EVENT_FLAG_DUMMY only in Debug builds Date: Wed, 4 Feb 2015 05:59:52 +0000 Message-ID: References: <1422567998-29995-1-git-send-email-tamas.lengyel@zentific.com> <1422567998-29995-13-git-send-email-tamas.lengyel@zentific.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1422567998-29995-13-git-send-email-tamas.lengyel@zentific.com> Content-Language: en-US List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tamas K Lengyel , "xen-devel@lists.xen.org" Cc: "wei.liu2@citrix.com" , "ian.campbell@citrix.com" , "steve@zentific.com" , "stefano.stabellini@eu.citrix.com" , "Nakajima, Jun" , "tim@xen.org" , "ian.jackson@eu.citrix.com" , "Dong, Eddie" , "andres@lagarcavilla.org" , "jbeulich@suse.com" , "rshriram@cs.ubc.ca" , "keir@xen.org" , "dgdegra@tycho.nsa.gov" , "yanghy@cn.fujitsu.com" , "rcojocaru@bitdefender.com" List-Id: xen-devel@lists.xenproject.org > From: Tamas K Lengyel [mailto:tamas.lengyel@zentific.com] > Sent: Friday, January 30, 2015 5:47 AM > > The flag is only used for debugging purposes, thus it should be only checked > for in debug builds of Xen. > > Signed-off-by: Tamas K Lengyel > --- > xen/arch/x86/mm/mem_sharing.c | 2 ++ > xen/arch/x86/mm/p2m.c | 2 ++ > xen/common/mem_access.c | 31 > +++++++++++++++++++++++++++++++ > 3 files changed, 35 insertions(+) > > diff --git a/xen/arch/x86/mm/mem_sharing.c > b/xen/arch/x86/mm/mem_sharing.c > index c487207..303c2fb 100644 > --- a/xen/arch/x86/mm/mem_sharing.c > +++ b/xen/arch/x86/mm/mem_sharing.c > @@ -604,8 +604,10 @@ int mem_sharing_sharing_resume(struct domain *d) > if ( rsp.version != VM_EVENT_INTERFACE_VERSION ) > continue; > > +#ifndef NDEBUG > if ( rsp.flags & VM_EVENT_FLAG_DUMMY ) > continue; > +#endif > > /* Validate the vcpu_id in the response. */ > if ( (rsp.vcpu_id >= d->max_vcpus) || !d->vcpu[rsp.vcpu_id] ) > diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c > index 3b58700..1d91000 100644 > --- a/xen/arch/x86/mm/p2m.c > +++ b/xen/arch/x86/mm/p2m.c > @@ -1305,8 +1305,10 @@ void p2m_mem_paging_resume(struct domain *d) > if ( rsp.version != VM_EVENT_INTERFACE_VERSION ) > continue; > > +#ifndef NDEBUG > if ( rsp.flags & VM_EVENT_FLAG_DUMMY ) > continue; > +#endif > > /* Validate the vcpu_id in the response. */ > if ( (rsp.vcpu_id >= d->max_vcpus) || !d->vcpu[rsp.vcpu_id] ) > diff --git a/xen/common/mem_access.c b/xen/common/mem_access.c > index 3655165..e0a538f 100644 > --- a/xen/common/mem_access.c > +++ b/xen/common/mem_access.c > @@ -30,6 +30,37 @@ > #include > #include > > +void mem_access_resume(struct domain *d) so there is no caller of this new function? > +{ > + vm_event_response_t rsp; > + > + /* Pull all responses off the ring. */ > + while ( vm_event_get_response(d, &d->vm_event->monitor, &rsp) ) > + { > + struct vcpu *v; > + > + if ( rsp.version != VM_EVENT_INTERFACE_VERSION ) > + continue; > + > +#ifndef NDEBUG > + if ( rsp.flags & VM_EVENT_FLAG_DUMMY ) > + continue; > +#endif > + > + /* Validate the vcpu_id in the response. */ > + if ( (rsp.vcpu_id >= d->max_vcpus) || !d->vcpu[rsp.vcpu_id] ) > + continue; > + > + v = d->vcpu[rsp.vcpu_id]; > + > + p2m_vm_event_emulate_check(v, &rsp); > + > + /* Unpause domain. */ > + if ( rsp.flags & VM_EVENT_FLAG_VCPU_PAUSED ) > + vm_event_vcpu_unpause(v); > + } > +} > + > int mem_access_memop(unsigned long cmd, > > XEN_GUEST_HANDLE_PARAM(xen_mem_access_op_t) arg) > { > -- > 2.1.4