[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z3yeWvg+JZ//wbLZ@intel.com>
Date: Tue, 7 Jan 2025 11:24:10 +0800
From: Chao Gao <chao.gao@...el.com>
To: Sean Christopherson <seanjc@...gle.com>
CC: Vishal Annapurve <vannapurve@...gle.com>, Binbin Wu
<binbin.wu@...ux.intel.com>, <pbonzini@...hat.com>, <kvm@...r.kernel.org>,
<rick.p.edgecombe@...el.com>, <kai.huang@...el.com>,
<adrian.hunter@...el.com>, <reinette.chatre@...el.com>,
<xiaoyao.li@...el.com>, <tony.lindgren@...ux.intel.com>,
<isaku.yamahata@...el.com>, <yan.y.zhao@...el.com>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 12/16] KVM: TDX: Inhibit APICv for TDX guest
>Note, kvm_use_posted_timer_interrupt() uses a heuristic of HLT/MWAIT interception
>being disabled to detect that it's worth trying to post a timer interrupt, but off
>the top of my head I'm pretty sure that's unnecessary and pointless. The
Commit 1714a4eb6fb0 gives an explanation:
if only some guests isolated and others not, they would not
have any benefit from posted timer interrupts, and at the same time lose
VMX preemption timer fast paths because kvm_can_post_timer_interrupt()
returns true and therefore forces kvm_can_use_hv_timer() to false.
>"vcpu->mode == IN_GUEST_MODE" is super cheap, and I can't think of any harm in
>posting the time interrupt if the target vCPU happens to be in guest mode even
>if the host wasn't configured just so.
>
>> Another scenario I was thinking of was hrtimer expiry during vcpu exit
>> being handled in KVM/userspace, which will cause timer interrupt
>> injection after the next exit [1] delaying timer interrupt to guest.
>
>No, the IRQ won't be delayed. Expiration from the hrtimer callback will set
>KVM_REQ_UNBLOCK, which will prevent actually entering the guest (see the call
>to kvm_request_pending() in kvm_vcpu_exit_request()).
>
>> This scenario is not specific to TDX VMs though.
>>
>> [1] https://git.kernel.org/pub/scm/virt/kvm/kvm.git/tree/arch/x86/kvm/x86.c?h=kvm-coco-queue#n11263
Powered by blists - more mailing lists