All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: Drop KVM_REQ_PENDING_TIMER
@ 2010-03-20  3:20 Xiao Wang
  2010-03-21 12:34 ` Avi Kivity
  0 siblings, 1 reply; 5+ messages in thread
From: Xiao Wang @ 2010-03-20  3:20 UTC (permalink / raw)
  To: avi, mtosatti; +Cc: kvm, akong, Xiao Wang

The pending timer is not detected through KVM_REQ_PENDING_TIMER now.

Signed-off-by: Xiao Wang <sirouni@gmail.com>
---
 arch/x86/kvm/timer.c     |    2 --
 arch/x86/kvm/x86.c       |    1 -
 include/linux/kvm_host.h |   11 +++++------
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kvm/timer.c b/arch/x86/kvm/timer.c
index eea4043..3aa09a6 100644
--- a/arch/x86/kvm/timer.c
+++ b/arch/x86/kvm/timer.c
@@ -16,8 +16,6 @@ static int __kvm_timer_fn(struct kvm_vcpu *vcpu, struct kvm_timer *ktimer)
 	 */
 	if (ktimer->reinject || !atomic_read(&ktimer->pending)) {
 		atomic_inc(&ktimer->pending);
-		/* FIXME: this code should not know anything about vcpus */
-		set_bit(KVM_REQ_PENDING_TIMER, &vcpu->requests);
 	}
 
 	if (waitqueue_active(q))
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index bcf52d1..a4baab4 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4444,7 +4444,6 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
 		if (r <= 0)
 			break;
 
-		clear_bit(KVM_REQ_PENDING_TIMER, &vcpu->requests);
 		if (kvm_cpu_has_pending_timer(vcpu))
 			kvm_inject_pending_timer_irqs(vcpu);
 
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index a3fd0f9..592c04b 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -33,12 +33,11 @@
 #define KVM_REQ_REPORT_TPR_ACCESS  2
 #define KVM_REQ_MMU_RELOAD         3
 #define KVM_REQ_TRIPLE_FAULT       4
-#define KVM_REQ_PENDING_TIMER      5
-#define KVM_REQ_UNHALT             6
-#define KVM_REQ_MMU_SYNC           7
-#define KVM_REQ_KVMCLOCK_UPDATE    8
-#define KVM_REQ_KICK               9
-#define KVM_REQ_DEACTIVATE_FPU    10
+#define KVM_REQ_UNHALT             5
+#define KVM_REQ_MMU_SYNC           6
+#define KVM_REQ_KVMCLOCK_UPDATE    7
+#define KVM_REQ_KICK               8
+#define KVM_REQ_DEACTIVATE_FPU     9
 
 #define KVM_USERSPACE_IRQ_SOURCE_ID	0
 
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] KVM: Drop KVM_REQ_PENDING_TIMER
  2010-03-20  3:20 [PATCH] KVM: Drop KVM_REQ_PENDING_TIMER Xiao Wang
@ 2010-03-21 12:34 ` Avi Kivity
  2010-03-23 17:15   ` KVM: x86: document KVM_REQ_PENDING_TIMER usage Marcelo Tosatti
  0 siblings, 1 reply; 5+ messages in thread
From: Avi Kivity @ 2010-03-21 12:34 UTC (permalink / raw)
  To: Xiao Wang; +Cc: mtosatti, kvm, akong

On 03/20/2010 05:20 AM, Xiao Wang wrote:
> The pending timer is not detected through KVM_REQ_PENDING_TIMER now.
>
>    

It does, see the commit message of 06e056456.

Marcelo, IIRC this is the second time time we get this patch... we need 
either a comment in the code, or better, a fix that doesn't involve an 
atomic in the fast path.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 5+ messages in thread

* KVM: x86: document KVM_REQ_PENDING_TIMER usage
  2010-03-21 12:34 ` Avi Kivity
@ 2010-03-23 17:15   ` Marcelo Tosatti
  2010-03-24  9:23     ` Avi Kivity
       [not found]     ` <cf3d7eae1003231810v57a03421y4bba07c02d690a31@mail.gmail.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Marcelo Tosatti @ 2010-03-23 17:15 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Xiao Wang, kvm, akong


Document that KVM_REQ_PENDING_TIMER is implicitly used during guest
entry.

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

diff --git a/arch/x86/kvm/timer.c b/arch/x86/kvm/timer.c
index eea4043..9805f05 100644
--- a/arch/x86/kvm/timer.c
+++ b/arch/x86/kvm/timer.c
@@ -12,7 +12,8 @@ static int __kvm_timer_fn(struct kvm_vcpu *vcpu, struct kvm_timer *ktimer)
 	/*
 	 * There is a race window between reading and incrementing, but we do
 	 * not care about potentially loosing timer events in the !reinject
-	 * case anyway.
+	 * case anyway. Note: KVM_REQ_PENDING_TIMER is implicitly checked 
+	 * in vcpu_enter_guest.
 	 */
 	if (ktimer->reinject || !atomic_read(&ktimer->pending)) {
 		atomic_inc(&ktimer->pending);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: KVM: x86: document KVM_REQ_PENDING_TIMER usage
  2010-03-23 17:15   ` KVM: x86: document KVM_REQ_PENDING_TIMER usage Marcelo Tosatti
@ 2010-03-24  9:23     ` Avi Kivity
       [not found]     ` <cf3d7eae1003231810v57a03421y4bba07c02d690a31@mail.gmail.com>
  1 sibling, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2010-03-24  9:23 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: Xiao Wang, kvm, akong

On 03/23/2010 07:15 PM, Marcelo Tosatti wrote:
> Document that KVM_REQ_PENDING_TIMER is implicitly used during guest
> entry.
>    

Applied, thanks.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: KVM: x86: document KVM_REQ_PENDING_TIMER usage
       [not found]     ` <cf3d7eae1003231810v57a03421y4bba07c02d690a31@mail.gmail.com>
@ 2010-03-24 15:43       ` Marcelo Tosatti
  0 siblings, 0 replies; 5+ messages in thread
From: Marcelo Tosatti @ 2010-03-24 15:43 UTC (permalink / raw)
  To: 王箫; +Cc: Avi Kivity, kvm, akong

On Wed, Mar 24, 2010 at 09:10:54AM +0800, 王箫 wrote:
> Thanks for pointing that, but is it possible that explicitly check the
> pending timer with kvm_cpu_has_pending_timer() in vcpu_enter_guest()? There
> seems some function duplication between KVM_REQ_PENDING_TIMER and
> ktimer->pending.

Right. KVM_REQ_PENDING_TIMER is per vcpu, and its one bit, while there
might be multiple ktimers per vcpu (its a shortcut between hrtimers and
guest entry, bypassing irq injection).

Yes, there is some duplication.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-03-24 15:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-20  3:20 [PATCH] KVM: Drop KVM_REQ_PENDING_TIMER Xiao Wang
2010-03-21 12:34 ` Avi Kivity
2010-03-23 17:15   ` KVM: x86: document KVM_REQ_PENDING_TIMER usage Marcelo Tosatti
2010-03-24  9:23     ` Avi Kivity
     [not found]     ` <cf3d7eae1003231810v57a03421y4bba07c02d690a31@mail.gmail.com>
2010-03-24 15:43       ` Marcelo Tosatti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.