qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Range of vcpu_index to plugin callbacks


From: Alex Bennée
Subject: Re: Range of vcpu_index to plugin callbacks
Date: Tue, 21 Sep 2021 11:31:18 +0100
User-agent: mu4e 1.7.0; emacs 28.0.50

Philippe Mathieu-Daudé <f4bug@amsat.org> writes:

> (Cc'ing qemu-devel@ mailing list since this is a development question).
>
> On 9/19/21 19:44, Robert Henry wrote:
>> What is the range of the values for vcpu_index given to callbacks, such as:
>> 
>> typedef void (*qemu_plugin_vcpu_udata_cb_t)(unsigned int vcpu_index,
>> void *userdata);
>> 
>> Empirically, when QEMU is in system mode, the maximum vcpu_index is 1
>> less than the -smp cpus=$(NCPUS) value.
>> 
>> Empirically, when QEMU is in user mode, the values for vcpu_index slowly
>> increase without an apparent upper bound known statically (or when the
>> plugin is loaded?).
>
> Isn't it related to clone() calls? I'd expect new threads use
> a new vCPU, incrementing vcpu_index. But that is just a guess
> without having looked at the code to corroborate...

It's exactly that - in user-mode each thread is modelled using a new
virtual CPU so a heavily threaded application will slowly grow the
maximum index. If you want to track the creation of these threads you
can use qemu_plugin_register_vcpu_init_cb to track the creation of the
new vCPUs.

It's more this reason the recently added cache modelling plugin does
vcpu_index % cores to bound the simulated cache the thread affects.

>
> Regards,
>
> Phil.


-- 
Alex Bennée



reply via email to

[Prev in Thread] Current Thread [Next in Thread]