From patchwork Thu Sep 21 16:20:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13394008 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C2CCE71090 for ; Thu, 21 Sep 2023 16:20:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC1BA6B020A; Thu, 21 Sep 2023 12:20:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DA0D56B0209; Thu, 21 Sep 2023 12:20:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C3A3C6B020A; Thu, 21 Sep 2023 12:20:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B59D56B0208 for ; Thu, 21 Sep 2023 12:20:40 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 8B29D808FF for ; Thu, 21 Sep 2023 16:20:40 +0000 (UTC) X-FDA: 81261117840.01.802FB8B Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf08.hostedemail.com (Postfix) with ESMTP id D9FCD160025 for ; Thu, 21 Sep 2023 16:20:38 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf08.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695313238; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qHCXosr3PvEhIv4wRyQYcPxGRzmyaFYWZMq7sEiKto0=; b=CuBxOXMRsJ/1ZC+FUj4++H2zogV6FvdS29OKhrbyFVOJGEidEIzLALjGB5EjOrmizP/4tO hMtDxLuPWo5sDwhmIxN4BqcpO8xSVRqaolBxjKgSXPNRyPCRfx4g+/yAdBAbOTPahsXjmD FAZG9lmcMbJw3Hf5UarMijP1Dzih6RM= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf08.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695313238; a=rsa-sha256; cv=none; b=NLO6iTovZ1nniwHX17XcBCBD3Jw64ALJj4xWjaX4+G/nVQYUkfGR5CKg/ARG661efMtMgB IOprk4eywTw+6ZjUaDBLTgSOFAoZ94yiqjbUGpoGLp3mTNklcyGbFD+Q/iXq/VuyriPrnu cLS3evZ0IfMr9r2Em5q+sHoTteWRs3Q= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EE7B51758; Thu, 21 Sep 2023 09:21:14 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 82D213F59C; Thu, 21 Sep 2023 09:20:33 -0700 (PDT) From: Ryan Roberts To: Catalin Marinas , Will Deacon , "James E.J. Bottomley" , Helge Deller , Nicholas Piggin , Christophe Leroy , Paul Walmsley , Palmer Dabbelt , Albert Ou , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Gerald Schaefer , "David S. Miller" , Arnd Bergmann , Mike Kravetz , Muchun Song , SeongJae Park , Andrew Morton , Uladzislau Rezki , Christoph Hellwig , Lorenzo Stoakes , Anshuman Khandual , Peter Xu , Axel Rasmussen , Qi Zheng Cc: Ryan Roberts , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org Subject: [PATCH v1 3/8] riscv: hugetlb: Convert set_huge_pte_at() to take vma Date: Thu, 21 Sep 2023 17:20:02 +0100 Message-Id: <20230921162007.1630149-4-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230921162007.1630149-1-ryan.roberts@arm.com> References: <20230921162007.1630149-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D9FCD160025 X-Stat-Signature: i7cahwq7t8rjzq5ew39hfxmtmgop3u4a X-HE-Tag: 1695313238-898732 X-HE-Meta: U2FsdGVkX18IwjfU9TYo5D4jd2R6KSpt+ESjobGs3ciNFt7sd7g9WxPE75S/vWuU1l23WTZgZs3qxQ5FDfZopEIC1uqsbGcGiF1jF8hvIIj9XrRhSkHFiVK0jVLjbKD7cwfwvh26pybUFZjBdeuttnZQHbWQ5sr+SoHcP6QGvOB4dJiftifTuc+HyLIZqiuiPek7pDmX6pEckfwAHFgljzuXmP6tgrYbm69AjNHDY9lfN4UA1ykTLOOpBtQpl0CcPQHHOCKqmPgjF6ko8sGoLtEGqvYonoyI81tv6jzgyt3GnlzBKWH1IiencYNpMjc8RuHtTHb96ddPOvMpuCN8iEL8XDNmItOJ16FBLBy5dr2AD8smG34UVm5e3fAOvhiq2Ad/C7lhqfRZiMYbFvwqlyxlVbSFuVIORxVxlU3DbLAZIbPNaywVJ1IIZ72O8s+ho7zQ498eCiQ6uwNSQIgA5mAITdHzsPHzCj16mWxApl72EaS9Q6C4vO7AbEtogK55kW3s/+qAafA1PKNKgX52VWkrbbYuaXbtk5BDEwM3laaJjvl6NC1wwMUFQQqNteRg8+AuWCj8P3AY7X4/gXF+KTEJ44SZkKzNSNelePaYzJiordy3btT1fXZnxl+G/KaMmIC+YMQ23GK30fUGOVQN2+Wj3FEfN5Z45XQ8g6BeR0EQUvxKQEYYYfLGkrur8lFWFuV+hfAXMaoH9447igFZevdQ8wEPoNKvfIPJKlfUBZToekH6Qe/KMpECfciWVqADBmS50lx9wuk6ZmbUJfFjnSOnGEY/N7Ar4417wjxc+mQNwEmiL0MiR6tFuItO1Z0/SPMGbtqxp431nuUCgtfrXUbL21/3B6HiRnsXL9Dzifx0wP9Wus9SbOjsMxcSfON8jA/+aHoPOmE/3ULgaOnYV3de6xtfebGzIdY2G/zQQdMSXmvgBZV7xUQf42I3waNlbPXDE1dE75MlVRKDaJ8 hbFR0WBM aO/udP5+X53rD2YOXJNkMDIzozrdAw8/dJJOfuNWL74TetPYsecHnX6qnPZ34hx/0d8tmBtjFTrZOtuvqy4Dz8vGQY6qUumHtmDhKiTwRIzmhnUrbai17LhH2mYdjC12lue3MSC4TzLgiMpudMD1YSuLP9+b1U7qKOCt8k/122j6WGA2YNfk8eKuDCO9TlwC4eZ5smqBIurGiQJk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: In order to fix a bug, arm64 needs access to the vma inside it's implementation of set_huge_pte_at(). Provide for this by converting the mm parameter to be a vma. Any implementations that require the mm can access it via vma->vm_mm. This commit makes the required riscv modifications. Separate commits update the other arches and core code, before the actual bug is fixed in arm64. No behavioral changes intended. Signed-off-by: Ryan Roberts Reviewed-by: Alexandre Ghiti --- arch/riscv/include/asm/hugetlb.h | 2 +- arch/riscv/mm/hugetlbpage.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/riscv/include/asm/hugetlb.h b/arch/riscv/include/asm/hugetlb.h index 34e24f078cc1..be1ac8582bc2 100644 --- a/arch/riscv/include/asm/hugetlb.h +++ b/arch/riscv/include/asm/hugetlb.h @@ -17,7 +17,7 @@ void huge_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep, unsigned long sz); #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT -void set_huge_pte_at(struct mm_struct *mm, +void set_huge_pte_at(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte); #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR diff --git a/arch/riscv/mm/hugetlbpage.c b/arch/riscv/mm/hugetlbpage.c index 96225a8533ad..7cdbf0960772 100644 --- a/arch/riscv/mm/hugetlbpage.c +++ b/arch/riscv/mm/hugetlbpage.c @@ -177,11 +177,12 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags) return entry; } -void set_huge_pte_at(struct mm_struct *mm, +void set_huge_pte_at(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte) { + struct mm_struct *mm = vma->vm_mm; int i, pte_num; if (!pte_napot(pte)) {