All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Aaron Lindsay <aaron@os.amperecomputing.com>
Cc: cota@braap.org, richard.henderson@linaro.org, qemu-devel@nongnu.org
Subject: Re: Detecting Faulting Instructions From Plugins
Date: Mon, 01 Feb 2021 12:07:13 +0000	[thread overview]
Message-ID: <87zh0ougis.fsf@linaro.org> (raw)
In-Reply-To: <YBWrpHUgLqY/h6Da@tahini.localdomain>


Aaron Lindsay <aaron@os.amperecomputing.com> writes:

> On Jan 29 22:23, Aaron Lindsay wrote:
>> 1. Is this considered a bug or a "feature"?
>> 2.a. If a bug, is there a good way to detect this from inside the
>> 	 tcg/plugin infrastructure and avoid calling the callback for the
>> 	 faulting execution of the instruction?
>> 2.b. If a "feature", is there a good way to detect this from my plugin?
>
> I think I've convinced myself the current behavior *is* a "feature", and
> working as intended since the instruction can be considered
> architecturally committed, even if it faults (ARM statement).

Yes I think that's correct. I assume in between the page-fault handler
has run and ensured the page is properly mapped and then returned to
*re*-execute the instruction.

> But I am
> still unsure of the best way to detect whether a load/store instruction
> has faulted from within the plugin interface, so I welcome thoughts
> there.

A hacky method would be to:

  a) track last executed PC on a per-vCPU basis in the callbacks for
  load/store
  b) have a specific callback handler for the head of the vector table
  for synchronous exceptions.

It wouldn't be ideal because you need some knowledge of where the table
is and depending on the architecture the entry may be shared between
synchronous (i.e. the last instruction that attempted to execute) and
asynchronous ones (e.g. a timer just happened to fire).

If we get to the point we can expose the register values to the plugin
then it becomes a much simpler operation because there will be state
information exposed somewhere in the register state.

>
> -Aaron


-- 
Alex Bennée


  reply	other threads:[~2021-02-01 12:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-30  3:23 Detecting Faulting Instructions From Plugins Aaron Lindsay
2021-01-30 18:55 ` Aaron Lindsay
2021-02-01 12:07   ` Alex Bennée [this message]
2021-02-04 21:31 ` Aaron Lindsay
2021-02-05 11:19   ` Alex Bennée
2021-02-05 14:26     ` Aaron Lindsay via
2021-02-05 15:03       ` Alex Bennée
2021-02-05 15:33         ` Aaron Lindsay via
2021-02-05 15:42         ` Aaron Lindsay via
2021-02-05 16:41           ` Alex Bennée
2021-02-11 17:27           ` Alex Bennée
2021-02-11 18:35             ` Aaron Lindsay via

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=87zh0ougis.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=aaron@os.amperecomputing.com \
    --cc=cota@braap.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.