[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 3/4] VMX: Add posted interrupt supporting
Keir Fraser wrote on 2013-04-09: > On 09/04/2013 07:01, "Yang Zhang" <yang.z.zhang@xxxxxxxxx> wrote: > >> From: Yang Zhang <yang.z.zhang@xxxxxxxxx> >> >> Add the supporting of using posted interrupt to deliver interrupt. >> >> Signed-off-by: Yang Zhang <yang.z.zhang@xxxxxxxxx> >> Reviewed-by: Jun Nakajima <jun.nakajima@xxxxxxxxx> >> --- > > ... > >> +static void __vmx_deliver_posted_interrupt(struct vcpu *v) >> +{ >> + bool_t running; >> + >> + running = v->is_running; >> + vcpu_unblock(v); >> + if ( running && (in_irq() || (v != current)) ) >> + { >> + unsigned int cpu = v->processor; >> + >> + if ( !test_and_set_bit(VCPU_KICK_SOFTIRQ, &softirq_pending(cpu)) >> + && (cpu != smp_processor_id()) ) >> + send_IPI_mask(cpumask_of(cpu), > POSTED_INTERRUPT_VECTOR); > > I don't think you need to tickle VCPU_KICK_SOFTIRQ here? You aren't > synchronising with vmx_intr_assist() here, only notifying the processor > itself of pending virtual interrupts. All that requires is an IPI of > POSTED_INTERRUPT_VECTOR in some cases. > > I suggest: > if ( running ) > { > unsigned int cpu = v->processor; > if ( cpu != smp_processor_id() ) > send_IPI_mask(...); > } > That would just work, right? And avoids needing to duplicate some of the > trickier logic in vcpu_kick(). If posted interrupt arrived after vmx_intr_assit() and before vmentry, then the interrupt cannot be inject to guest in time. vmx_asm_do_vmentry: call vmx_intr_assist call nvmx_switch_guest ASSERT_NOT_IN_ATOMIC <---------if posted interrupt arrived here and we don't set softirq, then the interrupt will be delay until next vmentry. GET_CURRENT(%rbx) cli mov VCPU_processor(%rbx),%eax shl $IRQSTAT_shift,%eax lea irq_stat+IRQSTAT_softirq_pending(%rip),%rdx cmpl $0,(%rdx,%rax,1) jnz .Lvmx_process_softirqs Actually, the posted interrupt is same with a normal vcpu kick IPI, except that if cpu received it in non-root mode, it will not cause vmext. So we must follow the vcpu_kick logic. > > A code comment to say that this is a simplified form of vcpu_kick() is > probably worthwhile too. There are useful code comments in vcpu_kick() > regarding why things are ordered as they are. Best regards, Yang _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |