[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [kvm-devel] [PATCH v2] kvm-ppc: halt secondary cpus when
From: |
Alexander Graf |
Subject: |
Re: [Qemu-ppc] [kvm-devel] [PATCH v2] kvm-ppc: halt secondary cpus when guest reset |
Date: |
Mon, 9 Jan 2012 23:39:57 +0100 |
On 09.01.2012, at 22:23, Scott Wood wrote:
> On 01/09/2012 01:41 AM, Liu Yu wrote:
>> When guest reset, we need to halt secondary cpus until guest kick them.
>> This already works for tcg. The patch add the support for kvm.
>>
>> There are two cases for kvm:
>>
>> 1. If not use in-kernel mpic. We return env->halted in
>> kvm_arch_process_async_events(), in order to tell kvm common code
>> whether we request to halt.
>>
>> 2. If use in-kernel mpic. Even we request to halt,
>> the common code cpu_thread_is_idle() refuses to halt,
>> because if vcpu halts while use in-kernel mpic, then there's
>> no external interrupt handled in qemu to wake up the vcpu thread.
>> In this case, we set stopped to pause the sencondaries instead,
>> And resume secondaries when primary cpu access ppce500_spin.
>>
>> Signed-off-by: Liu Yu <address@hidden>
>> ---
>> v2:
>> Add comment and modify commit log
>>
>> hw/ppce500_spin.c | 1 +
>> target-ppc/kvm.c | 15 ++++++++++++++-
>> 2 files changed, 15 insertions(+), 1 deletions(-)
>>
>> diff --git a/hw/ppce500_spin.c b/hw/ppce500_spin.c
>> index cccd940..2b52728 100644
>> --- a/hw/ppce500_spin.c
>> +++ b/hw/ppce500_spin.c
>> @@ -112,6 +112,7 @@ static void spin_kick(void *data)
>>
>> env->halted = 0;
>> env->exception_index = -1;
>> + env->stopped = 0;
>> qemu_cpu_kick(env);
>> }
>>
>> diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
>> index 429349f..b7c70e2 100644
>> --- a/target-ppc/kvm.c
>> +++ b/target-ppc/kvm.c
>> @@ -504,7 +504,20 @@ void kvm_arch_post_run(CPUState *env, struct kvm_run
>> *run)
>>
>> int kvm_arch_process_async_events(CPUState *env)
>> {
>> - return 0;
>> + if (kvm_irqchip_in_kernel()) {
>> + if (env->halted == 1 && env->exception_index == EXCP_HLT) {
>> + /* We're here because secondary vcpus are requested to halt
>> + * before get kicked. But it's not allowed to halt vcpu when
>> + * kvm_irqchip_in_kernel() is true. Instead, set stopped=1
>> + * so that vcpu thread can be paused until guest kick them */
>> + env->stopped = 1;
>> + return 1;
>> + } else {
>> + return 0;
>> + }
>> + }
>> +
>> + return env->halted;
>> }
>
> Alex, is there a better way to deal with the IRQ chip issue?
To be honest, I'm not sure what the issue really is.
But x86 does some weird things with an mp_state variable that I have no clue
what it's about. Jan, do you know what's going on here?
Alex
- Re: [Qemu-ppc] [kvm-devel] [PATCH v2] kvm-ppc: halt secondary cpus when guest reset,
Alexander Graf <=
- Re: [Qemu-ppc] [kvm-devel] [PATCH v2] kvm-ppc: halt secondary cpus when guest reset, Scott Wood, 2012/01/09
- Re: [Qemu-ppc] [kvm-devel] [PATCH v2] kvm-ppc: halt secondary cpus when guest reset, Jan Kiszka, 2012/01/10
- Re: [Qemu-ppc] [kvm-devel] [PATCH v2] kvm-ppc: halt secondary cpus when guest reset, Scott Wood, 2012/01/10
- Re: [Qemu-ppc] [kvm-devel] [PATCH v2] kvm-ppc: halt secondary cpus when guest reset, Jan Kiszka, 2012/01/10
- Re: [Qemu-ppc] [kvm-devel] [PATCH v2] kvm-ppc: halt secondary cpus when guest reset, Alexander Graf, 2012/01/10
- Re: [Qemu-ppc] [kvm-devel] [PATCH v2] kvm-ppc: halt secondary cpus when guest reset, Scott Wood, 2012/01/10
- Re: [Qemu-ppc] [kvm-devel] [PATCH v2] kvm-ppc: halt secondary cpus when guest reset, Alexander Graf, 2012/01/10