From patchwork Fri Mar 1 10:40:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13578323 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2EFF9C5478C for ; Fri, 1 Mar 2024 10:41:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=iZ2SOLe/TlVNe3hiYasjGrWIFQYPxVt8/BT/VSUVoeM=; b=ZMeZIfUYnNyy/ZRJB2TT+KquW2 F3jM30Fh6nYY3ckbx7FvLHEmbyy0XPgV5Muw6hq2XA6laZ3PAjkOK39Fk/iOAXIFJOjnIYpo+Zu/B mB7KO3UkRd67A+5ygv7vM75r2ZG3N444HGEeGgOcCuYXzYGG1WG0VjsPgiqZfMUvuxPvQBOJv2Fqd up2S2D+MctkUbRO5VDyzhhFEH6tCzTYCbDInqoAzWpUFjxFzPlweMEcB7RaAdkaI5C1zEYn/XYNdN cpAflWor4+3+sdLUeuXqufy60L6A3/0YsVvSQezAyceNmzLh17xJpl5ynhjPWijhzg2rs4pCmt2rv jR86WkPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rg0K6-0000000HOhR-2MZL; Fri, 01 Mar 2024 10:41:02 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rg0K3-0000000HOfK-4AIz for linux-arm-kernel@lists.infradead.org; Fri, 01 Mar 2024 10:41:01 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-60983922176so8429817b3.0 for ; Fri, 01 Mar 2024 02:40:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709289657; x=1709894457; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=kxdRDiZIrCvaJKsIpgxeAPJhXd0SCzjIl00w26sSc00=; b=p08APRFT8dlQrWK+ol5YuZbCvdZPwYG8icHf05ntH4RTa+q8CukAMUuhrpdOpq5u++ 2jj6SC8fPbhcn4n0Dy14SV0d21iI9xjEKP3gPGshrDQiz+M9mR0Ilbt1pYMsqdSLXQ9g gg1q5KY9/ecpypF0sDxL8/0GwB1LVq4qoKWfCigWSB5pcHmoZaNzU6fnNfo8BDcW+ySg zQh+ilPhTjoJASqF7dTmO/NLLdVJ8sUdijGJ1o/Z7TkAihw4I38Ld8joPiMBQ+KpEZAL mYPlCC0gkkwFdH6BoxkPgkeHCi2C4PqcqfxAXefAZ4b6rXzgx4KIBXSRTNo6RPBfkH1k It5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709289657; x=1709894457; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kxdRDiZIrCvaJKsIpgxeAPJhXd0SCzjIl00w26sSc00=; b=ludvM2g6zY7pXQUxGKcpCBytmJeY6wOsXhTMXqP4OEiq3NRLiK8GaTzyEtnes/W4od hQJ09PotuudmyO9bLlc+ecRPoAn4yR98fzB2TEAsVnwAwXMWvhaXT6ZcbwRE8Nvai6wc lYXXG65PhciUFC+olgh2Gmq5ZWyrBA9h0ETn5wNuwyDBDfKIpu9VOMvhQmD9/ZTUUdV6 g6ESN6qbF2kfjdEjv4DULpMRYOiUn4mPhn+aLLV6oPoFjOGSXdQdUdCMyN58zchwWfkU n8dG9VO8+KU9mXKydTvch7HzHlukR8Pn7C6Cl4u9/Nhn0IxhlL79GogY7MX8EXb/txcK amfw== X-Gm-Message-State: AOJu0Yy/0jp8Y0uwWXEie27ETRoNQ/208mhsa0qS4QTan7bplpg73G8F 7FQoAnvCrswa0dxj18gKAiyWrn3N6Dbnkdt28viBI5qeXmA+2nmjZxU7YPiE+6aWY4coaXJ/Q/j gzqNr5d8etLyVsqHiN62pS2kpGE/1hNSwCBq4ldvrobcJdnRw1YzP74NqbEOiyIaa9nkWHV/tiL wWCgCzlAFXn43V3OykZ9kAug7hACQOcbh8olY5wc5z X-Google-Smtp-Source: AGHT+IH5U/ajgZfdssVpAqL5aOkjzNArVXzUduHG7nWrEIiaFg+TFJEWXrely1V5GJ4z6yO0TUKjNBks X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a25:aacb:0:b0:dc7:7ce9:fb4d with SMTP id t69-20020a25aacb000000b00dc77ce9fb4dmr251467ybi.12.1709289657007; Fri, 01 Mar 2024 02:40:57 -0800 (PST) Date: Fri, 1 Mar 2024 11:40:48 +0100 In-Reply-To: <20240301104046.1234309-4-ardb+git@google.com> Mime-Version: 1.0 References: <20240301104046.1234309-4-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=1419; i=ardb@kernel.org; h=from:subject; bh=ag8zJr2Gwb2ja4POjmarB+c0hsl7Tnui13fu37wLWiI=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIfXhhg1JAUrR7YHinI8aGt61z0xz+J+mtiZju17q1/C3M /4ZfN7TUcrCIMbBICumyCIw+++7nacnStU6z5KFmcPKBDKEgYtTACYSY8fw338Ne561i/e/y4uv PL8qdX/nkxW3RIJ42Jt+zo/03uGVac3IcD9WM69vUvdHljmNDMpRu8S+qu/fE3u+kC9/TcSkI/9 UWAE= X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240301104046.1234309-5-ardb+git@google.com> Subject: [PATCH 1/2] arm64/mm: Use generic __pud_free() helper in pud_free() implementation From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: catalin.marinas@arm.com, will@kernel.org, Ard Biesheuvel , Ryan Roberts X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240301_024100_067472_B246E2B4 X-CRM114-Status: GOOD ( 13.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ard Biesheuvel Commit 0dd4f60a2c76 ("arm64: mm: Add support for folding PUDs at runtime") implements specialized PUD alloc/free helpers to allow the decision whether or not to fold PUDs to be made at runtime when the number of paging levels is 4 or higher. Its implementation of pud_free() is based on the generic version that existed when the patch was first written, but in the meantime, the freeing of a PUD has become a bit more involved, and so instead of simply freeing the page, we should invoke the generic __pud_free() that encapsulates whatever needs doing at this point. This fixes a reported warning emitted by the page flags self-diagnostics. Reported-by: Ryan Roberts Signed-off-by: Ard Biesheuvel Tested-by: Ryan Roberts --- arch/arm64/include/asm/pgalloc.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/pgalloc.h b/arch/arm64/include/asm/pgalloc.h index aeba2cf15a25..8ff5f2a2579e 100644 --- a/arch/arm64/include/asm/pgalloc.h +++ b/arch/arm64/include/asm/pgalloc.h @@ -60,8 +60,7 @@ static inline void pud_free(struct mm_struct *mm, pud_t *pud) { if (!pgtable_l4_enabled()) return; - BUG_ON((unsigned long)pud & (PAGE_SIZE-1)); - free_page((unsigned long)pud); + __pud_free(mm, pud); } #else static inline void __p4d_populate(p4d_t *p4dp, phys_addr_t pudp, p4dval_t prot)