KVM: rename KVM_REQ_PENDING_TIMER to KVM_REQ_UNBLOCK

KVM_REQ_UNBLOCK will be used to exit a vcpu from
its inner vcpu halt emulation loop.

Rename KVM_REQ_PENDING_TIMER to KVM_REQ_UNBLOCK, switch
PowerPC to arch specific request bit.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Message-Id: <20210525134321.303768132@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Marcelo Tosatti 2021-05-25 10:41:17 -03:00 committed by Paolo Bonzini
parent 57ab87947a
commit 084071d5e9
6 changed files with 11 additions and 6 deletions

View File

@ -118,10 +118,12 @@ KVM_REQ_MMU_RELOAD
necessary to inform each VCPU to completely refresh the tables. This necessary to inform each VCPU to completely refresh the tables. This
request is used for that. request is used for that.
KVM_REQ_PENDING_TIMER KVM_REQ_UNBLOCK
This request may be made from a timer handler run on the host on behalf This request informs the vCPU to exit kvm_vcpu_block. It is used for
of a VCPU. It informs the VCPU thread to inject a timer interrupt. example from timer handlers that run on the host on behalf of a vCPU,
or in order to update the interrupt routing and ensure that assigned
devices will wake up the vCPU.
KVM_REQ_UNHALT KVM_REQ_UNHALT

View File

@ -51,6 +51,7 @@
/* PPC-specific vcpu->requests bit members */ /* PPC-specific vcpu->requests bit members */
#define KVM_REQ_WATCHDOG KVM_ARCH_REQ(0) #define KVM_REQ_WATCHDOG KVM_ARCH_REQ(0)
#define KVM_REQ_EPR_EXIT KVM_ARCH_REQ(1) #define KVM_REQ_EPR_EXIT KVM_ARCH_REQ(1)
#define KVM_REQ_PENDING_TIMER KVM_ARCH_REQ(2)
#include <linux/mmu_notifier.h> #include <linux/mmu_notifier.h>

View File

@ -1669,7 +1669,7 @@ static void apic_timer_expired(struct kvm_lapic *apic, bool from_timer_fn)
} }
atomic_inc(&apic->lapic_timer.pending); atomic_inc(&apic->lapic_timer.pending);
kvm_make_request(KVM_REQ_PENDING_TIMER, vcpu); kvm_make_request(KVM_REQ_UNBLOCK, vcpu);
if (from_timer_fn) if (from_timer_fn)
kvm_vcpu_kick(vcpu); kvm_vcpu_kick(vcpu);
} }

View File

@ -9501,7 +9501,7 @@ static int vcpu_run(struct kvm_vcpu *vcpu)
if (r <= 0) if (r <= 0)
break; break;
kvm_clear_request(KVM_REQ_PENDING_TIMER, vcpu); kvm_clear_request(KVM_REQ_UNBLOCK, vcpu);
if (kvm_cpu_has_pending_timer(vcpu)) if (kvm_cpu_has_pending_timer(vcpu))
kvm_inject_pending_timer_irqs(vcpu); kvm_inject_pending_timer_irqs(vcpu);

View File

@ -147,7 +147,7 @@ static inline bool is_error_page(struct page *page)
*/ */
#define KVM_REQ_TLB_FLUSH (0 | KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP) #define KVM_REQ_TLB_FLUSH (0 | KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP)
#define KVM_REQ_MMU_RELOAD (1 | KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP) #define KVM_REQ_MMU_RELOAD (1 | KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP)
#define KVM_REQ_PENDING_TIMER 2 #define KVM_REQ_UNBLOCK 2
#define KVM_REQ_UNHALT 3 #define KVM_REQ_UNHALT 3
#define KVM_REQUEST_ARCH_BASE 8 #define KVM_REQUEST_ARCH_BASE 8

View File

@ -2929,6 +2929,8 @@ static int kvm_vcpu_check_block(struct kvm_vcpu *vcpu)
goto out; goto out;
if (signal_pending(current)) if (signal_pending(current))
goto out; goto out;
if (kvm_check_request(KVM_REQ_UNBLOCK, vcpu))
goto out;
ret = 0; ret = 0;
out: out: