From patchwork Mon Jun 24 22:11:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxwell Bland X-Patchwork-Id: 13710191 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 560E9C2BD09 for ; Mon, 24 Jun 2024 22:11:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB33B6B036F; Mon, 24 Jun 2024 18:11:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D61C06B0370; Mon, 24 Jun 2024 18:11:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2A2E6B0373; Mon, 24 Jun 2024 18:11:31 -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 9FE666B036F for ; Mon, 24 Jun 2024 18:11:31 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 469BEA3DAC for ; Mon, 24 Jun 2024 22:11:31 +0000 (UTC) X-FDA: 82267179582.03.FAB5A58 Received: from mx0b-00823401.pphosted.com (mx0b-00823401.pphosted.com [148.163.152.46]) by imf21.hostedemail.com (Postfix) with ESMTP id 5E75C1C0016 for ; Mon, 24 Jun 2024 22:11:29 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=zT6JBiLG; dmarc=pass (policy=none) header.from=motorola.com; spf=pass (imf21.hostedemail.com: domain of mbland@motorola.com designates 148.163.152.46 as permitted sender) smtp.mailfrom=mbland@motorola.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719267078; a=rsa-sha256; cv=none; b=TBy9RB6Xg/8Sg6d9OsT5lxKCcGXhQaKk6VFdlMRGegWIzGTIlDs/yVDJzvJPBLHZfVXRD0 tNhjoMP1fyP72O4QW0GSXiLFjyooGAZ/BNvFay6bm/wGPNaXbvWIpMsRDgTZ/3/wfvXRLF Kcc1zdhnwCb4OrsB1bjBl9jrRug8j9A= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=zT6JBiLG; dmarc=pass (policy=none) header.from=motorola.com; spf=pass (imf21.hostedemail.com: domain of mbland@motorola.com designates 148.163.152.46 as permitted sender) smtp.mailfrom=mbland@motorola.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719267078; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=UFM48GN3j3TGnx2m6Bd7A0f60Mbw6SruFuO0J8syXfM=; b=ToDt/IjNlEZgO1DApQSqXQaF3lxY4v1XS589sYoxLxLZAexESqUl7XXUZme5/KFmt2mMMJ /R3gzryUiLd01wjOBpfk94G6i+yglUYWLPiQ9AnGPnkVTDyLKeFIrHuk1hZEKJkmLzlWNy bsRy+pOBjhw+9sFpPIfj3Ih97/aa98M= Received: from pps.filterd (m0355090.ppops.net [127.0.0.1]) by m0355090.ppops.net (8.18.1.2/8.18.1.2) with ESMTP id 45OEviBT032476; Mon, 24 Jun 2024 22:11:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=motorola.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=DKIM202306; bh=UFM48GN3j3TGnx2m6Bd7A0f 60Mbw6SruFuO0J8syXfM=; b=zT6JBiLGKlW7OsPoAxDU7armuhbSVL4zAti3VIz vcbbu4uTtdTgdZuhjEbC6MWV6AabXIk2EHJtQqHZndEl21H0ASABOLFoJoUnVR+7 XBtU2HQpJh4m0Y9DZpLHM/D103NqBvBDEcMs821PsalH2NBDeaSlHuOebrqxv/tQ sYSoUuaDH0Qyj4dpGx5aR6QU+122CzuP4PHvWRoXN9/06km3nwekdAC0+Nf63+jx EECjS3rEFp23fORSgPl55HXvDd9E32Qu5j8TvjZC7KBfiEmwMda8zbMSMUQH/7HB XgdshYxnT+ZUQ6CsPhoptHDCHJPsbMHO0xVsHw+O4WFfD1w== Received: from va32lpfpp04.lenovo.com ([104.232.228.24]) by m0355090.ppops.net (PPS) with ESMTPS id 3yx9xrk9yd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jun 2024 22:11:14 +0000 (GMT) Received: from ilclmmrp01.lenovo.com (ilclmmrp01.mot.com [100.65.83.165]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by va32lpfpp04.lenovo.com (Postfix) with ESMTPS id 4W7McK3jM7zj9hH; Mon, 24 Jun 2024 22:11:13 +0000 (UTC) Received: from ilclasset02 (ilclasset02.mot.com [100.64.49.13]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mbland) by ilclmmrp01.lenovo.com (Postfix) with ESMTPSA id 4W7McK1zL8z3nd8L; Mon, 24 Jun 2024 22:11:13 +0000 (UTC) Date: Mon, 24 Jun 2024 17:11:12 -0500 From: Maxwell Bland To: linux-mm@kvack.org Cc: Catalin Marinas , Will Deacon , Jonathan Corbet , Andrew Morton , Ard Biesheuvel , Mark Rutland , Christophe Leroy , Maxwell Bland , Alexandre Ghiti , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 1/6] mm: add ARCH_SUPPORTS_NON_LEAF_PTDUMP Message-ID: References: <2bcb3htsjhepxdybpw2bwot2jnuezl3p5mnj5rhjwgitlsufe7@xzhkyntridw3> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2bcb3htsjhepxdybpw2bwot2jnuezl3p5mnj5rhjwgitlsufe7@xzhkyntridw3> X-Proofpoint-ORIG-GUID: aFZWZNnXyYrEtj8CTtxn_sgc6qmXaZgc X-Proofpoint-GUID: aFZWZNnXyYrEtj8CTtxn_sgc6qmXaZgc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-24_19,2024-06-24_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=615 priorityscore=1501 clxscore=1015 impostorscore=0 bulkscore=0 mlxscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406240177 X-Rspamd-Queue-Id: 5E75C1C0016 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 116cbfj37gqhisiwigtbwmdbb16s8mkp X-HE-Tag: 1719267089-402494 X-HE-Meta: U2FsdGVkX1/TFuYZAiaRGJ1NVEnosdPDhbUE4uLmoOOCoIHjrOy22fr0foTAbwN4aw0SeWPUaHDSXvYypOpUQNgVt7x4T/bLbW8UwKtgySMLKYgWkY3ogr4O/7TA281cUjI8UKyY1UM76hk0I7DN1y3h3OLaUxNQ2lW5fGs26V4JZOtqNlE5lQNOjgnDFO4gv5K0lPyjabjVi9hZk6SN3Ab9rPvtbTkS2My7zGSZUQM8fGhy8lo3/CPuIPlvQFmOuh77DH6BVMMg0YubzugEqrYsPIargMaOn3emMtcu4RedQr0E+l+3QSLcCnqK6L/+EuaL1OlEn9WLGyFp7zVGnqYYF0MTOArqFbkELkFIB0ZGXgc9NGR8M9gyP7o3e8lRkG1GT69pPWJ3Hx65yX0EB5gCbFz+vbgCzjF7GsIwHj9MgohPDE75wHwyw1f4JQ//BOXLlsTcZTaAJTn/0Nk54KCiE5q+bCd2RYdSQuOCAoyr0TPMRQTwJCSA7WVHC4uNXlqJRhn7NHOyBFnrWtPSTbPdN1sLKcx+2y2Hy/gVx353ffWeXiPs9RFSdUGsNiRFxPATC/NR47FcJ0N9PfVBFCc/6FBvCc8PHKjkW+3YTwXLnGCF7MciIDOyaeyB3xlsuuFvT+mOA3+xBs3iBjfWHKmOOu15lAGbX5uutQVVsLzUZ6vgAaVN1LD5JrAfpmnXcZx9dYSM7RF5iqIvQE+7xehpyTxhMRPsYhJy+WNZzXtiMGPBFI0NOgaWcCx4xoFkLwzGskFcrz3bPIWANSXAcPBv+ssMFtKIfKwIKpCjdR/poOefM5SUZd04ejiuQKLH0LVf5ZSUTE9ykmUe7hL7bRhJMrFBuZ8/Tf9v26e83sFhTtrDS2vi+OphrqIN9UFivqt8taRm2qcRI5UeaXLsJwWe36RsBL8qoNUPH7sw9rkHF0zKW+gSwoRYCC0oSP2zZa8jfXNUsGKd5yj3DWH WYoGKvXb 3PmCflQUANEXpxm4E/LKymGvyflLCqtwZCWvuDHKrhy6Ugah5+As2xpAHvPQtRy7HDRdvP3YZx3IQRC+LmKIMND7T8yc9/OYiqL8nWizPiysm5r9e4jdOzt4DeI9a6a4SqnxxjeVnpPD+NOuLlDXCKTh7cdBeFxiYv8wPbV8V/9Bs6K0WBPhkW68donXM5UumFOyd2BrUxFgDQIreLhEcEXT0ycdSU6y5w1lQ3ekkArVytLAuqjlMpeZPUNT+Cy21KvQbObKIyGx0rryW2peY6VI/vuDPo+3U/YSFkyZXCro2J+PWQTCaK6zU9B4yKIuXy9+DT8eCvZnkYPRYJeJhkRzgjw== 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: List-Subscribe: List-Unsubscribe: Provide a Kconfig option indicating if note_page can be called for intermediate page directories during ptdump. Signed-off-by: Maxwell Bland --- mm/Kconfig.debug | 8 ++++++++ mm/ptdump.c | 26 ++++++++++++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug index afc72fde0f03..41071539bf9e 100644 --- a/mm/Kconfig.debug +++ b/mm/Kconfig.debug @@ -201,6 +201,14 @@ config PTDUMP_DEBUGFS If in doubt, say N. +config ARCH_SUPPORTS_NON_LEAF_PTDUMP + bool "Include intermediate directory entries in pagetable dumps" + help + Enable the inclusion of intermediate page directory entries in calls + to the ptdump API. Once an architecture defines correct ptdump + behavior for PGD, PUD, P4D, and PMD entries, this config can be + selected. + config HAVE_DEBUG_KMEMLEAK bool diff --git a/mm/ptdump.c b/mm/ptdump.c index 106e1d66e9f9..3c8eea232282 100644 --- a/mm/ptdump.c +++ b/mm/ptdump.c @@ -26,6 +26,11 @@ static inline int note_kasan_page_table(struct mm_walk *walk, } #endif +static inline bool has_non_leaf_ptdump(void) +{ + return IS_ENABLED(CONFIG_ARCH_SUPPORTS_NON_LEAF_PTDUMP); +} + static int ptdump_pgd_entry(pgd_t *pgd, unsigned long addr, unsigned long next, struct mm_walk *walk) { @@ -41,10 +46,11 @@ static int ptdump_pgd_entry(pgd_t *pgd, unsigned long addr, if (st->effective_prot) st->effective_prot(st, 0, pgd_val(val)); - if (pgd_leaf(val)) { + if (has_non_leaf_ptdump() || pgd_leaf(val)) st->note_page(st, addr, 0, pgd_val(val)); + + if (pgd_leaf(val)) walk->action = ACTION_CONTINUE; - } return 0; } @@ -64,10 +70,11 @@ static int ptdump_p4d_entry(p4d_t *p4d, unsigned long addr, if (st->effective_prot) st->effective_prot(st, 1, p4d_val(val)); - if (p4d_leaf(val)) { + if (has_non_leaf_ptdump() || p4d_leaf(val)) st->note_page(st, addr, 1, p4d_val(val)); + + if (p4d_leaf(val)) walk->action = ACTION_CONTINUE; - } return 0; } @@ -87,10 +94,11 @@ static int ptdump_pud_entry(pud_t *pud, unsigned long addr, if (st->effective_prot) st->effective_prot(st, 2, pud_val(val)); - if (pud_leaf(val)) { + if (has_non_leaf_ptdump() || pud_leaf(val)) st->note_page(st, addr, 2, pud_val(val)); + + if (pud_leaf(val)) walk->action = ACTION_CONTINUE; - } return 0; } @@ -108,10 +116,12 @@ static int ptdump_pmd_entry(pmd_t *pmd, unsigned long addr, if (st->effective_prot) st->effective_prot(st, 3, pmd_val(val)); - if (pmd_leaf(val)) { + + if (has_non_leaf_ptdump() || pmd_leaf(val)) st->note_page(st, addr, 3, pmd_val(val)); + + if (pmd_leaf(val)) walk->action = ACTION_CONTINUE; - } return 0; } From patchwork Mon Jun 24 22:12:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxwell Bland X-Patchwork-Id: 13710193 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 2DF4DC2BD09 for ; Mon, 24 Jun 2024 22:12:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AFB516B0131; Mon, 24 Jun 2024 18:12:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A7D646B013B; Mon, 24 Jun 2024 18:12:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F5E76B012F; Mon, 24 Jun 2024 18:12:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6ECD16B0129 for ; Mon, 24 Jun 2024 18:12:33 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id E512740326 for ; Mon, 24 Jun 2024 22:12:32 +0000 (UTC) X-FDA: 82267182144.25.B5B9E03 Received: from mx0a-00823401.pphosted.com (mx0a-00823401.pphosted.com [148.163.148.104]) by imf14.hostedemail.com (Postfix) with ESMTP id EA691100005 for ; Mon, 24 Jun 2024 22:12:30 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=NcOofN60; spf=pass (imf14.hostedemail.com: domain of mbland@motorola.com designates 148.163.148.104 as permitted sender) smtp.mailfrom=mbland@motorola.com; dmarc=pass (policy=none) header.from=motorola.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719267132; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=beDAkvKYsDlCVLz13QLf8oAMscanV0EKlCxkUmhBfqk=; b=OKuJmCu19QmS9YI6UESfxUq4PfNJfI/LE6AXY3eVPXLriJHON0RPGaE/x9YpMdtjTHwL0+ ljm295ftyxN+RFi2f3uE4KgFx1jhbkrJTtN9XAYSpZVz+1y2RE75YGbeoOQkHnlTc/DJQK LHzRAduob1exk5ZW93zugLuO01cuzSQ= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=NcOofN60; spf=pass (imf14.hostedemail.com: domain of mbland@motorola.com designates 148.163.148.104 as permitted sender) smtp.mailfrom=mbland@motorola.com; dmarc=pass (policy=none) header.from=motorola.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719267132; a=rsa-sha256; cv=none; b=ONgGVI1Qmh6R/v95AmkLRcusn6NcyhpLAiGH1lFR+jkt83ZipHuU2dZ8tansnv6+HyBlqq g5vfT6zkdYoWoAQr9LKY4EL/itpGj+T5oFyuOVlA+59pNFQgU6Zr2Asy/+Mcfd1T2m4khY pdWJGEEEXSwj0HCrZndo0RRaFVR5CLo= Received: from pps.filterd (m0355088.ppops.net [127.0.0.1]) by m0355088.ppops.net (8.18.1.2/8.18.1.2) with ESMTP id 45OExZPE016200; Mon, 24 Jun 2024 22:12:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=motorola.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=DKIM202306; bh=beDAkvKYsDlCVLz13QLf8oA MscanV0EKlCxkUmhBfqk=; b=NcOofN60eggD0fDtyENxaoXl1pTKI3kjFo/BZUW rDhrNO3IKgdPV3JNqsMKA/eT8il00pVvW420+O6x/TG9VtWXABKDFqec5HrUJawW BRofFlq7rKojw1Bf5cC9oOdmA8PN2g3t3xbvl6Qd4h+an6DnZHbrqP1snVtWr2AM 3NZFYVAdR7b6avcv3eR6Y4XRE0nI36AhVqtk0tfNAeP4aGM8BhNnL601exSiy2Q7 gsFR+kE3N/kVz1fiRy4woTc1giQBXF+XaouC4Nfqj3KV9aJw2y2yowEExkvt9YnL QNqTKvR3RDyKQk86jB3DZG1Cb+06dCbiEWiuUIVOtdDuGkg== Received: from ilclpfpp01.lenovo.com ([144.188.128.67]) by m0355088.ppops.net (PPS) with ESMTPS id 3yxbstk762-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jun 2024 22:12:22 +0000 (GMT) Received: from va32lmmrp02.lenovo.com (va32lmmrp02.mot.com [10.62.176.191]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ilclpfpp01.lenovo.com (Postfix) with ESMTPS id 4W7Mdd4Wdszcxq9; Mon, 24 Jun 2024 22:12:21 +0000 (UTC) Received: from ilclasset02 (ilclasset02.mot.com [100.64.49.13]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mbland) by va32lmmrp02.lenovo.com (Postfix) with ESMTPSA id 4W7Mdd16g3z2VbbV; Mon, 24 Jun 2024 22:12:21 +0000 (UTC) Date: Mon, 24 Jun 2024 17:12:19 -0500 From: Maxwell Bland To: linux-mm@kvack.org Cc: Catalin Marinas , Will Deacon , Jonathan Corbet , Andrew Morton , Ard Biesheuvel , Mark Rutland , Christophe Leroy , Maxwell Bland , Alexandre Ghiti , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 2/6] arm64: add APTable encoding to pagetable defs Message-ID: References: <2bcb3htsjhepxdybpw2bwot2jnuezl3p5mnj5rhjwgitlsufe7@xzhkyntridw3> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2bcb3htsjhepxdybpw2bwot2jnuezl3p5mnj5rhjwgitlsufe7@xzhkyntridw3> X-Proofpoint-ORIG-GUID: cBD7-o-fMElZ7gAEi_7CTo0KFY4fieW1 X-Proofpoint-GUID: cBD7-o-fMElZ7gAEi_7CTo0KFY4fieW1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-24_19,2024-06-24_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 bulkscore=0 mlxscore=0 priorityscore=1501 adultscore=0 phishscore=0 clxscore=1015 mlxlogscore=715 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406240177 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: EA691100005 X-Stat-Signature: n77dgdsdmmo9x46677e11t5gt4ot1s15 X-Rspam-User: X-HE-Tag: 1719267150-970309 X-HE-Meta: U2FsdGVkX1+Ehqp5fgmdnclc4oNn5WknzFRHN4uq9BzABAoY4G+h1zHBN24fT5mtt4EJZzpbqHUmFo+VBb3J5Lo7h1GwPbSfPse3wPZiLUBfxSmToHHRBd3PcZ5ZCCc2QaBxPvb7vKzA+JMptankDAQld0zERI+IWOuHTDl/8DPF2RvQjKZiirzCSOfNGpkOzW+wW6muq8nmXTyg8UoK1xYONNdz+0Ll2OaDtRItPBg2EffPeepfdvAJ9+r1DImT2bYXt5XeKaEAnICUPa3Wl0nZfzXfwunbUutIzPpCHxJq2xL61jzivBtKtsoi1mZ2TwdVX+c9KHT0dt6KkxTUENFxfbv8aAcT5z2+gTiKnRUa8nqn7UepbN8k00SpMrrZ9gSyip/PrxPwJr9hfpf6s4Riko/nrfEg5h7pna9EXuxReNBg74w85auMpUyHvaCGnMXDeF4FtXBhpP9USfZluyUdM5fLU5Pt7n07bug3r7169XBcTHwgjMKSnVObiXw48aBeBKlr3pB+rW8cX/RhqrdNtT1BdnQ35If+sgTxIYy/npm7NZoBATP6kP7sZ6YMw5Mvpz60Rz9MP0AdhVnI75owpfu5Jvt8O1hhZ2Dj4k3fuE1u7W7z8HobO7zXfE4tgSabE4NzwaU8vpFo+R4qJzpn3UlFCx6c5aetR9T0rui9KCZ2mOxVoh1WIUeVqv6UnCVxxQR7puIrgmMEUDhPcDvRfhixMPq+QTBjQ0Ilq8uCuVtdknhWb30DEwuHDN8R9hA6Xjq4/RGKbiDftZPRPyp9fVRRrFN04u9oeJ0wuGo8QGig4huKBDuQ1g6DAobrEya7VrTvVibVv0OW1ggJm8xB5UYdmog8Z2sQYg8Id09Rfbzxu9ODOEEYwYyHo4ISXPl0XxKFaKH9VK17ynDDMUqemxD/mwLtw2VMgUBEFTUCphLtArUAsG11LfNopzUMRpzuT8piZyDvvNOIHDT McfK+LFw 9S7zVP8UoKXsL8a5QeQXvdhTTQlf8LiVNVwA7ZGFWO4TB0iHbPH9v2gWLd8MK0NUERBoi667R05LW7rzJdMA4V8ZWw9iNqVzkuQLmDvFEB4BAszw+hkNQo4BBvUlkZEP4OWFDxX77g4seUR8lOLP8YHz5oIdpKTupwWo/xqw539wVWni9UuSPsYh+4X6XdJBF7MD6s5kJflO93Ex4k3XVJtk5x/3yv1T+RPmWh+nvhl6O6AYAOx6UuS2V+Cpzgg/pRPxjRStl4gM3a2VYXA2lpFtbpEQR+H4hiSljStDHdfPblNVVnZ67IEF5scdU1/+t6FNQ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000150, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add in the APTable permission bit encoding to describe table-level hierarchical access control Signed-off-by: Maxwell Bland --- arch/arm64/include/asm/pgtable-hwdef.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h index 9943ff0af4c9..8c229fc96c0a 100644 --- a/arch/arm64/include/asm/pgtable-hwdef.h +++ b/arch/arm64/include/asm/pgtable-hwdef.h @@ -146,6 +146,11 @@ #define PMD_SECT_UXN (_AT(pmdval_t, 1) << 54) #define PMD_TABLE_PXN (_AT(pmdval_t, 1) << 59) #define PMD_TABLE_UXN (_AT(pmdval_t, 1) << 60) +/* + * APTable[1:0] encoding for hierarchical data access control + */ +#define PMD_TABLE_KERN (_AT(pmdval_t, 1) << 61) +#define PMD_TABLE_PRDONLY (_AT(pmdval_t, 1) << 62) /* * AttrIndx[2:0] encoding (mapping attributes defined in the MAIR* registers). From patchwork Mon Jun 24 22:13:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxwell Bland X-Patchwork-Id: 13710194 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 1121FC30653 for ; Mon, 24 Jun 2024 22:13:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6FDBE6B026D; Mon, 24 Jun 2024 18:13:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AC646B0284; Mon, 24 Jun 2024 18:13:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FF8B6B0286; Mon, 24 Jun 2024 18:13:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 31A026B026D for ; Mon, 24 Jun 2024 18:13:30 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C8DB0C13AD for ; Mon, 24 Jun 2024 22:13:29 +0000 (UTC) X-FDA: 82267184538.05.8BB30DC Received: from mx0b-00823401.pphosted.com (mx0b-00823401.pphosted.com [148.163.152.46]) by imf20.hostedemail.com (Postfix) with ESMTP id DD7181C0012 for ; Mon, 24 Jun 2024 22:13:27 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b="pNJGWhv/"; spf=pass (imf20.hostedemail.com: domain of mbland@motorola.com designates 148.163.152.46 as permitted sender) smtp.mailfrom=mbland@motorola.com; dmarc=pass (policy=none) header.from=motorola.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719267194; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=xzTdj//kQNkI6INZErfuhFKfWB5d10It9q/1v3tHJuc=; b=B7W1iiDSLbDWy9DeUfgi5d83su9H5Ticgd5uFf1YMZJyYES/GhhEz6xNyOvHQVb1SC2nTz fDXhifz/QRvRbMHvnmh6+PBnCpIcV6xBcQc9Fc+dtoQAzuJbhZZ+rlspI7YOy0cUzjDF9u 6OcN28XW2CDtLZlbReqmHd3pibY6hPE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719267194; a=rsa-sha256; cv=none; b=fE27TOFGJseEUeCjFqmqhSgPw0MBifYO+dPLsA5hnqd83lRH/3JD6GJhNv6OB3mInkYwBu Y7j2My2sFTTYzpcrPGWn53UvAWJxq453QVJJYCyyA9C1GWyugTcZmpxV21iibtyR460XbH kG8Wqu8YD0n8ttoPb4i9mH3xn576f3g= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b="pNJGWhv/"; spf=pass (imf20.hostedemail.com: domain of mbland@motorola.com designates 148.163.152.46 as permitted sender) smtp.mailfrom=mbland@motorola.com; dmarc=pass (policy=none) header.from=motorola.com Received: from pps.filterd (m0355091.ppops.net [127.0.0.1]) by mx0b-00823401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45OF2NlO000358; Mon, 24 Jun 2024 22:13:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=motorola.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=DKIM202306; bh=xzTdj//kQNkI6INZErfuhFK fWB5d10It9q/1v3tHJuc=; b=pNJGWhv/zhv7asZpsLEtNusKf0MwwHjM0R79XbK uGcztd9K6rkSBNDqLkVkcFRwa5mL3+Ht3hsTAraUUOQDPhnusLLlcDArY5H1CDnF VUqushrv0bKJWmPBUS8MxN+CVjXCZOBFl5k++gU/0UTytABC/YU38cFYDoOJ0b+p NAAQrdD7u1Lb/AO9oFzMV10XPpcPcmRbFQaIPauSipbp8T0VQ05a8+2SqkvNQ0Gk lbsDzBX/8qDbdK5UARdn8Nk8qvpKuLdylEJvtwU3UzKRgTODrWYd6uovyEfjTpo6 gRQKYPXul7TqcifAkan5C8uXfP6HGtr3h5OORF49gbPqF8w== Received: from va32lpfpp02.lenovo.com ([104.232.228.22]) by mx0b-00823401.pphosted.com (PPS) with ESMTPS id 3yxbqftx79-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jun 2024 22:13:18 +0000 (GMT) Received: from va32lmmrp02.lenovo.com (va32lmmrp02.mot.com [10.62.176.191]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by va32lpfpp02.lenovo.com (Postfix) with ESMTPS id 4W7Mfj6Y9Qz53xyW; Mon, 24 Jun 2024 22:13:17 +0000 (UTC) Received: from ilclasset02 (ilclasset02.mot.com [100.64.49.13]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mbland) by va32lmmrp02.lenovo.com (Postfix) with ESMTPSA id 4W7Mfj4N4Fz2VbbV; Mon, 24 Jun 2024 22:13:17 +0000 (UTC) Date: Mon, 24 Jun 2024 17:13:16 -0500 From: Maxwell Bland To: linux-mm@kvack.org Cc: Catalin Marinas , Will Deacon , Jonathan Corbet , Andrew Morton , Ard Biesheuvel , Mark Rutland , Christophe Leroy , Maxwell Bland , Alexandre Ghiti , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 3/6] arm64: table descriptor ptdump support Message-ID: <3z4hwt3fcvscs7zu767vp33tp2mqjor5edfnpgmd2s5p66sg6j@elmhqmeujb5m> References: <2bcb3htsjhepxdybpw2bwot2jnuezl3p5mnj5rhjwgitlsufe7@xzhkyntridw3> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2bcb3htsjhepxdybpw2bwot2jnuezl3p5mnj5rhjwgitlsufe7@xzhkyntridw3> X-Proofpoint-GUID: T8uRFtf4Po_E6S6YwRNJ3KsUezkw0neA X-Proofpoint-ORIG-GUID: T8uRFtf4Po_E6S6YwRNJ3KsUezkw0neA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-24_19,2024-06-24_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 mlxlogscore=999 lowpriorityscore=0 mlxscore=0 bulkscore=0 spamscore=0 malwarescore=0 suspectscore=0 adultscore=0 impostorscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406240178 X-Rspamd-Queue-Id: DD7181C0012 X-Stat-Signature: d4sqiwbo3t7in3pe8stx81obncz45utb X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1719267207-468019 X-HE-Meta: U2FsdGVkX1+kHCYV0EfOwxpt1JQ2PnCMWReBSaFeIcxBM1QUgGq7yXIRQfpMW3gmS37+uS7mUgxocvbxhubW4Gj4HgxcBcde4BAkSF5+Xccb42Es2EBSrwDJRJzIsai0bOkLk7TgvWzft3PpFNBJm0IJrh+OCu37S016gry57fmx0x6VYCM6FbnTWZ0fryc62BRTi41jpctRg4MF8K7xc0a8WcLQ4IC8ovs3LbhLxfT79Dx0Y0zl5R2RxHPXECkLNHiMJTfm8u53OufQ9jQM+Tg+UWA+D4/uLXkryYM+eyWje1cz92ORT2ontWWCoWKLLXc5wHuGwImGrT8ZgLLMtYSGXBbQk1L5ZntIgdHay7KFT24QTv9ax0nGtHPfcdkEndBGisxtSE/6IYyYEzjvd7xnTrwG1Rw9N7O1KV0j0Z97Iej40ICuq6gGQNsDdHXHv0Ji4IdAUGdiV6VdOlolryHapnYNrEiOMXMTkNqhhDoJR1O7mPqYbiVJ7rVyFceoxgt7ayJgC+bryZjApqVk7O4h2sb3ZBPMpS5O1qhw52VQ0a2mf7csPF0rVgVj3FOfkBnrKlYdhjq/lAAF+Z0OYSlWUHBl/Zy2/tGwP/Rlb22GiKB9tenqLwDoGDAP3qPg3eA/L/IQ74bZKLHmBeRUs5hMmh1O7vf39GPrNAjHwO4ywJce7yKknWSZVn0hTtYzaEfbzRxya1B9+n+su31S/axShMLGPBTuPuyF6Y8fjJkcYq3kuWsw03Rf6gJLAm1mzNgM9R6k5dNorF+Fe+0qemzv0+d8u9UOxWFMuHuabyZmyyqXMOUClRe12HP25tJKtWz94i6SKbzpm4DgzgZVpoW+pXn+XAKMcSmRiRME/crqCRofe8JJCgsLNVPRUrUNRfv34BbecQVxCslNBXjWfID6q6ubi/dGWg00h6rrFZLHQZhDaXgkekxxSW8hm/YsMYJwgD6nukQqQSJaiCZ UZkca/XN 0tVwOCEQjpN8lLnzMZ5akkT9RsC7k382vd5T2y3s7cQDnfbTOdpexbQRVDeH00KdYVO/EdAq7s24RcXsWjQPTNTLK4EkqFgkgQ+C5pjbg+kE5TCt/DjixOCXZGDvpRd4Cm7/eWxW4hRO3zTi9lj6lXbVbCJaFcU0oToTHwv7yyCTSkfFi9AXusqB+3/w7kt87FIC84qBGQy9lHd2CS9P3I8dBTl8cMtsObTXKmIkZY/y2GTYVfE3oKfsVoUaqouOKFQn7dEwsS5gzKB2okjbo0l8d3+KRtNvNiUuEh9wjx0X2rK9iQRBfhSa7EXyiGMRWn+P6056yLCIChp8= 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: List-Subscribe: List-Unsubscribe: Distinguish between table and block descriptor attribute bitfields, enable the Kconfig option to print table descriptors and intermediate page table entries, and support printing of attributes specific to table descriptors, such as PXNTable. This is useful when debugging protection systems that leverage hierarchical access control. Signed-off-by: Maxwell Bland --- arch/arm64/Kconfig | 1 + arch/arm64/mm/ptdump.c | 142 +++++++++++++++++++++++++++++++---------- 2 files changed, 108 insertions(+), 35 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 5d91259ee7b5..f4c3290160db 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -98,6 +98,7 @@ config ARM64 select ARCH_SUPPORTS_NUMA_BALANCING select ARCH_SUPPORTS_PAGE_TABLE_CHECK select ARCH_SUPPORTS_PER_VMA_LOCK + select ARCH_SUPPORTS_NON_LEAF_PTDUMP select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT select ARCH_WANT_DEFAULT_BPF_JIT diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c index 6986827e0d64..33ca6d182a6a 100644 --- a/arch/arm64/mm/ptdump.c +++ b/arch/arm64/mm/ptdump.c @@ -24,6 +24,7 @@ #include #include #include +#include #define pt_dump_seq_printf(m, fmt, args...) \ @@ -64,7 +65,7 @@ struct prot_bits { const char *clear; }; -static const struct prot_bits pte_bits[] = { +static const struct prot_bits blk_bits[] = { { .mask = PTE_VALID, .val = PTE_VALID, @@ -78,13 +79,13 @@ static const struct prot_bits pte_bits[] = { }, { .mask = PTE_RDONLY, .val = PTE_RDONLY, - .set = "ro", + .set = "RO", .clear = "RW", }, { .mask = PTE_PXN, .val = PTE_PXN, .set = "NX", - .clear = "x ", + .clear = "X ", }, { .mask = PTE_SHARED, .val = PTE_SHARED, @@ -142,44 +143,101 @@ static const struct prot_bits pte_bits[] = { .set = "MEM/NORMAL-TAGGED", } }; +static const size_t num_blk_bits = ARRAY_SIZE(blk_bits); + +static const struct prot_bits tbl_bits[] = { + { + .mask = PTE_VALID, + .val = PTE_VALID, + .set = " ", + .clear = "F", + }, { + .mask = PMD_TABLE_BIT, + .val = PMD_TABLE_BIT, + .set = "TBL", + .clear = " ", + }, { + .mask = PTE_AF, + .val = PTE_AF, + .set = "AF", + .clear = " ", + }, { + .mask = PMD_TABLE_PXN, + .val = PMD_TABLE_PXN, + .set = "NX", + .clear = " ", + }, { + .mask = PMD_TABLE_UXN, + .val = PMD_TABLE_UXN, + .set = "UXN", + .clear = " ", + }, { + .mask = PMD_TABLE_KERN, + .val = PMD_TABLE_KERN, + .set = "KRN", + .clear = " " + }, { + .mask = PMD_TABLE_PRDONLY, + .val = PMD_TABLE_PRDONLY, + .set = "RO", + .clear = "RW" + } +}; +static const size_t num_tbl_bits = ARRAY_SIZE(tbl_bits); struct pg_level { - const struct prot_bits *bits; + const struct prot_bits *blk_bits; + const struct prot_bits *tbl_bits; char name[4]; - int num; u64 mask; + unsigned long size; }; static struct pg_level pg_level[] __ro_after_init = { { /* pgd */ - .name = "PGD", - .bits = pte_bits, - .num = ARRAY_SIZE(pte_bits), + .name = "PGD", + .blk_bits = blk_bits, + .size = PGDIR_SIZE, + .tbl_bits = tbl_bits }, { /* p4d */ - .name = "P4D", - .bits = pte_bits, - .num = ARRAY_SIZE(pte_bits), + .name = "P4D", + .blk_bits = blk_bits, + .size = P4D_SIZE, + .tbl_bits = tbl_bits }, { /* pud */ - .name = "PUD", - .bits = pte_bits, - .num = ARRAY_SIZE(pte_bits), + .name = "PUD", + .blk_bits = blk_bits, + .size = PUD_SIZE, + .tbl_bits = tbl_bits }, { /* pmd */ - .name = "PMD", - .bits = pte_bits, - .num = ARRAY_SIZE(pte_bits), + .name = "PMD", + .blk_bits = blk_bits, + .size = PMD_SIZE, + .tbl_bits = tbl_bits }, { /* pte */ - .name = "PTE", - .bits = pte_bits, - .num = ARRAY_SIZE(pte_bits), + .name = "PTE", + .blk_bits = blk_bits, + .size = PAGE_SIZE, + .tbl_bits = NULL }, }; -static void dump_prot(struct pg_state *st, const struct prot_bits *bits, - size_t num) +static void dump_prot(struct pg_state *st, struct pg_level level) { unsigned i; + const struct prot_bits *bits; + int num_bits; - for (i = 0; i < num; i++, bits++) { + if ((st->current_prot & PTE_TABLE_BIT) == PTE_TABLE_BIT && + level.tbl_bits) { + bits = level.tbl_bits; + num_bits = num_tbl_bits; + } else { + bits = level.blk_bits; + num_bits = num_blk_bits; + } + + for (i = 0; i < num_bits; i++, bits++) { const char *s; if ((st->current_prot & bits->mask) == bits->val) @@ -251,21 +309,30 @@ static void note_page(struct ptdump_state *pt_st, unsigned long addr, int level, note_prot_wx(st, addr); } - pt_dump_seq_printf(st->seq, "0x%016lx-0x%016lx ", - st->start_address, addr); + if (st->start_address == addr) { + if (check_add_overflow(addr, pg_level[st->level].size, + &delta)) + delta = ULONG_MAX - addr + 1; + else + delta = pg_level[st->level].size; + pt_dump_seq_printf(st->seq, "0x%016lx-0x%016lx ", + addr, addr + delta); + } else { + delta = (addr - st->start_address); + pt_dump_seq_printf(st->seq, "0x%016lx-0x%016lx ", + st->start_address, addr); + } - delta = (addr - st->start_address) >> 10; + delta >>= 10; while (!(delta & 1023) && unit[1]) { delta >>= 10; unit++; } pt_dump_seq_printf(st->seq, "%9lu%c %s", delta, *unit, pg_level[st->level].name); - if (st->current_prot && pg_level[st->level].bits) - dump_prot(st, pg_level[st->level].bits, - pg_level[st->level].num); + if (st->current_prot && pg_level[st->level].blk_bits) + dump_prot(st, pg_level[st->level]); pt_dump_seq_puts(st->seq, "\n"); - if (addr >= st->marker[1].start_address) { st->marker++; pt_dump_seq_printf(st->seq, "---[ %s ]---\n", st->marker->name); @@ -311,11 +378,16 @@ void ptdump_walk(struct seq_file *s, struct ptdump_info *info) static void __init ptdump_initialize(void) { unsigned i, j; - - for (i = 0; i < ARRAY_SIZE(pg_level); i++) - if (pg_level[i].bits) - for (j = 0; j < pg_level[i].num; j++) - pg_level[i].mask |= pg_level[i].bits[j].mask; + struct pg_level *level = pg_level; + + for (i = 0; i < ARRAY_SIZE(pg_level); i++, level++) { + if (level->blk_bits) + for (j = 0; j < num_blk_bits; j++) + level->mask |= level->blk_bits[j].mask; + if (level->tbl_bits) + for (j = 0; j < num_tbl_bits; j++) + level->mask |= level->tbl_bits[j].mask; + } } static struct ptdump_info kernel_ptdump_info __ro_after_init = { From patchwork Mon Jun 24 22:14:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxwell Bland X-Patchwork-Id: 13710195 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 1B51EC2BD09 for ; Mon, 24 Jun 2024 22:14:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A57B26B0378; Mon, 24 Jun 2024 18:14:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A07806B0379; Mon, 24 Jun 2024 18:14:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8CFF56B037B; Mon, 24 Jun 2024 18:14:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 6C3F96B0378 for ; Mon, 24 Jun 2024 18:14:28 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 251D9810F9 for ; Mon, 24 Jun 2024 22:14:28 +0000 (UTC) X-FDA: 82267187016.30.A0F67DB Received: from mx0b-00823401.pphosted.com (mx0b-00823401.pphosted.com [148.163.152.46]) by imf15.hostedemail.com (Postfix) with ESMTP id 3E79CA001B for ; Mon, 24 Jun 2024 22:14:26 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=qLG2XGve; dmarc=pass (policy=none) header.from=motorola.com; spf=pass (imf15.hostedemail.com: domain of mbland@motorola.com designates 148.163.152.46 as permitted sender) smtp.mailfrom=mbland@motorola.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719267255; a=rsa-sha256; cv=none; b=XFf/jNi5qNBmxXKMGRlBvczHYbbuEoJhsEDr4mTWdMVWwi0GGzwk2UTodT+S7LNlQstmc9 5Mofe/cG5HPqk6MkW/zOqsmSGDu0WKYAX7Sb+oQxfnzfAwBxAhVdLUBf932LxFRyP6Suns vF88OqF/ytCrvwk1Bb0as5wVJOFtTYE= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=qLG2XGve; dmarc=pass (policy=none) header.from=motorola.com; spf=pass (imf15.hostedemail.com: domain of mbland@motorola.com designates 148.163.152.46 as permitted sender) smtp.mailfrom=mbland@motorola.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719267255; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=UiwKK45/t5jj3tMLvalGcwhelM3iqP5MoGXJmfeqrwA=; b=eCVPHlRtPc9/ztIEbAnmWyVq6W8LM/x1kcfDVdvlHIkU0Iup32wmN+GFizbo8L7v0+9DtG sJArqcSeQgZ74nqO7ck051oB5w4f8ub1nRNL9YIKAxdyiP0FHsjlk4R+2jt70bMmLdUWu1 Osu70u/fIgDF0H1kVz9ZCRriSc7uD5I= Received: from pps.filterd (m0355089.ppops.net [127.0.0.1]) by mx0b-00823401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45OECFp0020826; Mon, 24 Jun 2024 22:14:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=motorola.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=DKIM202306; bh=UiwKK45/t5jj3tMLvalGcwh elM3iqP5MoGXJmfeqrwA=; b=qLG2XGve7gX0Q3i8oHiLN/RdaUHDml4sGRQ9Pd+ uuEz12ZcyubhrXAe5Yy3dBsKslQCBLoAXxVlqe+HDHGZLhjUlbxsx2MkLdKmFU0+ iTsh91+URFRoH/t0zR+u+9uA0UCgoQp3WXWBpXIOTb60NZ/7a5wH0XkucSrG0bFY 1ceIaFh7WW3+/oxqqIO8gZ2wtHNMW+1/fxkov+npU2wTIgo8HYLa4ERxIXrHZAXC fNzp8AyK7wxFdkKEaDOcsGTmQhQJzu8JcuMbg6rIDDTLB9eDc2V+jwKiu+pawPkU ccint8utNf0RVlNLeQ5ZTOjQfSWzsRStuKUzwB3843wG8Hw== Received: from va32lpfpp03.lenovo.com ([104.232.228.23]) by mx0b-00823401.pphosted.com (PPS) with ESMTPS id 3yxb5m309d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jun 2024 22:14:19 +0000 (GMT) Received: from va32lmmrp02.lenovo.com (va32lmmrp02.mot.com [10.62.176.191]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by va32lpfpp03.lenovo.com (Postfix) with ESMTPS id 4W7Mgv1ymdz4ygtQ; Mon, 24 Jun 2024 22:14:19 +0000 (UTC) Received: from ilclasset02 (ilclasset02.mot.com [100.64.49.13]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mbland) by va32lmmrp02.lenovo.com (Postfix) with ESMTPSA id 4W7Mgv070Zz2VbbV; Mon, 24 Jun 2024 22:14:19 +0000 (UTC) Date: Mon, 24 Jun 2024 17:14:17 -0500 From: Maxwell Bland To: linux-mm@kvack.org Cc: Catalin Marinas , Will Deacon , Jonathan Corbet , Andrew Morton , Ard Biesheuvel , Mark Rutland , Christophe Leroy , Maxwell Bland , Alexandre Ghiti , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 4/6] arm64: indent ptdump by level, aligning attributes Message-ID: References: <2bcb3htsjhepxdybpw2bwot2jnuezl3p5mnj5rhjwgitlsufe7@xzhkyntridw3> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2bcb3htsjhepxdybpw2bwot2jnuezl3p5mnj5rhjwgitlsufe7@xzhkyntridw3> X-Proofpoint-GUID: 6hlKYHvbG4vu8qcSLMuNk0BF1XTe_Bhy X-Proofpoint-ORIG-GUID: 6hlKYHvbG4vu8qcSLMuNk0BF1XTe_Bhy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-24_19,2024-06-24_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 phishscore=0 mlxscore=0 priorityscore=1501 suspectscore=0 adultscore=0 clxscore=1015 mlxlogscore=999 impostorscore=0 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406240177 X-Rspamd-Queue-Id: 3E79CA001B X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 4edsm9cmn8tb8k7iyw5rq3a55e135xo7 X-HE-Tag: 1719267266-964362 X-HE-Meta: U2FsdGVkX1/5+voz6WMAc3l2NB8ngPvPP3R5IjR3E32akUt6/iPB3soKlZ3sBDPuU1atqfd0lCH5XH1mLKvakJMOb+ypGCdDDjhfmq7XEQBXdgfcOp0Yf6TW//TvrkXCSWg/fnryDOplcAj6gF0Q0hv4MtEGDx9Ha7IArGMmz2dAAQStbE2sItNdik86IRX2E9VudR6te8R8pST2Omy7sem2EaY/dyQw6PFcJwU/6w/SZzqOTr2nYlf8LSbNVrA37wgsRKiSoDhDBOtM3ofhfNdFWgtRYqKzOcOHVy4a7ZN+lGjU3l2oUtSN81hEk+BkXRByEm4QAHIf4mAZvaSr1L/N/vmrYskJt5wB1n3AADoF/3juHdXI+e31SkUX8w83LnctzW7AhrnaZPKtC9rVR4dg5kjvaxNsSESUt49AjWtRcy5LQOO8Yx/lCvDsDCC1p3u6SwXR8mtOUqrS5UZ5nEiVif6b1StGvMHi8eYn82zEz6wbt3j3/wErUUGAX6CF3QA8w/OGM/JzHY9OH7Z4CHmpPuAYexSoRA9Yb4RTnQFPBpOzIVYnpSsjo5h1sdC7C0CT2rDRfNxp2DVaHyCbE9jV1ZIjSAJG2iIwaI32hXx63j8pLUdDlIyxkl7jqXCV4Jocox+EWf7OXzcNna1ZdQKsf8zrse2igvqulmgiVYEBO0aeOBv2JK8uzoeEjjO67a1SdfducLr9ugKkqqH3eKPBKXB+BcAZnAbcuBBEwwgXhMaAGhxwHt2zDDF8sRbB2RlaODxq8zmby0tPHMHGgUlv5JebFuB0tQElQvFXiQH4CQkfXAIaIdKALmczS63KV/SDQaM7JXXATRLu1vy+xr6IFEeijK4VeWxfw6ljhkWeWLo5d6xSxT/8FY/yNyypg/gSsbxDSxgAlW10qTSr6E3lb4RhhQzum25P7+YWmeTWde6i32crVjW0pf9gxXhpiTamy+jMYU6v/BdAV3O jTBiTnvm QTCxxs1bijvpSYSCMWGEgfXOJCib61/d9prqwsrvXPq9QSMf62HiQ4z0jXyKDxdFwEMmJgZw9wAd4Xpy6eVA3UDiF0W3XIpWAsnkJU3P73PYke/K2UfJB4nf7sbW1v2djFdUjwJdYIVZyGgHyOqVl5woQhH/k3ERgngKnc3hnwvEYLSb/m3dnqg9kZ1wFGMLsi/bFaYR8fWfuZCTW3WKUaTPTjmh2nue6K0tWOoFkWPtQTO36cItOyWPM9U7k0dqyaT4MFFghBOB6FTMR5RhfaQgC68u1ed07eskz+RitRw3tvYW2UrGVE2DqejpNpkQvdPr7Z/he6pcJDaw= 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: List-Subscribe: List-Unsubscribe: Outputs each level of the page table with two additional spaces for parsers, distinction, and readability while maintaining the alignment of region size and attributes. Signed-off-by: Maxwell Bland --- arch/arm64/mm/ptdump.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c index 33ca6d182a6a..0660b74413a2 100644 --- a/arch/arm64/mm/ptdump.c +++ b/arch/arm64/mm/ptdump.c @@ -303,6 +303,10 @@ static void note_page(struct ptdump_state *pt_st, unsigned long addr, int level, addr >= st->marker[1].start_address) { const char *unit = units; unsigned long delta; + unsigned int i; + + for (i = 0; i < st->level; i++) + pt_dump_seq_printf(st->seq, " "); if (st->current_prot) { note_prot_uxn(st, addr); @@ -323,6 +327,10 @@ static void note_page(struct ptdump_state *pt_st, unsigned long addr, int level, st->start_address, addr); } + /* Align region information regardlesss of level */ + for (i = st->level; i < 4; i++) + pt_dump_seq_printf(st->seq, " "); + delta >>= 10; while (!(delta & 1023) && unit[1]) { delta >>= 10; From patchwork Mon Jun 24 22:15:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxwell Bland X-Patchwork-Id: 13710196 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 6673FC2BD09 for ; Mon, 24 Jun 2024 22:15:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB30B6B037E; Mon, 24 Jun 2024 18:15:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D63946B037C; Mon, 24 Jun 2024 18:15:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C03DF6B037E; Mon, 24 Jun 2024 18:15:19 -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 A12A76B037B for ; Mon, 24 Jun 2024 18:15:19 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 57D0AA1255 for ; Mon, 24 Jun 2024 22:15:19 +0000 (UTC) X-FDA: 82267189158.10.C341614 Received: from mx0a-00823401.pphosted.com (mx0a-00823401.pphosted.com [148.163.148.104]) by imf15.hostedemail.com (Postfix) with ESMTP id 66508A0004 for ; Mon, 24 Jun 2024 22:15:17 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=6ooSBqzH; spf=pass (imf15.hostedemail.com: domain of mbland@motorola.com designates 148.163.148.104 as permitted sender) smtp.mailfrom=mbland@motorola.com; dmarc=pass (policy=none) header.from=motorola.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719267298; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Gdo+A9lR32Bwl8rgtzcgwCfQAZOYi+4CngAwLwcyHBw=; b=QZO2Onm02MAwFpdX31UK18hV+IB1MOZ8r/pH/fDsgHqb1Mf1rcf1r/XiIKp3dipniJezrC wMSO+lnrjybs5VQS3XVMj0kf2uw2EKCmWr/EmFCz1iIm17Im8iFXashlrgeOcCSfiF4oYk 1R5/K/IAwSduYRQsEnH6+9nQC2UPrfw= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=6ooSBqzH; spf=pass (imf15.hostedemail.com: domain of mbland@motorola.com designates 148.163.148.104 as permitted sender) smtp.mailfrom=mbland@motorola.com; dmarc=pass (policy=none) header.from=motorola.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719267298; a=rsa-sha256; cv=none; b=juE70On/TWAW/2PDqjxmXcBiHDpPG0iwI9XYUPppINm6NdczU1l/PqzVxsr7FsNLnUbIyX hS75/ma5pd9E0MqV6GYhOt0WLd0VsthqMtT1CtPsFfsMsB1PiPDk+VAkW0x7OoF7sdbJJZ k8f8QZiEFfJhf9hVfRDreqUQnqD9158= Received: from pps.filterd (m0355088.ppops.net [127.0.0.1]) by m0355088.ppops.net (8.18.1.2/8.18.1.2) with ESMTP id 45OKhVlf023210; Mon, 24 Jun 2024 22:15:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=motorola.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=DKIM202306; bh=Gdo+A9lR32Bwl8rgtzcgwCf QAZOYi+4CngAwLwcyHBw=; b=6ooSBqzHdfsXIm3I/BjkKOp8gYuoWZs4Fyhb97i 668nWAIPp4RLzo2mDzJzaPzXAwXktQvGBd/qw+4P2SYPLP32o3tv8zkybvKkdLkH GTN6d84p3ahqd0/wDxHem3s+8QMumwsN0PBd8K+2mBCeHlsBoo/TCFed2mhEjavD noS6iFVy2vUC+Kms7MSscXOd4CtBEBnQ8OCU2eoNbPSNKReUbbGuFyr2f6YUe8qZ 9jVqvTrEWQ6qKmiLKjj9pELujwjw7mYRVQQFtFTrSFA7HZ/qILWZFXoXzVVkkY77 TLU2LEekm6diH8In2hdb3Bp/JbWxSCWoJSMOrDdzWn3DusA== Received: from va32lpfpp01.lenovo.com ([104.232.228.21]) by m0355088.ppops.net (PPS) with ESMTPS id 3yxbstk78d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jun 2024 22:15:09 +0000 (GMT) Received: from ilclmmrp02.lenovo.com (ilclmmrp02.mot.com [100.65.83.26]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by va32lpfpp01.lenovo.com (Postfix) with ESMTPS id 4W7Mhr3qTGzhWB7; Mon, 24 Jun 2024 22:15:08 +0000 (UTC) Received: from ilclasset02 (ilclasset02.mot.com [100.64.49.13]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mbland) by ilclmmrp02.lenovo.com (Postfix) with ESMTPSA id 4W7Mhr2CBlz3p6jp; Mon, 24 Jun 2024 22:15:08 +0000 (UTC) Date: Mon, 24 Jun 2024 17:15:07 -0500 From: Maxwell Bland To: linux-mm@kvack.org Cc: Catalin Marinas , Will Deacon , Jonathan Corbet , Andrew Morton , Ard Biesheuvel , Mark Rutland , Christophe Leroy , Maxwell Bland , Alexandre Ghiti , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 5/6] arm64: exclusive upper bound for ptdump entries Message-ID: <2e6i3jrv7mfd3athc2g4sbv5rirrukj46cnchcym4io5uhle2n@ah3viwbr5bxr> References: <2bcb3htsjhepxdybpw2bwot2jnuezl3p5mnj5rhjwgitlsufe7@xzhkyntridw3> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2bcb3htsjhepxdybpw2bwot2jnuezl3p5mnj5rhjwgitlsufe7@xzhkyntridw3> X-Proofpoint-ORIG-GUID: xJSB6QTklBwCv0gHX8X554KR7Ds_NYcO X-Proofpoint-GUID: xJSB6QTklBwCv0gHX8X554KR7Ds_NYcO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-24_19,2024-06-24_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 bulkscore=0 mlxscore=0 priorityscore=1501 adultscore=0 phishscore=0 clxscore=1015 mlxlogscore=947 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406240178 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 66508A0004 X-Stat-Signature: fmc5n6grsn6amoqxdi41mupe91uhhudf X-Rspam-User: X-HE-Tag: 1719267317-477535 X-HE-Meta: U2FsdGVkX19epqy5rxE9+dv/07lZC5wyaT5+AIPCd5ybEtBbFvv4da0n4kSqtbryoDT/TZoyelxuGV1aJ0WpAsuze0HX/POoM8XBaUBRjJY5KKacoISzpR3LbJQ9isWC0chBS6XC/X1miYTn61zUZ36bPWdhytq85YJkPmc/3ed8xUMq9AphzR6nP3PXZwfhw91RC+06XzFrab22GEuITotJ1YjFPCMj3shKj2dmxh8Nc52qfkYXvxCR5J1LD143TdOCghGgqqfEzDsi+VsK3PgbO7V1ano00YEYXLVRhNSJxC1NSKIkDcrDYY6KGwZDuksENXf1j+rcKi/1kAWody4rNqzor/oM3fsplzamEI6aXv27gx33rRpNf+aKE30ZmecjyVeaLf/7+iu6PZ3P1M1UbZNIx4MK+Hgpiu9cEjze2s1Bfpu9cjJzpvnZFFLZpdcF1SBaetlDmdVpW981+PRAZ1Rr92oW9agvjHtQ4datIvoGbfPhZeW2Zy+beSb+Ns79v0lpmKi/cymC1Wt6F0ufyg5f8kzQTO30nD9jVz5YDcyim2QHnwqZOsCnFOAqHhd8fXKb3dRtaSSzF6iAogzPVjiYFgGZw+4J8zwqK/aMultvOwrDSH9LWvFrzii3eGxjW5vICg6h0qpPKF3YxwIbTwK6kePG58l8xvafLgTxcqPoEsos3Zlm82uatfKPT2lAtyjIJH/WtofldupfSgHRNnpTDtkyiZU7w5g20Kypl+FbEEeyPtMen+vDt3BQwQfnniUbkK1O+rWe7DsMGu2Pm7BmgKcF0nK/7APpqfcG1xH8Ho03mNY4e6c6QC3I4WLWtvazPl0sZ5Jy5TxLpVlaDAsm0W8BxdESwkDPZPi7iBKjDOqZuykZWte9p6VH/TM7DtVXaLJe9rkYcSFJVBmor+IycGmzhXRRC4Jto6U2YV1OFJq26+gF8pn88DwC1GFW5E8Dijua8bViOmy xp8if8Nc ansfz/aiZWssKywzOLkwSq/VnzwANElQcAVV0G4ZgudC3djzP0rZrpGBdF4gK4pIs1mcteJ81Zua4W0lsAkq7ZR1M6QYTJUxi6e8xsqGVGcR7fG+IOAicODuZlRGzIDxV6EdC8SMArUtlYx69spe03vkkdFEHaTSeZnn9RxynZirg3mS8ROozVg23ZQ3QjKl4Lt+2JwZ5AE4zDgBKlmIoL5h8jUowPBxD4A9mgX+VFfDFCoSVhTxXsG2bMzri3WPiXizMA6O95jMDRp7GvFdc+gP3gmD8ANyjr7pb X-Bogosity: Ham, tests=bogofilter, spamicity=0.000030, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Update the upper bound of all ptdump entries to not include the byte which is actually governed by the next entry. As the lowest byte is included and governed, this makes the size specifications exact. Signed-off-by: Maxwell Bland --- arch/arm64/mm/ptdump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c index 0660b74413a2..f13acf9b1cd8 100644 --- a/arch/arm64/mm/ptdump.c +++ b/arch/arm64/mm/ptdump.c @@ -320,11 +320,11 @@ static void note_page(struct ptdump_state *pt_st, unsigned long addr, int level, else delta = pg_level[st->level].size; pt_dump_seq_printf(st->seq, "0x%016lx-0x%016lx ", - addr, addr + delta); + addr, addr + delta - 1); } else { delta = (addr - st->start_address); pt_dump_seq_printf(st->seq, "0x%016lx-0x%016lx ", - st->start_address, addr); + st->start_address, addr - 1); } /* Align region information regardlesss of level */ From patchwork Mon Jun 24 22:16:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxwell Bland X-Patchwork-Id: 13710197 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 C92DEC2BD09 for ; Mon, 24 Jun 2024 22:16:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 59F756B0167; Mon, 24 Jun 2024 18:16:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 54E266B017C; Mon, 24 Jun 2024 18:16:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43F876B017B; Mon, 24 Jun 2024 18:16:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 2125A6B010E for ; Mon, 24 Jun 2024 18:16:32 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id BC7E61C2C10 for ; Mon, 24 Jun 2024 22:16:31 +0000 (UTC) X-FDA: 82267192182.28.0E71DF1 Received: from mx0b-00823401.pphosted.com (mx0b-00823401.pphosted.com [148.163.152.46]) by imf13.hostedemail.com (Postfix) with ESMTP id CA26820004 for ; Mon, 24 Jun 2024 22:16:29 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=PrP3P5Sv; spf=pass (imf13.hostedemail.com: domain of mbland@motorola.com designates 148.163.152.46 as permitted sender) smtp.mailfrom=mbland@motorola.com; dmarc=pass (policy=none) header.from=motorola.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719267375; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gZCJlBi8DE484qacbTVY678Pgp4eLQRFW/HaquAhFOI=; b=xs3CtD6uWpk7vMs0DugG0Yd1bd40Kz9Yc5QQEWZ8H0I4PrywISpT7ovQX1CTrJnlSd8XtY YgDjOcChqnCbf7a6LfTkKSYtMMWuHCTetM248J7GqMOWv+FW0/FJi3Bjy/jKSPXaMCvbm8 aVjmEMm7grMHWMbUPgKS6vwdgwZ8+Us= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719267375; a=rsa-sha256; cv=none; b=kclLjiEIEm0olkli2iV9TVCHcT0txZYV6IBS+mcj6EWAuXsYAeL4l/N9wvTM0yyYD+Isvj rLmZKvABBdooi+D1jGhsJLeRNxMBQOrDiHAKfo23gDEd5IjNFYFraNS1I+16UyzidQ1g6j +0KEe97YyVlak5pSEVYBHKdik667l7s= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=PrP3P5Sv; spf=pass (imf13.hostedemail.com: domain of mbland@motorola.com designates 148.163.152.46 as permitted sender) smtp.mailfrom=mbland@motorola.com; dmarc=pass (policy=none) header.from=motorola.com Received: from pps.filterd (m0355092.ppops.net [127.0.0.1]) by mx0b-00823401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45ODoKln017548; Mon, 24 Jun 2024 22:16:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=motorola.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=DKIM202306; bh=gZCJlBi8DE484qacbTVY678 Pgp4eLQRFW/HaquAhFOI=; b=PrP3P5SvKBxjv7d7dvpcx+IB8ke1xj/q6kCyrbB NFdYlcqBk++M7o8c8bLmiJlXeUhfwx6aIWUB91CJ68q27nl4pgnY+OGjFbu3OzlT Y/aKwz7UmZv5l67K48PGzIEDanWo+QSeRPJtGUN1VtBt+jCNnQc0SHo9kmNgk3Zp YW8Dr5Qq7ad7HlaoObJnlddNowPQYNCWi71sKhmNohIzikzgW/WFr8i5btXERFHD wrLdOjBqzCaeOKQF2rFjy/nxVp4Z+KmfV9FE+vvbM5837Ms7/yPVOGZ0sQQ4KYhh ODhz7n32+PBeGCUL7zlFye5SmFECzY2QoN+6ikBGTcoH+JQ== Received: from va32lpfpp01.lenovo.com ([104.232.228.21]) by mx0b-00823401.pphosted.com (PPS) with ESMTPS id 3yxcxf2vqh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jun 2024 22:16:22 +0000 (GMT) Received: from ilclmmrp01.lenovo.com (ilclmmrp01.mot.com [100.65.83.165]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by va32lpfpp01.lenovo.com (Postfix) with ESMTPS id 4W7MkF4tV5zhWB3; Mon, 24 Jun 2024 22:16:21 +0000 (UTC) Received: from ilclasset02 (ilclasset02.mot.com [100.64.49.13]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mbland) by ilclmmrp01.lenovo.com (Postfix) with ESMTPSA id 4W7MkF39R6z3nd8L; Mon, 24 Jun 2024 22:16:21 +0000 (UTC) Date: Mon, 24 Jun 2024 17:16:20 -0500 From: Maxwell Bland To: linux-mm@kvack.org Cc: Catalin Marinas , Will Deacon , Jonathan Corbet , Andrew Morton , Ard Biesheuvel , Mark Rutland , Christophe Leroy , Maxwell Bland , Alexandre Ghiti , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 6/6] arm64: add attrs and format to ptdump document Message-ID: References: <2bcb3htsjhepxdybpw2bwot2jnuezl3p5mnj5rhjwgitlsufe7@xzhkyntridw3> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2bcb3htsjhepxdybpw2bwot2jnuezl3p5mnj5rhjwgitlsufe7@xzhkyntridw3> X-Proofpoint-GUID: LlMeeVVbZ8SJ4SyDN-hV-5CbZZYHi3lJ X-Proofpoint-ORIG-GUID: LlMeeVVbZ8SJ4SyDN-hV-5CbZZYHi3lJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-24_19,2024-06-24_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=896 impostorscore=0 lowpriorityscore=0 mlxscore=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 adultscore=0 clxscore=1015 suspectscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406240178 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: CA26820004 X-Stat-Signature: 1bmigqoiy1me9jbpp6egs1unswzcgi87 X-HE-Tag: 1719267389-875703 X-HE-Meta: U2FsdGVkX1/FWp7cbfaNubJvjmm7k7j0x53uBXKu2rCYg+ikqk3+uLAuugSfL/soDO9Af1DrX/WA1hldto/882fkZ/KzRKsZVJ0zeHAmPGLZFmNgmNKFYGZnVJWoeD2z9G9VXPFhZHL7ThSsMMok7hSVDxm2n76LN8ZSIHJCj8MvaHRAWhd0VGaRH2yEvo8UO04WfyaqHxOfBwgTSFsSX8liKa2xLd7i+eATUgkfBR2tnILes+ycuNlHj1l41ukZYHBqOCx3msnqL7qCPzfWlbbGiJWQReInlisynGBzDeQypgINy8YPrfmuq6DvgsIbbZGxdHlLbIRqjqb7nFYM2EYw7j9ArAnc7r+6EnM7/cP8EqD3jYA8Otu/j6JhA6QMBXyNnhWju1IHk+7A4FQLebTVvjxNesKLlz4jQKHXJtXetXPI3Sb90PuTAWwOG0oyroyo8U2leF0VRVyvz6XOLeMSRvnvuy/pIk62/MeGU0LP+FBvKzeBUrHP6YaK+DKBCIyifny8GNRjF7Ic0R7k3zLabMX+jRkOaWh/szM472QnpMeyx7an5C7XY1t96O5beWAOYLggy5HzFEX5W2kmGlKzz/bzYkA4gPnXokCPj4T1CP0XgtDLE5g3sUm4lUyiU5HOFHkmWudE0pTnj0Hm4VM40slHXYESVJDCn0sFsiCJZAkGJdeFkQTiqTZRuFYZsuQxLqGZ/QBR6WGlS02q2UC4AVRva2f/mJ+VYAauKkSjNjoWfkgZbHpPlmAygC7wL+Qa6dxYeEDai4u7GQP9lO8l8+pNlnkx4F65MigEoWGkUn+F4BMzf8dVSaD8ypOTrKnghKdkTVp1V/0ZgJ0Ny/z0A7Tjg3iGakGY3LUghZVcfv1OFbjfn5AZyhVi4ZKkcJpOsJfkhTCcu+XGWp1zw9HtLrOyKa2i8qR2/t9gXJxU0pzcwaP3ybtn7qA1gIx7HBtr27QGAZ4cZIO7HkD Fhh5bFCg APZddUZre00YAD7csYLCsekDyLvnUzgicXK1fqNvUSOSyMmPD/2aaZaABUDZnj7fvggGqsz6RM0nr2WTemIJ5LLaj1zRNgbLXPzR9Bp2W4d4NNmCwKaxCZJOaiWbF3ogN7HKBKcbeB7Nm+pGvGj+mFDLA+m5TNOQxAyw6k65oOQedI+J4oMjucgOAfS4E9JXZeZZJmlLMBfSS2mmHhwlUP0PqNUMgrEPou4uP+WcOuQjOlTDqDKXkO7b1pcIq5BrisMl8f0BVSbzf0elGPuLlZobx49St7KktFcOyqm7sM/U8DL8pz5+WLF4IIEYKs/pYgotjBrdHaKqwd4s= 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: List-Subscribe: List-Unsubscribe: Update the ptdump content with a precise explanation of the attribute symbols and the coalescing of identical entries implicit in the code. Remove unnecessary layout example given the existing cat example, and opt instead for a precise, clear explanation of address markers, format, attributes. Update example to match the new cosmetic and intermediate-directory printing changes. Signed-off-by: Maxwell Bland Reviewed-by: Randy Dunlap --- Documentation/arch/arm64/ptdump.rst | 126 ++++++++++++++-------------- 1 file changed, 61 insertions(+), 65 deletions(-) diff --git a/Documentation/arch/arm64/ptdump.rst b/Documentation/arch/arm64/ptdump.rst index 5dcfc5d7cddf..785b96ab2e89 100644 --- a/Documentation/arch/arm64/ptdump.rst +++ b/Documentation/arch/arm64/ptdump.rst @@ -29,68 +29,64 @@ configurations and mount debugfs:: mount -t debugfs nodev /sys/kernel/debug cat /sys/kernel/debug/kernel_page_tables -On analysing the output of ``cat /sys/kernel/debug/kernel_page_tables`` -one can derive information about the virtual address range of the entry, -followed by size of the memory region covered by this entry, the -hierarchical structure of the page tables and finally the attributes -associated with each page. The page attributes provide information about -access permissions, execution capability, type of mapping such as leaf -level PTE or block level PGD, PMD and PUD, and access status of a page -within the kernel memory. Assessing these attributes can assist in -understanding the memory layout, access patterns and security -characteristics of the kernel pages. - -Kernel virtual memory layout example:: - - start address end address size attributes - +---------------------------------------------------------------------------------------+ - | ---[ Linear Mapping start ]---------------------------------------------------------- | - | .................. | - | 0xfff0000000000000-0xfff0000000210000 2112K PTE RW NX SHD AF UXN MEM/NORMAL-TAGGED | - | 0xfff0000000210000-0xfff0000001c00000 26560K PTE ro NX SHD AF UXN MEM/NORMAL | - | .................. | - | ---[ Linear Mapping end ]------------------------------------------------------------ | - +---------------------------------------------------------------------------------------+ - | ---[ Modules start ]----------------------------------------------------------------- | - | .................. | - | 0xffff800000000000-0xffff800008000000 128M PTE | - | .................. | - | ---[ Modules end ]------------------------------------------------------------------- | - +---------------------------------------------------------------------------------------+ - | ---[ vmalloc() area ]---------------------------------------------------------------- | - | .................. | - | 0xffff800008010000-0xffff800008200000 1984K PTE ro x SHD AF UXN MEM/NORMAL | - | 0xffff800008200000-0xffff800008e00000 12M PTE ro x SHD AF CON UXN MEM/NORMAL | - | .................. | - | ---[ vmalloc() end ]----------------------------------------------------------------- | - +---------------------------------------------------------------------------------------+ - | ---[ Fixmap start ]------------------------------------------------------------------ | - | .................. | - | 0xfffffbfffdb80000-0xfffffbfffdb90000 64K PTE ro x SHD AF UXN MEM/NORMAL | - | 0xfffffbfffdb90000-0xfffffbfffdba0000 64K PTE ro NX SHD AF UXN MEM/NORMAL | - | .................. | - | ---[ Fixmap end ]-------------------------------------------------------------------- | - +---------------------------------------------------------------------------------------+ - | ---[ PCI I/O start ]----------------------------------------------------------------- | - | .................. | - | 0xfffffbfffe800000-0xfffffbffff800000 16M PTE | - | .................. | - | ---[ PCI I/O end ]------------------------------------------------------------------- | - +---------------------------------------------------------------------------------------+ - | ---[ vmemmap start ]----------------------------------------------------------------- | - | .................. | - | 0xfffffc0002000000-0xfffffc0002200000 2M PTE RW NX SHD AF UXN MEM/NORMAL | - | 0xfffffc0002200000-0xfffffc0020000000 478M PTE | - | .................. | - | ---[ vmemmap end ]------------------------------------------------------------------- | - +---------------------------------------------------------------------------------------+ - -``cat /sys/kernel/debug/kernel_page_tables`` output:: - - 0xfff0000001c00000-0xfff0000080000000 2020M PTE RW NX SHD AF UXN MEM/NORMAL-TAGGED - 0xfff0000080000000-0xfff0000800000000 30G PMD - 0xfff0000800000000-0xfff0000800700000 7M PTE RW NX SHD AF UXN MEM/NORMAL-TAGGED - 0xfff0000800700000-0xfff0000800710000 64K PTE ro NX SHD AF UXN MEM/NORMAL-TAGGED - 0xfff0000800710000-0xfff0000880000000 2089920K PTE RW NX SHD AF UXN MEM/NORMAL-TAGGED - 0xfff0000880000000-0xfff0040000000000 4062G PMD - 0xfff0040000000000-0xffff800000000000 3964T PGD +``/sys/kernel/debug/kernel_page_tables`` provides a line of information +for each group of page table entries sharing the same attributes and +type of mapping, i.e. page descriptor PTE or table descriptor PGD, PMD, +and PUD. Assessing these attributes can assist in determining memory +layout, access patterns and security characteristics of the kernel +pages. + +Lines are formatted as follows:: + + - + +Note that the set of attributes, and therefore formatting, is not +equivalent between block (or page) and table descriptor entries. For +example, PMD table descriptors can support the PXNTable permission bit +and do not share that same set of attributes as PTEs. + +The following attributes are presently supported:: + +F Entry is invalid +RO Memory is read-only +RW Memory is read-write +X Memory is privileged executable +NX Memory is privileged execute never +UXN Memory is unprivileged execute never +USR Memory is unprivileged accessible +KRN Memory is unprivileged inaccessible (e.g. APTable bits) +SHD Memory is shared +AF Entry accessed flag is set +NG Entry Not-Global flag is set +CON Entry contiguous bit is set +GP Page is guarded with branch target integrity protection +TBL Entry is a table descriptor +BLK Entry is a block descriptor +DEVICE/* Entry is device memory, see ARM reference for types +MEM/* Entry is non-device memory, see ARM reference for types + +The beginning and end of each region is also delineated by a single line +tag in the following format:: + + ---[ ]--- + +With supported address markers including the kernel's linear mapping, +kasan shadow memory, kernel modules memory, vmalloc memory, PCI I/O +memory, and the kernel's fixmap region. + +Example ``cat /sys/kernel/debug/kernel_page_tables`` output:: + + ---[ Linear Mapping start ]--- + 0xffff000000000000-0xffff1affffffffff 27T PGD + 0xffff1b0000000000-0xffffffffffffffff 229T PGD TBL NX UXN RW + 0xffff1b0000000000-0xffff1b397fffffff 230G PUD + 0xffff1b3980000000-0xffff1b39bfffffff 1G PUD TBL NX UXN RW + 0xffff1b3980000000-0xffff1b39801fffff 2M PMD TBL NX UXN RW + 0xffff1b3980000000-0xffff1b39801fffff 2M PTE RW NX SHD AF NG UXN MEM/NORMAL-TAGGED + 0xffff1b3980200000-0xffff1b39803fffff 2M PMD TBL NX UXN RW + 0xffff1b3980200000-0xffff1b398020ffff 64K PTE RW NX SHD AF NG UXN MEM/NORMAL-TAGGED + 0xffff1b3980210000-0xffff1b39803fffff 1984K PTE RO NX SHD AF NG UXN MEM/NORMAL + 0xffff1b3980400000-0xffff1b3981dfffff 26M PMD RO NX SHD AF NG BLK UXN MEM/NORMAL + 0xffff1b3981e00000-0xffff1b3981ffffff 2M PMD TBL NX UXN RW + 0xffff1b3981e00000-0xffff1b3981e1ffff 128K PTE RO NX SHD AF NG UXN MEM/NORMAL + 0xffff1b3981e20000-0xffff1b3981ffffff 1920K PTE RW NX SHD AF NG UXN MEM/NORMAL-TAGGED