From patchwork Tue Jun 18 14:40:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxwell Bland X-Patchwork-Id: 13702489 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 9621EC27C4F for ; Tue, 18 Jun 2024 15:07:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1CA306B00E7; Tue, 18 Jun 2024 11:07:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 178ED6B00E8; Tue, 18 Jun 2024 11:07:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 040BA6B00EB; Tue, 18 Jun 2024 11:07:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D7F1E6B00E7 for ; Tue, 18 Jun 2024 11:07:07 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 1E83F4494B for ; Tue, 18 Jun 2024 14:40:35 +0000 (UTC) X-FDA: 82244270472.17.D5736B2 Received: from mx0a-00823401.pphosted.com (mx0a-00823401.pphosted.com [148.163.148.104]) by imf28.hostedemail.com (Postfix) with ESMTP id 58291C0023 for ; Tue, 18 Jun 2024 14:40:30 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=YzPFJf7R; spf=pass (imf28.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=1718721626; 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=bbCv2w4nRPgLR23TBfkseR6W0fRU0+Q29X4EO3LvQgk=; b=S/invT4TbS3Q6lLlqhjBPpYYlSX2exrV64YhY8g+GVr7/2k1EKiOgMdDKY+1IhAjFbtTh7 /EpkxZSxjzugF0GxfHVQeR6JmRQjd7jUNEuALuLt4Fsj3O86op4w/2Ia0AojK+N6YGhot5 Ir4HfQGChbNRvelBNd+FibH39WMsYsE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718721626; a=rsa-sha256; cv=none; b=rToOgqeRUcpDuJ5mj+eB7INrCSbqw3mmICFEDTIKlkPBTUPrLVbAOkD/ovPLuVcszZQMeE d8wHEB5zfcewuwcgc9G7z0KLMtF7Y1s4dm1ffXXNNZ8F5lvejiVC5ZGPhfqhzjvWZBGXMP FBdjFyjEsywlP8NyxjmMhSheE758kKI= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=YzPFJf7R; spf=pass (imf28.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 Received: from pps.filterd (m0355087.ppops.net [127.0.0.1]) by mx0a-00823401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45IDWdJJ010728; Tue, 18 Jun 2024 14:40:13 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=bbCv2w4nRPgLR23TBfkseR6 W0fRU0+Q29X4EO3LvQgk=; b=YzPFJf7R/tL3nNALkgnits8rxljz2OgU6RY5fzk AeRVWeGyFGWBcLlns6znE2q+PVWu06Wm8Yp4IlO/5BgLoTimcLZ6+97cMttqZUuB vH63gu8rbdihKNQFFbl2+ZgjjvzmUdRK6IUKK4J2pgCeVC7dTdAOqh4FTf36wUI8 Ygvxknxt96dWmJ7QCNbUbMVJEIlucm9XMlYKaFc115kyAR4z+vQYEthfToO4RXx0 T9n0PklJ9pKSa6m7OFVqy61LR6CYg/VFZWNWUnDHWMcFKHAqSjGr13xOWyyPe2hv WfgIYkVZY8hlkoL0IGfQ4URaJqrroF2maumaN8QDrTy0wUA== Received: from ilclpfpp01.lenovo.com ([144.188.128.67]) by mx0a-00823401.pphosted.com (PPS) with ESMTPS id 3ysqth6nbj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jun 2024 14:40:13 +0000 (GMT) Received: from va32lmmrp01.lenovo.com (va32lmmrp01.mot.com [10.62.177.113]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ilclpfpp01.lenovo.com (Postfix) with ESMTPS id 4W3Tth1vDHzcxpn; Tue, 18 Jun 2024 14:40:12 +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 va32lmmrp01.lenovo.com (Postfix) with ESMTPSA id 4W3Ttg5fB5z2VZRs; Tue, 18 Jun 2024 14:40:11 +0000 (UTC) Date: Tue, 18 Jun 2024 09:40:10 -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 v4 1/5] mm: add ARCH_SUPPORTS_NON_LEAF_PTDUMP Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Proofpoint-GUID: blkS0LT6wZdY1-TTwIlfF-qhh7xDcsXA X-Proofpoint-ORIG-GUID: blkS0LT6wZdY1-TTwIlfF-qhh7xDcsXA 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-18_02,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 malwarescore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 mlxlogscore=618 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406180110 X-Rspamd-Queue-Id: 58291C0023 X-Stat-Signature: yroghzbgjxjn6riisseb7pjc1oh39fbz X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1718721630-515567 X-HE-Meta: U2FsdGVkX18L3fe4OxvDoVQI5Li2WxpHFTbjTzUsllPk0hOauwQnLDsJ6KT/SNObLazJsNbUAkRTTzjedKfHNPPBWSwDBZSC0NWSSN4fNw+g0ZKoL34FyTIjRoR2vcGKzltdEXMszojW0or0Cea/USZNOve1QA9ff0PWl5uifNe1cUx7eow2J3eGvCdvGq+RvpK/fb2bHQvrgBbQAYlQHvKaKGTpGcSQulgKu5obyzBtcSSyZjABoF40YT9FzZlJpImsaOZEvomNCOaIP7fK37wbUyZKckS5sMrYXC0YEdl3J1GeGqHqxdCa4a6CaNNBaliL6kgmSEx/s4F6nrlRz9pXZ6SJx7GfzDSrjpNwx4jBwCMIQHwtlVZZ0K41V8wS8W0f1+E5I/2rm5Bj6sk6YU0eXjVMjhrJMEgqk3R7omFDGZDfX7ewayb5XUwhl4PXB4eOWzQ6mdX1ff48nq3gjRYdTKUcgzgCW1ckhMr4CXLAu1aaef6tU0huFqFQqeYP4b7XYEPb+UOfGZ36SkHZolOD5YsXABXOG9BKtfi56QyHZsnonzjqnNSVtjd307AQuiFOycj3sJAGra3o1+Ln+w9/Ly1j6y4PE1lpi4GkeFG7mDZAbi9XEZhbwKHd3Q+BwsfwVTlWXrYH9HynPUKusV0R8hrTBKpQsfpg2woUtsZqu3b3KeGlx/actLIL+SPjbQ7D2yjD+Pv73+yUBbxkP+EvUH1QL2YV0slsqhnu4HBf00nzqcrZG2VWcVc1EGAzIsuWJxqvTxZ5unll6+HHicAO0FbzGTXuQSM/wZ7Pd29LkBPWvIgWNp180J1Px6AYuCqlnRFqlkaOdZwOviNLOhcL/Fez+/NDQY5XC2ylGqAO4jckzfmDxMMd6EvxRp5TtxUb95z5Z2hkjtxkY7DW1Gk7WIJpvblrePFOR8E0Vgc7HOBPRp2A+9aaOr8V422RMDG65bbMO8S3UdxVnfM 8rWHrHUT VNL1rCZVE4vGag9xH/wTXJhm+NP0Mx6Sh3Tu8wTfudZ2yk1HMXs0ne+3ViYeqQuU2wttu9i/b7SBshFwrv1cdCI8ZriXTK5Xh6lN+4wiqr2He3b82szRZR2WaCNEavVOmgY3ivQLsrijl2p8hP+i+G411ojvJx+ycC3DwvVfD1zh65xFbu0PNmWd0d7lQW8DAaRxvX7UMp9CG+/+oAJVTyadHrq3fwee5OfybavslHiNc+DG9ywNiEKyhefvIV1D325fiVRGZG8JM0G518/xO7KaYAPvQZjDGkLUYpR73QOUFWVnLs5A3H1fXEX4aH1Wt/fVxHq/Gw1CcMi8Qe2LDrVjsjG+CTp7rG+7bo5lK4KfI9YB4xPSiAuf+6XIr6jqj5GJf 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 | 9 +++++++++ mm/ptdump.c | 21 +++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug index afc72fde0f03..6af5ecfdef93 100644 --- a/mm/Kconfig.debug +++ b/mm/Kconfig.debug @@ -201,6 +201,15 @@ config PTDUMP_DEBUGFS If in doubt, say N. +config ARCH_SUPPORTS_NON_LEAF_PTDUMP + bool "Include intermediate directory entries in pagetable dumps" + default n + 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..6180708669fe 100644 --- a/mm/ptdump.c +++ b/mm/ptdump.c @@ -41,10 +41,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 (IS_ENABLED(CONFIG_ARCH_SUPPORTS_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 +65,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 (IS_ENABLED(CONFIG_ARCH_SUPPORTS_NON_LEAF_PTDUMP) || pgd_leaf(val)) st->note_page(st, addr, 1, p4d_val(val)); + + if (p4d_leaf(val)) walk->action = ACTION_CONTINUE; - } return 0; } @@ -87,10 +89,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 (IS_ENABLED(CONFIG_ARCH_SUPPORTS_NON_LEAF_PTDUMP) || pgd_leaf(val)) st->note_page(st, addr, 2, pud_val(val)); + + if (pud_leaf(val)) walk->action = ACTION_CONTINUE; - } return 0; } @@ -108,10 +111,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 (IS_ENABLED(CONFIG_ARCH_SUPPORTS_NON_LEAF_PTDUMP) || pgd_leaf(val)) st->note_page(st, addr, 3, pmd_val(val)); + + if (pmd_leaf(val)) walk->action = ACTION_CONTINUE; - } return 0; } From patchwork Tue Jun 18 14:40:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxwell Bland X-Patchwork-Id: 13702507 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 A412AC27C4F for ; Tue, 18 Jun 2024 15:13:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 353858D002F; Tue, 18 Jun 2024 11:13:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 302FC8D002C; Tue, 18 Jun 2024 11:13:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A3AA8D002F; Tue, 18 Jun 2024 11:13:06 -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 F0EDB8D002C for ; Tue, 18 Jun 2024 11:13:05 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id ABFF044AE5 for ; Tue, 18 Jun 2024 14:41:13 +0000 (UTC) X-FDA: 82244272026.08.242CCAA Received: from mx0a-00823401.pphosted.com (mx0a-00823401.pphosted.com [148.163.148.104]) by imf09.hostedemail.com (Postfix) with ESMTP id 15D4114000D for ; Tue, 18 Jun 2024 14:41:02 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=Nj+tV39+; spf=pass (imf09.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=1718721668; 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=ZiQ3f8xQzS9FA6BEFRuceTMlsKV6Mo9WAxwHVPxN0eM=; b=hERUG4c29CifMcKlOygHa3122xEhtf4qmJzm/g7OTi9PUkd4a8uzRmcF8ElGPPw2/vxtsR ooW8Svdc5f5NTUDFsopBq204UHKnhTwL1KbUzbl3i1YlF6HSzTyiBQC6Qwiy+WjFBv6BJm t+dCZOv8IBQFRya0nRnI26GEREqRTq4= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=Nj+tV39+; spf=pass (imf09.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=1718721668; a=rsa-sha256; cv=none; b=hA1q95iICNksasvben7yep9c3uZ3YPzRDaUg6z5KooiBt67AC1kKm6rKfqZEqhUvr2+9Po 00A9qmJ5d8tZFfOJ8X8JWgJnwUcKX6S1huK0igBZWa04ir+O6mc/5//AqoCd/70yYqAJwK iTetwSN5ewqpicwmQz1WzItPWxdDaxQ= Received: from pps.filterd (m0355085.ppops.net [127.0.0.1]) by mx0a-00823401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45IEd3JS008967; Tue, 18 Jun 2024 14:40:51 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=ZiQ3f8xQzS9FA6BEFRuceTM lsKV6Mo9WAxwHVPxN0eM=; b=Nj+tV39+SFug10BoWEz7cWUgnPrs8dviGW7cYFp rc027YAqKCrb2WHJt+ThlffX5PYRm+OOfe0W3OPjbymBFOhAtI0WxunWcy4QQn+E AFPOTjwIjDPEsNZRV5XfBP9Ny4zIBGMcfELvz8Ay0TjZI9NJKnDtSuu2r+sbQTS9 HVvk3qcC6+GpXP6HAc6XcrGIR8yV/plDi3IIGpskek1twpsq633RplwxmH7tjbJA PJNTjIcJRbB0EC7k7bGMOKdunPR8k1ui+QPJnCH0jNuanamr94vooF6oBPIFapRn x/ofVlZu1aEh58PZTC5jvZBcR7HrAj2A9AbpyC+vIfqPuhg== Received: from va32lpfpp02.lenovo.com ([104.232.228.22]) by mx0a-00823401.pphosted.com (PPS) with ESMTPS id 3yssffxjhq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jun 2024 14:40:51 +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 va32lpfpp02.lenovo.com (Postfix) with ESMTPS id 4W3TvQ06ymz50TkT; Tue, 18 Jun 2024 14:40:50 +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 4W3TvP5ry1z3p6jp; Tue, 18 Jun 2024 14:40:49 +0000 (UTC) Date: Tue, 18 Jun 2024 09:40:48 -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 v4 2/5] arm64: non leaf ptdump support Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Proofpoint-ORIG-GUID: kmBwrD3JLnyF3RFV3h1ScHXshTVxVoVj X-Proofpoint-GUID: kmBwrD3JLnyF3RFV3h1ScHXshTVxVoVj 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-18_02,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 mlxscore=0 impostorscore=0 phishscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 priorityscore=1501 mlxlogscore=914 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406180110 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 15D4114000D X-Stat-Signature: scj6co67wrttfkaazufhs3jfph83f1hh X-HE-Tag: 1718721662-574113 X-HE-Meta: U2FsdGVkX19ok79Y7rSPFaU7a2syuwsszLcqemfiq/J3oCANu9Wh2JGyMZA97+s3Em4oBILTw5KINxDjxtaUeCQDBtiKu5BhkeFEI3DB8IKaaaJkU1c3L71nPEZwdcHrS0WG7pVdY9jTHfHqhN3HH0nVEjoAXqaHQApjkzAxCXAD5Uc/pM6A9diYixZrU8U87X58uw1yWteWdoPiL1XViaOHSCYia5WG9yVFBbFSIKg2yVmH7DhzZGE1C36ecwhPU9Ye81nN63wfLQktFg5BXY+mD6uU6XqlrCaW96aB2ADC5XRO3uwVAIpjvyIM3vZgsTSyD+W2DsyFCQ3/JfE+BBJEJpzmTm6Gyf1sx9b4mIpL7BYVxNWdLdeejnR0jaGz9znPFYDaebW6KdFIObbGL0XBp+wXVme0mSYDUehLFmQgds5HglgKKK7cpe+YYdOLGzvKnIpWo/z2FXPTtLe6LZk5ef4zKgE7980rGyraFmrjnFEcruwKsL6mOyxKf3VYeAfFYOhGt/ryx4ptt5k17+vJ88C2q/O2PzHEH0ubvPH3jjKwbAL7RpzvbAulj/DmO3s6nehHl8C+phSZB6jkq9jD8TloC9+VXBPhDLr/nSrf92RIlfsDlOQz+V6NIYKPF0eURt8QkBtY3tW+AscA+ETjAYTQYxjEqNCpc3c1jgMDwz+z2CpxQF1T0ncSBO1f5UO07Ab3+/pYupTTKQMWPqcFQHPjpXd236PUFQa8lJ6DjNvOVFoAjb56VBU+EDJSYO8BfxAXvBz8BUlZ9aVtsZ8aS1s0ZVfE41NRZRqUQfGVWvyCK4i6MY8aROy0IWvc153P+Wzvqwl38BmIClMTQIBG6O1sK7cLiW8/IVZzuXkHCdS6ZHgZonwPmVUP1Iy5VmqgothkUTR2KeT1dz7eg1sNMt/XcoyTEuIY16BYt2Fs1hj/odQaJiG2E69Z5GnwLSb1npCJXmOPFotZcp2 wU1VOQxG rJDr3En3Qs8Yzg2skOnsSA9ySdgH/rBdHErgo3YG9HT4JcC8pPRakdEVigvE808vIkCBDYcxBw5DJhvb6MbjpLSAAp06o3ByrDjyXnkXCRpIlq4nLQ0qbxOQnGMQp9nXaT6+mXt4dofSQO6vLK7Rhv/jTg1WRNCeu+Ewoky3DJKqs9ntoAT2n613apTup//RCEQHcMnQx7mDTJZa3UJ5z2JQY+rYZmVrkN6HymkrHDwZ7MWX5PWACBVD2xVyaVwghlQzL3VR1NWfBfc7p3iUuCj7cl278cpDc8uDCiaMRs9+8VkFlamYnYvxria8vl518vVrF/2tbS7Lgod8= 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: Separate the pte_bits used in ptdump from pxd_bits used by pmd, p4d, pud, and pgd descriptors, thereby adding support for printing key intermediate directory protection bits, such as PXNTable, and enable the associated support Kconfig option. Signed-off-by: Maxwell Bland --- arch/arm64/Kconfig | 1 + arch/arm64/mm/ptdump.c | 140 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 125 insertions(+), 16 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..8f0b459c13ed 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...) \ @@ -105,11 +106,6 @@ static const struct prot_bits pte_bits[] = { .val = PTE_CONT, .set = "CON", .clear = " ", - }, { - .mask = PTE_TABLE_BIT, - .val = PTE_TABLE_BIT, - .set = " ", - .clear = "BLK", }, { .mask = PTE_UXN, .val = PTE_UXN, @@ -143,34 +139,129 @@ static const struct prot_bits pte_bits[] = { } }; +static const struct prot_bits pxd_bits[] = { + { + .mask = PMD_SECT_VALID, + .val = PMD_SECT_VALID, + .set = " ", + .clear = "F", + }, { + .mask = PMD_TABLE_BIT, + .val = PMD_TABLE_BIT, + .set = "TBL", + .clear = "BLK", + }, { + .mask = PMD_SECT_USER, + .val = PMD_SECT_USER, + .set = "USR", + .clear = " ", + }, { + .mask = PMD_SECT_RDONLY, + .val = PMD_SECT_RDONLY, + .set = "ro", + .clear = "RW", + }, { + .mask = PMD_SECT_S, + .val = PMD_SECT_S, + .set = "SHD", + .clear = " ", + }, { + .mask = PMD_SECT_AF, + .val = PMD_SECT_AF, + .set = "AF", + .clear = " ", + }, { + .mask = PMD_SECT_NG, + .val = PMD_SECT_NG, + .set = "NG", + .clear = " ", + }, { + .mask = PMD_SECT_CONT, + .val = PMD_SECT_CONT, + .set = "CON", + .clear = " ", + }, { + .mask = PMD_SECT_PXN, + .val = PMD_SECT_PXN, + .set = "NX", + .clear = "x ", + }, { + .mask = PMD_SECT_UXN, + .val = PMD_SECT_UXN, + .set = "UXN", + .clear = " ", + }, { + .mask = PMD_TABLE_PXN, + .val = PMD_TABLE_PXN, + .set = "NXTbl", + .clear = " ", + }, { + .mask = PMD_TABLE_UXN, + .val = PMD_TABLE_UXN, + .set = "UXNTbl", + .clear = " ", + }, { + .mask = PTE_GP, + .val = PTE_GP, + .set = "GP", + .clear = " ", + }, { + .mask = PMD_ATTRINDX_MASK, + .val = PMD_ATTRINDX(MT_DEVICE_nGnRnE), + .set = "DEVICE/nGnRnE", + }, { + .mask = PMD_ATTRINDX_MASK, + .val = PMD_ATTRINDX(MT_DEVICE_nGnRE), + .set = "DEVICE/nGnRE", + }, { + .mask = PMD_ATTRINDX_MASK, + .val = PMD_ATTRINDX(MT_NORMAL_NC), + .set = "MEM/NORMAL-NC", + }, { + .mask = PMD_ATTRINDX_MASK, + .val = PMD_ATTRINDX(MT_NORMAL), + .set = "MEM/NORMAL", + }, { + .mask = PMD_ATTRINDX_MASK, + .val = PMD_ATTRINDX(MT_NORMAL_TAGGED), + .set = "MEM/NORMAL-TAGGED", + } +}; + struct pg_level { const struct prot_bits *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), + .bits = pxd_bits, + .num = ARRAY_SIZE(pxd_bits), + .size = PGDIR_SIZE, }, { /* p4d */ .name = "P4D", - .bits = pte_bits, - .num = ARRAY_SIZE(pte_bits), + .bits = pxd_bits, + .num = ARRAY_SIZE(pxd_bits), + .size = P4D_SIZE, }, { /* pud */ .name = "PUD", - .bits = pte_bits, - .num = ARRAY_SIZE(pte_bits), + .bits = pxd_bits, + .num = ARRAY_SIZE(pxd_bits), + .size = PUD_SIZE, }, { /* pmd */ .name = "PMD", - .bits = pte_bits, - .num = ARRAY_SIZE(pte_bits), + .bits = pxd_bits, + .num = ARRAY_SIZE(pxd_bits), + .size = PMD_SIZE, }, { /* pte */ .name = "PTE", .bits = pte_bits, .num = ARRAY_SIZE(pte_bits), + .size = PAGE_SIZE }, }; @@ -251,10 +342,27 @@ 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); + /* + * Non-leaf entries use a fixed size for their range + * specification, whereas leaf entries are grouped by + * attributes and may not have a range larger than the type + * specifier. + */ + 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++; From patchwork Tue Jun 18 14:42:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxwell Bland X-Patchwork-Id: 13702480 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 3E812C2BA18 for ; Tue, 18 Jun 2024 14:53:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 592898D0028; Tue, 18 Jun 2024 10:53:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 542516B030F; Tue, 18 Jun 2024 10:53:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4097C8D0028; Tue, 18 Jun 2024 10:53:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 222D86B030E for ; Tue, 18 Jun 2024 10:53:09 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5459EA7559 for ; Tue, 18 Jun 2024 14:42:21 +0000 (UTC) X-FDA: 82244274924.01.4FB74DF Received: from mx0b-00823401.pphosted.com (mx0b-00823401.pphosted.com [148.163.152.46]) by imf22.hostedemail.com (Postfix) with ESMTP id 71043C0008 for ; Tue, 18 Jun 2024 14:42:19 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=63ok91ig; spf=pass (imf22.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=1718721732; 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=ezwWQXmivCwqBRYERK7BZUh3xDdPWSaca1WBI9VsK/Q=; b=tlWZqruMbBjLjJrMNwI0Z9R4SyOb3ZeKTBjtOM7kwzdrdZ6YD3iK/A9iwgMIN4vk8jPzQj DP6SgRUZ+pduHFQ2aeWnR5KzSZDhLGxzEZ3BYNZ5NK/M2HYsaiZ0FQl5zOXIcV584oOYst CWhCqIkS7cS2HfhJgtOjOi/3F1m/Tcw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718721732; a=rsa-sha256; cv=none; b=gjSFNZJ3THtcf+khY/zEC07F+1/615RUO52q1RSMbl7aneXLF01E/ABvMJDErlfwaHTz9O MiaAN5aiA3qMEWPWU/G4pZPuaLkmM3un3T9wat+ShCd9Tn92DLOVz49h1casCzvGNKAuHb 7ZzQBql8SwTVprOZmQSQNnTXLboq8cw= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=63ok91ig; spf=pass (imf22.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 45IBkGKC002088; Tue, 18 Jun 2024 14:42:10 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=ezwWQXmivCwqBRYERK7BZUh 3xDdPWSaca1WBI9VsK/Q=; b=63ok91igM9aGiEEBMeMzFg5e2fnYqPPTXSMShHM 8N1gRUJqcMTc+GQqkI4iu5qfSwof0HNHrqzcR6rwua+Ndvq3bV5TEV2D/7yBG7Tq 9mIDeeyV563EHgBl0TYfuwOwUCFF90/bgx9eVd16kiwuyPHqAzUWz9nOAcv0Yz7f riIdLZWRo4rAldszEdiXfM3jTTSJVpdx1xpY4hxM2gQn1aC7RI02rekC6VRRGpe2 iTTg6jnMaoAWACDhrQ9NAJ6XHGj/l8KWMtRCq+lsNfOO+QwBo9i3+F5YdT3vD2on EepZda0hQwKf2NbJsxyo7ks8XT5D8VNn/rMMrb2sPnsdh6Q== Received: from va32lpfpp02.lenovo.com ([104.232.228.22]) by mx0b-00823401.pphosted.com (PPS) with ESMTPS id 3yss9d6hk2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jun 2024 14:42:10 +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 va32lpfpp02.lenovo.com (Postfix) with ESMTPS id 4W3Twy1Qvtz50TkT; Tue, 18 Jun 2024 14:42:10 +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 4W3Twy07LJz3p6jp; Tue, 18 Jun 2024 14:42:10 +0000 (UTC) Date: Tue, 18 Jun 2024 09:42:08 -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 v4 3/5] arm64: indent ptdump by level, aligning attributes Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Proofpoint-ORIG-GUID: Y_evLIlZBS663m3UA_uhG0DNOEs7VpPu X-Proofpoint-GUID: Y_evLIlZBS663m3UA_uhG0DNOEs7VpPu 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-18_02,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 impostorscore=0 mlxscore=0 mlxlogscore=999 phishscore=0 adultscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406180110 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 71043C0008 X-Stat-Signature: as1tsf5sopjt7s5igfmprn1rhu4p3bm4 X-HE-Tag: 1718721739-767077 X-HE-Meta: U2FsdGVkX1962loTf0AdvBcTPkiB6dnjcAI8XT38HIDhrHlyrKgS22bO7ilKZxqrtYPTnvFCqQ4faZ5KqTCivMeAuBTd6F5rqKXcjfQGMmtCWg9IVcQ4HuxH6m/4E8orqTFB5nzujLRQD86vNuCrVQzn35rtu1NAV8Wnbzz/o6Y+oKYiM3QlHBeA7N9jhEpNtoaa3p0S3puMRRCbihBdUKjHCt2vIaf8BP861I9PwEYF9X1beNMJvlQ6RzbEDIm0X5t+mMjB2XKG3DVsV2yzn8k/6o/N9QRQix4IyzYON2vjwlYKbOX8ugB6ftiZIzljHO3VEeqFAEeo9XOFm53PITTiw3Kzn3W5DDvzvw/H2URwZzIRtsOmscB2KcuJnGr0OZ/GOaO3olEtD78HN7Em+AkQL125QFJkxiVIz7O2tvz1MuAf0bZ2hkhdDg3AiiB8uBEhz4HNIQcBicoc/0qUJEoIH4o2g5Duemaf4kdIDZRooU3UewiT1DSkSPqLfn6sufRmBjnd5ULwtazyZIMHcKMzFn+KfBdgzDOKjeNbJuMzDFhx4Sd7a3J+NITEkn7KsNHR9WKkvFpxoL4IG0dQTGq77fySeWSdxl8Rbh+AcCcCHoaItcETxbHSyamQq1oK3ZLCOy9IR1/nQieLlN4samFvBccMPJX99W+JIQAQ51IBH2NS1T6K0qu2GC0v+gjEVgwFuKBpPQXlyH6juwn22YKpsD/fWo+F7OdM7e8vT0Nrxxww4guBGuhW+4fmzLjA2Gb2EN/4ybV6VK7WeckbKuodbkcxITxzcw24wAb4AZqBZTXECJm1qhiexZPBKhWtCgDqdCbx2RAmLqfg4hemNtaXjcMAnmnXm1NNx7qQBoKLOavFptqeygXE0XdFN+HmevLHWB3gygvNYBgMGke9iZUD716gZlLIxFnyNxjRTEb3kNOj3cwWF6PZ1DK7vtT1x+CJzoEZebvlsmRfVCG 7MtZV6Ic h3xJxiNbIFb8ofJaapUEdlwQ9ahY5CIKbL6lvdBJl65fVlmhP839YulwmYXTrG/1O6RgZLY8qW8vSvSjkl9PeWe9Q+/12z8OoIhUHWp1A/+1/LtHgG9zSIf79PYbySUtG9B4izhufW8z3r5ysTNtV4x81RsFJ/4a28/cDJJWV3zIIO2MHUyRtcs/MjxLckzJsPbdx23K8iEP6PjI0xSqrxKW5DqNAKT3/3rmkElvw/CtG2UEp9prdvOtxrhPsIKqFF95+8aH8LK3fZb3BC1Evlll7DZ8hdIB44n7qajOW1nLgvasp+NwgIXutigVFM4ZlmnoS+NyWrszUvD4= 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c index 8f0b459c13ed..2ec16b523043 100644 --- a/arch/arm64/mm/ptdump.c +++ b/arch/arm64/mm/ptdump.c @@ -336,6 +336,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); @@ -362,6 +366,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; @@ -369,6 +377,7 @@ static void note_page(struct ptdump_state *pt_st, unsigned long addr, int level, } 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); From patchwork Tue Jun 18 14:42:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxwell Bland X-Patchwork-Id: 13702490 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 67129C2BA18 for ; Tue, 18 Jun 2024 15:07:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B18078D002D; Tue, 18 Jun 2024 11:07:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AC8888D002C; Tue, 18 Jun 2024 11:07:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9421B8D002D; Tue, 18 Jun 2024 11:07:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 75F9E8D002C for ; Tue, 18 Jun 2024 11:07:47 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 86CC644F60 for ; Tue, 18 Jun 2024 14:43:09 +0000 (UTC) X-FDA: 82244276940.04.9116D6B Received: from mx0a-00823401.pphosted.com (mx0a-00823401.pphosted.com [148.163.148.104]) by imf12.hostedemail.com (Postfix) with ESMTP id 6374C40010 for ; Tue, 18 Jun 2024 14:43:07 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b="wvP/R0rX"; spf=pass (imf12.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=1718721778; 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=k7mR/1SYybA1E3VAkvQonOeZDJRDOYjJN4T4w1geSnY=; b=ozgkJRDGoN54sL/qoWm5YLikohLMqEJi6IlTFtkgGLLFO95Si+6b0t1LsfjuAcDryUgqjQ mLuAW0CPNSJmK4PecfDlWtUQPHGqafNU+aGwOBIP38AYBbKz1BaHxxnjVLQmV2gBTY3smN yvTEi1m3or6tcmdCqLiEzKysCaQQwS8= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b="wvP/R0rX"; spf=pass (imf12.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=1718721778; a=rsa-sha256; cv=none; b=VCJQ8oWQOKh8zL1Dk3HWgW4H9R17Ui+TDeuKTRHukC7dsww7rLrufBONztwTvh+b8faiLT 0qdGIiFdswNjzlDLNdNaqcBgoOetUBi2E1UJd8YJGbp2+7UtrztO/r7wcfd0xyog176+8N 4JqLyb8u9GqZxd/vPB37IWm43wRVinY= Received: from pps.filterd (m0355086.ppops.net [127.0.0.1]) by mx0a-00823401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45IDF1Ec018084; Tue, 18 Jun 2024 14:42:58 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=k7mR/1SYybA1E3VAkvQonOe ZDJRDOYjJN4T4w1geSnY=; b=wvP/R0rX9a8dgx5FDpQnFK1jCQK+H4ZG2fYy7Cd Mykjl4BJafMvBub/tcH9tDgOBl3/wwmJ49aWM69M0GBjRl/jOoH/GUGHfugjUTHa sAUDYiIWPEO7CSJLTwCa1Bk2G4j/u+Kaq6kXToN4Z7esMnB31aUD/TPxXS0FQTqS kYQ6YmvXIqXXhA1ae7MxS837nWBAT5/wWkRwt01qulCHG++C5uXn7rsgsxOByr1N tik4nW1LhEuKFDr6/VmUaMrjQDRbyLPWLSvMrN05ncPDMwVS1aqV/OwW0NpjUICa KQPuBItc6I8fBgAodSNFwdM/L+7iuLA4CKC1gbotYVSxO1w== Received: from va32lpfpp01.lenovo.com ([104.232.228.21]) by mx0a-00823401.pphosted.com (PPS) with ESMTPS id 3ysrqk6n1s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jun 2024 14:42:58 +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 4W3Txr6TbMzfBb1; Tue, 18 Jun 2024 14:42:56 +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 4W3Txr5H2Bz3p6jp; Tue, 18 Jun 2024 14:42:56 +0000 (UTC) Date: Tue, 18 Jun 2024 09:42:55 -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 v4 4/5] arm64: exclusive upper bound for ptdump entries Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Proofpoint-ORIG-GUID: lUW5eH0wfVUKzgqnNwLox3eS303p6jMG X-Proofpoint-GUID: lUW5eH0wfVUKzgqnNwLox3eS303p6jMG 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-18_02,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 mlxscore=0 malwarescore=0 spamscore=0 mlxlogscore=941 bulkscore=0 adultscore=0 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406180110 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 6374C40010 X-Stat-Signature: td77xycxaq7mkm8a1nj4uptoej4ar4b3 X-Rspam-User: X-HE-Tag: 1718721787-879891 X-HE-Meta: U2FsdGVkX18dGCbrWv4Empsh0RGidLQDjuKsFtOTJ8khfzniYLDXMS0vFVg2unN/ivEShRGlp4c020iJByMsMZeJGvks20Hz3eEsln+Ic51ki9ctJmJh/83wCGS3zVv5evwvqGzCf9aYtpNdJskV9Hj8H7jxdNSccZFGGBl/qXMlzVkYZnDcgey/n4kB+IzwMYf1PKRLPXjHxLdZYPgKCrf4Se+uIGdgwsDjDNhFFSf6MUSt6G7OEt1v33Q2XyPmOFKXb4f+AvgfvbOkCi3os9FVzT7mLobJF3/aSKNV0zEcqucj0lTNceMNv4udkuu6G8n0GpsiO61hYNGo02rIY6wOZdlOD4W3nR3zhZ/Jb//6gUA5y/NrYYDYjKuoQ6sRyfNNSTwS8e5LbOuD1kxZu+pgTlibCOr41CXa/gs4IeNhyZsol89vixgXsFmkQJqViody7uf+4hXkNElD5N04OPfhVMVSs+gbg3eIVNoDTswOlZmcFu0+nJQjFgdGAy0pkOtNLg57G5HazaV3cL2z88UUHqiCZihR1h7XetVAxs7vtXWPLA2oDkf2g/xn8K7jI1X9d44TzOBkAuSC+v5pwrm7xqTRpMICVBY7ofJ2uGt5dmZOJXGtUxXLUkWYHmgM3dWsuSqpSyTTrh5PvsrTvYRRg8ZcVecl9dw0zOMA4FsYwVCaxmT+3Qlf/qWwzh2e52F+E1I26gkpjmoc6lekRrKuddQbdeZR8Y73X7yBdGK3hcZ67yjrSWEImKljGD021Nw/dHmhhD8+RGmZni2wCI+r6qSQOLqaB+mLlayj+G8wGOsvjfTzzqsR6rqmi0D/QMMaMbVr3k+L2ll6kDgzmH0+vyV2HmCvdN5BqFodc4SJ9Q+P8krnldgQcV8iljQ7Yo34g/zW1PUih6jOArjumoDDKQk9VS0667DMx05l3DVNNwplo9kYkvEbuwuM0SBS01ARKdyulKCHwGbBgkv Kq4E9h+F t18Arg80gPzmy/V4hVguHhqa10nxkUd2RZRaPI6lyXOL7dtJgsjzTmJzX+dSKAc/SCbvffMgLd/QxDW5OkvD0xiHtjcCuq3LaS5ul6C9fRVL3fS2OJ2m/qr7h0J+qUvbCSPI/Q4gQX+OwN3u/J3qwBv7ENrz5NObABv9wrSKYNmFQuDkoF8Z69cLMeT5+jYIegMT1whlZsiQEhcMfCTf5x0MzjVSJsQiH650C2OLXTLCq7y8KUpZRq/TS9qlwDarJnJxJj/x+JoFnfl791yayIHcinM28v9L0BOyp+Y6e2TFcJszFIgMxjZRZ/a765so/G6RKgGCUN7RdteU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000225, 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 2ec16b523043..63f17c08c406 100644 --- a/arch/arm64/mm/ptdump.c +++ b/arch/arm64/mm/ptdump.c @@ -359,11 +359,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 Tue Jun 18 14:43:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxwell Bland X-Patchwork-Id: 13702492 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 AA9C4C27C4F for ; Tue, 18 Jun 2024 15:10:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3072F6B02F4; Tue, 18 Jun 2024 11:10:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 28FC36B02F5; Tue, 18 Jun 2024 11:10:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0E07E6B02F6; Tue, 18 Jun 2024 11:10:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id DE2B86B02F4 for ; Tue, 18 Jun 2024 11:10:44 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id BE1AC1251B3 for ; Tue, 18 Jun 2024 14:43:48 +0000 (UTC) X-FDA: 82244278578.23.ACC417D Received: from mx0b-00823401.pphosted.com (mx0b-00823401.pphosted.com [148.163.152.46]) by imf24.hostedemail.com (Postfix) with ESMTP id CE5BD18000E for ; Tue, 18 Jun 2024 14:43:46 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=USndzeMs; spf=pass (imf24.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=1718721823; 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=BryO1H2z7osolHTe2vGSsXkTHPwleLKRIftQnHBqaKE=; b=p2pRcOndrVX52oq72fKOXUQ2aMaS+Bc+Pu7JfrhBcRCeI//iN+vbaSST2mzq112EQ0SrvT 3Xc3dw/WLVKPXPiL7bYtEBj8KykYi6KzJVYtaUm8GveVFOxGwz/uJLVbBBl7tP+BbJuaIx NrsKNHbXes4VIOzafl7oVFvK7+Fd22k= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=motorola.com header.s=DKIM202306 header.b=USndzeMs; spf=pass (imf24.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718721823; a=rsa-sha256; cv=none; b=p5PaTVIxsBYgV5FQyPVtToGqeK5js4hHvAXF1W6AcQGY+AKL4Crd3ylrg3nLBzOolWZ3Ah JMqSss2og/U1WoPGfKJB7h7Kru0uV3cqUZFN7Mhkqnmhh0RJLX8g2dkNn3QIuBTFdHWWDU t8QGXJwiZRzrlpYNEc/wJvDqgIVd43s= 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 45IC8mw9023649; Tue, 18 Jun 2024 14:43:39 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=BryO1H2z7osolHTe2vGSsXk THPwleLKRIftQnHBqaKE=; b=USndzeMsEq25+QaX3Ooi6L+1b7/go4FVx7lbgMS UKBFXnzuPWEIx/BQOjd3pSfkFuOJLWXcruEjy1Hqetz4w7maYBVvAHKPK044KrcB Z2/KXQHngSRsSVWtJXwqajBs0G4GHzN3nPRv4Rhuy/CEPX5aLR5nykkDq+R8ep0M M14Kslpe03MAEbXj9jq0q0VzS55MskQHc6vL/s7X4WD2ZppRYUoK+HquaK7kaAMt YCbjoywNsVP9H7d5R6InN3SjZyagRWmTWq1aBFLOERh5uBDCQ/x2Vi5VlxWhH7yk +Qztss8cRQKAew5QqFKmdDILZTQIb4UOkIOAVdT0XAD7DOg== Received: from va32lpfpp02.lenovo.com ([104.232.228.22]) by mx0b-00823401.pphosted.com (PPS) with ESMTPS id 3ysqgmxqcf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jun 2024 14:43:39 +0000 (GMT) Received: from va32lmmrp01.lenovo.com (va32lmmrp01.mot.com [10.62.177.113]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by va32lpfpp02.lenovo.com (Postfix) with ESMTPS id 4W3Tyg0Cs0z50TkV; Tue, 18 Jun 2024 14:43:39 +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 va32lmmrp01.lenovo.com (Postfix) with ESMTPSA id 4W3Tyf59PGz2VZRs; Tue, 18 Jun 2024 14:43:38 +0000 (UTC) Date: Tue, 18 Jun 2024 09:43:37 -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 v4 5/5] arm64: add attrs and format to ptdump document Message-ID: <2hhihkaeeyyy3xj22mjdx44zlied2sp4mfewj7y6ffrnakw7cy@3fuds6n7f4ew> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Proofpoint-GUID: 361aNQGQXUBOEgw_wet2N1UkzcVudRSG X-Proofpoint-ORIG-GUID: 361aNQGQXUBOEgw_wet2N1UkzcVudRSG 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-18_02,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 spamscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 mlxlogscore=989 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406180110 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: CE5BD18000E X-Stat-Signature: jhxokncnqkkxhpx88kqhho7tc9jiaw8d X-HE-Tag: 1718721826-359235 X-HE-Meta: U2FsdGVkX1+doFQwNtSiGhTEBsVOc3flYYiJmmTtUALBKuSc5LobWgoW49NN9Im4Vzzw22nGTL5BBGASpm7VuRSloDKGen+MzD6RaZZFrxZ2LmJcaw0RZygK7scEd6tqZ7OiSOSuqFwIXc73DzxHgc1orrJPCZ1N/NRkRCGVD3bB7TsCQ+jezOWSV8FxYJsQoVOpA0brmsex5h/T9S3hOp4sJo/eHTnS0R7Hb9acDrqPdWzhVN2k+DFeH401Z3K9Aijb+UJlCXQuDSnv3mTXZ3lqdPQbrnfftTeyreYFmLEDWvPO15pz3SAoXfHfrGCvwOLmIAmuq1cdXc0SQRFxWMLGnNIXJCIMRNBmXwO3qKg+pHVLn+2I/oBH8yAp6xhLEM8nsPlxsCD54MB/ToSg/uSbXkVeumlLOUDTdI99F0KokR6CbPFDars1Lm5MOhQV56hCs1tILMCi/BxMCvBOAhDMznS4WNZSRDrHzflmonZUQf+U/ZQ7IinsWw2bXNqwmgho6/RUZfhmLj+kl7vZmJhAECfMJXNZE6eeXytVyLKXSprmUcPkQdoHeCSZZcbikyd3JGkBcUW8O44OSiVbHRxSTn6vOWtx2QXDwMQcfIGdM5iczQhS3X23FuwSgAQpa/7d71+CJn6IHFYEOpq+JnulU75w/Nx5eVGVJ2iuo/dB7hUE0AqS2Dh5kLmSn6V7ogxcCgx0DhJm5diROXCZ9PlPccGDtiF5CoCs6PlH7UR6qjNPNciM8O6wM5fK5m29OfZmNuNiJeNSC0csDX7H7TCt+4UXhg1rtE43wtMXvT1FuRIDbJEE4UrfhxtrgL/52OhTgQDROQ1E9G0cb/DgKCqASkOYfNKWc6RKX32tf3kLfQ+wUgDbKt2HQE5/RwbioDadrir1ctHho+fUG+SfypO13WeFvSKFfZR2MyQP0iGD3TZHW6W3BXARkBcVXw9/BuLkcVnQY9eIkUDX4WE YnFEN2XT j2UDOk9h70upuUYGdraytbPAdnmErWWXvEOgBYyVD8Z15rUdkBi0LiA94I6YGUgE8jfadT1krwqbYxIiSNjh8xgQmD9/BbDQeOnXhaUE9detJNkFz8LHTryETTjb1QVTnyMwS9MZnOJTp2C8N4xxr9LW5NzT5IW28W/qutwBpQRMVzHm0pJ6xGtghAvxXsi9yOHQbuNCJiTbS3IvmCfDchdgj/QFOa6T7rsmRtJ6CbIOp2mXqFbknWs0xZMD2c5VqRGn8jkhA20kUoCCcLCuDEGv36xN5+K8wjnI60khmJRtUazY03SemARpQ7lHWCDl8atiQ+1bJk3Dy41s= 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 identical-entry coalescing implicit in the code. Remove unnecessary layout example given the existing cat example, and opt instead for a precise, clear explantination of address markers, format, attributes. Update example to match the new cosmetic and intermediate-directory printing changes. Signed-off-by: Maxwell Bland --- 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..fee7600dd4d1 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. leaf level PTE or block level 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 leaf and non-leaf entries. For example, PMD entries +can support the PXNTable permission bit and do not share that same set +of attributes as leaf level PTE entries. + +The following attributes are presently supported:: + +F Entry is invalid +USER Memory is user mapped +ro Memory is read-only +RW Memory is read-write +NX Memory is privileged execute never +x Memory is privileged executable +SHD Memory is shared +AF Entry accessed flag is set +NG Entry Not-Global flag is set +CON Entry contiguous bit is set +UXN Memory is unprivileged execute never +GP Memory supports BTI +TBL Entry is a table descriptor +BLK Entry is a block descriptor +NXTbl Entry's referenced table is PXN +UXNTbl Entry's referenced table is unprivileged execute never +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-0xffff31ffffffffff 50T PGD +0xffff320000000000-0xffffffffffffffff 206T PGD TBL RW x NXTbl UXNTbl MEM/NORMAL + 0xffff320000000000-0xffff3251ffffffff 328G PUD + 0xffff325200000000-0xffff32523fffffff 1G PUD TBL RW x NXTbl UXNTbl MEM/NORMAL + 0xffff325200000000-0xffff3252001fffff 2M PMD TBL RW x NXTbl UXNTbl MEM/NORMAL + 0xffff325200000000-0xffff3252001fffff 2M PTE RW NX SHD AF NG UXN MEM/NORMAL-TAGGED + 0xffff325200200000-0xffff3252003fffff 2M PMD TBL RW x NXTbl UXNTbl MEM/NORMAL + 0xffff325200200000-0xffff32520020ffff 64K PTE RW NX SHD AF NG UXN MEM/NORMAL-TAGGED + 0xffff325200210000-0xffff3252003fffff 1984K PTE ro NX SHD AF NG UXN MEM/NORMAL + 0xffff325200400000-0xffff325201dfffff 26M PMD BLK ro SHD AF NG NX UXN MEM/NORMAL + 0xffff325201e00000-0xffff325201ffffff 2M PMD TBL RW x NXTbl UXNTbl MEM/NORMAL + 0xffff325201e00000-0xffff325201e0ffff 64K PTE ro NX SHD AF NG UXN MEM/NORMAL + 0xffff325201e10000-0xffff325201ffffff 1984K PTE RW NX SHD AF NG UXN MEM/NORMAL-TAGGED