From: "Jan Beulich" Subject: Re: [PATCH RFC V7 4/5] xen, libxc: Request page fault injection via libxc Date: Tue, 26 Aug 2014 15:13:26 +0100 Message-ID: <53FCB226020000780002DA7B@mail.emea.novell.com> References: <1407943689-9249-1-git-send-email-rcojocaru@bitdefender.com> <1407943689-9249-4-git-send-email-rcojocaru@bitdefender.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1407943689-9249-4-git-send-email-rcojocaru@bitdefender.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: Razvan Cojocaru Cc: kevin.tian@intel.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, eddie.dong@intel.com, xen-devel@lists.xen.org, jun.nakajima@intel.com, ian.jackson@eu.citrix.com List-Id: xen-devel@lists.xenproject.org >>> On 13.08.14 at 17:28, wrote: > +static bool_t vmx_check_pf_injection(void) > +{ > + struct vcpu *curr = current; > + const struct domain *currd = curr->domain; > + struct segment_register seg; > + unsigned long ev; > + uint32_t pending_event = 0; > + uint64_t mask; > + > + if ( !is_hvm_domain(currd) || > + likely(!currd->arch.hvm_domain.fault_info.valid) ) > + return 0; > + > + vmx_get_segment_register(curr, x86_seg_ss, &seg); > + > + if ( seg.attr.fields.dpl != 3 ) /* Guest is not in user mode */ > + return 0; > + > + if ( hvm_long_mode_enabled(curr) ) > + mask = (PADDR_MASK & PAGE_MASK); /* Bits 51:12. */ Pointless parentheses. > + case XEN_DOMCTL_set_pagefault_info: > + { > + ret = -EINVAL; > + > + if ( is_hvm_domain(d) ) > + { > + d->arch.hvm_domain.fault_info.address_space = > + op->u.set_pagefault_info.address_space; > + d->arch.hvm_domain.fault_info.virtual_address = > + op->u.set_pagefault_info.virtual_address; > + d->arch.hvm_domain.fault_info.errcode = > + op->u.set_pagefault_info.errcode; > + d->arch.hvm_domain.fault_info.valid = 1; > + > + ret = 0; > + } > + } Pointless curly braces. > --- a/xen/include/asm-x86/hvm/domain.h > +++ b/xen/include/asm-x86/hvm/domain.h > @@ -141,6 +141,14 @@ struct hvm_domain { > */ > uint64_t sync_tsc; > > + /* Memory introspection page fault injection data. */ > + struct { > + uint64_t address_space; > + uint64_t virtual_address; > + uint32_t errcode; > + bool_t valid; > + } fault_info; Sorry for noticing this only now, but how can this be a per-domain thing rather than a per-vCPU one? Jan