From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [RFC v1 12/15] vmx: Properly handle notification event when vCPU is running Date: Thu, 2 Apr 2015 15:15:13 -0400 Message-ID: <20150402191512.GG3131@x230.dumpdata.com> References: <1427286717-4093-1-git-send-email-feng.wu@intel.com> <1427286717-4093-13-git-send-email-feng.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "Tian, Kevin" Cc: "Zhang, Yang Z" , "keir@xen.org" , "Wu, Feng" , "JBeulich@suse.com" , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Thu, Apr 02, 2015 at 06:08:12AM +0000, Tian, Kevin wrote: > > From: Wu, Feng > > Sent: Friday, March 27, 2015 12:58 PM > > > > > > > > > -----Original Message----- > > > From: Zhang, Yang Z > > > Sent: Friday, March 27, 2015 12:44 PM > > > To: Wu, Feng; xen-devel@lists.xen.org > > > Cc: JBeulich@suse.com; keir@xen.org; Tian, Kevin > > > Subject: RE: [RFC v1 12/15] vmx: Properly handle notification event when > > vCPU > > > is running > > > > > > Wu, Feng wrote on 2015-03-27: > > > > > > > > > > > > Zhang, Yang Z wrote on 2015-03-25: > > > >> when vCPU is running > > > >> > > > >> Wu, Feng wrote on 2015-03-25: > > > >>> When a vCPU is running in Root mode and a notification event has > > > >>> been injected to it. we need to set VCPU_KICK_SOFTIRQ for the > > > >>> current cpu, so the pending interrupt in PIRR will be synced to > > > >>> vIRR before This would imply that we had VMEXIT-ed due to pending interrupt? And we end up calling 'do_IRQ'? If so then the DPCI_SOFTIRQ ends up being set and you stll end up calling the softirq code? > > > > VM-Exit in time. > > > >> > > > >> Shouldn't the pending interrupt be synced unconditionally before next > > > >> vmentry? What happens if we didn't set the softirq? > > > > > > > > If we didn't set the softirq in the notification handler, the > > > > interrupts happened exactly before VM-entry cannot be delivered to > > > > guest at this time. Please see the following code fragments from > > > > xen/arch/x86/hvm/vmx/entry.S: (pls pay attention to the comments) > > > > > > > > .Lvmx_do_vmentry > > > > > > > > ...... > > > > /* If Vt-d engine issues a notification event here, > > > > * it cannot be delivered to guest during this VM-entry > > > > * without raising the softirq in notification handler. */ > > > > cmp %ecx,(%rdx,%rax,1) > > > > jnz .Lvmx_process_softirqs > > > > ...... > > > > > > > > je .Lvmx_launch > > > > ...... > > > > > > > > > > > > .Lvmx_process_softirqs: > > > > sti > > > > call do_softirq > > > > jmp .Lvmx_do_vmentry > > > > > > You are right! This helps me to recall why raise the softirq when delivering > > the > > > PI. > > > > Yes, __vmx_deliver_posted_interrupt() is the software way to deliver PI, it sets > > the > > softirq for this purpose, however, when VT-d HW delivers PI, we have no > > control to > > the HW itself, hence we need to set this softirq in the Notification Event > > handler. > > > > could you include this information in the comment so others can easily > understand this requirement? from code you only mentioned VCPU_KICK > _SOFTIRQ is required, but how it leads to PIRR->VIRR sync is not explained. > > Thanks > Kevin > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel