do not use extra env field.
PATCH 1/1 do not use extra env field.
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.
--- 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(-)
qemu/qemu-kvm-powerpc.c +1 -3
@@ -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
qemu/qemu-kvm-x86.c +1 -3
@@ -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 ;
qemu/qemu-kvm.c +0 -1
@@ -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
qemu/target-i386/cpu.h +0 -1
@@ -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 */
qemu/target-ia64/cpu.h +0 -2
@@ -51,8 +51,6 @@ typedef struct CPUIA64State {int user_mode_only;uint32_t hflags; -uint8_t ready_for_interrupt_injection; - } CPUIA64State;#define CPUState CPUIA64State
qemu/target-ia64/op_helper.c +0 -1
@@ -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;
qemu/target-ppc/cpu.h +0 -2
@@ -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;
Signature · 1 line
1.5.4.5
Quoted 12 lines · Glauber Costa
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
qemu/target-ia64/op_helper.c +0
-0
qemu/target-ia64/op_helper.c CPUState *cpu_ia64_init(char *cpu_model){ · line 41
Quoted 7 lines
qemu/target-ia64/op_helper.c +0
-1@@ -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?
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
Quoted 6 lines · Avi Kivity
Quoted 4 lines · Glauber Costa
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.
Quoted 15 lines
qemu/target-ia64/op_helper.c CPUState *cpu_ia64_init(char *cpu_model){ · line 41
Quoted 12 lines
#define CPUState CPUIA64State
(quoted diff) +0
-0
b/qemu/target-ia64/op_helper.cindex 4969ef7..f582023 100644 ---a/qemu/target-ia64/op_helper.c+++b/qemu/target-ia64/op_helper.cqemu/target-ia64/op_helper.c +0
-1@@ -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
Quoted 9 lines · Anthony
Quoted 6 lines
Quoted 4 lines · Glauber Costa
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.
Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.