From patchwork Fri May 4 07:25:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 10380091 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7EA446038F for ; Fri, 4 May 2018 07:32:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 691702935B for ; Fri, 4 May 2018 07:32:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DD7629363; Fri, 4 May 2018 07:32:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BDC482935B for ; Fri, 4 May 2018 07:32:33 +0000 (UTC) Received: from localhost ([::1]:32770 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEVCh-0001xL-Qx for patchwork-qemu-devel@patchwork.kernel.org; Fri, 04 May 2018 03:32:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEV5x-0004JF-FQ for qemu-devel@nongnu.org; Fri, 04 May 2018 03:25:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEV5w-00078x-2H for qemu-devel@nongnu.org; Fri, 04 May 2018 03:25:33 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:56648 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fEV5v-00077f-OB; Fri, 04 May 2018 03:25:31 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 56DFE4026779; Fri, 4 May 2018 07:25:31 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E92BE83B80; Fri, 4 May 2018 07:25:30 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Date: Fri, 4 May 2018 09:25:03 +0200 Message-Id: <20180504072514.8450-5-cohuck@redhat.com> In-Reply-To: <20180504072514.8450-1-cohuck@redhat.com> References: <20180504072514.8450-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 04 May 2018 07:25:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 04 May 2018 07:25:31 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 04/15] s390x/kvm: cleanup calls to cpu_synchronize_state() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , qemu-devel@nongnu.org, Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: David Hildenbrand We have a call to cpu_synchronize_state() on every kvm_arch_handle_exit(). Let's remove the ones that are no longer needed. Remaining places (for s390x) are in - target/s390x/sigp.c, on the target CPU - target/s390x/cpu.c:s390_cpu_get_crash_info() While at it, use kvm_cpu_synchronize_state() instead of cpu_synchronize_state() in KVM code. (suggested by Thomas Huth) Signed-off-by: David Hildenbrand Message-Id: <20180412093521.2469-1-david@redhat.com> Acked-by: Christian Borntraeger Reviewed-by: Thomas Huth Signed-off-by: Cornelia Huck --- hw/s390x/s390-pci-inst.c | 8 -------- target/s390x/kvm.c | 20 +------------------- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 3fcc330fe3..02a815fd31 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -155,8 +155,6 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra) S390pciState *s = s390_get_phb(); int i; - cpu_synchronize_state(CPU(cpu)); - if (env->psw.mask & PSW_MASK_PSTATE) { s390_program_interrupt(env, PGM_PRIVILEGED, 4, ra); return 0; @@ -389,8 +387,6 @@ int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra) uint32_t fh; uint8_t pcias; - cpu_synchronize_state(CPU(cpu)); - if (env->psw.mask & PSW_MASK_PSTATE) { s390_program_interrupt(env, PGM_PRIVILEGED, 4, ra); return 0; @@ -487,8 +483,6 @@ int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra) uint32_t fh; uint8_t pcias; - cpu_synchronize_state(CPU(cpu)); - if (env->psw.mask & PSW_MASK_PSTATE) { s390_program_interrupt(env, PGM_PRIVILEGED, 4, ra); return 0; @@ -620,8 +614,6 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra) S390IOTLBEntry entry; hwaddr start, end; - cpu_synchronize_state(CPU(cpu)); - if (env->psw.mask & PSW_MASK_PSTATE) { s390_program_interrupt(env, PGM_PRIVILEGED, 4, ra); return 0; diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index fb59d92def..12b90cf5c5 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -1081,7 +1081,6 @@ static int kvm_sclp_service_call(S390CPU *cpu, struct kvm_run *run, uint32_t code; int r = 0; - cpu_synchronize_state(CPU(cpu)); sccb = env->regs[ipbh0 & 0xf]; code = env->regs[(ipbh0 & 0xf0) >> 4]; @@ -1101,8 +1100,6 @@ static int handle_b2(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1) int rc = 0; uint16_t ipbh0 = (run->s390_sieic.ipb & 0xffff0000) >> 16; - cpu_synchronize_state(CPU(cpu)); - switch (ipa1) { case PRIV_B2_XSCH: ioinst_handle_xsch(cpu, env->regs[1], RA_IGNORED); @@ -1248,7 +1245,6 @@ static int kvm_stpcifc_service_call(S390CPU *cpu, struct kvm_run *run) uint8_t ar; if (s390_has_feat(S390_FEAT_ZPCI)) { - cpu_synchronize_state(CPU(cpu)); fiba = get_base_disp_rxy(cpu, run, &ar); return stpcifc_service_call(cpu, r1, fiba, ar, RA_IGNORED); @@ -1266,7 +1262,6 @@ static int kvm_sic_service_call(S390CPU *cpu, struct kvm_run *run) uint16_t mode; int r; - cpu_synchronize_state(CPU(cpu)); mode = env->regs[r1] & 0xffff; isc = (env->regs[r3] >> 27) & 0x7; r = css_do_sic(env, isc, mode); @@ -1297,7 +1292,6 @@ static int kvm_pcistb_service_call(S390CPU *cpu, struct kvm_run *run) uint8_t ar; if (s390_has_feat(S390_FEAT_ZPCI)) { - cpu_synchronize_state(CPU(cpu)); gaddr = get_base_disp_rsy(cpu, run, &ar); return pcistb_service_call(cpu, r1, r3, gaddr, ar, RA_IGNORED); @@ -1313,7 +1307,6 @@ static int kvm_mpcifc_service_call(S390CPU *cpu, struct kvm_run *run) uint8_t ar; if (s390_has_feat(S390_FEAT_ZPCI)) { - cpu_synchronize_state(CPU(cpu)); fiba = get_base_disp_rxy(cpu, run, &ar); return mpcifc_service_call(cpu, r1, fiba, ar, RA_IGNORED); @@ -1401,7 +1394,6 @@ static int handle_hypercall(S390CPU *cpu, struct kvm_run *run) CPUS390XState *env = &cpu->env; int ret; - cpu_synchronize_state(CPU(cpu)); ret = s390_virtio_hypercall(env); if (ret == -EINVAL) { kvm_s390_program_interrupt(cpu, PGM_SPECIFICATION); @@ -1416,7 +1408,6 @@ static void kvm_handle_diag_288(S390CPU *cpu, struct kvm_run *run) uint64_t r1, r3; int rc; - cpu_synchronize_state(CPU(cpu)); r1 = (run->s390_sieic.ipa & 0x00f0) >> 4; r3 = run->s390_sieic.ipa & 0x000f; rc = handle_diag_288(&cpu->env, r1, r3); @@ -1429,7 +1420,6 @@ static void kvm_handle_diag_308(S390CPU *cpu, struct kvm_run *run) { uint64_t r1, r3; - cpu_synchronize_state(CPU(cpu)); r1 = (run->s390_sieic.ipa & 0x00f0) >> 4; r3 = run->s390_sieic.ipa & 0x000f; handle_diag_308(&cpu->env, r1, r3, RA_IGNORED); @@ -1440,8 +1430,6 @@ static int handle_sw_breakpoint(S390CPU *cpu, struct kvm_run *run) CPUS390XState *env = &cpu->env; unsigned long pc; - cpu_synchronize_state(CPU(cpu)); - pc = env->psw.addr - sw_bp_ilen; if (kvm_find_sw_breakpoint(CPU(cpu), pc)) { env->psw.addr = pc; @@ -1493,8 +1481,6 @@ static int kvm_s390_handle_sigp(S390CPU *cpu, uint8_t ipa1, uint32_t ipb) int ret; uint8_t order; - cpu_synchronize_state(CPU(cpu)); - /* get order code */ order = decode_basedisp_rs(env, ipb, NULL) & SIGP_ORDER_MASK; @@ -1556,7 +1542,6 @@ static int handle_oper_loop(S390CPU *cpu, struct kvm_run *run) CPUState *cs = CPU(cpu); PSW oldpsw, newpsw; - cpu_synchronize_state(cs); newpsw.mask = ldq_phys(cs->as, cpu->env.psa + offsetof(LowCore, program_new_psw)); newpsw.addr = ldq_phys(cs->as, cpu->env.psa + @@ -1609,7 +1594,6 @@ static int handle_intercept(S390CPU *cpu) break; case ICPT_WAITPSW: /* disabled wait, since enabled wait is handled in kernel */ - cpu_synchronize_state(cs); s390_handle_wait(cpu); r = EXCP_HALTED; break; @@ -1651,8 +1635,6 @@ static int handle_tsch(S390CPU *cpu) struct kvm_run *run = cs->kvm_run; int ret; - cpu_synchronize_state(cs); - ret = ioinst_handle_tsch(cpu, cpu->env.regs[1], run->s390_tsch.ipb, RA_IGNORED); if (ret < 0) { @@ -1778,7 +1760,7 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run) qemu_mutex_lock_iothread(); - cpu_synchronize_state(cs); + kvm_cpu_synchronize_state(cs); switch (run->exit_reason) { case KVM_EXIT_S390_SIEIC: