[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH for-4.9] x86/emul: Drop more redundant ctxt.event_pending checks
> -----Original Message----- > From: Andrew Cooper [mailto:andrew.cooper3@xxxxxxxxxx] > Sent: 10 April 2017 13:15 > To: Xen-devel <xen-devel@xxxxxxxxxxxxx> > Cc: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>; Jan Beulich > <JBeulich@xxxxxxxx>; Tim (Xen.org) <tim@xxxxxxx>; Paul Durrant > <Paul.Durrant@xxxxxxxxxx>; Jun Nakajima <jun.nakajima@xxxxxxxxx>; Kevin > Tian <kevin.tian@xxxxxxxxx>; Julien Grall <julien.grall@xxxxxxx> > Subject: [PATCH for-4.9] x86/emul: Drop more redundant > ctxt.event_pending checks > > Since c/s 92cf67888a, x86_emulate_wrapper() asserts stricter behaviour > about > the relationship between X86EMUL_EXCEPTION and ctxt.event_pending. > > These removals should have been included in the aforementioned > changeset, and > were only omitted due an oversight. > As long as suitable assertions are in place... Reviewed-by: Paul Durrant <paul.durrant@xxxxxxxxxx> > Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> > --- > CC: Jan Beulich <JBeulich@xxxxxxxx> > CC: Tim Deegan <tim@xxxxxxx> > CC: Paul Durrant <paul.durrant@xxxxxxxxxx> > CC: Jun Nakajima <jun.nakajima@xxxxxxxxx> > CC: Kevin Tian <kevin.tian@xxxxxxxxx> > CC: Julien Grall <julien.grall@xxxxxxx> > --- > xen/arch/x86/hvm/emulate.c | 6 ++---- > xen/arch/x86/hvm/hvm.c | 3 +-- > xen/arch/x86/hvm/io.c | 3 +-- > xen/arch/x86/hvm/vmx/realmode.c | 15 --------------- > xen/arch/x86/mm/shadow/multi.c | 2 +- > xen/arch/x86/traps.c | 9 --------- > 6 files changed, 5 insertions(+), 33 deletions(-) > > diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c > index 06b8f1b..91e269f 100644 > --- a/xen/arch/x86/hvm/emulate.c > +++ b/xen/arch/x86/hvm/emulate.c > @@ -2035,8 +2035,7 @@ int hvm_emulate_one_mmio(unsigned long mfn, > unsigned long gla) > hvm_dump_emulation_state(XENLOG_G_WARNING "MMCFG", &ctxt); > break; > case X86EMUL_EXCEPTION: > - if ( ctxt.ctxt.event_pending ) > - hvm_inject_event(&ctxt.ctxt.event); > + hvm_inject_event(&ctxt.ctxt.event); > /* fallthrough */ > default: > hvm_emulate_writeback(&ctxt); > @@ -2095,8 +2094,7 @@ void hvm_emulate_one_vm_event(enum > emul_kind kind, unsigned int trapnr, > hvm_inject_hw_exception(trapnr, errcode); > break; > case X86EMUL_EXCEPTION: > - if ( ctx.ctxt.event_pending ) > - hvm_inject_event(&ctx.ctxt.event); > + hvm_inject_event(&ctx.ctxt.event); > break; > } > > diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c > index f50d15f..9ffe702 100644 > --- a/xen/arch/x86/hvm/hvm.c > +++ b/xen/arch/x86/hvm/hvm.c > @@ -3696,8 +3696,7 @@ void hvm_ud_intercept(struct cpu_user_regs > *regs) > hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC); > break; > case X86EMUL_EXCEPTION: > - if ( ctxt.ctxt.event_pending ) > - hvm_inject_event(&ctxt.ctxt.event); > + hvm_inject_event(&ctxt.ctxt.event); > /* fall through */ > default: > hvm_emulate_writeback(&ctxt); > diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c > index 9e00409..67528d9 100644 > --- a/xen/arch/x86/hvm/io.c > +++ b/xen/arch/x86/hvm/io.c > @@ -100,8 +100,7 @@ bool > hvm_emulate_one_insn(hvm_emulate_validate_t *validate) > return false; > > case X86EMUL_EXCEPTION: > - if ( ctxt.ctxt.event_pending ) > - hvm_inject_event(&ctxt.ctxt.event); > + hvm_inject_event(&ctxt.ctxt.event); > break; > } > > diff --git a/xen/arch/x86/hvm/vmx/realmode.c > b/xen/arch/x86/hvm/vmx/realmode.c > index 7b908c7..4eb4232 100644 > --- a/xen/arch/x86/hvm/vmx/realmode.c > +++ b/xen/arch/x86/hvm/vmx/realmode.c > @@ -114,21 +114,6 @@ void vmx_realmode_emulate_one(struct > hvm_emulate_ctxt *hvmemul_ctxt) > > if ( rc == X86EMUL_EXCEPTION ) > { > - if ( !hvmemul_ctxt->ctxt.event_pending ) > - { > - unsigned long intr_info; > - > - __vmread(VM_ENTRY_INTR_INFO, &intr_info); > - __vmwrite(VM_ENTRY_INTR_INFO, 0); > - if ( !(intr_info & INTR_INFO_VALID_MASK) ) > - { > - gdprintk(XENLOG_ERR, "Exception pending but no info.\n"); > - goto fail; > - } > - hvmemul_ctxt->ctxt.event.vector = (uint8_t)intr_info; > - hvmemul_ctxt->ctxt.event.insn_len = 0; > - } > - > if ( unlikely(curr->domain->debugger_attached) && > ((hvmemul_ctxt->ctxt.event.vector == TRAP_debug) || > (hvmemul_ctxt->ctxt.event.vector == TRAP_int3)) ) > diff --git a/xen/arch/x86/mm/shadow/multi.c > b/xen/arch/x86/mm/shadow/multi.c > index 5195d61..2fb0125 100644 > --- a/xen/arch/x86/mm/shadow/multi.c > +++ b/xen/arch/x86/mm/shadow/multi.c > @@ -3457,7 +3457,7 @@ static int sh_page_fault(struct vcpu *v, > > r = x86_emulate(&emul_ctxt.ctxt, emul_ops); > > - if ( r == X86EMUL_EXCEPTION && emul_ctxt.ctxt.event_pending ) > + if ( r == X86EMUL_EXCEPTION ) > { > /* > * This emulation covers writes to shadow pagetables. We tolerate > #PF > diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c > index d69769f..ca0a04a 100644 > --- a/xen/arch/x86/traps.c > +++ b/xen/arch/x86/traps.c > @@ -3185,15 +3185,9 @@ static void emulate_gate_op(struct cpu_user_regs > *regs) > if ( IS_ERR_OR_NULL(state) ) > { > if ( PTR_ERR(state) == -X86EMUL_EXCEPTION ) > - { > - ASSERT(ctxt.ctxt.event_pending); > pv_inject_event(&ctxt.ctxt.event); > - } > else > - { > - ASSERT(!ctxt.ctxt.event_pending); > do_guest_trap(TRAP_gp_fault, regs); > - } > return; > } > > @@ -3234,13 +3228,10 @@ static void emulate_gate_op(struct > cpu_user_regs *regs) > > if ( rc == X86EMUL_EXCEPTION ) > { > - ASSERT(ctxt.ctxt.event_pending); > pv_inject_event(&ctxt.ctxt.event); > return; > } > > - ASSERT(!ctxt.ctxt.event_pending); > - > if ( rc != X86EMUL_OKAY || > jump < 0 || > (opnd_sel & ~3) != regs->error_code || > -- > 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |