arch:x86:kvm:Add function for setting pending timer on virtual cpu in x86.c
Paolo Bonzini
maintainerarch/x86/kvm/x86.c static void update_pvclock_gtod(struct timekeeper *tk)
Quoted 31 lines · Nicholas Krause
Adds the function
kvm_vcpu_set_pending_timerfor setting a pending timer on a virtual cpu for x86 systems. This function callskvm_make_requestinternally as moved over fromlapic.cwith the arugments of the virtual cpu passed to the functionkvm_vcpu_set_pending_timerand the flag ofKVM_REQ_PENDING_TIMERfor requesting a pending timer to kvm. In additon we added a function prototype definition as to allow this function to be used by any files that include the header file,x86.h and need to set the pending timer on a virtual cpu supported by kvm.Signed-off-by Nicholas Krause <[email protected]>--- arch/x86/kvm/lapic.c | 3 +-- arch/x86/kvm/x86.c | 3 +++ arch/x86/kvm/x86.h | 1 + 3 files changed, 5 insertions(+), 2 deletions(-)arch/x86/kvm/lapic.c +1
-2@@ -1082,8 +1082,7 @@ static void apic_timer_expired(struct kvm_lapic *apic)return ;atomic_inc (&apic->lapic_timer.pending); -/* FIXME: this code should not know anything about vcpus */ -kvm_make_request (KVM_REQ_PENDING_TIMER , vcpu); +kvm_set_pending_timer (vcpu);if (waitqueue_active (q))wake_up_interruptible (q);arch/x86/kvm/x86.c +0
-0@@ -1083,6 +1083,9 @@ static void update_pvclock_gtod(struct timekeeper *tk)
The patch didn't apply as is because the ",9" should have been ",10".
Fixed up and applied.
Paolo
Quoted 23 lines
arch/x86/kvm/x86.c +4
-0}#endif +void kvm_set_pending_timer (struct kvm_vcpu *vcpu) +{ +kvm_make_request (KVM_REQ_PENDING_TIMER , vcpu); +}static void kvm_write_wall_clock (struct kvm *kvm,gpa_t wall_clock) {arch/x86/kvm/x86.h +1
-0@@ -147,6 +147,7 @@ static inline void kvm_register_writel(struct kvm_vcpu *vcpu,void kvm_before_handle_nmi (struct kvm_vcpu *vcpu);void kvm_after_handle_nmi (struct kvm_vcpu *vcpu); +void kvm_set_pending_timer (struct kvm_vcpu *vcpu);int kvm_inject_realmode_interrupt (struct kvm_vcpu *vcpu,int irq,int inc_eip);void kvm_write_tsc (struct kvm_vcpu *vcpu,struct msr_data *msr);
Hi
Quoted 22 lines · Paolo Bonzini
Quoted 19 lines · Nicholas Krause
Adds the function
kvm_vcpu_set_pending_timerfor setting a pending timer on a virtual cpu for x86 systems. This function callskvm_make_requestinternally as moved over fromlapic.cwith the arugments of the virtual cpu passed to the functionkvm_vcpu_set_pending_timerand the flag ofKVM_REQ_PENDING_TIMERfor requesting a pending timer to kvm. In additon we added a function prototype definition as to allow this function to be used by any files that include the header file,x86.h and need to set the pending timer on a virtual cpu supported by kvm.Signed-off-by Nicholas Krause <[email protected]>--- arch/x86/kvm/lapic.c | 3 +-- arch/x86/kvm/x86.c | 3 +++ arch/x86/kvm/x86.h | 1 + 3 files changed, 5 insertions(+), 2 deletions(-)arch/x86/kvm/lapic.c +0
-0@@ -1082,8 +1082,7 @@ static void apic_timer_expired(struct kvm_lapic *apic)return ;
Quoted 2 lines
arch/x86/kvm/lapic.c static void apic_timer_expired(struct kvm_lapic *apic) · line 1085
Quoted 2 lines
arch/x86/kvm/lapic.c +0
-1atomic_inc (&apic->lapic_timer.pending); -/* FIXME: this code should not know anything about vcpus */
I don't want to sounds like I'm nitpicking. But I need to ask. Why is this comment removed?
Quoted 47 lines
arch/x86/kvm/x86.c static void update_pvclock_gtod(struct timekeeper *tk)
Quoted 10 lines
arch/x86/kvm/lapic.c +1
-1-kvm_make_request (KVM_REQ_PENDING_TIMER , vcpu); +kvm_set_pending_timer (vcpu);if (waitqueue_active (q))wake_up_interruptible (q);arch/x86/kvm/x86.c +0
-0@@ -1083,6 +1083,9 @@ static void update_pvclock_gtod(struct timekeeper *tk)The patch didn't apply as is because the ",9" should have been ",10".
Fixed up and applied.
Paolo
Quoted 16 lines
arch/x86/kvm/x86.c +4
-0}#endif +void kvm_set_pending_timer (struct kvm_vcpu *vcpu) +{ +kvm_make_request (KVM_REQ_PENDING_TIMER , vcpu); +}static void kvm_write_wall_clock (struct kvm *kvm,gpa_t wall_clock) {arch/x86/kvm/x86.h +0
-0arch/x86/kvm/x86.h static inline void kvm_register_writel(struct kvm_vcpu *vcpu, · line 153
Quoted 7 lines
arch/x86/kvm/x86.h +1
-0@@ -147,6 +147,7 @@ static inline void kvm_register_writel(struct kvm_vcpu *vcpu,void kvm_before_handle_nmi (struct kvm_vcpu *vcpu);void kvm_after_handle_nmi (struct kvm_vcpu *vcpu); +void kvm_set_pending_timer (struct kvm_vcpu *vcpu);int kvm_inject_realmode_interrupt (struct kvm_vcpu *vcpu,int irq,int inc_eip);void kvm_write_tsc (struct kvm_vcpu *vcpu,struct msr_data *msr);--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 2 lines
Kind regards, b.
Paolo Bonzini
maintainerQuoted 3 lines · Andrej Manduch
Quoted 1 line
Quoted 1 line
Quoted 1 line
Review
Quoted 1 line
(quoted diff) +0
-1- /* FIXME: this code should not know anything about vcpus */I don't want to sounds like I'm nitpicking. But I need to ask. Why is this comment removed?
Because the real point of the comment was that the code should not know anything about VCPU requests. But it's okay to call a function to tell the VCPU "we want you to call us back at kvm_inject_apic_timer_irqs".
Paolo
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(quoted diff) +1
-1- kvm_make_request(KVM_REQ_PENDING_TIMER, vcpu); + kvm_set_pending_timer(vcpu);