From: Aaron Lindsay via <qemu-devel@nongnu.org>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-devel@nongnu.org, "Emilio G. Cota" <cota@braap.org>,
Richard Henderson <richard.henderson@linaro.org>
Subject: Re: Plugin Memory Callback Debugging
Date: Tue, 22 Nov 2022 12:05:02 -0500 [thread overview]
Message-ID: <Y30BPtRgqSlLvtGk@strawberry.localdomain> (raw)
In-Reply-To: <87wn7oarhw.fsf@linaro.org>
On Nov 21 22:02, Alex Bennée wrote:
>
> Aaron Lindsay <aaron@os.amperecomputing.com> writes:
>
> > Sorry, left off the very end of my timeline:
> >
> > On Nov 18 16:58, Aaron Lindsay wrote:
> >> I have, so far, discovered the following timeline:
> >> 1. My plugin receives a instruction execution callback for a load
> >> instruction. At this time, cpu->plugin_mem_cbs points to the same
> >> memory which will later be freed
> >> 2. During the handling of this callback, my plugin calls
> >qemu_plugin_reset()
>
> The final plugin reset should only execute in the safe async context
> (i.e. no other vCPUs running code). That flushes all current generated
> code.
>
> >> 3. Ostensibly something goes wrong here with the cleanup of
> >> cpu->plugin_mem_cbs???
>
> This may be missed by the reset path (hence your patch) but it should be
> being reset every instruction we instrument.
>
> >> 4. Step 2 triggers the TBs to be flushed, which frees the memory pointed
> >> to by cpu->plugin_mem_cbs
> >
> > 5. A store exclusive instruction is translated and then executed, which
> > requires the use of a helper. When executed, this helper checks
> > cpu->plugin_mem_cbs, which is non-null, so it attempts to dereference
> > and use it, resulting in the assertion.
>
> It should be being reset for each instruction I think.
FYI - I suspect my above presentation of the problem suffered from the
"searching where the streetlamp is instead of where you lost something"
problem. In other words, I did/do observe the error at reset, but I now
believe that is merely where it is easiest to observe. The
cpu->plugin_mem_cbs doesn't appear to be reset at the end of
instructions and manifests at reset because that's when the underlying
memory is freed.
-Aaron
next prev parent reply other threads:[~2022-11-22 17:05 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 22:05 Plugin Memory Callback Debugging Aaron Lindsay
2022-11-15 22:36 ` Alex Bennée
2022-11-18 21:58 ` Aaron Lindsay via
2022-11-18 22:02 ` Aaron Lindsay
2022-11-21 22:02 ` Alex Bennée
2022-11-22 17:05 ` Aaron Lindsay via [this message]
2022-11-21 20:18 ` Aaron Lindsay via
2022-11-21 21:51 ` Alex Bennée
2022-11-22 2:22 ` Richard Henderson
2022-11-22 15:57 ` Aaron Lindsay via
2022-11-29 20:37 ` Aaron Lindsay via
2022-12-01 19:32 ` Alex Bennée
2022-12-18 5:24 ` Emilio Cota
2022-12-19 20:11 ` Aaron Lindsay
2023-01-06 10:30 ` Alex Bennée
2023-01-07 3:07 ` Emilio Cota
2022-11-16 6:19 ` Emilio Cota
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=Y30BPtRgqSlLvtGk@strawberry.localdomain \
--to=qemu-devel@nongnu.org \
--cc=aaron@os.amperecomputing.com \
--cc=alex.bennee@linaro.org \
--cc=cota@braap.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).