qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	Alexander Graf <agraf@suse.de>,
	David Hildenbrand <dahi@linux.vnet.ibm.com>,
	Jens Freimann <jfrei@linux.vnet.ibm.com>,
	Anthony Liguori <anthony@codemonkey.ws>,
	Cornelia Huck <cornelia.huck@de.ibm.com>,
	Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] [PULL 01/19] s390x/kvm: run guest triggered resets on the target vcpu thread
Date: Mon,  1 Sep 2014 14:54:12 +0200	[thread overview]
Message-ID: <1409576070-55803-2-git-send-email-borntraeger@de.ibm.com> (raw)
In-Reply-To: <1409576070-55803-1-git-send-email-borntraeger@de.ibm.com>

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

Currently, load_normal_reset() and modified_clear_reset() as triggered
by a guest vcpu will initiate cpu resets on the current vcpu thread for
all cpus. The reset should happen on the individual vcpu thread
instead, so let's use run_on_cpu() for this.

This avoids calls to synchronize_rcu() in the kernel.

Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 target-s390x/cpu.h         | 15 +++++++++++++++
 target-s390x/misc_helper.c | 30 ++++++++----------------------
 2 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index b13761d..17a3df4 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -353,6 +353,21 @@ static inline hwaddr decode_basedisp_s(CPUS390XState *env, uint32_t ipb)
 /* Base/displacement are at the same locations. */
 #define decode_basedisp_rs decode_basedisp_s
 
+/* helper functions for run_on_cpu() */
+static inline void s390_do_cpu_reset(void *arg)
+{
+    CPUState *cs = arg;
+    S390CPUClass *scc = S390_CPU_GET_CLASS(cs);
+
+    scc->cpu_reset(cs);
+}
+static inline void s390_do_cpu_full_reset(void *arg)
+{
+    CPUState *cs = arg;
+
+    cpu_reset(cs);
+}
+
 void s390x_tod_timer(void *opaque);
 void s390x_cpu_timer(void *opaque);
 
diff --git a/target-s390x/misc_helper.c b/target-s390x/misc_helper.c
index 0b62582..ef9758a 100644
--- a/target-s390x/misc_helper.c
+++ b/target-s390x/misc_helper.c
@@ -114,33 +114,16 @@ uint32_t HELPER(servc)(CPUS390XState *env, uint64_t r1, uint64_t r2)
 }
 
 #ifndef CONFIG_USER_ONLY
-static void cpu_reset_all(void)
-{
-    CPUState *cs;
-    S390CPUClass *scc;
-
-    CPU_FOREACH(cs) {
-        scc = S390_CPU_GET_CLASS(cs);
-        scc->cpu_reset(cs);
-    }
-}
-
-static void cpu_full_reset_all(void)
-{
-    CPUState *cpu;
-
-    CPU_FOREACH(cpu) {
-        cpu_reset(cpu);
-    }
-}
-
 static int modified_clear_reset(S390CPU *cpu)
 {
     S390CPUClass *scc = S390_CPU_GET_CLASS(cpu);
+    CPUState *t;
 
     pause_all_vcpus();
     cpu_synchronize_all_states();
-    cpu_full_reset_all();
+    CPU_FOREACH(t) {
+        run_on_cpu(t, s390_do_cpu_full_reset, t);
+    }
     cmma_reset(cpu);
     io_subsystem_reset();
     scc->load_normal(CPU(cpu));
@@ -152,10 +135,13 @@ static int modified_clear_reset(S390CPU *cpu)
 static int load_normal_reset(S390CPU *cpu)
 {
     S390CPUClass *scc = S390_CPU_GET_CLASS(cpu);
+    CPUState *t;
 
     pause_all_vcpus();
     cpu_synchronize_all_states();
-    cpu_reset_all();
+    CPU_FOREACH(t) {
+        run_on_cpu(t, s390_do_cpu_reset, t);
+    }
     cmma_reset(cpu);
     io_subsystem_reset();
     scc->initial_cpu_reset(CPU(cpu));
-- 
1.8.4.2

  reply	other threads:[~2014-09-01 12:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-01 12:54 [Qemu-devel] [PULL 00/19] s390x/kvm: Several updates/fixes/features Christian Borntraeger
2014-09-01 12:54 ` Christian Borntraeger [this message]
2014-09-01 12:54 ` [Qemu-devel] [PULL 02/19] s390x/kvm: execute sigp orders on the target vcpu thread Christian Borntraeger
2014-09-01 12:54 ` [Qemu-devel] [PULL 03/19] s390x/kvm: execute "system reset" cpu resets on the " Christian Borntraeger
2014-09-01 12:54 ` [Qemu-devel] [PULL 04/19] s390x/kvm: execute the first cpu reset " Christian Borntraeger
2014-09-01 12:54 ` [Qemu-devel] [PULL 05/19] pc-bios/s390-ccw: support all virtio block size Christian Borntraeger
2014-09-01 12:54 ` [Qemu-devel] [PULL 06/19] pc-bios/s390-ccw: handle more ECKD DASD block sizes Christian Borntraeger
2014-09-01 12:54 ` [Qemu-devel] [PULL 07/19] pc-bios/s390-ccw Improve ECKD informational message Christian Borntraeger
2014-09-01 12:54 ` [Qemu-devel] [PULL 08/19] pc-bios/s390-ccw Really big EAV ECKD DASD handling Christian Borntraeger
2014-09-01 12:54 ` [Qemu-devel] [PULL 09/19] pc-bios/s390-ccw: IPL from DASD with format variations Christian Borntraeger
2014-09-01 12:54 ` [Qemu-devel] [PULL 10/19] pc-bios/s390-ccw: Do proper console setup Christian Borntraeger
2014-09-01 12:54 ` [Qemu-devel] [PULL 11/19] pc-bios/s390-ccw.img binary update Christian Borntraeger
2014-09-01 12:54 ` [Qemu-devel] [PULL 12/19] sclp-s390: Add device to manage s390 memory hotplug Christian Borntraeger
2014-09-01 12:54 ` [Qemu-devel] [PULL 13/19] virtio-ccw: Include standby memory when calculating storage increment Christian Borntraeger
2014-09-01 12:54 ` [Qemu-devel] [PULL 14/19] s390-virtio: Apply same memory boundaries as virtio-ccw Christian Borntraeger
2014-09-01 12:54 ` [Qemu-devel] [PULL 15/19] sclp-s390: Add memory hotplug SCLPs Christian Borntraeger
2014-09-01 12:54 ` [Qemu-devel] [PULL 16/19] s390x/gdb: don't touch the cc if tcg is not enabled Christian Borntraeger
2014-09-01 12:54 ` [Qemu-devel] [PULL 17/19] s390x/gdb: add the feature xml files for s390x Christian Borntraeger
2014-09-01 12:54 ` [Qemu-devel] [PULL 18/19] s390x/gdb: generate target.xml and handle fp/ac as coprocessors Christian Borntraeger
2014-09-01 12:54 ` [Qemu-devel] [PULL 19/19] s390x/gdb: coding style fixes Christian Borntraeger
2014-09-01 13:44 ` [Qemu-devel] [PULL 00/19] s390x/kvm: Several updates/fixes/features Peter Maydell

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=1409576070-55803-2-git-send-email-borntraeger@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=agraf@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=cornelia.huck@de.ibm.com \
    --cc=dahi@linux.vnet.ibm.com \
    --cc=jfrei@linux.vnet.ibm.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).