[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 19/37] contrib/plugins/hwprofile: fix 32-bit build
From: |
Alex Bennée |
Subject: |
[PATCH v2 19/37] contrib/plugins/hwprofile: fix 32-bit build |
Date: |
Tue, 14 Jan 2025 11:38:03 +0000 |
From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20241217224306.2900490-10-pierrick.bouvier@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
contrib/plugins/hwprofile.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/contrib/plugins/hwprofile.c b/contrib/plugins/hwprofile.c
index 739ac0c66b..2a4cbc47d4 100644
--- a/contrib/plugins/hwprofile.c
+++ b/contrib/plugins/hwprofile.c
@@ -43,6 +43,8 @@ typedef struct {
static GMutex lock;
static GHashTable *devices;
+static struct qemu_plugin_scoreboard *source_pc_scoreboard;
+static qemu_plugin_u64 source_pc;
/* track the access pattern to a piece of HW */
static bool pattern;
@@ -159,7 +161,7 @@ static DeviceCounts *new_count(const char *name, uint64_t
base)
count->name = name;
count->base = base;
if (pattern || source) {
- count->detail = g_hash_table_new(NULL, NULL);
+ count->detail = g_hash_table_new(g_int64_hash, g_int64_equal);
}
g_hash_table_insert(devices, (gpointer) name, count);
return count;
@@ -169,7 +171,7 @@ static IOLocationCounts *new_location(GHashTable *table,
uint64_t off_or_pc)
{
IOLocationCounts *loc = g_new0(IOLocationCounts, 1);
loc->off_or_pc = off_or_pc;
- g_hash_table_insert(table, (gpointer) off_or_pc, loc);
+ g_hash_table_insert(table, &loc->off_or_pc, loc);
return loc;
}
@@ -224,12 +226,12 @@ static void vcpu_haddr(unsigned int cpu_index,
qemu_plugin_meminfo_t meminfo,
/* either track offsets or source of access */
if (source) {
- off = (uint64_t) udata;
+ off = qemu_plugin_u64_get(source_pc, cpu_index);
}
if (pattern || source) {
IOLocationCounts *io_count = g_hash_table_lookup(counts->detail,
- (gpointer) off);
+ &off);
if (!io_count) {
io_count = new_location(counts->detail, off);
}
@@ -247,10 +249,14 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct
qemu_plugin_tb *tb)
for (i = 0; i < n; i++) {
struct qemu_plugin_insn *insn = qemu_plugin_tb_get_insn(tb, i);
- gpointer udata = (gpointer) (source ? qemu_plugin_insn_vaddr(insn) :
0);
+ if (source) {
+ uint64_t pc = qemu_plugin_insn_vaddr(insn);
+ qemu_plugin_register_vcpu_mem_inline_per_vcpu(
+ insn, rw, QEMU_PLUGIN_INLINE_STORE_U64,
+ source_pc, pc);
+ }
qemu_plugin_register_vcpu_mem_cb(insn, vcpu_haddr,
- QEMU_PLUGIN_CB_NO_REGS,
- rw, udata);
+ QEMU_PLUGIN_CB_NO_REGS, rw, NULL);
}
}
@@ -306,10 +312,9 @@ int qemu_plugin_install(qemu_plugin_id_t id, const
qemu_info_t *info,
return -1;
}
- /* Just warn about overflow */
- if (info->system.smp_vcpus > 64 ||
- info->system.max_vcpus > 64) {
- fprintf(stderr, "hwprofile: can only track up to 64 CPUs\n");
+ if (source) {
+ source_pc_scoreboard = qemu_plugin_scoreboard_new(sizeof(uint64_t));
+ source_pc = qemu_plugin_scoreboard_u64(source_pc_scoreboard);
}
plugin_init();
--
2.39.5
- [PATCH v2 11/37] tests/tcg/plugins/insn: remove unused callback parameter, (continued)
- [PATCH v2 11/37] tests/tcg/plugins/insn: remove unused callback parameter, Alex Bennée, 2025/01/14
- [PATCH v2 37/37] scripts/nsis.py: Run dependency check for each DLL file only once, Alex Bennée, 2025/01/14
- [PATCH v2 18/37] contrib/plugins/cflow: fix 32-bit build, Alex Bennée, 2025/01/14
- [PATCH v2 28/37] tests/qtest: fix some copy and paste errors in kdoc, Alex Bennée, 2025/01/14
- [PATCH v2 29/37] include/exec: fix some copy and paste errors in kdoc, Alex Bennée, 2025/01/14
- [PATCH v2 24/37] docs/devel/style: add a section about bitfield, and disallow them for packed structures, Alex Bennée, 2025/01/14
- [PATCH v2 21/37] configure: reenable plugins by default for 32-bit hosts, Alex Bennée, 2025/01/14
- [PATCH v2 32/37] docs/devel: add git-publish for patch submitting, Alex Bennée, 2025/01/14
- [PATCH v2 19/37] contrib/plugins/hwprofile: fix 32-bit build,
Alex Bennée <=
- [PATCH v2 27/37] editorconfig: update for perl scripts, Alex Bennée, 2025/01/14
- [PATCH v2 31/37] docs/sphinx: include kernel-doc script as a dependency, Alex Bennée, 2025/01/14
- [PATCH v2 20/37] contrib/plugins/hotpages: fix 32-bit build, Alex Bennée, 2025/01/14
- [PATCH v2 23/37] win32: remove usage of attribute gcc_struct, Alex Bennée, 2025/01/14
- [PATCH v2 30/37] include/exec: remove warning_printed from MemoryRegion, Alex Bennée, 2025/01/14
- [PATCH v2 22/37] accel/tcg: also suppress asynchronous IRQs for cpu_io_recompile, Alex Bennée, 2025/01/14