[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZhIX7K0WK+gYtcan@chao-email>
Date: Sun, 7 Apr 2024 11:50:04 +0800
From: Chao Gao <chao.gao@...el.com>
To: Isaku Yamahata <isaku.yamahata@...el.com>
CC: Sean Christopherson <seanjc@...gle.com>, <kvm@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <isaku.yamahata@...il.com>, Paolo Bonzini
<pbonzini@...hat.com>, <erdemaktas@...gle.com>, Sagi Shahar
<sagis@...gle.com>, Kai Huang <kai.huang@...el.com>, <chen.bo@...el.com>,
<hang.yuan@...el.com>, <tina.zhang@...el.com>,
<isaku.yamahata@...ux.intel.com>
Subject: Re: [PATCH v19 108/130] KVM: TDX: Handle TDX PV HLT hypercall
>> > >+ union tdx_vcpu_state_details details;
>> > >+ struct vcpu_tdx *tdx = to_tdx(vcpu);
>> > >+
>> > >+ if (ret || vcpu->arch.mp_state != KVM_MP_STATE_HALTED)
>> > >+ return true;
>> >
>> > Question: why mp_state matters here?
>> > >+
>> > >+ if (tdx->interrupt_disabled_hlt)
>> > >+ return false;
>> >
>> > Shouldn't we move this into vt_interrupt_allowed()? VMX calls the function to
>> > check if interrupt is disabled.
>
>Chao, are you suggesting to implement tdx_interrupt_allowed() as
>"EXIT_REASON_HLT && a0" instead of "return true"?
>I don't think it makes sense because it's rare case and we can't avoid spurious
>wakeup for TDX case.
Yes. KVM differeniates "interrupt allowed" from "has interrupt", e.g.,
static inline bool kvm_vcpu_has_events(struct kvm_vcpu *vcpu)
..
if (kvm_arch_interrupt_allowed(vcpu) &&
(kvm_cpu_has_interrupt(vcpu) ||
kvm_guest_apic_has_interrupt(vcpu)))
return true;
I think tdx_protected_apic_has_interrupt() mixes them together, which isn't
good.
Probably it is a minor thing; if no one else thinks it is better to move the
"interrupt allowed" check to tdx_interrupt_allowed(), I am also fine with not
doing that.
Powered by blists - more mailing lists