qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: Max Filippov <jcmvbkbc@gmail.com>,
	Richard Henderson <rth@twiddle.net>,
	qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 1/2] exec: flush CPU TB cache in breakpoint_invalidate
Date: Tue, 03 Dec 2019 11:16:59 +0000	[thread overview]
Message-ID: <87immxbqvo.fsf@linaro.org> (raw)
In-Reply-To: <3c02ba4a-11fe-4d6a-e6d9-f1d164528d85@linaro.org>


Richard Henderson <richard.henderson@linaro.org> writes:

> On 11/27/19 10:06 PM, Max Filippov wrote:
>> 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.
>> 
>> Flush entire CPU TB cache in breakpoint_invalidate to force
>> re-translation of all TBs for the breakpoint address.
>> 
>> This change fixes the following scenario:
>> - 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>
>> ---
>> Changes RFC->v1:
>> - do tb_flush in breakpoint_invalidate unconditionally
>
> Unlike Paolo, I don't think this is a good idea.

We previously had a general tb_flush during the MTTCG implementation as
a temporary fix. It was changed back in 406bc339b0 and it would be nice
to minimise the flushing of code if we can. While most interactive users
aren't going to notice the temporary slow down it would suck for any
automated gdb scripting.

>
> If I was going to change anything here, I'd change this to not use
> cpu_get_phys_page_attrs_debug but using the caching available from the actual
> cputlb, using cc->tlb_fill() in probe mode -- something akin to probe_access(),
> but not returning a host address, nor handling watchpoints nor notdirty.
>
> This would help flushing too much by distinguishing different tbs for the same
> virtual address mapping to a different physical address.
>
>
> r~


-- 
Alex Bennée


  reply	other threads:[~2019-12-03 11:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-27 22:06 [PATCH 0/2] flush CPU TB cache in breakpoint_invalidate Max Filippov
2019-11-27 22:06 ` [PATCH 1/2] exec: " Max Filippov
2019-12-01 23:48   ` Richard Henderson
2019-12-03 11:16     ` Alex Bennée [this message]
2020-02-05 11:00   ` Richard Henderson
2020-02-05 21:14     ` Max Filippov
2019-11-27 22:06 ` [PATCH 2/2] exec: drop tb_invalidate_phys_addr Max Filippov
2019-12-01 23:53   ` 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=87immxbqvo.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=jcmvbkbc@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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).