qemu-kvm: Fix segfault on -no-kvm startup
PATCH 1/1 qemu-kvm: Fix segfault on -no-kvm startup
The check for in-kernel irqchip must be protected by kvm_enabled, and we have a different wrapper for it.
---
hw/apic.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
hw/apic.c +2 -1
@@ -509,9 +509,10 @@ void apic_init_reset(CPUState *env) env->halted = !(s->apicbase &MSR_IA32_APICBASE_BSP );#ifdef KVM_CAP_MP_STATE -if (kvm_irqchip_in_kernel (kvm_context)) +if (kvm_enabled () &&qemu_kvm_irqchip_in_kernel ()) { env->mp_state = env->halted ?KVM_MP_STATE_UNINITIALIZED :KVM_MP_STATE_RUNNABLE ; + }#endif }
Quoted 3 lines · Jan Kiszka
The check for in-kernel irqchip must be protected by
kvm_enabled, and we have a different wrapper for it.
Why not move kvm_enabled() into kvm_irqchip_in_kernel()? It will return false if !kvm_enabled().
Quoted 23 lines
Signed-off-by Jan Kiszka <[email protected]>---
hw/apic.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)hw/apic.c +2
-2@@ -509,9 +509,10 @@ void apic_init_reset(CPUState *env) env->halted = !(s->apicbase &MSR_IA32_APICBASE_BSP );#ifdef KVM_CAP_MP_STATE -if (kvm_irqchip_in_kernel (kvm_context)) +if (kvm_enabled () &&qemu_kvm_irqchip_in_kernel ()) { env->mp_state = env->halted ?KVM_MP_STATE_UNINITIALIZED :KVM_MP_STATE_RUNNABLE ; + }#endif } --
Quoted 3 lines
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Gleb.
Quoted 6 lines · Gleb Natapov
Quoted 3 lines · Jan Kiszka
The check for in-kernel irqchip must be protected by
kvm_enabled, and we have a different wrapper for it.Why not move
kvm_enabled()intokvm_irqchip_in_kernel()? It will return false if !kvm_enabled().
Yes, possible. But I'm not sure if it's worth to refactor at this level.
I think the whole irqchip interface has to go through some broader refactoring when pushing it upstream. The result should either be a specific, in-kernel-irqchip apic device or generic wrapper services that cover all cases, is easily compiled away in the absence of KVM and avoid #ifdefs like below.
Jan
Quoted 23 lines
Quoted 23 lines
Signed-off-by Jan Kiszka <[email protected]>---
hw/apic.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)hw/apic.c +2
-1@@ -509,9 +509,10 @@ void apic_init_reset(CPUState *env) env->halted = !(s->apicbase &MSR_IA32_APICBASE_BSP );#ifdef KVM_CAP_MP_STATE -if (kvm_irqchip_in_kernel (kvm_context)) +if (kvm_enabled () &&qemu_kvm_irqchip_in_kernel ()) { env->mp_state = env->halted ?KVM_MP_STATE_UNINITIALIZED :KVM_MP_STATE_RUNNABLE ; + }#endif }
Avi Kivity
AppliedQuoted 4 lines · Jan Kiszka
The check for in-kernel irqchip must be protected by
kvm_enabled, and we have a different wrapper for it.
Applied, thanks.
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
Quoted 4 lines · Jan Kiszka
Quoted 2 lines · Gleb Natapov
On Fri, Sep 25, 2009 at 06:05:49PM +0200, Jan Kiszka wrote:
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
The check for in-kernel irqchip must be protected by
kvm_enabled, and we have a different wrapper for it.Why not move
kvm_enabled()intokvm_irqchip_in_kernel()? It will return false if !kvm_enabled().Yes, possible. But I'm not sure if it's worth to refactor at this level.
In any case, fix bugs first, refactor later.
Quoted 6 lines
I think the whole irqchip interface has to go through some broader refactoring when pushing it upstream. The result should either be a specific, in-kernel-irqchip apic device or generic wrapper services that cover all cases, is easily compiled away in the absence of KVM and avoid #ifdefs like below.
s/when/before/
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.