public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] do not use extra env field.
@ 2008-06-06  2:36 Glauber Costa
  2008-06-09 16:02 ` Avi Kivity
  0 siblings, 1 reply; 4+ messages in thread
From: Glauber Costa @ 2008-06-06  2:36 UTC (permalink / raw)
  To: kvm; +Cc: glommer, avi

There's no need to polute the already poluted CPUState
with "ready_for_interrupt_injection". We can compute it
in the few times we use it, and be fine.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 qemu/qemu-kvm-powerpc.c      |    4 +---
 qemu/qemu-kvm-x86.c          |    4 +---
 qemu/qemu-kvm.c              |    1 -
 qemu/target-i386/cpu.h       |    1 -
 qemu/target-ia64/cpu.h       |    2 --
 qemu/target-ia64/op_helper.c |    1 -
 qemu/target-ppc/cpu.h        |    2 --
 7 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/qemu/qemu-kvm-powerpc.c b/qemu/qemu-kvm-powerpc.c
index 024b18c..553c27f 100644
--- a/qemu/qemu-kvm-powerpc.c
+++ b/qemu/qemu-kvm-powerpc.c
@@ -150,8 +150,6 @@ void kvm_arch_post_kvm_run(void *opaque, int vcpu)
 {
     CPUState *env = qemu_kvm_cpu_env(vcpu);
     cpu_single_env = env;
-    env->ready_for_interrupt_injection = \
-	kvm_is_ready_for_interrupt_injection(kvm_context, vcpu);
 }
 
 int kvm_arch_has_work(CPUState *env)
@@ -170,7 +168,7 @@ int kvm_arch_try_push_interrupts(void *opaque)
 
     /* PowerPC Qemu tracks the various core input pins (interrupt, critical
      * interrupt, reset, etc) in PPC-specific env->irq_input_state. */
-    if (env->ready_for_interrupt_injection &&
+    if (kvm_is_ready_for_interrupt_injection(kvm_context, env->cpu_index) &&
         (env->irq_input_state & (1<<PPC40x_INPUT_INT)))
        {
             /* For now KVM disregards the 'irq' argument. However, in the
diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
index 5e43a44..5daedd1 100644
--- a/qemu/qemu-kvm-x86.c
+++ b/qemu/qemu-kvm-x86.c
@@ -620,8 +620,6 @@ void kvm_arch_post_kvm_run(void *opaque, int vcpu)
 
     env->eflags = kvm_get_interrupt_flag(kvm_context, vcpu)
 	? env->eflags | IF_MASK : env->eflags & ~IF_MASK;
-    env->ready_for_interrupt_injection
-	= kvm_is_ready_for_interrupt_injection(kvm_context, vcpu);
 
     cpu_set_apic_tpr(env, kvm_get_cr8(kvm_context, vcpu));
     cpu_set_apic_base(env, kvm_get_apic_base(kvm_context, vcpu));
@@ -640,7 +638,7 @@ int kvm_arch_try_push_interrupts(void *opaque)
     CPUState *env = cpu_single_env;
     int r, irq;
 
-    if (env->ready_for_interrupt_injection &&
+    if (kvm_is_ready_for_interrupt_injection(kvm_context, env->cpu_index) &&
         (env->interrupt_request & CPU_INTERRUPT_HARD) &&
         (env->eflags & IF_MASK)) {
             env->interrupt_request &= ~CPU_INTERRUPT_HARD;
diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index 119303e..553875b 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -387,7 +387,6 @@ static int kvm_main_loop_cpu(CPUState *env)
 	env->halted = 0;
 
     kvm_qemu_init_env(env);
-    env->ready_for_interrupt_injection = 1;
 #ifdef TARGET_I386
     kvm_tpr_vcpu_start(env);
 #endif
diff --git a/qemu/target-i386/cpu.h b/qemu/target-i386/cpu.h
index 8efc2f4..0cfe730 100644
--- a/qemu/target-i386/cpu.h
+++ b/qemu/target-i386/cpu.h
@@ -566,7 +566,6 @@ typedef struct CPUX86State {
 #endif
 
     uint64_t tsc; /* time stamp counter */
-    uint8_t ready_for_interrupt_injection;
     uint64_t pat;
 
     /* exception/interrupt handling */
diff --git a/qemu/target-ia64/cpu.h b/qemu/target-ia64/cpu.h
index 97358ee..f8e5e8a 100644
--- a/qemu/target-ia64/cpu.h
+++ b/qemu/target-ia64/cpu.h
@@ -51,8 +51,6 @@ typedef struct CPUIA64State {
    int user_mode_only;
    uint32_t hflags;
 
-    uint8_t ready_for_interrupt_injection;
-
 } CPUIA64State;
 
 #define CPUState CPUIA64State
diff --git a/qemu/target-ia64/op_helper.c b/qemu/target-ia64/op_helper.c
index 4969ef7..f582023 100644
--- a/qemu/target-ia64/op_helper.c
+++ b/qemu/target-ia64/op_helper.c
@@ -36,7 +36,6 @@ CPUState *cpu_ia64_init(char *cpu_model){
     cpu_reset(env);
     if (kvm_enabled()) {
 	kvm_qemu_init_env(env);
-	env->ready_for_interrupt_injection = 1;
 	kvm_init_new_ap(env->cpu_index, env);
     }
     return env;
diff --git a/qemu/target-ppc/cpu.h b/qemu/target-ppc/cpu.h
index 029d1f3..6d98738 100644
--- a/qemu/target-ppc/cpu.h
+++ b/qemu/target-ppc/cpu.h
@@ -574,8 +574,6 @@ struct CPUPPCState {
     /* temporary general purpose registers */
     ppc_gpr_t tgpr[4]; /* Used to speed-up TLB assist handlers */
 
-    uint8_t ready_for_interrupt_injection;
-
     /* Floating point execution context */
     /* temporary float registers */
     float64 ft0;
-- 
1.5.4.5


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

* Re: [PATCH] do not use extra env field.
  2008-06-06  2:36 [PATCH] do not use extra env field Glauber Costa
@ 2008-06-09 16:02 ` Avi Kivity
  2008-06-11  3:26   ` Xu, Anthony
  0 siblings, 1 reply; 4+ messages in thread
From: Avi Kivity @ 2008-06-09 16:02 UTC (permalink / raw)
  To: Glauber Costa, Xu, Anthony, Zhang, Xiantao; +Cc: kvm, glommer

Glauber Costa wrote:
> There's no need to polute the already poluted CPUState
> with "ready_for_interrupt_injection". We can compute it
> in the few times we use it, and be fine.
>   

>  #define CPUState CPUIA64State
> diff --git a/qemu/target-ia64/op_helper.c b/qemu/target-ia64/op_helper.c
> index 4969ef7..f582023 100644
> --- a/qemu/target-ia64/op_helper.c
> +++ b/qemu/target-ia64/op_helper.c
> @@ -36,7 +36,6 @@ CPUState *cpu_ia64_init(char *cpu_model){
>      cpu_reset(env);
>      if (kvm_enabled()) {
>  	kvm_qemu_init_env(env);
> -	env->ready_for_interrupt_injection = 1;
>  	kvm_init_new_ap(env->cpu_index, env);
>      }
>      return env;
>   

This bit means that this patch is not an identity transformation.  
Anthony/Xiantao, can you confirm that this patch is safe for ia64?

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


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

* RE: [PATCH] do not use extra env field.
  2008-06-09 16:02 ` Avi Kivity
