* [RFC PATCH] contrib/plugins: avoid hanging program
@ 2024-09-13 17:38 Alex Bennée
2024-09-14 15:20 ` Richard Henderson
2024-09-18 18:47 ` Pierrick Bouvier
0 siblings, 2 replies; 3+ messages in thread
From: Alex Bennée @ 2024-09-13 17:38 UTC (permalink / raw)
To: qemu-devel
Cc: richard.henderson, Alex Bennée, Elisha Hollander,
Alexandre Iooss, Mahmoud Mandour, Pierrick Bouvier
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>
---
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.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC PATCH] contrib/plugins: avoid hanging program
2024-09-13 17:38 [RFC PATCH] contrib/plugins: avoid hanging program Alex Bennée
@ 2024-09-14 15:20 ` Richard Henderson
2024-09-18 18:47 ` Pierrick Bouvier
1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2024-09-14 15:20 UTC (permalink / raw)
To: Alex Bennée, qemu-devel
Cc: Elisha Hollander, Alexandre Iooss, Mahmoud Mandour,
Pierrick Bouvier
On 9/13/24 10:38, Alex Bennée wrote:
> 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>
> ---
> contrib/plugins/ips.c | 5 +++++
> 1 file changed, 5 insertions(+)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC PATCH] contrib/plugins: avoid hanging program
2024-09-13 17:38 [RFC PATCH] contrib/plugins: avoid hanging program Alex Bennée
2024-09-14 15:20 ` Richard Henderson
@ 2024-09-18 18:47 ` Pierrick Bouvier
1 sibling, 0 replies; 3+ messages in thread
From: Pierrick Bouvier @ 2024-09-18 18:47 UTC (permalink / raw)
To: Alex Bennée, qemu-devel
Cc: richard.henderson, Elisha Hollander, Alexandre Iooss,
Mahmoud Mandour
On 9/13/24 10:38, Alex Bennée wrote:
> 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>
> ---
> 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);
>
The ips plugin uses tb based trap, so it should not be expected that an
ips of 1 will do what is expected (it will execute the whole tb at minimum).
Either we could extend this plugin with a precise mode (instruction
based), or simply emit an error when ips is too low, like < 100.
I'm more in favor of the latter solution.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-18 18:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-13 17:38 [RFC PATCH] contrib/plugins: avoid hanging program Alex Bennée
2024-09-14 15:20 ` Richard Henderson
2024-09-18 18:47 ` Pierrick Bouvier
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).