qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: linzc@zju.edu.cn
Subject: [Qemu-devel] [PATCH 3/6] cpus: dummy: unregister thread with RCU, exit loop on unplug
Date: Thu,  1 Feb 2018 09:44:27 -0500	[thread overview]
Message-ID: <20180201144430.14441-4-pbonzini@redhat.com> (raw)
In-Reply-To: <20180201144430.14441-1-pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 cpus.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/cpus.c b/cpus.c
index 789ff7897b..34c86192d1 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1235,7 +1235,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg)
     cpu->created = true;
     qemu_cond_signal(&qemu_cpu_cond);
 
-    while (1) {
+    do {
         qemu_mutex_unlock_iothread();
         do {
             int sig;
@@ -1247,8 +1247,9 @@ static void *qemu_dummy_cpu_thread_fn(void *arg)
         }
         qemu_mutex_lock_iothread();
         qemu_wait_io_event(cpu);
-    }
+    } while (!cpu->unplug);
 
+    rcu_unregister_thread();
     return NULL;
 #endif
 }
-- 
2.14.3

  parent reply	other threads:[~2018-02-01 14:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-01 14:44 [Qemu-devel] [PATCH 0/6] cpus: fix various issues with vCPU unplug Paolo Bonzini
2018-02-01 14:44 ` [Qemu-devel] [PATCH 1/6] cpus: hax: register/unregister thread with RCU, exit loop on unplug Paolo Bonzini
2018-02-01 14:44 ` [Qemu-devel] [PATCH 2/6] cpus: kvm: unregister thread with RCU Paolo Bonzini
2018-02-01 14:44 ` Paolo Bonzini [this message]
2018-02-01 14:44 ` [Qemu-devel] [PATCH 4/6] cpus: tcg: unregister thread with RCU, fix exiting of loop on unplug Paolo Bonzini
2018-02-01 15:05   ` Eric Blake
2018-02-01 14:44 ` [Qemu-devel] [PATCH 5/6] cpus: hvf: unregister thread with RCU Paolo Bonzini
2018-02-01 14:44 ` [Qemu-devel] [PATCH 6/6] cpus: join thread when removing a vCPU Paolo Bonzini

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=20180201144430.14441-4-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=linzc@zju.edu.cn \
    --cc=qemu-devel@nongnu.org \
    /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).