Hi Pierrick,
December 5, 2024 at 12:14 AM, "Pierrick Bouvier" wrote:
On 12/2/24 11:26, Julian Ganz wrote:
+typedef struct {
+ uint64_t interrupts;
+ uint64_t exceptions;
+ uint64_t hostcalls;
+ bool active;
The active field can be removed, as you can query qemu_plugin_num_vcpus() to
know (dynamically) how many vcpus were created.
Yes, if the ids of dynamically initialized VCPUs are contiguous. I
wasn't sure they really are. And I distinctly remember we originally
used some query function and ended up with the maximum number of VCPUs
supported rather then those actually used. But that may have been
another function, or some unfortunate result of me being too cautious
and doing
+ break;
+ }
+}
+
+static void plugin_exit(qemu_plugin_id_t id, void *p)
+{
+ g_autoptr(GString) report;
+ report = g_string_new("VCPU, interrupts, exceptions, hostcalls\n");
+ int vcpu;
+
+ for (vcpu = 0; vcpu < max_vcpus; vcpu++) {
vcpu < qemu_plugin_num_vcpus()
Yes, max_vcpus was introduced as an optimization. If we can rely on all
VCPUs with id < qemu_plugin_num_vcpus() having been active at some point
this becomes unnecessary.
+ qemu_plugin_register_vcpu_discon_cb(id, QEMU_PLUGIN_DISCON_TRAPS,
+ vcpu_discon);
+
The change from QEMU_PLUGIN_DISCON_TRAPS to QEMU_PLUGIN_DISCON_ALL should be
included in this patch, instead of next one.
Ah, thanks for pointing that out. I likely fumbled this at some point when
rebasing.
Regards,
Julian Ganz