From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: Re: [PATCH v13 1/2] vmx: VT-d posted-interrupt core logic handling Date: Tue, 23 Feb 2016 11:06:40 +0000 Message-ID: <56CC3D40.8050502@citrix.com> References: <1456216452-3745-1-git-send-email-feng.wu@intel.com> <1456216452-3745-2-git-send-email-feng.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1456216452-3745-2-git-send-email-feng.wu@intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Feng Wu , xen-devel@lists.xen.org Cc: Kevin Tian , Keir Fraser , George Dunlap , Andrew Cooper , Dario Faggioli , Jan Beulich List-Id: xen-devel@lists.xenproject.org On 23/02/16 08:34, Feng Wu wrote: > This is the core logic handling for VT-d posted-interrupts. Basically it > deals with how and when to update posted-interrupts during the following > scenarios: > - vCPU is preempted > - vCPU is slept > - vCPU is blocked > > When vCPU is preempted/slept, we update the posted-interrupts during > scheduling by introducing two new architecutral scheduler hooks: > vmx_pi_switch_from() and vmx_pi_switch_to(). When vCPU is blocked, we > introduce a new architectural hook: arch_vcpu_block() to update > posted-interrupts descriptor. > > Besides that, before VM-entry, we will make sure the 'NV' filed is set > to 'posted_intr_vector' and the vCPU is not in any blocking lists, which > is needed when vCPU is running in non-root mode. The reason we do this check > is because we change the posted-interrupts descriptor in vcpu_block(), > however, we don't change it back in vcpu_unblock() or when vcpu_block() > directly returns due to event delivery (in fact, we don't need to do it > in the two places, that is why we do it before VM-Entry). > > When we handle the lazy context switch for the following two scenarios: > - Preempted by a tasklet, which uses in an idle context. > - the prev vcpu is in offline and no new available vcpus in run queue. > We don't change the 'SN' bit in posted-interrupt descriptor, this > may incur spurious PI notification events, but since PI notification > event is only sent when 'ON' is clear, and once the PI notificatoin > is sent, ON is set by hardware, hence no more notification events > before 'ON' is clear. Besides that, spurious PI notification events are > going to happen from time to time in Xen hypervisor, such as, when > guests trap to Xen and PI notification event happens, there is > nothing Xen actually needs to do about it, the interrupts will be > delivered to guest atht the next time we do a VMENTRY. > > CC: Keir Fraser > CC: Jan Beulich > CC: Andrew Cooper > CC: Kevin Tian > CC: George Dunlap > CC: Dario Faggioli > Suggested-by: Yang Zhang > Suggested-by: Dario Faggioli > Suggested-by: George Dunlap > Suggested-by: Jan Beulich > Signed-off-by: Feng Wu Reviewed-by: George Dunlap And you can retain my Acked-by wrt the scheduler bits if you make any further changes to the non-scheduler parts that would require dropping the Reviewed-by.