* [PATCH] KVM: x86: Add EOI exit bitmap handlers for Hyper-V SynIC vectors
@ 2022-07-05 8:37 Wang Guangju
2022-07-07 8:26 ` Vitaly Kuznetsov
0 siblings, 1 reply; 3+ messages in thread
From: Wang Guangju @ 2022-07-05 8:37 UTC (permalink / raw)
To: seanjc, pbonzini, vkuznets, jmattson, wanpengli, bp, joro,
suravee.suthikulpanit, hpa, tglx, mingo, kvm
Cc: linux-kernel, wangguangju
From: wangguangju <wangguangju@baidu.com>
Hyper-V SynIC vectors were added into EOI exit bitmap in func
synic_set_sint().But when the Windows VM VMEXIT due to
EXIT_REASON_EOI_INDUCED, there are no EOI exit bitmap handlers
for Hyper-V SynIC vectors.
This patch fix it.
Change-Id: I2404ebf7bda60326be3f6786e0e34e63aa81bbd4
Signed-off-by: wangguangju <wangguangju@baidu.com>
---
arch/x86/kvm/lapic.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 0e68b4c..59096f8 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1303,6 +1303,10 @@ void kvm_apic_set_eoi_accelerated(struct kvm_vcpu *vcpu, int vector)
trace_kvm_eoi(apic, vector);
+ if (to_hv_vcpu(apic->vcpu) &&
+ test_bit(vector, to_hv_synic(apic->vcpu)->vec_bitmap))
+ kvm_hv_synic_send_eoi(apic->vcpu, vector);
+
kvm_ioapic_send_eoi(apic, vector);
kvm_make_request(KVM_REQ_EVENT, apic->vcpu);
}
--
2.9.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: x86: Add EOI exit bitmap handlers for Hyper-V SynIC vectors
2022-07-05 8:37 [PATCH] KVM: x86: Add EOI exit bitmap handlers for Hyper-V SynIC vectors Wang Guangju
@ 2022-07-07 8:26 ` Vitaly Kuznetsov
2022-07-07 9:27 ` 答复: " Wang,Guangju
0 siblings, 1 reply; 3+ messages in thread
From: Vitaly Kuznetsov @ 2022-07-07 8:26 UTC (permalink / raw)
To: Wang Guangju
Cc: linux-kernel, wangguangju, seanjc, pbonzini, jmattson, wanpengli,
bp, joro, suravee.suthikulpanit, hpa, tglx, mingo, kvm
Wang Guangju <wangguangju@baidu.com> writes:
> From: wangguangju <wangguangju@baidu.com>
>
> Hyper-V SynIC vectors were added into EOI exit bitmap in func
> synic_set_sint().But when the Windows VM VMEXIT due to
> EXIT_REASON_EOI_INDUCED, there are no EOI exit bitmap handlers
> for Hyper-V SynIC vectors.
My take:
"When EOI virtualization is performed on VMX,
kvm_apic_set_eoi_accelerated() is called upon EXIT_REASON_EOI_INDUCED
but unlike its non-accelerated apic_set_eoi() sibling, Hyper-V SINT
vectors are left unhandled.
"
>
> This patch fix it.
>
> Change-Id: I2404ebf7bda60326be3f6786e0e34e63aa81bbd4
In case this is not something publicly available it doesn't belong to
kernel changelog as it doesn't bring any value.
> Signed-off-by: wangguangju <wangguangju@baidu.com>
> ---
> arch/x86/kvm/lapic.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index 0e68b4c..59096f8 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -1303,6 +1303,10 @@ void kvm_apic_set_eoi_accelerated(struct kvm_vcpu *vcpu, int vector)
>
> trace_kvm_eoi(apic, vector);
>
> + if (to_hv_vcpu(apic->vcpu) &&
> + test_bit(vector, to_hv_synic(apic->vcpu)->vec_bitmap))
> + kvm_hv_synic_send_eoi(apic->vcpu, vector);
> +
> kvm_ioapic_send_eoi(apic, vector);
> kvm_make_request(KVM_REQ_EVENT, apic->vcpu);
This whole part:
if (to_hv_vcpu(apic->vcpu) &&
test_bit(vector, to_hv_synic(apic->vcpu)->vec_bitmap))
kvm_hv_synic_send_eoi(apic->vcpu, vector);
kvm_ioapic_send_eoi(apic, vector);
kvm_make_request(KVM_REQ_EVENT, apic->vcpu);
could be split into an inline function, something like (completely
untested):
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 6ff17d5a2ae3..9d19c7c738c0 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1269,6 +1269,16 @@ static void kvm_ioapic_send_eoi(struct kvm_lapic *apic, int vector)
kvm_ioapic_update_eoi(apic->vcpu, vector, trigger_mode);
}
+static inline void apic_set_eoi_vector(struct kvm_lapic *apic, int vector)
+{
+ if (to_hv_vcpu(apic->vcpu) &&
+ test_bit(vector, to_hv_synic(apic->vcpu)->vec_bitmap))
+ kvm_hv_synic_send_eoi(apic->vcpu, vector);
+
+ kvm_ioapic_send_eoi(apic, vector);
+ kvm_make_request(KVM_REQ_EVENT, apic->vcpu);
+}
+
static int apic_set_eoi(struct kvm_lapic *apic)
{
int vector = apic_find_highest_isr(apic);
@@ -1285,12 +1295,8 @@ static int apic_set_eoi(struct kvm_lapic *apic)
apic_clear_isr(vector, apic);
apic_update_ppr(apic);
- if (to_hv_vcpu(apic->vcpu) &&
- test_bit(vector, to_hv_synic(apic->vcpu)->vec_bitmap))
- kvm_hv_synic_send_eoi(apic->vcpu, vector);
+ apic_set_eoi_vector(apic, vector);
- kvm_ioapic_send_eoi(apic, vector);
- kvm_make_request(KVM_REQ_EVENT, apic->vcpu);
return vector;
}
@@ -1304,8 +1310,7 @@ void kvm_apic_set_eoi_accelerated(struct kvm_vcpu *vcpu, int vector)
trace_kvm_eoi(apic, vector);
- kvm_ioapic_send_eoi(apic, vector);
- kvm_make_request(KVM_REQ_EVENT, apic->vcpu);
+ apic_set_eoi_vector(apic, vector);
}
EXPORT_SYMBOL_GPL(kvm_apic_set_eoi_accelerated);
> }
--
Vitaly
^ permalink raw reply related [flat|nested] 3+ messages in thread
* 答复: [PATCH] KVM: x86: Add EOI exit bitmap handlers for Hyper-V SynIC vectors
2022-07-07 8:26 ` Vitaly Kuznetsov
@ 2022-07-07 9:27 ` Wang,Guangju
0 siblings, 0 replies; 3+ messages in thread
From: Wang,Guangju @ 2022-07-07 9:27 UTC (permalink / raw)
To: Vitaly Kuznetsov
Cc: linux-kernel, seanjc, pbonzini, jmattson, wanpengli, bp, joro,
suravee.suthikulpanit, hpa, tglx, mingo, kvm
> This whole part:
>
> if (to_hv_vcpu(apic->vcpu) &&
> test_bit(vector, to_hv_synic(apic->vcpu)->vec_bitmap))
> kvm_hv_synic_send_eoi(apic->vcpu, vector);
>
> kvm_ioapic_send_eoi(apic, vector);
> kvm_make_request(KVM_REQ_EVENT, apic->vcpu);
> could be split into an inline function, something like (completely
> untested):
Thank you, I will modify and test it and then send a new patch.
--
Wang
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-07 9:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 8:37 [PATCH] KVM: x86: Add EOI exit bitmap handlers for Hyper-V SynIC vectors Wang Guangju
2022-07-07 8:26 ` Vitaly Kuznetsov
2022-07-07 9:27 ` 答复: " Wang,Guangju
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.