[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/17] exec: flush the whole TLB if a watchpoint crosses a page bo
From: |
Alex Bennée |
Subject: |
[PULL 04/17] exec: flush the whole TLB if a watchpoint crosses a page boundary |
Date: |
Tue, 9 Jun 2020 11:37:56 +0100 |
There is no particular reason why you can't have a watchpoint in TCG
that covers a large chunk of the address space. We could be clever
about it but these cases are pretty rare and we can assume the user
will expect a little performance degradation.
NB: In my testing gdb will silently squash a watchpoint like:
watch (char[0x7fffffffff]) *0x0
to a 4 byte watchpoint. Practically it will limit the maximum size
based on max-value-size. However given enough of a tweak the sky is
the limit.
Reported-by: Alexander Bulekov <alxndr@bu.edu>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200605154929.26910-5-alex.bennee@linaro.org>
diff --git a/exec.c b/exec.c
index be4be2df3a1..a0bf9d61c87 100644
--- a/exec.c
+++ b/exec.c
@@ -1038,6 +1038,7 @@ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr,
vaddr len,
int flags, CPUWatchpoint **watchpoint)
{
CPUWatchpoint *wp;
+ vaddr in_page;
/* forbid ranges which are empty or run off the end of the address space */
if (len == 0 || (addr + len - 1) < addr) {
@@ -1058,7 +1059,12 @@ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr,
vaddr len,
QTAILQ_INSERT_TAIL(&cpu->watchpoints, wp, entry);
}
- tlb_flush_page(cpu, addr);
+ in_page = -(addr | TARGET_PAGE_MASK);
+ if (len <= in_page) {
+ tlb_flush_page(cpu, addr);
+ } else {
+ tlb_flush(cpu);
+ }
if (watchpoint)
*watchpoint = wp;
--
2.20.1
- [PULL 00/17] testing and misc fixes, Alex Bennée, 2020/06/09
- [PULL 01/17] qemu-plugin.h: add missing include <stddef.h> to define size_t, Alex Bennée, 2020/06/09
- [PULL 04/17] exec: flush the whole TLB if a watchpoint crosses a page boundary,
Alex Bennée <=
- [PULL 03/17] tests/plugin: correctly honour io_count, Alex Bennée, 2020/06/09
- [PULL 02/17] scripts/clean-includes: Mark 'qemu/qemu-plugin.h' as special header, Alex Bennée, 2020/06/09
- [PULL 12/17] tests/tcg: add simple commpage test case, Alex Bennée, 2020/06/09
- [PULL 05/17] .travis.yml: allow failure for unreliable hosts, Alex Bennée, 2020/06/09
- [PULL 06/17] .shippable: temporaily disable some cross builds, Alex Bennée, 2020/06/09
- [PULL 09/17] hw/virtio/vhost: re-factor vhost-section and allow DIRTY_MEMORY_CODE, Alex Bennée, 2020/06/09
- [PULL 10/17] linux-user: provide fallback pgd_find_hole for bare chroots, Alex Bennée, 2020/06/09
- [PULL 08/17] docker: update Ubuntu to 20.04, Alex Bennée, 2020/06/09
- [PULL 11/17] linux-user: deal with address wrap for ARM_COMMPAGE on 32 bit, Alex Bennée, 2020/06/09
- [PULL 07/17] tests/docker: fix pre-requisite for debian-tricore-cross, Alex Bennée, 2020/06/09