[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250818091436.938517-3-anshuman.khandual@arm.com>
Date: Mon, 18 Aug 2025 14:44:35 +0530
From: Anshuman Khandual <anshuman.khandual@....com>
To: linux-arm-kernel@...ts.infradead.org
Cc: Anshuman Khandual <anshuman.khandual@....com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Mark Brown <broonie@...nel.org>,
Ryan Roberts <ryan.roberts@....com>,
Mark Rutland <mark.rutland@....com>,
linux-kernel@...r.kernel.org
Subject: [RFC 2/3] arm64/ptdump: Enable console output in pt_dump_seq_[printf|puts]()
Enable console output in pt_dump_seq_[printf|puts]() in order to dump early
kernel page tables when required. CONFIG_DEBUG_WX enabled ptdump_check_wx()
already sets seq file as NULL to avoid any output. Hence just introduce a
special sentinel named CONSOLE as ((struct seq_file *)-1) which can be used
to identify kernel console output request for early kernel page table dump.
Suggested-by: Ryan Roberts <ryan.roberts@....com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@....com>
---
arch/arm64/mm/ptdump.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c
index 7c42be62898b..c78e6b496dea 100644
--- a/arch/arm64/mm/ptdump.c
+++ b/arch/arm64/mm/ptdump.c
@@ -25,17 +25,26 @@
#include <asm/pgtable-hwdef.h>
#include <asm/ptdump.h>
-
-#define pt_dump_seq_printf(m, fmt, args...) \
-({ \
- if (m) \
- seq_printf(m, fmt, ##args); \
+#define CONSOLE ((struct seq_file *)-1)
+
+#define pt_dump_seq_printf(m, fmt, args...) \
+({ \
+ if (m) { \
+ if (m == CONSOLE) \
+ pr_cont(fmt, ##args); \
+ else \
+ seq_printf(m, fmt, ##args); \
+ } \
})
-#define pt_dump_seq_puts(m, fmt) \
-({ \
- if (m) \
- seq_printf(m, fmt); \
+#define pt_dump_seq_puts(m, fmt) \
+({ \
+ if (m) { \
+ if (m == CONSOLE) \
+ pr_cont(fmt); \
+ else \
+ seq_printf(m, fmt); \
+ } \
})
static const struct ptdump_prot_bits pte_bits[] = {
--
2.25.1
Powered by blists - more mailing lists