Re: [PATCH v19 091/130] KVM: TDX: remove use of struct vcpu_vmx from posted_interrupt.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 28, 2024 at 04:12:36PM +0800,
Chao Gao <chao.gao@xxxxxxxxx> wrote:

> On Mon, Feb 26, 2024 at 12:26:33AM -0800, isaku.yamahata@xxxxxxxxx wrote:
> >@@ -190,7 +211,8 @@ static bool vmx_needs_pi_wakeup(struct kvm_vcpu *vcpu)
> > 	 * notification vector is switched to the one that calls
> > 	 * back to the pi_wakeup_handler() function.
> > 	 */
> >-	return vmx_can_use_ipiv(vcpu) || vmx_can_use_vtd_pi(vcpu->kvm);
> >+	return (vmx_can_use_ipiv(vcpu) && !is_td_vcpu(vcpu)) ||
> >+		vmx_can_use_vtd_pi(vcpu->kvm);
> 
> It is better to separate this functional change from the code refactoring.

Agreed. Let's split this patch.


> > }
> > 
> > void vmx_vcpu_pi_put(struct kvm_vcpu *vcpu)
> >@@ -200,7 +222,8 @@ void vmx_vcpu_pi_put(struct kvm_vcpu *vcpu)
> > 	if (!vmx_needs_pi_wakeup(vcpu))
> > 		return;
> > 
> >-	if (kvm_vcpu_is_blocking(vcpu) && !vmx_interrupt_blocked(vcpu))
> >+	if (kvm_vcpu_is_blocking(vcpu) &&
> >+	    (is_td_vcpu(vcpu) || !vmx_interrupt_blocked(vcpu)))
> 
> Ditto.
> 
> This looks incorrect to me. here we assume interrupt is always enabled for TD.
> But on TDVMCALL(HLT), the guest tells KVM if hlt is called with interrupt
> disabled. KVM can just check that interrupt status passed from the guest.

That's true.  We can complicate this function and HLT emulation.  But I don't
think it's worthwhile because HLT with interrupt masked is rare.  Only for
CPU online.
-- 
Isaku Yamahata <isaku.yamahata@xxxxxxxxx>




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux