From nobody Thu Jan 30 23:56:07 2025 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 778061FDA6F for ; Mon, 27 Jan 2025 09:36:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737970605; cv=none; b=UTM1VM9NMHxgffpPL9j5SEKwPaapUcHQNO4HuIDlGcfNgHgfxp65V1MGZjqXQl7Fu6D2gwtEjoRTXanxXQ7CcaCgH0FH4KtwhTWhtJOG+oSvXeMhUlEdI0fMoh70r94FN0I4kODbSWplZUw5bRCHIE+tH1DzSmuvt8vqKGKFDd4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737970605; c=relaxed/simple; bh=lXPN0zAr41aya+3WNiJQA3eWzEBSucGk/JihnpGrsD4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=B7N7tjL1pc8U/xbWkUntP7Nzd6D/MYBdqsR3p8/d58Al07q+UXQnAqdwd6PjtReuK5RM+XTuvkiXH0i/LKSGEdGXg8ICYvdVQlUxO717piHYnRePot016KRuAuafCyVCg4ylnMJy+dRJf6IMQyRJIGyL3zMwklF0cjL0kGwD5dU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=3AYVy1ND; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="3AYVy1ND" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-385e27c75f4so3700016f8f.2 for ; Mon, 27 Jan 2025 01:36:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1737970601; x=1738575401; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YlgUGAmuTWGVKaOGr6DQU8bhY7gyR7CYcPHPJxmYPTE=; b=3AYVy1ND+PIRB6ripZu2soHejPtm4WuIryRbEN/nxR9TUiDvHO22YlULbrQ0mMW6bD KmZy8Td3TdYoc7o7e3UoaP/25Mw/tK0fuc6S+80u7oIQ/6Bc4WC0KqEDaX/aSbAGrD++ 5HQMoDZVj7tWgTDfhWVB+UBYOnFAUNniYahFL4kyVC3uP7nUlBHjraj5LMIR8RgfpJ2j Z+HDU2rJyBzfI1NNdgoUtKH6DNaT3O0As9xsZdngZTWSb8IzXH2dd+MUOffj6kAt/cFn w/9fs7pLdmHcncvgNNWFHm0j5V1xVRtdBeQA3nIHnePsdUDWRKQgSoKYc894q+BM6O/y WFyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737970601; x=1738575401; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YlgUGAmuTWGVKaOGr6DQU8bhY7gyR7CYcPHPJxmYPTE=; b=OAsNVBQYDHCFX3JvYqAZiCe/jv47ZyB6BA2RH5TSXhxMRIFqGu0qkOC2ynnBCtgitq MvGRGFWnpO8Cx3b66q57j7wd7JRH6bOPiDlYEB6rYBXTzveDhkPCjv5rsfPf6VrMh+dC 1hCKllSg2nn4ihtKqgRO0CKlO8Lt+C7mqyfCeQrJp8a+TvNUjElFP7Vdj91jferv22Gt HAELk5afxJ8DRhVWjqdWggfOIwPTI0ZnShDoq26ZBDyTt411HUWEibM6h1f6JqiKgg0h GhR39pJYBpquM5N7IwPRcAB5Mrhj52WpwAXaOp+drvTX/lKaBq77DHiN4cKqAm45Wrao Ga6w== X-Forwarded-Encrypted: i=1; AJvYcCWx+0Y2GPaznfT+CUfNrHJ5WxVWjymNPLXryK67ZPAvowQ+a+po6XaXGLsUhbvw8jiCoyGyazAJh2XwMPE=@vger.kernel.org X-Gm-Message-State: AOJu0Yys4N37Kh2K+zTm+1xrbMByWyPDSVr6KdfUXdyBVzGyAnwdfQea Nm7KclopSbhH7bmLKW/YYJRDNPghmHUxoZeSryUU3rVlNfnU03KUqHq2/f6mq/g= X-Gm-Gg: ASbGncvFr0pBzJqg5eoCIs0+Z27E7Pth+K4WEEBjCLQkMXX7s0qWUnzPJ0Vw+WNfIc7 mZl3V7PTpBTvelawUkNkW70JVQupKGJnVYmidOuxF5RURDu3CRPjrX9aakRm7JgV6V8fh3zUZNt CGdvAFgmRmTWuJtM1ViUU2gZNqEfnJ2X8fZ9AAEvQbkaFijdPbaJUkpRvBrMQo6HGn9W8rx2vdG O9br791E2wKtlexB4AYEI2c0vBq9Mjd/RdAkbznFXVhhFJ0+4BiUuQNQPafSqdOpGHt6XrKyWuQ z44Slb1LhIArUqY9t5aiNrRRFv4o+wA= X-Google-Smtp-Source: AGHT+IHUUXHJ5coMzJl68ATLI/2WB7Q+b+nPXfERL8/PDwCduzlj4e0CTpfsp9bAQ08qd/jskgeAvg== X-Received: by 2002:a05:6000:1445:b0:386:37f5:99f6 with SMTP id ffacd0b85a97d-38bf59ed62fmr33321912f8f.53.1737970600263; Mon, 27 Jan 2025 01:36:40 -0800 (PST) Received: from alex-rivos.ba.rivosinc.com ([2001:861:3382:ef90:3e22:3e78:ce5a:32c3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a176490sm10314205f8f.1.2025.01.27.01.36.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jan 2025 01:36:39 -0800 (PST) From: Alexandre Ghiti To: Catalin Marinas , Will Deacon , Ryan Roberts , Mark Rutland , Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrew Morton , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-mm@kvack.org Cc: Alexandre Ghiti Subject: [PATCH v4 1/9] riscv: Safely remove huge_pte_offset() when manipulating NAPOT ptes Date: Mon, 27 Jan 2025 10:35:22 +0100 Message-Id: <20250127093530.19548-2-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20250127093530.19548-1-alexghiti@rivosinc.com> References: <20250127093530.19548-1-alexghiti@rivosinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The pte_t pointer is expected to point to the first entry of the NAPOT mapping so no need to use huge_pte_offset(), similarly to what is done in arm64. Signed-off-by: Alexandre Ghiti --- arch/riscv/mm/hugetlbpage.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/riscv/mm/hugetlbpage.c b/arch/riscv/mm/hugetlbpage.c index 42314f093922..6b09cd1ef41c 100644 --- a/arch/riscv/mm/hugetlbpage.c +++ b/arch/riscv/mm/hugetlbpage.c @@ -276,7 +276,6 @@ int huge_ptep_set_access_flags(struct vm_area_struct *v= ma, =20 order =3D napot_cont_order(pte); pte_num =3D napot_pte_num(order); - ptep =3D huge_pte_offset(mm, addr, napot_cont_size(order)); orig_pte =3D get_clear_contig_flush(mm, addr, ptep, pte_num); =20 if (pte_dirty(orig_pte)) @@ -322,7 +321,6 @@ void huge_ptep_set_wrprotect(struct mm_struct *mm, =20 order =3D napot_cont_order(pte); pte_num =3D napot_pte_num(order); - ptep =3D huge_pte_offset(mm, addr, napot_cont_size(order)); orig_pte =3D get_clear_contig_flush(mm, addr, ptep, pte_num); =20 orig_pte =3D pte_wrprotect(orig_pte); --=20 2.39.2