qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 3/3] plugins: avoid failing plugin when CPU is inited several


From: Nikolay Igotti
Subject: Re: [PATCH 3/3] plugins: avoid failing plugin when CPU is inited several times
Date: Mon, 20 Apr 2020 13:04:51 +0300

OK, maybe this version will work better (gmail web interface may be not the best one for sending patches):
----

In linux-user multithreaded scenarious CPU could be inited many times with the same id,
so avoid assertions on already present hashtable entry.

Signed-off-by: Nikolay Igotti <address@hidden>
---
 plugins/core.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/plugins/core.c b/plugins/core.c
index 51bfc94787..889cc6441a 100644
--- a/plugins/core.c
+++ b/plugins/core.c
@@ -196,13 +196,10 @@ plugin_register_cb_udata(qemu_plugin_id_t id, enum qemu_plugin_event ev,
 
 void qemu_plugin_vcpu_init_hook(CPUState *cpu)
 {
-    bool success;
-
     qemu_rec_mutex_lock(&plugin.lock);
     plugin_cpu_update__locked(&cpu->cpu_index, NULL, NULL);
-    success = g_hash_table_insert(plugin.cpu_ht, &cpu->cpu_index,
+    g_hash_table_insert(plugin.cpu_ht, &cpu->cpu_index,
                                   &cpu->cpu_index);
-    g_assert(success);
     qemu_rec_mutex_unlock(&plugin.lock);
 
     plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_INIT);
--
2.24.2 (Apple Git-127)



On Mon, Apr 20, 2020 at 12:51 PM Laurent Vivier <address@hidden> wrote:
Nikolay,

the patch seems corrupted by your mailer.

CC: Alex and Emilio as this code is theirs.

Thanks,
Laurent

Le 20/04/2020 à 11:15, Nikolay Igotti a écrit :
> In linux-user multithreaded scenarious CPU could be inited many times
> with the same id,
>
> so avoid assertions on already present hashtable entry.
>
>
> Signed-off-by: Nikolay Igotti <address@hidden <mailto:address@hidden>>
>
> ---
>
>  plugins/core.c | 5 +----
>
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
>
> diff --git a/plugins/core.c b/plugins/core.c
>
> index 51bfc94787..889cc6441a 100644
>
> --- a/plugins/core.c
>
> +++ b/plugins/core.c
>
> @@ -196,13 +196,10 @@ plugin_register_cb_udata(qemu_plugin_id_t id, enum
> qemu_plugin_event ev,
>
>  
>
>  void qemu_plugin_vcpu_init_hook(CPUState *cpu)
>
>  {
>
> -    bool success;
>
> -
>
>      qemu_rec_mutex_lock(&plugin.lock);
>
>      plugin_cpu_update__locked(&cpu->cpu_index, NULL, NULL);
>
> -    success = g_hash_table_insert(plugin.cpu_ht, &cpu->cpu_index,
>
> +    g_hash_table_insert(plugin.cpu_ht, &cpu->cpu_index,
>
>                                    &cpu->cpu_index);
>
> -    g_assert(success);
>
>      qemu_rec_mutex_unlock(&plugin.lock);
>
>  
>
>      plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_INIT);
>
> -- 
>
> 2.24.2 (Apple Git-127)
>


reply via email to

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