[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 25/34] x86/mm/shadow: make it build with !CONFIG_HVM



On Tue, Aug 21, 2018 at 10:29:21AM +0200, Roger Pau Monné wrote:
> On Fri, Aug 17, 2018 at 04:12:43PM +0100, Wei Liu wrote:
> > Enclose HVM only emulation code under CONFIG_HVM. Add some BUG()s to
> > to catch any issue.
> > 
> > Note that although some code checks is_hvm_*, which hints it can be
> > called for PV as well, I can't find such paths.
> > 
> > Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
> > ---
> >  xen/arch/x86/mm/shadow/common.c | 18 ++++++++++++++++--
> >  xen/arch/x86/mm/shadow/multi.c  | 27 +++++++++++++++++++++------
> >  2 files changed, 37 insertions(+), 8 deletions(-)
> > 
> > diff --git a/xen/arch/x86/mm/shadow/common.c 
> > b/xen/arch/x86/mm/shadow/common.c
> > index 0856650..4381538 100644
> > --- a/xen/arch/x86/mm/shadow/common.c
> > +++ b/xen/arch/x86/mm/shadow/common.c
> > @@ -113,6 +113,7 @@ __initcall(shadow_audit_key_init);
> >  #endif /* SHADOW_AUDIT */
> >  
> >  
> > +#if CONFIG_HVM
> >  
> > /**************************************************************************/
> >  /* x86 emulator support for the shadow code
> >   */
> > @@ -380,11 +381,13 @@ static const struct x86_emulate_ops 
> > hvm_shadow_emulator_ops = {
> >      .cmpxchg    = hvm_emulate_cmpxchg,
> >      .cpuid      = hvmemul_cpuid,
> >  };
> > +#endif
> >  
> >  const struct x86_emulate_ops *shadow_init_emulation(
> >      struct sh_emulate_ctxt *sh_ctxt, struct cpu_user_regs *regs,
> >      unsigned int pte_size)
> >  {
> > +#if CONFIG_HVM
> >      struct segment_register *creg, *sreg;
> >      struct vcpu *v = current;
> >      unsigned long addr;
> > @@ -423,6 +426,10 @@ const struct x86_emulate_ops *shadow_init_emulation(
> >          ? sizeof(sh_ctxt->insn_buf) : 0;
> >  
> >      return &hvm_shadow_emulator_ops;
> > +#else
> > +    BUG();
> 
> I would usually use ASSERT_UNREACHABLE in such situations.
> 
> And here I wonder whether this cannot be called from a PV path,
> AFAICT:
> 
> do_page_fault -> fixup_page_fault -> paging_fault -> page_fault
> (sh_page_fault) -> shadow_init_emulation
> 
> But maybe there are other conditions that make this path actually
> unreachable (or maybe something in your series changed this path).

It can't / shouldn't be reached from PV. See Jan's replies.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.