Philippe Mathieu-Daudé <phi...@linaro.org> writes:

> vCPUs are not really usable until fully realized. Do not attempt
> to commit memory changes in the middle of vCPU realization. Defer
> until realization is completed and vCPU fully operational.
>
> Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
> Reviewed-by: Richard Henderson <richard.hender...@linaro.org>
> ---
>  system/physmem.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/system/physmem.c b/system/physmem.c
> index ff0ca40222d..8b2be31fa7e 100644
> --- a/system/physmem.c
> +++ b/system/physmem.c
> @@ -2792,6 +2792,14 @@ static void tcg_commit(MemoryListener *listener)
>      cpuas = container_of(listener, CPUAddressSpace, tcg_as_listener);
>      cpu = cpuas->cpu;
>  
> +    if (!qdev_is_realized(DEVICE(cpu))) {
> +        /*
> +         * The listener is also called during realize, before
> +         * all of the tcg machinery for run-on is initialized.
> +         */
> +        return;
> +    }
> +

This is a c&p of the wording bellow:

     * That said, the listener is also called during realize, before
     * all of the tcg machinery for run-on is initialized: thus halt_cond.

which is now redundant because of the early exit?


>      /*
>       * Defer changes to as->memory_dispatch until the cpu is quiescent.
>       * Otherwise we race between (1) other cpu threads and (2) ongoing

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro

Reply via email to