From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>,
Laurent Vivier <laurent@vivier.eu>
Cc: Eduardo Habkost <ehabkost@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Aleksandar Markovic <amarkovic@wavecomp.com>,
Michael Walle <michael@walle.cc>,
Paolo Bonzini <pbonzini@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>,
Aurelien Jarno <aurelien@aurel32.net>,
Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Subject: Re: [PATCH 2/2] cpu: Assert a vCPU is created before resetting it
Date: Mon, 9 Mar 2020 16:30:30 +0100 [thread overview]
Message-ID: <630fc27e-6a37-b31c-a0f8-5d850fd42e2a@redhat.com> (raw)
In-Reply-To: <CAFEAcA9LcTUmBuzsHmOSPKOfiyfPy0+gPhKpQdd91EV76HapxA@mail.gmail.com>
On 3/9/20 2:10 PM, Peter Maydell wrote:
> On Mon, 9 Mar 2020 at 12:11, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>>
>> cpu_reset() might modify architecture-specific fields allocated
>> by qemu_init_vcpu(). To avoid bugs similar to the one fixed in
>> commit 00d0f7cb66 when introducing new architectures, assert a
>> vCPU is created before resetting it.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> hw/core/cpu.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/hw/core/cpu.c b/hw/core/cpu.c
>> index fe65ca62ac..09e49f8d6a 100644
>> --- a/hw/core/cpu.c
>> +++ b/hw/core/cpu.c
>> @@ -251,6 +251,7 @@ void cpu_reset(CPUState *cpu)
>> {
>> CPUClass *klass = CPU_GET_CLASS(cpu);
>>
>> + assert(cpu->created);
>> if (klass->reset != NULL) {
>> (*klass->reset)(cpu);
>> }
>
> This will conflict with the change to use DeviceClass::reset.
>
> Ideally we should do an equivalent assert in the DeviceClass
> (and flush out all the bugs where we forgot to realize the
> device before using it).
OK (I should have sent as RFC probably).
Anyway this fails the ppc64le/s390x linux-user tests on Travis-CI:
qemu-ppc64le: hw/core/cpu.c:254: cpu_reset: Assertion `cpu->created' failed.
qemu-s390x: hw/core/cpu.c:254: cpu_reset: Assertion `cpu->created' failed.
>
> thanks
> -- PMM
>
prev parent reply other threads:[~2020-03-09 15:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-09 12:11 [PATCH 0/2] cpu: Avoid latent bug calling cpu_reset() on uninitialized vCPU Philippe Mathieu-Daudé
2020-03-09 12:11 ` [PATCH 1/2] cpu: Do not reset a vCPU before it is created Philippe Mathieu-Daudé
2020-03-09 13:08 ` Laurent Vivier
2020-03-09 13:09 ` Peter Maydell
2020-03-09 13:13 ` Laurent Vivier
2020-03-09 13:18 ` Peter Maydell
2020-03-09 13:28 ` Laurent Vivier
2020-03-09 12:11 ` [PATCH 2/2] cpu: Assert a vCPU is created before resetting it Philippe Mathieu-Daudé
2020-03-09 13:10 ` Peter Maydell
2020-03-09 15:30 ` Philippe Mathieu-Daudé [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=630fc27e-6a37-b31c-a0f8-5d850fd42e2a@redhat.com \
--to=philmd@redhat.com \
--cc=aleksandar.rikalo@rt-rk.com \
--cc=amarkovic@wavecomp.com \
--cc=aurelien@aurel32.net \
--cc=edgar.iglesias@gmail.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=kbastian@mail.uni-paderborn.de \
--cc=laurent@vivier.eu \
--cc=michael@walle.cc \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).