[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 09/10] cpu: remove exit_request global.
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [RFC 09/10] cpu: remove exit_request global. |
Date: |
Thu, 29 Jan 2015 15:52:39 +0000 |
On 16 January 2015 at 17:19, <address@hidden> wrote:
> From: KONRAD Frederic <address@hidden>
>
> This removes exit_request global and adds a variable in CPUState for this.
> Only the flag for the first cpu is used for the moment as we are still with
> one
> TCG thread.
> --- a/cpus.c
> +++ b/cpus.c
> @@ -646,10 +646,14 @@ static void cpu_handle_guest_debug(CPUState *cpu)
>
> static void cpu_signal(int sig)
> {
> + CPUState *cpu;
> if (current_cpu) {
> cpu_exit(current_cpu);
> }
> - exit_request = 1;
> +
> + CPU_FOREACH(cpu) {
> + cpu->exit_loop_request = 1;
> + }
> }
You can't do this -- this code is a signal handler so it could
get run at any time including while the list of CPUs is being
updated. (This is why we have the exit_request flag in the
first place rather than just setting the exit_request flag in
each CPU...)
Possibly you want exit_request to be a per-thread variable,
but I haven't thought much about it.
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -249,6 +249,7 @@ struct CPUState {
> bool created;
> bool stop;
> bool stopped;
> + volatile sig_atomic_t exit_loop_request;
> volatile sig_atomic_t exit_request;
> uint32_t interrupt_request;
> int singlestep_enabled;
This would duplicate the exit_request and
exit_loop_request flags in the CPU, which is kind of odd.
-- PMM
- [Qemu-devel] [RFC 00/10] MultiThread TCG., fred . konrad, 2015/01/16
- [Qemu-devel] [RFC 03/10] replace spinlock by QemuMutex., fred . konrad, 2015/01/16
- [Qemu-devel] [RFC 07/10] tcg: remove tcg_halt_cond global variable., fred . konrad, 2015/01/16
- [Qemu-devel] [RFC 08/10] Drop global lock during TCG code execution, fred . konrad, 2015/01/16
- [Qemu-devel] [RFC 01/10] target-arm: protect cpu_exclusive_*., fred . konrad, 2015/01/16
- [Qemu-devel] [RFC 09/10] cpu: remove exit_request global., fred . konrad, 2015/01/16
- Re: [Qemu-devel] [RFC 09/10] cpu: remove exit_request global.,
Peter Maydell <=
- [Qemu-devel] [RFC 05/10] extract TBContext from TCGContext., fred . konrad, 2015/01/16
- [Qemu-devel] [RFC 10/10] tcg: switch on multithread., fred . konrad, 2015/01/16
- [Qemu-devel] [RFC 02/10] use a different translation block list for each cpu., fred . konrad, 2015/01/16
- [Qemu-devel] [RFC 06/10] protect TBContext with tb_lock., fred . konrad, 2015/01/16
- [Qemu-devel] [RFC 04/10] remove unused spinlock., fred . konrad, 2015/01/16