All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Igotti <igotti@gmail.com>
To: Laurent Vivier <laurent@vivier.eu>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	riku.voipio@iki.fi, "Emilio G. Cota" <cota@braap.org>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH 3/3] plugins: avoid failing plugin when CPU is inited several times
Date: Mon, 20 Apr 2020 13:04:51 +0300	[thread overview]
Message-ID: <CAEme+7EtF6B2+2U_yF2dd-g2m+=S3P5=DL1oLmHfmWw2S7PYAw@mail.gmail.com> (raw)
In-Reply-To: <f4feb648-7dc5-ac54-bc0b-db650dd176f1@vivier.eu>

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

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 <igotti@gmail.com>
---
 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 <laurent@vivier.eu> 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 <igotti@gmail.com <mailto:igotti@gmail.com
> >>
> >
> > ---
> >
> >  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)
> >
>
>

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

  reply	other threads:[~2020-04-20 10:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-20  9:15 [PATCH 3/3] plugins: avoid failing plugin when CPU is inited several times Nikolay Igotti
2020-04-20  9:51 ` Laurent Vivier
2020-04-20 10:04   ` Nikolay Igotti [this message]
2020-05-09 23:00     ` Emilio G. Cota
2020-05-11 15:53       ` Nikolay Igotti
2020-05-12  0:55         ` Emilio G. Cota
2020-05-12  8:38           ` Nikolay Igotti
2020-05-12 19:35             ` Alex Bennée
2020-05-12 20:11           ` Alex Bennée
2020-05-24 14:11             ` Emilio G. Cota
2020-04-20 10:11 ` Peter Maydell
2020-04-20 10:18   ` Nikolay Igotti
2020-04-20 10:30     ` Peter Maydell
2020-04-20 15:07   ` Alex Bennée
2020-04-20 16:14     ` Nikolay Igotti

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='CAEme+7EtF6B2+2U_yF2dd-g2m+=S3P5=DL1oLmHfmWw2S7PYAw@mail.gmail.com' \
    --to=igotti@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=cota@braap.org \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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 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.