[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 18/18] contrib/plugins: avoid hanging program
From: |
Alex Bennée |
Subject: |
[PATCH v2 18/18] contrib/plugins: avoid hanging program |
Date: |
Mon, 16 Sep 2024 09:54:00 +0100 |
Although we asks for instructions per second we work in quanta and
that cannot be 0. Fail to load the plugin instead and report the
minimum IPS we can handle.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reported-by: Elisha Hollander <just4now666666@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
contrib/plugins/ips.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/contrib/plugins/ips.c b/contrib/plugins/ips.c
index 29fa556d0f..6f078689dc 100644
--- a/contrib/plugins/ips.c
+++ b/contrib/plugins/ips.c
@@ -152,6 +152,11 @@ QEMU_PLUGIN_EXPORT int
qemu_plugin_install(qemu_plugin_id_t id,
vcpus = qemu_plugin_scoreboard_new(sizeof(vCPUTime));
max_insn_per_quantum = max_insn_per_second / NUM_TIME_UPDATE_PER_SEC;
+ if (max_insn_per_quantum == 0) {
+ fprintf(stderr, "minimum of %d instructions per second needed\n",
NUM_TIME_UPDATE_PER_SEC);
+ return -1;
+ }
+
time_handle = qemu_plugin_request_time_control();
g_assert(time_handle);
--
2.39.5
- [PATCH v2 10/18] tests/tcg: clean up output of memory system test, (continued)
- [PATCH v2 10/18] tests/tcg: clean up output of memory system test, Alex Bennée, 2024/09/16
- [PATCH v2 06/18] tests/tcg: add mechanism to run specific tests with plugins, Alex Bennée, 2024/09/16
- [PATCH v2 09/18] tests/tcg/multiarch: add test for plugin memory access, Alex Bennée, 2024/09/16
- [PATCH v2 11/18] tests/tcg: only read/write 64 bit words on 64 bit systems, Alex Bennée, 2024/09/16
- [PATCH v2 12/18] tests/tcg: ensure s390x-softmmu output redirected, Alex Bennée, 2024/09/16
- [PATCH v2 08/18] tests/tcg/plugins/mem: add option to print memory accesses, Alex Bennée, 2024/09/16
- [PATCH v2 01/18] deprecation: don't enable TCG plugins by default on 32 bit hosts, Alex Bennée, 2024/09/16
- [PATCH v2 07/18] tests/tcg: allow to check output of plugins, Alex Bennée, 2024/09/16
- [PATCH v2 18/18] contrib/plugins: avoid hanging program,
Alex Bennée <=
- [PATCH v2 14/18] util/timer: avoid deadlock when shutting down, Alex Bennée, 2024/09/16
- [PATCH v2 13/18] tests/tcg: add a system test to check memory instrumentation, Alex Bennée, 2024/09/16
- [PATCH v2 15/18] contrib/plugins: Add a plugin to generate basic block vectors, Alex Bennée, 2024/09/16
- [PATCH v2 17/18] plugins: add option to dump write argument to syscall plugin, Alex Bennée, 2024/09/16
- [PATCH v2 16/18] plugins: add plugin API to read guest memory, Alex Bennée, 2024/09/16