public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RFC: Create kvm_arch_vcpu_runnable() function
@ 2007-12-03 22:15 Hollis Blanchard
  2007-12-04 13:20 ` Carsten Otte
  2007-12-05 10:18 ` Avi Kivity
  0 siblings, 2 replies; 6+ messages in thread
From: Hollis Blanchard @ 2007-12-03 22:15 UTC (permalink / raw)
  To: Avi Kivity
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Signed-off-by: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
vcpu->mp_state looks like an arch-specific field, so what do we think about
this patch? It might make sense to fold the kvm_cpu_has_interrupt() test inside
kvm_arch_vcpu_runnable() as well.

2 files changed, 9 insertions(+), 3 deletions(-)
drivers/kvm/kvm_main.c |    3 +--
drivers/kvm/x86.h      |    9 ++++++++-


diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -643,8 +643,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcp
 	 */
 	while (!kvm_cpu_has_interrupt(vcpu)
 	       && !signal_pending(current)
-	       && vcpu->mp_state != VCPU_MP_STATE_RUNNABLE
-	       && vcpu->mp_state != VCPU_MP_STATE_SIPI_RECEIVED) {
+	       && !kvm_arch_vcpu_runnable(vcpu)) {
 		set_current_state(TASK_INTERRUPTIBLE);
 		vcpu_put(vcpu);
 		schedule();
diff --git a/drivers/kvm/x86.h b/drivers/kvm/x86.h
--- a/drivers/kvm/x86.h
+++ b/drivers/kvm/x86.h
@@ -471,4 +471,11 @@ static inline u32 get_rdx_init_val(void)
 #define TSS_IOPB_SIZE (65536 / 8)
 #define TSS_REDIRECTION_SIZE (256 / 8)
 #define RMODE_TSS_SIZE (TSS_BASE_SIZE + TSS_REDIRECTION_SIZE + TSS_IOPB_SIZE + 1)
-#endif
+
+static inline int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
+{
+	return vcpu->mp_state == VCPU_MP_STATE_RUNNABLE
+	       || vcpu->mp_state == VCPU_MP_STATE_SIPI_RECEIVED;
+}
+
+#endif

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

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

* Re: [PATCH] RFC: Create kvm_arch_vcpu_runnable() function
  2007-12-03 22:15 [PATCH] RFC: Create kvm_arch_vcpu_runnable() function Hollis Blanchard
@ 2007-12-04 13:20 ` Carsten Otte
       [not found]   ` <47555417.7020103-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
  2007-12-05 10:18 ` Avi Kivity
  1 sibling, 1 reply; 6+ messages in thread
From: Carsten Otte @ 2007-12-04 13:20 UTC (permalink / raw)
  To: Hollis Blanchard
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Avi Kivity

Hollis Blanchard wrote:
> Signed-off-by: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Acked-by: Carsten Otte <cotte-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>

We'll need this too on big iron.

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

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

* Re: [PATCH] RFC: Create kvm_arch_vcpu_runnable() function
       [not found]   ` <47555417.7020103-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
@ 2007-12-04 13:53     ` Avi Kivity
       [not found]       ` <47555BD2.1010305-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Avi Kivity @ 2007-12-04 13:53 UTC (permalink / raw)
  To: carsteno-tA70FqPdS9bQT0dZR+AlfA
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Hollis Blanchard

Carsten Otte wrote:
> Hollis Blanchard wrote:
>> Signed-off-by: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> Acked-by: Carsten Otte <cotte-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
>
> We'll need this too on big iron.

What about merging kvm_cpu_has_interrupt() into _runnable()?

My feeling is that we can keep it separated.

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


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

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

* Re: [PATCH] RFC: Create kvm_arch_vcpu_runnable() function
       [not found]       ` <47555BD2.1010305-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-12-05  9:06         ` Carsten Otte
       [not found]           ` <47566A17.3040802-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Carsten Otte @ 2007-12-05  9:06 UTC (permalink / raw)
  To: Avi Kivity
  Cc: carsteno-tA70FqPdS9bQT0dZR+AlfA,
	kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Hollis Blanchard

Avi Kivity wrote:
> What about merging kvm_cpu_has_interrupt() into _runnable()?
> 
> My feeling is that we can keep it separated.
On s390 there is a difference between has_interrupt and not runnable: 
CPUs can be in stopped state, and they can be in enabled wait (enabled 
for interrupts, similar to hlt state on x86) or in disabled wait 
state. All those states indicate that the CPU is not runnable.
Interrupts on the other hand are typically floating between all 
virtual CPUs and can be accepted by running CPUs only (that is either 
running, or in enabled wait).

I agree that we should keep it seperated.

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

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

* Re: [PATCH] RFC: Create kvm_arch_vcpu_runnable() function
       [not found]           ` <47566A17.3040802-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
@ 2007-12-05 10:06             ` Avi Kivity
  0 siblings, 0 replies; 6+ messages in thread
From: Avi Kivity @ 2007-12-05 10:06 UTC (permalink / raw)
  To: carsteno-tA70FqPdS9bQT0dZR+AlfA
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Hollis Blanchard

Carsten Otte wrote:
> Avi Kivity wrote:
>   
>> What about merging kvm_cpu_has_interrupt() into _runnable()?
>>
>> My feeling is that we can keep it separated.
>>     
> On s390 there is a difference between has_interrupt and not runnable: 
> CPUs can be in stopped state, and they can be in enabled wait (enabled 
> for interrupts, similar to hlt state on x86) or in disabled wait 
> state. All those states indicate that the CPU is not runnable.
> Interrupts on the other hand are typically floating between all 
> virtual CPUs and can be accepted by running CPUs only (that is either 
> running, or in enabled wait).
>
> I agree that we should keep it seperated.
>   

On x86, running hlt with interrupts disabled is similar to your disabled 
wait.  Interrupts in general are directed towards a specific cpu, though 
older processors supported round-robin or priority based dispatching.  
With extensive caches this is a performance loss, so the feature is not 
missed.

Thanks for the clarification.

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


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

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

* Re: [PATCH] RFC: Create kvm_arch_vcpu_runnable() function
  2007-12-03 22:15 [PATCH] RFC: Create kvm_arch_vcpu_runnable() function Hollis Blanchard
  2007-12-04 13:20 ` Carsten Otte
@ 2007-12-05 10:18 ` Avi Kivity
  1 sibling, 0 replies; 6+ messages in thread
From: Avi Kivity @ 2007-12-05 10:18 UTC (permalink / raw)
  To: Hollis Blanchard
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Hollis Blanchard wrote:
> Signed-off-by: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
>   

Applied, thanks.  Note that there is free advertising space between the 
summary and the signoff that you can use to explain the change.


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


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

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

end of thread, other threads:[~2007-12-05 10:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-03 22:15 [PATCH] RFC: Create kvm_arch_vcpu_runnable() function Hollis Blanchard
2007-12-04 13:20 ` Carsten Otte
     [not found]   ` <47555417.7020103-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2007-12-04 13:53     ` Avi Kivity
     [not found]       ` <47555BD2.1010305-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-12-05  9:06         ` Carsten Otte
     [not found]           ` <47566A17.3040802-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2007-12-05 10:06             ` Avi Kivity
2007-12-05 10:18 ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox