From 85ca3371f6f5284d54202aec091e7cb3a49e5135 Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Thu, 28 Aug 2014 13:58:49 +0200 Subject: s390x/kvm: run guest triggered resets on the target vcpu thread 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 Acked-by: Christian Borntraeger Signed-off-by: David Hildenbrand Signed-off-by: Jens Freimann Signed-off-by: Christian Borntraeger --- target-s390x/cpu.h | 15 +++++++++++++++ target-s390x/misc_helper.c | 30 ++++++++---------------------- 2 files changed, 23 insertions(+), 22 deletions(-) (limited to 'target-s390x') diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index b13761d925..17a3df4d06 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 0b625826ef..ef9758a96a 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)); -- cgit v1.2.3