qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "QEMU Developers" <qemu-devel@nongnu.org>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Phil Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: 'make check-tcg' fails with an assert in qemu_plugin_vcpu_init_hook
Date: Wed, 21 Jun 2023 10:55:51 +0100	[thread overview]
Message-ID: <87y1kdgmo8.fsf@linaro.org> (raw)
In-Reply-To: <CAFEAcA9JuKBZSjq6WaztNA74CU1g+b=5GQFO0KPqb2RzT3LcWg@mail.gmail.com>


Peter Maydell <peter.maydell@linaro.org> writes:

> On Wed, 21 Jun 2023 at 09:05, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>>
>> Peter Maydell <peter.maydell@linaro.org> writes:
>>
>> > On Tue, 20 Jun 2023 at 17:56, Peter Maydell <peter.maydell@linaro.org> wrote:
>> >>
>> >> $ make -C build/x86 check-tcg
>> >> make: Entering directory '/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/x86'
>> >> [...]
>> >>   TEST    munmap-pthread on arm
>> >> **
>> >> ERROR:../../plugins/core.c:221:qemu_plugin_vcpu_init_hook: assertion
>> >> failed: (success)
>> >> **
>> >> ERROR:../../accel/tcg/cpu-exec.c:1024:cpu_exec_setjmp: assertion
>> >> failed: (cpu == current_cpu)
>> >
>> > git bisect blames commit d7ee93e2435970:
>> >
>> >     cputlb: Restrict SavedIOTLB to system emulation
>> >
>> > I think that commit is not correct, because it means that
>> > the size of 'struct CPUState' and also the offset of fields
>> > like 'cpu_index' will be different for files which are
>> > compile-per-target-for-usermode and files which are
>> > compile-once-only. The assert happens here because the
>> > code which sets up cpu_index is build-once, but the code
>> > in qemu_plugin_vcpu_init_hook() which reads cpu_index is
>> > build-per-target and now they don't agree about where in
>> > the struct the field is...
>>
>> Hmm two things from that imply:
>>
>>   - I suspect the plugin core stuff could be build once (or maybe twice,
>>     system and user)
>
> It is already build-once, that's why it goes wrong...

I thought it was the other way around:

  specific_ss.add(when: 'CONFIG_PLUGIN', if_true: [files(
    'loader.c',
    'core.c',
    'api.c',
  ), declare_dependency(link_args: plugin_ldflags)])

but if we built it for linux-user and softmmu this could be fixed (until
the next breakage anyway). cpus-common.c is the common code that sets
this once.

>>   - we need to have some guard rails somehow to make sure things don't
>>     go out of sync
>
> We do, this is the poison.h stuff. CONFIG_USER_ONLY is a
> special case which we don't poison because there would be
> too much refactoring required...

I guess a great big honking comment at the top of CPUState telling
people not to do that or pushing softmmu and user specific bits of
CPUState into their own de-referenced structures.

>
> -- PMM


-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  reply	other threads:[~2023-06-21 10:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 16:56 'make check-tcg' fails with an assert in qemu_plugin_vcpu_init_hook Peter Maydell
2023-06-20 17:00 ` Richard Henderson
2023-06-20 17:47 ` Peter Maydell
2023-06-21  8:03   ` Alex Bennée
2023-06-21  8:53     ` Peter Maydell
2023-06-21  9:55       ` Alex Bennée [this message]
2023-06-21 19:23         ` Peter Maydell
2023-06-21  9:55       ` Philippe Mathieu-Daudé

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=87y1kdgmo8.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@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).