From patchwork Thu Aug 28 11:58:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Freimann X-Patchwork-Id: 383809 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B2BDA1400F0 for ; Thu, 28 Aug 2014 22:01:39 +1000 (EST) Received: from localhost ([::1]:36120 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMyOX-00005f-W1 for incoming@patchwork.ozlabs.org; Thu, 28 Aug 2014 08:01:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMyMD-0004ox-64 for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:59:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMyM4-0002fV-4R for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:59:13 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:36387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMyM3-0002f5-Du for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:59:04 -0400 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 28 Aug 2014 12:59:01 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp16.uk.ibm.com (192.168.101.146) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 28 Aug 2014 12:59:00 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id BC3EB1B0804B for ; Thu, 28 Aug 2014 12:59:58 +0100 (BST) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s7SBx0rP41943154 for ; Thu, 28 Aug 2014 11:59:00 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s7SBwxR3017618 for ; Thu, 28 Aug 2014 05:59:00 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s7SBwxti017615; Thu, 28 Aug 2014 05:58:59 -0600 Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 1122) id C32331224439; Thu, 28 Aug 2014 13:58:59 +0200 (CEST) From: Jens Freimann To: Christian Borntraeger , Alexander Graf , Cornelia Huck Date: Thu, 28 Aug 2014 13:58:49 +0200 Message-Id: <1409227132-55354-3-git-send-email-jfrei@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.5.5 In-Reply-To: <1409227132-55354-1-git-send-email-jfrei@linux.vnet.ibm.com> References: <1409227132-55354-1-git-send-email-jfrei@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14082811-3548-0000-0000-0000012BE6F5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.112 Cc: David Hildenbrand , Jens Freimann , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 2/5] s390x/kvm: run guest triggered resets on the target vcpu thread X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: David Hildenbrand 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 --- 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));