Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1229556ybx; Thu, 7 Nov 2019 09:04:55 -0800 (PST) X-Google-Smtp-Source: APXvYqxt80sgptcCDpQqIGOgHXO0AqZaqbXLWZRoV8PznKiJtuYAnIzKwOIwrsvSNJjzJB5GTJRy X-Received: by 2002:a17:906:7e58:: with SMTP id z24mr4104688ejr.302.1573146295844; Thu, 07 Nov 2019 09:04:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573146295; cv=none; d=google.com; s=arc-20160816; b=0WeSAtZDFTADABS1KtYOIDA1Ledf4VP1jNVE1tPe2k2Pu/eXuZYQAlgzeaC9fPlAwu aHk8BssDlA0iqB/XVRwtWVm5SoHSLbyKWPm8zwCmmIBFSsZ8MZw2jFOMFUCDRHX+btiU efo9eJmdd4BxuuAcmRwIPrd+tQgSQyPg+uB+mCwCxYru5dPoxETy6sOH3STKnQQDiWfm Z0OAbfqwfeeozLmFaNY9OzZ58jo2GEuMBWgXsVJX+jsrWtvHgqB51PdS+656YGluqati JKiTl3iKpyrXSyllRoagU3wZijS/RXwB8L+UNPPoQe5yvqJleluiaACEfoGsREpdeWnd lnPw== 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=TZvz/widAVOch39M7JVkiN9b1CyZ5dseKIaywEE3pvQ=; b=vsUHUKHJwP2NkCAee4KIpAZmIxgxEUPunx7/9B43E6p8GZZwwbWNwJhfBk9tuqRqhK 0v824O5Hfqm/QJX0+l9StycvmjF5MDCyObIx88imnRSUbbgpbKFZk9efDVM5z/a8qMCs 5Kcl0vKSkPpJiHx18R+fYKK0b4H9LVXjYM0SJUiXxOsCBfDLsFJs2tZoiwihYjp88sDP 3cfteQJVLxryi7e/AqWg4VLfZjGPeXJUuvtemro/+Ww9CemUzcLCrcapbxxufCLeIk5B JfYCzrL6BOl441TBOHb30ddNq24ui6MMvT/L2eCXISb+yAKK4Dsr3y+IyqyWRA9q3Gqt FpAQ== 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 ce9si1465249ejb.213.2019.11.07.09.04.31; Thu, 07 Nov 2019 09:04:55 -0800 (PST) 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 S2389696AbfKGRDg (ORCPT + 99 others); Thu, 7 Nov 2019 12:03:36 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:8608 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389649AbfKGRDe (ORCPT ); Thu, 7 Nov 2019 12:03:34 -0500 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xA7GslkH043032; Thu, 7 Nov 2019 12:03:23 -0500 Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0a-001b2d01.pphosted.com with ESMTP id 2w4pdejt6b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2019 12:03:22 -0500 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id xA7H1Ye1006107; Thu, 7 Nov 2019 17:03:07 GMT Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by ppma02wdc.us.ibm.com with ESMTP id 2w41ujt4mx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2019 17:03:07 +0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xA7H36o525166144 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 7 Nov 2019 17:03:06 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C2781AE05F; Thu, 7 Nov 2019 17:03:06 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A8342AE060; Thu, 7 Nov 2019 17:03:05 +0000 (GMT) Received: from LeoBras.br.ibm.com (unknown [9.18.235.40]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 7 Nov 2019 17:03:05 +0000 (GMT) From: Leonardo Bras To: kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: Leonardo Bras , Paul Mackerras , Benjamin Herrenschmidt , Michael Ellerman Subject: [PATCH v2 3/4] powerpc/kvm/book3e: Replace current->mm by kvm->mm Date: Thu, 7 Nov 2019 14:02:57 -0300 Message-Id: <20191107170258.36379-4-leonardo@linux.ibm.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191107170258.36379-1-leonardo@linux.ibm.com> References: <20191107170258.36379-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-11-07_05:,, 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-1910280000 definitions=main-1911070159 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..fd7bdb4f8f87 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 = vcpu->kvm->mm->pgd; kvmppc_fix_ee_before_entry(); ret = __kvmppc_vcpu_run(kvm_run, vcpu); -- 2.23.0