mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 03:53:37 +02:00
KVM: VMX: Save/restore IRQs (instead of CLI/STI) during PI pre/post block
Save/restore IRQs when disabling IRQs in posted interrupt pre/post block in preparation for moving the code into vcpu_put/load(), where it would be called with IRQs already disabled. No functional changed intended. Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20211009021236.4122790-26-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
29802380b6
commit
89ef0f21cf
|
|
@ -145,13 +145,13 @@ int pi_pre_block(struct kvm_vcpu *vcpu)
|
|||
{
|
||||
struct pi_desc old, new;
|
||||
struct pi_desc *pi_desc = vcpu_to_pi_desc(vcpu);
|
||||
unsigned long flags;
|
||||
|
||||
if (!vmx_can_use_vtd_pi(vcpu->kvm) ||
|
||||
vmx_interrupt_blocked(vcpu))
|
||||
return 0;
|
||||
|
||||
WARN_ON(irqs_disabled());
|
||||
local_irq_disable();
|
||||
local_irq_save(flags);
|
||||
|
||||
vcpu->pre_pcpu = vcpu->cpu;
|
||||
spin_lock(&per_cpu(blocked_vcpu_on_cpu_lock, vcpu->cpu));
|
||||
|
|
@ -175,19 +175,20 @@ int pi_pre_block(struct kvm_vcpu *vcpu)
|
|||
if (pi_test_on(pi_desc))
|
||||
__pi_post_block(vcpu);
|
||||
|
||||
local_irq_enable();
|
||||
local_irq_restore(flags);
|
||||
return (vcpu->pre_pcpu == -1);
|
||||
}
|
||||
|
||||
void pi_post_block(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
if (vcpu->pre_pcpu == -1)
|
||||
return;
|
||||
|
||||
WARN_ON(irqs_disabled());
|
||||
local_irq_disable();
|
||||
local_irq_save(flags);
|
||||
__pi_post_block(vcpu);
|
||||
local_irq_enable();
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user