From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: fam@euphon.net, berrange@redhat.com, stefanha@redhat.com,
crosa@redhat.com,
"Richard Henderson" <richard.henderson@linaro.org>,
aaron@os.amperecomputing.com, robhenry@microsoft.com,
f4bug@amsat.org, mahmoudabdalghany@outlook.com, minyihh@uci.edu,
cota@braap.org, Luke.Craig@ll.mit.edu, pbonzini@redhat.com,
kuhn.chenqun@huawei.com, ma.mandourr@gmail.com,
"Alex Bennée" <alex.bennee@linaro.org>,
aurelien@aurel32.net
Subject: [PATCH v1 09/15] cputlb: add tracepoints for the protect/unprotect helpers
Date: Fri, 8 Apr 2022 17:47:36 +0100 [thread overview]
Message-ID: <20220408164742.2844631-10-alex.bennee@linaro.org> (raw)
In-Reply-To: <20220408164742.2844631-1-alex.bennee@linaro.org>
This helps track when pages are tagged for detecting code changes.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
accel/tcg/cputlb.c | 14 ++++++++++----
accel/tcg/trace-events | 3 +++
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index 35797cea49..f2983cb2fc 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -947,18 +947,24 @@ void tlb_flush_page_bits_by_mmuidx_all_cpus_synced(CPUState *src_cpu,
idxmap, bits);
}
-/* update the TLBs so that writes to code in the virtual page 'addr'
- can be detected */
+/*
+ * Update the TLBs so that writes to code in the virtual page 'ram_addr'
+ * can be detected.
+ */
void tlb_protect_code(ram_addr_t ram_addr)
{
+ trace_tlb_protect_code(ram_addr);
cpu_physical_memory_test_and_clear_dirty(ram_addr, TARGET_PAGE_SIZE,
DIRTY_MEMORY_CODE);
}
-/* update the TLB so that writes in physical page 'phys_addr' are no longer
- tested for self modifying code */
+/*
+ * Update the TLB so that writes in physical page 'ram_addr' are no longer
+ * tested for self modifying code
+ */
void tlb_unprotect_code(ram_addr_t ram_addr)
{
+ trace_tlb_unprotect_code(ram_addr);
cpu_physical_memory_set_dirty_flag(ram_addr, DIRTY_MEMORY_CODE);
}
diff --git a/accel/tcg/trace-events b/accel/tcg/trace-events
index f4d1321b1b..e11e59492f 100644
--- a/accel/tcg/trace-events
+++ b/accel/tcg/trace-events
@@ -7,6 +7,9 @@ exec_tb_nocache(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
exec_tb_exit(void *last_tb, unsigned int flags) "tb:%p flags=0x%x"
# cputlb.c
+tlb_protect_code(uint64_t ram_addr) "0x%" PRIx64""
+tlb_unprotect_code(uint64_t ram_addr) "0x%" PRIx64""
+
memory_notdirty_write_access(uint64_t vaddr, uint64_t ram_addr, unsigned size) "0x%" PRIx64 " ram_addr 0x%" PRIx64 " size %u"
memory_notdirty_set_dirty(uint64_t vaddr) "0x%" PRIx64
--
2.30.2
next prev parent reply other threads:[~2022-04-08 17:00 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-08 16:47 [PATCH v1 00/15] testing, docs, tracepoints and cputlb hacks Alex Bennée
2022-04-08 16:47 ` [PATCH v1 01/15] tests/avocado: update aarch64_virt test to exercise -cpu max Alex Bennée
2022-04-08 16:47 ` [PATCH v1 02/15] docs/devel: add some notes on the binfmt-image-debian targets Alex Bennée
2022-04-08 16:47 ` [PATCH v1 03/15] docs/devel: drop :hidden: and :includehidden: tags Alex Bennée
2022-04-08 16:47 ` [PATCH v1 04/15] accel/tcg: move trace events to correct location Alex Bennée
2022-04-09 15:54 ` Richard Henderson
2022-04-08 16:47 ` [PATCH v1 05/15] accel/tcg: add tb_invalidate_phy_pages_fast tracepoint Alex Bennée
2022-04-09 15:57 ` Richard Henderson
2022-04-08 16:47 ` [PATCH v1 06/15] monitor: expose monitor_puts to rest of code Alex Bennée
2022-04-09 15:58 ` Richard Henderson
2022-04-21 14:45 ` Markus Armbruster
2022-04-08 16:47 ` [PATCH v1 07/15] disas: generalise plugin_printf and use for monitor_disas Alex Bennée
2022-04-09 16:04 ` Richard Henderson
2022-04-08 16:47 ` [PATCH v1 08/15] disas: use result of ->read_memory_func Alex Bennée
2022-04-09 16:07 ` Richard Henderson
2022-04-08 16:47 ` Alex Bennée [this message]
2022-04-09 16:09 ` [PATCH v1 09/15] cputlb: add tracepoints for the protect/unprotect helpers Richard Henderson
2022-04-08 16:47 ` [PATCH v1 10/15] cputlb: add tracepoints for TB invalidation Alex Bennée
2022-04-09 16:10 ` Richard Henderson
2022-04-08 16:47 ` [PATCH v1 11/15] accel/tcg: add tb_invalidate_phys_page_range tracepoint Alex Bennée
2022-04-09 16:14 ` Richard Henderson
2022-04-08 16:47 ` [PATCH v1 12/15] tests/tcg: add memory-sve test for aarch64 Alex Bennée
2022-04-08 16:47 ` [PATCH v1 13/15] plugins: extend execlog to filter matches Alex Bennée
2022-04-08 16:47 ` [PATCH v1 14/15] plugins: Assert mmu_idx in range before use in qemu_plugin_get_hwaddr Alex Bennée
2022-04-08 16:47 ` [PATCH v1 15/15] accel/tcg: add heuristic to invalidate al TBs in a page [hack!] Alex Bennée
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=20220408164742.2844631-10-alex.bennee@linaro.org \
--to=alex.bennee@linaro.org \
--cc=Luke.Craig@ll.mit.edu \
--cc=aaron@os.amperecomputing.com \
--cc=aurelien@aurel32.net \
--cc=berrange@redhat.com \
--cc=cota@braap.org \
--cc=crosa@redhat.com \
--cc=f4bug@amsat.org \
--cc=fam@euphon.net \
--cc=kuhn.chenqun@huawei.com \
--cc=ma.mandourr@gmail.com \
--cc=mahmoudabdalghany@outlook.com \
--cc=minyihh@uci.edu \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=robhenry@microsoft.com \
--cc=stefanha@redhat.com \
/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).