On 10/05/21 19:26, Marcelo Tosatti wrote:
+void vmx_pi_start_assignment(struct kvm *kvm)
+{
+ struct kvm_vcpu *vcpu;
+ int i;
+
+ if (!irq_remapping_cap(IRQ_POSTING_CAP))
+ return;
+
+ /*
+ * Wakeup will cause the vCPU to bail out of kvm_vcpu_block() and
+ * go back through vcpu_block().
+ */
+ kvm_for_each_vcpu(i, vcpu, kvm) {
+ if (!kvm_vcpu_apicv_active(vcpu))
+ continue;
+
+ kvm_vcpu_wake_up(vcpu);
Would you still need the check_block callback, if you also added a
kvm_make_request(KVM_REQ_EVENT)?
In fact, since this is entirely not a hot path, can you just do
kvm_make_all_cpus_request(kvm, KVM_REQ_EVENT) instead of this loop?
Thanks,
Paolo
+ }
+}
/*
* pi_update_irte - set IRTE for Posted-Interrupts
Index: kvm/arch/x86/kvm/vmx/posted_intr.h
===================================================================
--- kvm.orig/arch/x86/kvm/vmx/posted_intr.h
+++ kvm/arch/x86/kvm/vmx/posted_intr.h
@@ -95,5 +95,7 @@ void __init pi_init_cpu(int cpu);
bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu);
int pi_update_irte(struct kvm *kvm, unsigned int host_irq, uint32_t guest_irq,
bool set);
+void vmx_pi_start_assignment(struct kvm *kvm);
+int vmx_vcpu_check_block(struct kvm_vcpu *vcpu);
#endif /* __KVM_X86_VMX_POSTED_INTR_H */
Index: kvm/arch/x86/kvm/vmx/vmx.c
===================================================================
--- kvm.orig/arch/x86/kvm/vmx/vmx.c
+++ kvm/arch/x86/kvm/vmx/vmx.c
@@ -7727,13 +7727,13 @@ static struct kvm_x86_ops vmx_x86_ops __
.pre_block = vmx_pre_block,
.post_block = vmx_post_block,
- .vcpu_check_block = NULL,
+ .vcpu_check_block = vmx_vcpu_check_block,
.pmu_ops = &intel_pmu_ops,
.nested_ops = &vmx_nested_ops,
.update_pi_irte = pi_update_irte,
- .start_assignment = NULL,
+ .start_assignment = vmx_pi_start_assignment,
#ifdef CONFIG_X86_64
.set_hv_timer = vmx_set_hv_timer,