All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Range of vcpu_index to plugin callbacks
       [not found] <CAEYr_8=uH3=BGbVQrbjijoE5xB7jRch=35hjD0g0v91u_cXUog@mail.gmail.com>
@ 2021-09-19 17:54 ` Philippe Mathieu-Daudé
  2021-09-20 19:03   ` [EXTERNAL] " Robert Henry
  2021-09-21 10:31   ` Alex Bennée
  0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-09-19 17:54 UTC (permalink / raw)
  To: Robert Henry, qemu-discuss; +Cc: Alex Bennée, qemu-devel

(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...

Regards,

Phil.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [EXTERNAL] Re: Range of vcpu_index to plugin callbacks
  2021-09-19 17:54 ` Range of vcpu_index to plugin callbacks Philippe Mathieu-Daudé
@ 2021-09-20 19:03   ` Robert Henry
  2021-09-21 10:31   ` Alex Bennée
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Henry @ 2021-09-20 19:03 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, rrh.henry, qemu-discuss
  Cc: Alex Bennée, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1424 bytes --]

Yes, the value of the cpu_index seems to track the number of clone() syscalls.  (I did strace the process, but forgot to look for clone() syscalls... I still have vfork()/execve() on the brain.)
________________________________
From: Qemu-discuss <qemu-discuss-bounces+robhenry=microsoft.com@nongnu.org> on behalf of Philippe Mathieu-Daudé <f4bug@amsat.org>
Sent: Sunday, September 19, 2021 10:54 AM
To: rrh.henry <rrh.henry@gmail.com>; qemu-discuss@nongnu.org <qemu-discuss@nongnu.org>
Cc: Alex Bennée <alex.bennee@linaro.org>; qemu-devel <qemu-devel@nongnu.org>
Subject: [EXTERNAL] Re: Range of vcpu_index to plugin callbacks

(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...

Regards,

Phil.


[-- Attachment #2: Type: text/html, Size: 2305 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Range of vcpu_index to plugin callbacks
  2021-09-19 17:54 ` Range of vcpu_index to plugin callbacks Philippe Mathieu-Daudé
  2021-09-20 19:03   ` [EXTERNAL] " Robert Henry
@ 2021-09-21 10:31   ` Alex Bennée
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Bennée @ 2021-09-21 10:31 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: Robert Henry, qemu-devel, qemu-discuss


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-21 10:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAEYr_8=uH3=BGbVQrbjijoE5xB7jRch=35hjD0g0v91u_cXUog@mail.gmail.com>
2021-09-19 17:54 ` Range of vcpu_index to plugin callbacks Philippe Mathieu-Daudé
2021-09-20 19:03   ` [EXTERNAL] " Robert Henry
2021-09-21 10:31   ` Alex Bennée

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.