Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1482246ybn; Wed, 25 Sep 2019 19:31:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIiix0o7vWXh13V+EAfuLc9TFUbsdPvB3Zj604YfssXlerDKnhW33CBgzp9Kw7JsXY/35x X-Received: by 2002:a17:906:3083:: with SMTP id 3mr58409ejv.259.1569465061890; Wed, 25 Sep 2019 19:31:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569465061; cv=none; d=google.com; s=arc-20160816; b=mBPX5nMyxvNNO+r+SbeIyUPTeWYfvBz9APneJSa32EiU2DfNAkTyqzhNIgY5wSzSV6 c7278mHpkJhMkdGlySnDNLCF0Qu/HkK3ISjwQ5eHMGLww+yCqiiJu5s+ZxYesalZtOpj RNQsO9QFQEhPfBtsRus67nzDWC6qFaThzR9khDJ914J5ZoYvT8NuT54Xdi7rA1cfnqI0 e7pFjEkXYKRPI53yDarRPHiso7Izeb49uOVX/8Sw0rgvMGJnEqdJkb497AukkcUlbXxJ oSYnVhkY0ekso6S9vcBnL9FK+3BrW01u64rfOEd6yCJxWJpwPgbMK+xpxsOFHdRldqNp dK9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=vgNdjtEgVIGhSdM9SqWkqApekq3PIfzPysCt4rffJJ4=; b=dRjWi4PHxqYchUgJkxOQrTt4WovFKhnsUDfmHaQz2Uv4rEa+nNdxQcMEVz9GZO8IZX 7AIURZ3sidmUbO9Ons23mS6rK4dCst6DVRNhlbJcCebILlRWg36K1sm5/BmG6qw4SxrX TTMhrZbcW3gsM6PQC6jJxgIgyrhw6pDLasUTq1CDJN2WKcVVe4VzZE3m5CKwcp++fFc8 eBgUqcbb901Oq0gf1xj8jW1bMk3a8mzU53PzSsSBba+7M9GpyB7JQv63vSPw/0JkrrN6 tHNoMnSK7n51d03ErpEEP57Gl4aiSoOKSb+FvKdxvP4nY2vUU6NA2V9drqkQ5FAoV37L KORw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si508442eda.129.2019.09.25.19.30.36; Wed, 25 Sep 2019 19:31:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733124AbfIWSoJ (ORCPT + 99 others); Mon, 23 Sep 2019 14:44:09 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:16292 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733062AbfIWSoH (ORCPT ); Mon, 23 Sep 2019 14:44:07 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8NIbRN5100702; Mon, 23 Sep 2019 14:43:57 -0400 Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v73bn0e17-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Sep 2019 14:43:56 -0400 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id x8NIfLKK006387; Mon, 23 Sep 2019 18:43:55 GMT Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by ppma03wdc.us.ibm.com with ESMTP id 2v5bg6nu92-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Sep 2019 18:43:55 +0000 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8NIhtXd51052840 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Sep 2019 18:43:55 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 73987112065; Mon, 23 Sep 2019 18:43:55 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 75D74112063; Mon, 23 Sep 2019 18:43:54 +0000 (GMT) Received: from LeoBras.aus.stglabs.ibm.com (unknown [9.18.235.184]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 23 Sep 2019 18:43:54 +0000 (GMT) From: Leonardo Bras To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: Leonardo Bras , Paul Mackerras , Benjamin Herrenschmidt , Michael Ellerman Subject: [PATCH 2/3] powerpc/kvm/book3e: Replace current->mm by kvm->mm Date: Mon, 23 Sep 2019 15:43:31 -0300 Message-Id: <20190923184332.412-3-leonardo@linux.ibm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190923184332.412-1-leonardo@linux.ibm.com> References: <20190923184332.412-1-leonardo@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-09-23_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909230160 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Given that in kvm_create_vm() there is: kvm->mm = current->mm; And that on every kvm_*_ioctl we have: if (kvm->mm != current->mm) return -EIO; I see no reason to keep using current->mm instead of kvm->mm. By doing so, we would reduce the use of 'global' variables on code, relying more in the contents of kvm struct. Signed-off-by: Leonardo Bras --- arch/powerpc/kvm/booke.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index be9a45874194..383108263af5 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c @@ -775,7 +775,7 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) debug = current->thread.debug; current->thread.debug = vcpu->arch.dbg_reg; - vcpu->arch.pgdir = current->mm->pgd; + vcpu->arch.pgdir = kvm->mm->pgd; kvmppc_fix_ee_before_entry(); ret = __kvmppc_vcpu_run(kvm_run, vcpu); -- 2.20.1