[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] MTTCG External Halt
From: |
Alistair Francis |
Subject: |
Re: [Qemu-devel] MTTCG External Halt |
Date: |
Wed, 31 Jan 2018 10:17:08 -0800 |
On Wed, Jan 31, 2018 at 9:13 AM, Paolo Bonzini <address@hidden> wrote:
> On 03/01/2018 17:10, Alistair Francis wrote:
>> Hey guys, I'm super stuck with an ugly MTTCG issue and was wondering
>> if anyone had any ideas.
>>
>> In the Xilinx fork of QEMU (based on 2.11) we have a way for CPUs to
>> halt other CPUs. This is used for example when the power control unit
>> halts the ARM A53s. To do this we have internal GPIO signals that end
>> up calling a function that basically does this:
>>
>> To halt:
>> cpu->halted = true;
>> cpu_interrupt(cpu, CPU_INTERRUPT_HALT);
>
> cpu->halted = true should not be needed here. It will be set by
> cpu_handle_interrupt when processing CPU_INTERRUPT_HALT.
>
>> To un-halt
>> cpu->halted = false;
>> cpu_reset_interrupt(cpu, CPU_INTERRUPT_HALT);
>
> cpu->halted = false likewise should not be needed here, but you cannot
> just clear CPU_INTERRUPT_HALT either. You need to set a *different*
> interrupt request bit (the dummy CPU_INTERRUPT_EXITTB will do) and
> cpu_handle_halt will clear cpu->halted.
The problem with that is that I hit this assert for ARM CPUs:
qemu-system-aarch64: ./target/arm/cpu.h:1446: arm_el_is_aa64:
Assertion `el >= 1 && el <= 3' failed.
Alistair
>
> Paolo
>
>> We also have the standard ARM WFI (Wait For Interrupt) implementation
>> in op_helper.c:
>> cs->halted = 1;
>> cs->exception_index = EXCP_HLT;
>> cpu_loop_exit(cs);
>>
>> Before MTTCG this used to work great, but now either we end up with
>> the guest Linux complaining about CPU stalls or we hit:
>> ERROR:/scratch/alistai/master-qemu/cpus.c:1516:qemu_tcg_cpu_thread_fn:
>> assertion failed: (cpu->halted)
>>
>> If I remove the instances of manually setting cpu->halted then I don't
>> see the asserts(), but the the WFI instruction doesn't work correctly.
>> So it seems like setting the halted status externally from the CPU
>> causes the issue. I have tried setting it inside a lock, using atomic
>> operations and running the setter async on the CPU, but nothing works.
>>
>> Any chance any one has some insight into a way to externally set a
>> vCPU as halted/un-halted?
>>
>> Thanks,
>> Alistair
>>
>
Re: [Qemu-devel] MTTCG External Halt, Paolo Bonzini, 2018/01/31
- Re: [Qemu-devel] MTTCG External Halt,
Alistair Francis <=
- Re: [Qemu-devel] MTTCG External Halt, Peter Maydell, 2018/01/31
- Re: [Qemu-devel] MTTCG External Halt, Alistair Francis, 2018/01/31
- Re: [Qemu-devel] MTTCG External Halt, Alistair Francis, 2018/01/31
- Re: [Qemu-devel] MTTCG External Halt, Peter Maydell, 2018/01/31
- Re: [Qemu-devel] MTTCG External Halt, Alistair Francis, 2018/01/31