qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Alexandre Iooss" <erdnaxe@crans.org>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Yanan Wang" <wangyanan55@huawei.com>,
	"Mahmoud Mandour" <ma.mandourr@gmail.com>
Subject: Re: [PATCH 1/3] plugins: Ensure vCPU index is assigned in init/exit hooks
Date: Thu, 6 Jun 2024 14:13:37 -0700	[thread overview]
Message-ID: <3921f885-a75d-4506-a0a7-f1dfdf7e892f@linaro.org> (raw)
In-Reply-To: <20240606124010.2460-2-philmd@linaro.org>

On 6/6/24 05:40, Philippe Mathieu-Daudé wrote:
> Since vCPUs are hashed by their index, this index can't
> be uninitialized (UNASSIGNED_CPU_INDEX).
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   plugins/core.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/plugins/core.c b/plugins/core.c
> index badede28cf..d339b3db4d 100644
> --- a/plugins/core.c
> +++ b/plugins/core.c
> @@ -245,6 +245,7 @@ void qemu_plugin_vcpu_init_hook(CPUState *cpu)
>   {
>       bool success;
>   
> +    assert(cpu->cpu_index != UNASSIGNED_CPU_INDEX);
>       qemu_rec_mutex_lock(&plugin.lock);
>       plugin.num_vcpus = MAX(plugin.num_vcpus, cpu->cpu_index + 1);
>       plugin_cpu_update__locked(&cpu->cpu_index, NULL, NULL);
> @@ -263,6 +264,7 @@ void qemu_plugin_vcpu_exit_hook(CPUState *cpu)
>   
>       plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_EXIT);
>   
> +    assert(cpu->cpu_index != UNASSIGNED_CPU_INDEX);
>       qemu_rec_mutex_lock(&plugin.lock);
>       success = g_hash_table_remove(plugin.cpu_ht, &cpu->cpu_index);
>       g_assert(success);

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>

  reply	other threads:[~2024-06-06 21:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-06 12:40 [PATCH 0/3] plugins: Few debugging cleanups Philippe Mathieu-Daudé
2024-06-06 12:40 ` [PATCH 1/3] plugins: Ensure vCPU index is assigned in init/exit hooks Philippe Mathieu-Daudé
2024-06-06 21:13   ` Pierrick Bouvier [this message]
2024-06-06 12:40 ` [PATCH 2/3] plugins: Free CPUPluginState before destroying vCPU state Philippe Mathieu-Daudé
2024-06-06 21:14   ` Pierrick Bouvier
2024-06-07  4:53     ` Philippe Mathieu-Daudé
2024-06-07 16:13       ` Pierrick Bouvier
2024-06-06 12:40 ` [PATCH 3/3] accel/tcg: Move qemu_plugin_vcpu_init__async() to plugins/ Philippe Mathieu-Daudé
2024-06-13 10:52 ` [PATCH 0/3] plugins: Few debugging cleanups Philippe Mathieu-Daudé
2024-07-04 10:13 ` Alex Bennée

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=3921f885-a75d-4506-a0a7-f1dfdf7e892f@linaro.org \
    --to=pierrick.bouvier@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=eduardo@habkost.net \
    --cc=erdnaxe@crans.org \
    --cc=ma.mandourr@gmail.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wangyanan55@huawei.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).