[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v7 15/17] vmx: VT-d posted-interrupt core logic handling
On 09/17/2015 01:40 PM, Dario Faggioli wrote: > On Thu, 2015-09-17 at 12:44 +0100, George Dunlap wrote: >> On 09/17/2015 10:38 AM, George Dunlap wrote: >>> Is it the case that the interrupt is not actually delivered to the >>> processor, but that the pending bit will be set in the pi field, so that >>> the interrupt will be delivered the next time the hypervisor returns >>> into the guest? >>> >>> (I am assuming that is the case, because if the hypervisor *does* get an >>> interrupt, then it can just unblock it there.) >> >> Actually, it looks like you *do* in fact get a >> pi_notification_interrupt() in this case. Could we to check to see if >> the current vcpu is blocked and unblock it? >> >> I haven't yet decided whether I prefer my original suggestion of >> switching the interrupt and putting things on the wake-up list in >> vcpu_block(), or of deferring adding things to the wake-up list until >> the actual context switch. >> > Sorry but I don't get what you mean with the latter. > > I particular, I don't think I understand what you mean with and how it > would work to "defer[ring] adding things to the wake-up list until > actual context switch"... In what case would you defer stuff to context > switch? So one option is to do the "blocking" stuff in an arch-specific call from vcpu_block(): vcpu_block() set(_VPF_blocked) v->arch.block() - Add v to pcpu.pi_blocked_vcpu - NV => pi_wakeup_vector local_events_need_delivery() hvm_vcpu_has_pending_irq() ... context_switch(): nothing The other is to do the "blocking" stuff in the context switch (similar to what's done now): vcpu_block() set(_VPF_blocked) local_events_need_delivery() hvm_vcpu_has_pending_irq() ... context_switch v->arch.block() - Add v to pcpu.pi_blocked_vcpu - NV => pi_wakeup_vector If we do it the first way, and an interrupt comes in before the context switch is finished, it will call pi_wakeup_vector, which will DTRT -- take v off the pi_blocked_vcpu list and call vcpu_unblock() (which in turn will set NV back to posted_intr_vector). If we do it the second way, and an interrupt comes in before the context switch is finished, it will call posted_intr_vector. We can, at that point, check to see if the current vcpu is marked as blocked. If it is, we can call vcpu_unblock() without having to modify NV or worry about adding / removing the vcpu from the pi_blocked_vcpu list. The thing I like about the first one is that it makes PI blocking the same as normal blocking -- everything happens in the same place; so the code is cleaner and easier to understand. The thing I like about the second one is that it cleverly avoids having to do all the work of adding the vcpu to the list and then searching to remove it if the vcpu in question gets woken up on the way to being blocked. So the code may end up being faster for workloads where that happens frequently. -George _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |