From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: Max Filippov <jcmvbkbc@gmail.com>,
Richard Henderson <rth@twiddle.net>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [RFC] exec: flush CPU TB cache when breakpoint address translation fails
Date: Wed, 27 Nov 2019 19:06:04 +0000 [thread overview]
Message-ID: <87tv6pf8bn.fsf@linaro.org> (raw)
In-Reply-To: <20191126222607.25653-1-jcmvbkbc@gmail.com>
Max Filippov <jcmvbkbc@gmail.com> writes:
> When a breakpoint is inserted at location for which there's currently no
> virtual to physical translation no action is taken on CPU TB cache. If a
> TB for that virtual address already exists but is not visible ATM the
> breakpoint won't be hit next time an instruction at that address will be
> executed.
So the userspace has run once but is currently paged out?
>
> Flush entire CPU TB cache when a breakpoint is set for a virtual address
> that cannot be translated to physical address.
>
> This change fixes the following workflow:
> - linux user application is running
> - a breakpoint is inserted from QEMU gdbstub for a user address that is
> not currently present in the target CPU TLB
> - an instruction at that address is executed, but the external debugger
> doesn't get control.
>
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> ---
> exec.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/exec.c b/exec.c
> index ffdb5185353b..918945f8097e 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1024,6 +1024,8 @@ static void breakpoint_invalidate(CPUState *cpu, target_ulong pc)
> /* Locks grabbed by tb_invalidate_phys_addr */
> tb_invalidate_phys_addr(cpu->cpu_ases[asidx].as,
> phys | (pc & ~TARGET_PAGE_MASK), attrs);
> + } else {
> + tb_flush(cpu);
> }
> }
> #endif
--
Alex Bennée
next prev parent reply other threads:[~2019-11-27 19:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-26 22:26 [RFC] exec: flush CPU TB cache when breakpoint address translation fails Max Filippov
2019-11-27 16:36 ` Paolo Bonzini
2019-11-27 19:06 ` Alex Bennée [this message]
2019-11-27 19:13 ` Max Filippov
2019-12-01 23:35 ` Richard Henderson
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=87tv6pf8bn.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=jcmvbkbc@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).