On Wed, Jun 02, 2021 at 03:02:43PM +0800, Kefeng Wang wrote:OK, I will drop this one, thanks
Like commit 67ce16ec15ce ("arm64: mm: print out correct page table entries")This can be misleading on 32-bit ARM.
does, drop the struct mm_struct argument of show_pte(), print the tables
based on the faulting address.
Signed-off-by: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx>
The effective page tables for each thread are the threads *own* page
tables. There is no hardware magic for addresses above PAGE_OFFSET being
directed to the init_mm page tables.
So, when we hit a fault in kernel space, we need to be printing the
currently in-use page tables associated with the running thread.
Hence:
/*is incorrect here.
- * This is useful to dump out the page tables associated with
- * 'addr' in mm 'mm'.
+ * Dump out the page tables associated with 'addr' in the currently active mm
*/
-void show_pte(const char *lvl, struct mm_struct *mm, unsigned long addr)
+void show_pte(const char *lvl, unsigned long addr)
{
pgd_t *pgd;
-
- if (!mm)
+ struct mm_struct *mm;
+
+ if (addr < TASK_SIZE) {
+ mm = current->active_mm;
+ if (mm == &init_mm) {
+ printk("%s[%08lx] user address but active_mm is swapper\n",
+ lvl, addr);
+ return;
+ }
+ } else {
mm = &init_mm;
+ }
It's completely fine for architectures where kernel accesses always go
to the init_mm page tables, but for 32-bit ARM that is not the case.