From: David Hildenbrand <david@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: Re: [Qemu-devel] [PATCH 4/6] exec: Factor out cpu_watchpoint_address_matches
Date: Wed, 28 Aug 2019 23:54:56 +0200 [thread overview]
Message-ID: <6ef87901-2088-46b2-1550-cc09c960a455@redhat.com> (raw)
In-Reply-To: <a699d74e-c257-0abb-7680-1bd2038f1c88@linaro.org>
On 28.08.19 23:28, Richard Henderson wrote:
> On 8/26/19 1:41 AM, David Hildenbrand wrote:
>>> - /* Make accesses to pages with watchpoints go via the
>>> - watchpoint trap routines. */
>>> - QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
>>> - if (cpu_watchpoint_address_matches(wp, vaddr, TARGET_PAGE_SIZE)) {
>>> - /* Avoid trapping reads of pages with a write breakpoint. */
>>> - if ((prot & PAGE_WRITE) || (wp->flags & BP_MEM_READ)) {
>>> - iotlb = PHYS_SECTION_WATCH + paddr;
>>> - *address |= TLB_MMIO;
>>> - break;
>> In the old code, we were able to break once we found a hit ...
>>
>>> - }
>>> - }
>>> + /* Avoid trapping reads of pages with a write breakpoint. */
>>> + match = (prot & PAGE_READ ? BP_MEM_READ : 0)
>>> + | (prot & PAGE_WRITE ? BP_MEM_WRITE : 0);
>>> + flags = cpu_watchpoint_address_matches(cpu, vaddr, TARGET_PAGE_SIZE);
>>> + if (flags & match) {
>> ... now you cannot break early anymore. Maybe pass in the match to
>> cpu_watchpoint_address_matches() ?
>
> Hmm, yes, perhaps.
>
> OTOH, summing a bitmask is a very quick operation. Depending on the total
> number of watchpoints, of course...
And for anything that is not a hit, we have to walk all watchpoints
either way, so the speedup would most probably be neglectable.
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2019-08-28 21:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-24 21:34 [Qemu-devel] [PATCH 0/6] exec: Cleanup watchpoints Richard Henderson
2019-08-24 21:34 ` [Qemu-devel] [PATCH 1/6] exec: Move user-only watchpoint stubs inline Richard Henderson
2019-08-26 7:45 ` David Hildenbrand
2019-08-24 21:34 ` [Qemu-devel] [PATCH 2/6] exec: Factor out core logic of check_watchpoint() Richard Henderson
2019-08-24 21:34 ` [Qemu-devel] [PATCH 3/6] cputlb: Fold TLB_RECHECK into TLB_INVALID_MASK Richard Henderson
2019-08-26 8:36 ` David Hildenbrand
2019-08-24 21:34 ` [Qemu-devel] [PATCH 4/6] exec: Factor out cpu_watchpoint_address_matches Richard Henderson
2019-08-26 8:41 ` David Hildenbrand
2019-08-28 21:28 ` Richard Henderson
2019-08-28 21:54 ` David Hildenbrand [this message]
2019-08-24 21:34 ` [Qemu-devel] [PATCH 5/6] cputlb: Handle watchpoints via TLB_WATCHPOINT Richard Henderson
2019-08-28 22:00 ` David Hildenbrand
2019-08-24 21:34 ` [Qemu-devel] [PATCH 6/6] tcg: Check for watchpoints in probe_write() Richard Henderson
2019-08-28 21:47 ` [Qemu-devel] [PATCH 0/6] exec: Cleanup watchpoints 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=6ef87901-2088-46b2-1550-cc09c960a455@redhat.com \
--to=david@redhat.com \
--cc=peter.maydell@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).