@ 2008-06-11  3:26   ` Xu, Anthony
  2008-06-12 12:55     ` Avi Kivity
  0 siblings, 1 reply; 4+ messages in thread
From: Xu, Anthony @ 2008-06-11  3:26 UTC (permalink / raw)
  To: Avi Kivity, Glauber Costa, Zhang, Xiantao; +Cc: kvm, glommer

Avi Kivity wrote:
> Glauber Costa wrote:
>> There's no need to polute the already poluted CPUState
>> with "ready_for_interrupt_injection". We can compute it
>> in the few times we use it, and be fine.
>> 
> 
>>  #define CPUState CPUIA64State
>> diff --git a/qemu/target-ia64/op_helper.c
>> b/qemu/target-ia64/op_helper.c index 4969ef7..f582023 100644 ---
>> a/qemu/target-ia64/op_helper.c +++ b/qemu/target-ia64/op_helper.c
>> @@ -36,7 +36,6 @@ CPUState *cpu_ia64_init(char *cpu_model){     
>>      cpu_reset(env); if (kvm_enabled()) {
>>  	kvm_qemu_init_env(env);
>> -	env->ready_for_interrupt_injection = 1;
>>  	kvm_init_new_ap(env->cpu_index, env);
>>      }
>>      return env;
>> 
> 
> This bit means that this patch is not an identity transformation.
> Anthony/Xiantao, can you confirm that this patch is safe for ia64?

Give a simple test
This patch is safe for ia64.

Anthony

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

* Re: [PATCH] do not use extra env field.
  2008-06-11  3:26   ` Xu, Anthony
@ 2008-06-12 12:55     ` Avi Kivity
  0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2008-06-12 12:55 UTC (permalink / raw)
  To: Xu, Anthony; +Cc: Glauber Costa, Zhang, Xiantao, kvm, glommer

Xu, Anthony wrote:
>> Glauber Costa wrote:
>>     
>>> There's no need to polute the already poluted CPUState
>>> with "ready_for_interrupt_injection". We can compute it
>>> in the few times we use it, and be fine.
>>>       
> Give a simple test
> This patch is safe for ia64.
>   

Thanks, I applied the patch.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


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

end of thread, other threads:[~2008-06-12 12:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-06  2:36 [PATCH] do not use extra env field Glauber Costa
2008-06-09 16:02 ` Avi Kivity
2008-06-11  3:26   ` Xu, Anthony
2008-06-12 12:55     ` Avi Kivity

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