From patchwork Wed Nov 29 16:41:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10082829 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 EC1A860311 for ; Wed, 29 Nov 2017 16:44:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D382329955 for ; Wed, 29 Nov 2017 16:44:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C759129B4C; Wed, 29 Nov 2017 16:44:46 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DF43729B48 for ; Wed, 29 Nov 2017 16:44:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=RxOwp1kOECHyK29vZc7qLbO/WYART0dOmHT6qx7TLQo=; b=Dwp+1ao2pw3E0sNBsSRL66hViJ OG1zGPAUXocMvZcqDGw8h/Q1RRR0pslhNfCX4WGBKwiAOH0wFUel55uoEMftTYGaJqdgZdhrEcxXW U9lb3h9uOaocbEXyHu57MR1tIsC5mrWI1QAuPo2RpMRdW+6ZrK3eczK5plaXmBFKyEa3hTyVQ1o3t f2ewf/lhv6w57fmxxjuphETYpWB2FKxvns/X7qN+8Oml/wNyjXkn1A/3yO3B1c/9dczftsNwuQyYd SptiEgbaZLIPtsZjsR3YGFlofB4MXXsmL7O6yI9SUFTKKPaXmtXJnn5vfEMe0s3g+uJ45wrIjcBX5 XxpIMLAw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eK5TY-0007To-37; Wed, 29 Nov 2017 16:44:44 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eK5Qo-0004cF-0t for linux-arm-kernel@lists.infradead.org; Wed, 29 Nov 2017 16:42:01 +0000 Received: by mail-wm0-x244.google.com with SMTP id i11so7185469wmf.4 for ; Wed, 29 Nov 2017 08:41:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OUilMp8GJQaK/3PwvYsmqwhU9F1Bw7TTcmnJ+kgxAzc=; b=EsH0KUchgJnLuoXIMMEHnN34ckAWO+4MwVdrxSl5frx/iFZ2aYA523lyJ75ebG7Jtp rIbM73ZP8Tf7a53msbjU+f7fVfDsQM9RFz1MiQWcei0t3uRvS4vlW0pA5EnciFExOtcH vpu0eI1K9PGwi1UXwiqabLauYP5/2MpWeWhjI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OUilMp8GJQaK/3PwvYsmqwhU9F1Bw7TTcmnJ+kgxAzc=; b=fVwg5IjXb1EK2CX3vlL5WywxasFCczpQE1o4t0K6imZewRs7qdU5tYbBz80EO7mZOA VRFHB07Q6fBOBbvqQQvfgcXx3D1E28XoVtWoLIAZPDlSO48Ys2WIxgp7SVFXak0tTSVF KNcwlaOcOsm0C4vHg9QuWmylyDGz+YmCjPChjpmzX3A1NZOpkVU3cMuaveFBkOfxcyMn +wpF6BNpufBrcXnQB6pS2toYS/yyDpGjglGZP+fjvzLEpWgFnJPgjw98XR8UubP+8DBO /r9cNQZGnB4h9Rzb6V5V+wQmLNvdHrnLf5/IBqJ1ZPWNopu2OICWJkBu2xH38NiA/APi 8ctw== X-Gm-Message-State: AJaThX6rBrKjUmo+60sXvQIa7mBVVeveylGq2Fbt4YUZ6vs+W6wGMAg/ ad4ylbrSnAFQmJjUZOmDumNz7g== X-Google-Smtp-Source: AGs4zMbGo+mooMxiNm+5eRst+CffGK3w8+C45r9XoZciINunC3heNytjH7jMPD7gcVjWDRH00MBsHA== X-Received: by 10.28.105.196 with SMTP id z65mr3173915wmh.146.1511973696121; Wed, 29 Nov 2017 08:41:36 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id e71sm2080765wma.13.2017.11.29.08.41.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Nov 2017 08:41:35 -0800 (PST) From: Christoffer Dall To: kvm@vger.kernel.org Subject: [PATCH v2 10/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_translate Date: Wed, 29 Nov 2017 17:41:10 +0100 Message-Id: <20171129164116.16167-11-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171129164116.16167-1-christoffer.dall@linaro.org> References: <20171129164116.16167-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171129_084154_438914_5AE35432 X-CRM114-Status: GOOD ( 12.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mips@linux-mips.org, Andrew Jones , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Marc Zyngier , James Hogan , Cornelia Huck , Christian Borntraeger , kvm-ppc@vger.kernel.org, Alexander Graf , linux-arm-kernel@lists.infradead.org, Paolo Bonzini , linux-s390@vger.kernel.org, kvmarm@lists.cs.columbia.edu, Christoffer Dall MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Move vcpu_load() and vcpu_put() into the architecture specific implementations of kvm_arch_vcpu_ioctl_translate(). Signed-off-by: Christoffer Dall Reviewed-by: David Hildenbrand --- arch/powerpc/kvm/booke.c | 2 ++ arch/x86/kvm/x86.c | 3 +++ virt/kvm/kvm_main.c | 2 -- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index cdf0be0..1b491b8 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c @@ -1793,7 +1793,9 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu, { int r; + vcpu_load(vcpu); r = kvmppc_core_vcpu_translate(vcpu, tr); + vcpu_put(vcpu); return r; } diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index ee357b6..eb70974 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -7661,6 +7661,8 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu, gpa_t gpa; int idx; + vcpu_load(vcpu); + idx = srcu_read_lock(&vcpu->kvm->srcu); gpa = kvm_mmu_gva_to_gpa_system(vcpu, vaddr, NULL); srcu_read_unlock(&vcpu->kvm->srcu, idx); @@ -7669,6 +7671,7 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu, tr->writeable = 1; tr->usermode = 0; + vcpu_put(vcpu); return 0; } diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index f360005..0a8a490 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -2627,9 +2627,7 @@ static long kvm_vcpu_ioctl(struct file *filp, r = -EFAULT; if (copy_from_user(&tr, argp, sizeof(tr))) goto out; - vcpu_load(vcpu); r = kvm_arch_vcpu_ioctl_translate(vcpu, &tr); - vcpu_put(vcpu); if (r) goto out; r = -EFAULT;