Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2414950rdb; Thu, 21 Sep 2023 19:29:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwLZ9ZJkUpJJt1aPw0iIDrhkVDP9ya9oEQgFBN0jxCHSw4fTEHRK5Tz1OWYwV6GetcCJpT X-Received: by 2002:a17:90a:7b88:b0:268:38a7:842e with SMTP id z8-20020a17090a7b8800b0026838a7842emr6866855pjc.2.1695349741217; Thu, 21 Sep 2023 19:29:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695349741; cv=none; d=google.com; s=arc-20160816; b=OHdj8eeilOWvuL87s0IJA8NhfideqqcBSqO2+6uTZ7IFmcqGlf3jn46BMnTV0uavmg OlBnKSCgz9h0PKW1VMFK7DfsuLjbmHAiZgJIs9dNMgCvZ62s1ntrORCwQgsQOhzPvodd Szoc0X1C44LZfU/tv5rht8g+vQUWwA9vIXwcB8/lZfwJbgYZ4skXDFOLAzKlmOwew0Mu 9Hb+t+uZWonjPSQi98VV6lIF3uDsjL6Qsphi0CNWSQpQ9K/yt8/wv3qS/CGojv7xk/bT pb89E80CgKaJkSkE9bILHDje1Sn3sQClUu8B3KxdnQKzYASHcPcBS1kcawNeCfbNotPo w1wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=qHCXosr3PvEhIv4wRyQYcPxGRzmyaFYWZMq7sEiKto0=; fh=q/eoddAVbbeWDzUVs4Vwk85GEJr6Ex1kH1y0q+v38Hg=; b=CeH/c5U2PlfWzndNvQfhLxh1M8cJrJfhF/m5VuZL/zHopAXk3qH68H5UxzX6UMEzEM XAEh164wHmIM6nPuySR5gJHj2lSRMHcFxS1mXDQKkToubcnnCJ65zKrVvNEBtGs3Bz/l Q6+w6trNWVeRjYkJuJUg1rgvqTu+Tq24dTHIRNwQPQFNcLutGxKx91xQwtdsq2mGY4IG FwcoFuBSYfD2o5KnCQ72kEN/pLTTrVEMSGtsl+8VKq7Y7FbEq98aMLANm23UMV9/WtA1 e+69CkFxyRsYBFZVkbHvTaRCecCsEzlvqq404cbWsg8Oy5fYeq+MslmjUgzWpaTPyaHU 63jg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id mg24-20020a17090b371800b0025c219a68e3si2776302pjb.45.2023.09.21.19.29.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 19:29:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 0906A820E53C; Thu, 21 Sep 2023 14:55:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233112AbjIUVyl (ORCPT + 99 others); Thu, 21 Sep 2023 17:54:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232854AbjIUVx2 (ORCPT ); Thu, 21 Sep 2023 17:53:28 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5DF4785D09; Thu, 21 Sep 2023 10:37:47 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 21 Sep 2023 14:55:21 -0700 (PDT) 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 --- 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)) { -- 2.25.1