Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3055199ybb; Sun, 12 Apr 2020 22:49:39 -0700 (PDT) X-Google-Smtp-Source: APiQypKWnZ6Dd0zO2UgLqdyyrvrLQe/IXFWRSvi0Dd9tKoJbtCKVps5tMxxhGACwFWEjYuLyL4F+ X-Received: by 2002:a37:49c7:: with SMTP id w190mr14764672qka.402.1586756979534; Sun, 12 Apr 2020 22:49:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586756979; cv=none; d=google.com; s=arc-20160816; b=tN6ZtfA9eh4/apTO4YeJkj+xhZF3KqDB8w2ro/mQ+cQLiUjGPYFcBiDgzfqbvHZnCY Drp+blDfVyxhBaxZHy1JlqxgzswsfjWuz1GSjxaezmquEWXMjnR2Wl5BAQ4DQeG3JVPM 0Yi++fMHSnsSdbqakPmZs/5V7dvoYrdXpe+3ESu2R5hlWnsM+zvtR6U1M8SZ8PUqfgo2 uR1hnDM+Q2uCCoiGsrkJMx4Eohmkhc6ZX7rEZUMLtxARxP4INv3a5JLe+uIbrDxskApF BCMLYonNoKMnxnd+kXNO3jlW+7DNQ23Tw6x5a24PAf2eHhGcPZvlJmJ+RDa1J8i2VW07 3uow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=GL67F+3/MYQ67Fwxr3wCnP7KBEofk6h8hMhsWy3UtQ4=; b=cJ5DI7uVK/4nfHaWEURMdnq4ja4UrttbVT6TR8JN8neilagCPBrm24TVw+cs1Y5wWd bzWcv/g7h02hFjsNJv0OFqBGiBLTHwDJ4WwAS9Ut960Ydzdy2isy9TxcWl27Fl57lJyA nwtPDT25YaW9ijuIhM/4UWQpKLm8s3deRXYpOtxrkUi0CiduPRDyZRpk6o1sXEcWfLCj cVulUGAXT9NTvqEe4DhD3aWw8Un+ob66+T9KKhassNDcVu2XWBw4x6tXUvFD21Zj6A6E eGH/8SCP46curQfkIAFz52wZkTF4oCJb824xzOdnQg2iWbfPjak1FD8y+qf47j6CJDoF KSlA== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 209.132.180.67 is neither permitted nor denied by best guess record for domain of linux-kernel-owner@vger.kernel.org) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org ([209.132.180.67]) by mx.google.com with ESMTP id y2si467876qvl.157.2020.04.12.22.49.25; Sun, 12 Apr 2020 22:49:39 -0700 (PDT) Received-SPF: neutral (google.com: 209.132.180.67 is neither permitted nor denied by best guess record for domain of linux-kernel-owner@vger.kernel.org) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.132.180.67 is neither permitted nor denied by best guess record for domain of linux-kernel-owner@vger.kernel.org) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728609AbgDMDp2 (ORCPT + 99 others); Sun, 12 Apr 2020 23:45:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.18]:52962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727513AbgDMDp2 (ORCPT ); Sun, 12 Apr 2020 23:45:28 -0400 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48FCEC0A3BE0; Sun, 12 Apr 2020 20:45:28 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R771e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04397;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=20;SR=0;TI=SMTPD_---0TvK0H1G_1586749524; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0TvK0H1G_1586749524) by smtp.aliyun-inc.com(127.0.0.1); Mon, 13 Apr 2020 11:45:24 +0800 From: Tianjia Zhang To: pbonzini@redhat.com, sean.j.christopherson@intel.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, maz@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, tianjia.zhang@linux.alibaba.com Subject: [PATCH] KVM: Optimize kvm_arch_vcpu_ioctl_run function Date: Mon, 13 Apr 2020 11:45:23 +0800 Message-Id: <20200413034523.110548-1-tianjia.zhang@linux.alibaba.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kvm_arch_vcpu_ioctl_run() is only called in the file kvm_main.c, where vcpu->run is the kvm_run parameter, so it has been replaced. Signed-off-by: Tianjia Zhang --- arch/x86/kvm/x86.c | 8 ++++---- virt/kvm/arm/arm.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 3bf2ecafd027..70e3f4abbd4d 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -8726,18 +8726,18 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) r = -EAGAIN; if (signal_pending(current)) { r = -EINTR; - vcpu->run->exit_reason = KVM_EXIT_INTR; + kvm_run->exit_reason = KVM_EXIT_INTR; ++vcpu->stat.signal_exits; } goto out; } - if (vcpu->run->kvm_valid_regs & ~KVM_SYNC_X86_VALID_FIELDS) { + if (kvm_run->kvm_valid_regs & ~KVM_SYNC_X86_VALID_FIELDS) { r = -EINVAL; goto out; } - if (vcpu->run->kvm_dirty_regs) { + if (kvm_run->kvm_dirty_regs) { r = sync_regs(vcpu); if (r != 0) goto out; @@ -8767,7 +8767,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) out: kvm_put_guest_fpu(vcpu); - if (vcpu->run->kvm_valid_regs) + if (kvm_run->kvm_valid_regs) store_regs(vcpu); post_kvm_run_save(vcpu); kvm_sigset_deactivate(vcpu); diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index 48d0ec44ad77..ab9d7966a4c8 100644 --- a/virt/kvm/arm/arm.c +++ b/virt/kvm/arm/arm.c @@ -659,7 +659,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) return ret; if (run->exit_reason == KVM_EXIT_MMIO) { - ret = kvm_handle_mmio_return(vcpu, vcpu->run); + ret = kvm_handle_mmio_return(vcpu, run); if (ret) return ret; } -- 2.17.1