From patchwork Mon Mar 10 09:59:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 14009512 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 82178C28B2E for ; Mon, 10 Mar 2025 10:07:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=usxpGZ2JIapOfM0P0HHDXpsbI77WvhT/gkt231dPbVg=; b=ryp41j/tSxpJDJNUcgea3cDthx OGHaL+8FCdv3EcRMpWulGrM2cnJhMOo6AWeB5d9UKmHiJuYyI9jQfcTACSoBgAmxLZMmVmyMD3Z1k 9KDcZ0JizfpvJz04D28CupYKfI+2icXA0HmL8Yup2XvT/7Zx3wSCVfJg3N6Hb4yFpV0IEG7bfGhDN YvAXBqdWbXhyuhSD9dd8R0jZrGMqQE5a7QwByekaN79jA4KbXlS4PpOHx/Unz3fIsnDjiz3hR77Ry 5eZOIdBr/6fNHJVtQtBVsAcYWY1NykQDgwXl1ac+SH2ZPZz4Jw/7ISUCynkp/A7M6ebWnWRIVmidJ JNAUXZsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tra2V-00000002Cig-0ZUb; Mon, 10 Mar 2025 10:07:15 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1trZui-00000002B2u-1ulA; Mon, 10 Mar 2025 09:59:13 +0000 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 4AD8515A1; Mon, 10 Mar 2025 02:59:23 -0700 (PDT) Received: from a077893.arm.com (unknown [10.163.42.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 59DE33F673; Mon, 10 Mar 2025 02:59:04 -0700 (PDT) From: Anshuman Khandual To: linux-mm@kvack.org Cc: Anshuman Khandual , Catalin Marinas , Will Deacon , Madhavan Srinivasan , Nicholas Piggin , Paul Walmsley , Palmer Dabbelt , Gerald Schaefer , Heiko Carstens , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Andrew Morton , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org Subject: [RFC 0/2] mm/ptdump: Drop assumption that pxd_val() is u64 Date: Mon, 10 Mar 2025 15:29:00 +0530 Message-Id: <20250310095902.390664-1-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250310_025912_584508_028EFC26 X-CRM114-Status: GOOD ( 11.31 ) 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 Last argument passed down in note_page() is u64 assuming pxd_val() returned value (all page table levels) is 64 bit - which might not be the case going ahead when D128 page tables is enabled on arm64 platform. Besides pxd_val() is very platform specific and its type should not be assumed in generic MM. This series splits note_page() into individual page table level specific callbacks which accepts corresponding pxd_t page table entry as an argument instead and later all subscribing platforms could derive pxd_val() from the entries as required and proceed as before. Page table entry's value, mask and protection are represented with pteval_t not u64 that has been assumed while dumping the page table entries on arm64 platform. Replace such u64 instances with pteval_t instead as expected. This series has been lightly tested on arm64 platform but it does build on other relevant platforms (v6.14-rc5). Some questions: - Is there a better method to address this problem than splitting current note_page() into multiple call backs as proposed here ? - This replaces note_page(st, 0, -1, 0) with note_page_pte(st, 0, pte_zero) Is that problematic ? Does level = -1 has got a special meaning ? Should level = -1 case be handled differently possibly via a separate callback ? Cc: Catalin Marinas Cc: Will Deacon Cc: Madhavan Srinivasan Cc: Nicholas Piggin Cc: Paul Walmsley Cc: Palmer Dabbelt Cc: Gerald Schaefer Cc: Heiko Carstens Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Andrew Morton Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-riscv@lists.infradead.org Cc: linux-s390@vger.kernel.org Cc: linux-mm@kvack.org Anshuman Khandual (2): mm/ptdump: Split note_page() into level specific callbacks arm64/ptdump: Replace u64 with pteval_t arch/arm64/include/asm/ptdump.h | 22 ++++++++++++----- arch/arm64/mm/ptdump.c | 41 ++++++++++++++++++++++++++++--- arch/powerpc/mm/ptdump/ptdump.c | 37 ++++++++++++++++++++++++++-- arch/riscv/mm/ptdump.c | 37 ++++++++++++++++++++++++++-- arch/s390/mm/dump_pagetables.c | 37 ++++++++++++++++++++++++++-- arch/x86/mm/dump_pagetables.c | 31 +++++++++++++++++++++++- include/linux/ptdump.h | 7 ++++-- mm/ptdump.c | 43 +++++++++++++++++++++++++-------- 8 files changed, 226 insertions(+), 29 deletions(-)