Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1239197ybn; Wed, 25 Sep 2019 14:50:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxG1CN1T9qevt5GZMkDjQVLy68q+dwxVeXxmdKCAVG/xEuhb4junlliRKtguHmhOsHMXs8I X-Received: by 2002:a17:906:e290:: with SMTP id gg16mr311833ejb.176.1569448237928; Wed, 25 Sep 2019 14:50:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569448237; cv=none; d=google.com; s=arc-20160816; b=OxZgbjL7RmovM86ryuMVixde/hK6D6IziDJCsWr0Ch9SMz/85k1NVCSEkQFVvJMXqJ HQTOOXf09Wl+K4WjgBgxpd928OwJpsJj9EgcaoZNpEptoW9pzfSbLcqkWj/QASMQxlkM aag4d2p0rQ0fAuIYrsyud2MrLHhi1lpqTx7altcpl/Xw2d9U4OIKaK3RraenaZlmV/oq HM9k7AR+Bckl7794cxqogHUPOnIu3TbsUzkVkMoUjdWS3HOsPbAK0wGKpcBRedTW02mm tUQlZU8Zh4jfM9B1ycObQDudn3aqo3WnfimHiSO+y96JqxLbcCZavUGmXPE4vINcXMnp 6KCg== 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=ytrHrEOJu9L3UMCvOFUd50IsWdP0UiIRPV0izrDwWDg=; b=aUoiLwEvWUQ3O+MfgK3n38NSdYJXuYMvPsLeSa7V/6yNBesE14h+OR5lLbHz/YVGpy EoHWFvJtkFs06efr3fC1QFohMEGv50Sk5NNU3dYTEQzBqAgYtPf1Vu5XLpeD+9qfF8rD KYR7gwLfCA7Tj1HPBDCp+K4OVb18APm4Bm2L/J26c0q9ykC0rL8Q7/5lWpMVE4LYaq3V Ibmp7m4Nv6uVnRvkWPyInzarNg+B6NEk4Is4V+3t6kNCUBjQorh6aguFB6ivyMSxdEcS O+lcK7W+pFCW4U5/DQixw2s82bohaL8mJseb7lii2DaVScR5/Cr8NPjCMi3uRcq3BSGA iNrA== 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 e4si40138ejb.303.2019.09.25.14.50.14; Wed, 25 Sep 2019 14:50:37 -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 S1733115AbfIWSoH (ORCPT + 99 others); Mon, 23 Sep 2019 14:44:07 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:36370 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733075AbfIWSoH (ORCPT ); Mon, 23 Sep 2019 14:44:07 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8NIbUoL084013; Mon, 23 Sep 2019 14:43:58 -0400 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v71cdvhs4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Sep 2019 14:43:58 -0400 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id x8NIgDAB030819; Mon, 23 Sep 2019 18:43:57 GMT Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by ppma03dal.us.ibm.com with ESMTP id 2v5bg6u7cc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Sep 2019 18:43:57 +0000 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8NIhuqb14484162 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Sep 2019 18:43:56 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B8BE9112061; Mon, 23 Sep 2019 18:43:56 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BA92F112066; Mon, 23 Sep 2019 18:43:55 +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:55 +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 3/3] powerpc/kvm/e500: Replace current->mm by kvm->mm Date: Mon, 23 Sep 2019 15:43:32 -0300 Message-Id: <20190923184332.412-4-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=878 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/e500_mmu_host.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c index 321db0fdb9db..425d13806645 100644 --- a/arch/powerpc/kvm/e500_mmu_host.c +++ b/arch/powerpc/kvm/e500_mmu_host.c @@ -355,9 +355,9 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500, if (tlbsel == 1) { struct vm_area_struct *vma; - down_read(¤t->mm->mmap_sem); + down_read(&kvm->mm->mmap_sem); - vma = find_vma(current->mm, hva); + vma = find_vma(kvm->mm, hva); if (vma && hva >= vma->vm_start && (vma->vm_flags & VM_PFNMAP)) { /* @@ -441,7 +441,7 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500, tsize = max(BOOK3E_PAGESZ_4K, tsize & ~1); } - up_read(¤t->mm->mmap_sem); + up_read(&kvm->mm->mmap_sem); } if (likely(!pfnmap)) { -- 2.20.1