From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: Robert Henry <rrh.henry@gmail.com>,
qemu-devel <qemu-devel@nongnu.org>,
qemu-discuss@nongnu.org
Subject: Re: Range of vcpu_index to plugin callbacks
Date: Tue, 21 Sep 2021 11:31:18 +0100 [thread overview]
Message-ID: <87y27qnrfs.fsf@linaro.org> (raw)
In-Reply-To: <6ab9eb4d-5835-df61-b27f-932af7e64889@amsat.org>
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
prev parent reply other threads:[~2021-09-21 10:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y27qnrfs.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=f4bug@amsat.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-discuss@nongnu.org \
--cc=rrh.henry@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).