mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-15 02:57:49 +00:00
KVM: Move apic timer migration away from critical section
Migrating the apic timer in the critical section is not very nice, and is absolutely horrible with the real-time port. Move migration to the regular vcpu execution path, triggered by a new bitflag. Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Avi Kivity <avi@qumranet.com>
This commit is contained in:
parent
a03d7f4b54
commit
2f52d58c92
4 changed files with 12 additions and 4 deletions
|
@ -83,6 +83,6 @@ void kvm_pic_reset(struct kvm_kpic_state *s);
|
||||||
void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec);
|
void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec);
|
||||||
void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu);
|
void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu);
|
||||||
void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu);
|
void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu);
|
||||||
void kvm_migrate_apic_timer(struct kvm_vcpu *vcpu);
|
void __kvm_migrate_apic_timer(struct kvm_vcpu *vcpu);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1092,7 +1092,7 @@ void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu)
|
||||||
start_apic_timer(apic);
|
start_apic_timer(apic);
|
||||||
}
|
}
|
||||||
|
|
||||||
void kvm_migrate_apic_timer(struct kvm_vcpu *vcpu)
|
void __kvm_migrate_apic_timer(struct kvm_vcpu *vcpu)
|
||||||
{
|
{
|
||||||
struct kvm_lapic *apic = vcpu->arch.apic;
|
struct kvm_lapic *apic = vcpu->arch.apic;
|
||||||
struct hrtimer *timer;
|
struct hrtimer *timer;
|
||||||
|
@ -1104,7 +1104,6 @@ void kvm_migrate_apic_timer(struct kvm_vcpu *vcpu)
|
||||||
if (hrtimer_cancel(timer))
|
if (hrtimer_cancel(timer))
|
||||||
hrtimer_start(timer, timer->expires, HRTIMER_MODE_ABS);
|
hrtimer_start(timer, timer->expires, HRTIMER_MODE_ABS);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(kvm_migrate_apic_timer);
|
|
||||||
|
|
||||||
void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu)
|
void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2518,13 +2518,16 @@ again:
|
||||||
if (unlikely(r))
|
if (unlikely(r))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (vcpu->requests)
|
if (vcpu->requests) {
|
||||||
|
if (test_and_clear_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests))
|
||||||
|
__kvm_migrate_apic_timer(vcpu);
|
||||||
if (test_and_clear_bit(KVM_REQ_REPORT_TPR_ACCESS,
|
if (test_and_clear_bit(KVM_REQ_REPORT_TPR_ACCESS,
|
||||||
&vcpu->requests)) {
|
&vcpu->requests)) {
|
||||||
kvm_run->exit_reason = KVM_EXIT_TPR_ACCESS;
|
kvm_run->exit_reason = KVM_EXIT_TPR_ACCESS;
|
||||||
r = 0;
|
r = 0;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
kvm_inject_pending_timer_irqs(vcpu);
|
kvm_inject_pending_timer_irqs(vcpu);
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
* vcpu->requests bit members
|
* vcpu->requests bit members
|
||||||
*/
|
*/
|
||||||
#define KVM_REQ_TLB_FLUSH 0
|
#define KVM_REQ_TLB_FLUSH 0
|
||||||
|
#define KVM_REQ_MIGRATE_TIMER 1
|
||||||
#define KVM_REQ_REPORT_TPR_ACCESS 2
|
#define KVM_REQ_REPORT_TPR_ACCESS 2
|
||||||
|
|
||||||
struct kvm_vcpu;
|
struct kvm_vcpu;
|
||||||
|
@ -277,6 +278,11 @@ static inline gpa_t gfn_to_gpa(gfn_t gfn)
|
||||||
return (gpa_t)gfn << PAGE_SHIFT;
|
return (gpa_t)gfn << PAGE_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void kvm_migrate_apic_timer(struct kvm_vcpu *vcpu)
|
||||||
|
{
|
||||||
|
set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests);
|
||||||
|
}
|
||||||
|
|
||||||
enum kvm_stat_kind {
|
enum kvm_stat_kind {
|
||||||
KVM_STAT_VM,
|
KVM_STAT_VM,
|
||||||
KVM_STAT_VCPU,
|
KVM_STAT_VCPU,
|
||||||
|
|
Loading…
Add table
Reference in a new issue