All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mm: page_owner: fixing wrong information in dump_page_owner
       [not found] <CGME20240424112123epcas5p46e76f51b8913661a6b740dcbbec83621@epcas5p4.samsung.com>
@ 2024-04-24 11:18 ` Hariom Panthi
       [not found]   ` <CGME20240424112131epcas5p100ad84d676c861db5a0d84439fe5f718@epcas5p1.samsung.com>
  2024-04-24 12:50   ` [PATCH 1/2] mm: page_owner: fixing wrong information in dump_page_owner Oscar Salvador
  0 siblings, 2 replies; 3+ messages in thread
From: Hariom Panthi @ 2024-04-24 11:18 UTC (permalink / raw
  To: akpm, urezki, hch, lstoakes, vbabka, osalvador
  Cc: linux-mm, linux-kernel, r.thapliyal, Maninder Singh,
	Hariom Panthi

From: Maninder Singh <maninder1.s@samsung.com>

with commit ea4b5b33bf8a ("mm,page_owner: update metadata for tail pages"),
new API __update_page_owner_handle was introduced and arguemnt was passed
in wrong order from __set_page_owner and thus page_owner is giving
wrong data.

[   15.982420] page last allocated via order 0, migratetype Unmovable, gfp_mask 0xcc0(GFP_KERNEL), pid 80, tgid -1210279584 (insmod), ts 80, free_ts 0

Fixing the same.
Correct output:
[   14.556482] page last allocated via order 0, migratetype Unmovable, gfp_mask 0xcc0(GFP_KERNEL), pid 80, tgid 80 (insmod), ts 14552004992, free_ts 0

Fixes: ea4b5b33bf8a ("mm,page_owner: update metadata for tail pages")
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Signed-off-by: Hariom Panthi <hariom1.p@samsung.com>
---
 mm/page_owner.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_owner.c b/mm/page_owner.c
index 742f432e5bf0..6669c7eadfb3 100644
--- a/mm/page_owner.c
+++ b/mm/page_owner.c
@@ -328,7 +328,7 @@ noinline void __set_page_owner(struct page *page, unsigned short order,
 	if (unlikely(!page_ext))
 		return;
 	__update_page_owner_handle(page_ext, handle, order, gfp_mask, -1,
-				   current->pid, current->tgid, ts_nsec,
+				   ts_nsec, current->pid, current->tgid,
 				   current->comm);
 	page_ext_put(page_ext);
 	inc_stack_record_count(handle, gfp_mask, 1 << order);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] mm: vmalloc: dump page owner info if page is already mapped
       [not found]   ` <CGME20240424112131epcas5p100ad84d676c861db5a0d84439fe5f718@epcas5p1.samsung.com>
@ 2024-04-24 11:18     ` Hariom Panthi
  0 siblings, 0 replies; 3+ messages in thread
From: Hariom Panthi @ 2024-04-24 11:18 UTC (permalink / raw
  To: akpm, urezki, hch, lstoakes, vbabka, osalvador
  Cc: linux-mm, linux-kernel, r.thapliyal, Hariom Panthi

In vmap_pte_range, BUG_ON is called when page is already mapped,
It doesn't give enough information to debug further.
Dumping page owner information alongwith BUG_ON will be more useful
in case of multiple page mapping.

Example:
[   14.552875] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10b923
[   14.553440] flags: 0xbffff0000000000(node=0|zone=2|lastcpupid=0x3ffff)
[   14.554001] page_type: 0xffffffff()
[   14.554783] raw: 0bffff0000000000 0000000000000000 dead000000000122 0000000000000000
[   14.555230] raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
[   14.555768] page dumped because: remapping already mapped page
[   14.556172] page_owner tracks the page as allocated
[   14.556482] page last allocated via order 0, migratetype Unmovable, gfp_mask 0xcc0(GFP_KERNEL), pid 80, tgid 80 (insmod), ts 14552004992, free_ts 0
[   14.557286]  prep_new_page+0xa8/0x10c
[   14.558052]  get_page_from_freelist+0x7f8/0x1248
[   14.558298]  __alloc_pages+0x164/0x2b4
[   14.558514]  alloc_pages_mpol+0x88/0x230
[   14.558904]  alloc_pages+0x4c/0x7c
[   14.559157]  load_module+0x74/0x1af4
[   14.559361]  __do_sys_init_module+0x190/0x1fc
[   14.559615]  __arm64_sys_init_module+0x1c/0x28
[   14.559883]  invoke_syscall+0x44/0x108
[   14.560109]  el0_svc_common.constprop.0+0x40/0xe0
[   14.560371]  do_el0_svc_compat+0x1c/0x34
[   14.560600]  el0_svc_compat+0x2c/0x80
[   14.560820]  el0t_32_sync_handler+0x90/0x140
[   14.561040]  el0t_32_sync+0x194/0x198
[   14.561329] page_owner free stack trace missing
[   14.562049] ------------[ cut here ]------------
[   14.562314] kernel BUG at mm/vmalloc.c:113!

Signed-off-by: Hariom Panthi <hariom1.p@samsung.com>
---
replaced dump_page_owner() with dump_page() as per Andrew's suggestion

 mm/vmalloc.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 68fa001648cc..bc74eb406c0a 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -42,6 +42,7 @@
 #include <linux/sched/mm.h>
 #include <asm/tlbflush.h>
 #include <asm/shmparam.h>
+#include <linux/page_owner.h>
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/vmalloc.h>
@@ -96,6 +97,7 @@ static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
 {
 	pte_t *pte;
 	u64 pfn;
+	struct page *page;
 	unsigned long size = PAGE_SIZE;
 
 	pfn = phys_addr >> PAGE_SHIFT;
@@ -103,7 +105,13 @@ static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
 	if (!pte)
 		return -ENOMEM;
 	do {
-		BUG_ON(!pte_none(ptep_get(pte)));
+		if (!pte_none(ptep_get(pte))) {
+			if (pfn_valid(pfn)) {
+				page = pfn_to_page(pfn);
+				dump_page(page, "remapping already mapped page");
+			}
+			BUG();
+		}
 
 #ifdef CONFIG_HUGETLB_PAGE
 		size = arch_vmap_pte_range_map_size(addr, end, pfn, max_page_shift);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] mm: page_owner: fixing wrong information in dump_page_owner
  2024-04-24 11:18 ` [PATCH 1/2] mm: page_owner: fixing wrong information in dump_page_owner Hariom Panthi
       [not found]   ` <CGME20240424112131epcas5p100ad84d676c861db5a0d84439fe5f718@epcas5p1.samsung.com>
@ 2024-04-24 12:50   ` Oscar Salvador
  1 sibling, 0 replies; 3+ messages in thread
From: Oscar Salvador @ 2024-04-24 12:50 UTC (permalink / raw
  To: Hariom Panthi
  Cc: akpm, urezki, hch, lstoakes, vbabka, linux-mm, linux-kernel,
	r.thapliyal, Maninder Singh

On Wed, Apr 24, 2024 at 04:48:37PM +0530, Hariom Panthi wrote:
> From: Maninder Singh <maninder1.s@samsung.com>
> 
> with commit ea4b5b33bf8a ("mm,page_owner: update metadata for tail pages"),
> new API __update_page_owner_handle was introduced and arguemnt was passed
> in wrong order from __set_page_owner and thus page_owner is giving
> wrong data.
> 
> [   15.982420] page last allocated via order 0, migratetype Unmovable, gfp_mask 0xcc0(GFP_KERNEL), pid 80, tgid -1210279584 (insmod), ts 80, free_ts 0
> 
> Fixing the same.
> Correct output:
> [   14.556482] page last allocated via order 0, migratetype Unmovable, gfp_mask 0xcc0(GFP_KERNEL), pid 80, tgid 80 (insmod), ts 14552004992, free_ts 0
> 
> Fixes: ea4b5b33bf8a ("mm,page_owner: update metadata for tail pages")
> Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
> Signed-off-by: Hariom Panthi <hariom1.p@samsung.com>

Acked-by: Oscar Salvador <osalvador@suse.de>

Thanks!

 

-- 
Oscar Salvador
SUSE Labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-24 12:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20240424112123epcas5p46e76f51b8913661a6b740dcbbec83621@epcas5p4.samsung.com>
2024-04-24 11:18 ` [PATCH 1/2] mm: page_owner: fixing wrong information in dump_page_owner Hariom Panthi
     [not found]   ` <CGME20240424112131epcas5p100ad84d676c861db5a0d84439fe5f718@epcas5p1.samsung.com>
2024-04-24 11:18     ` [PATCH 2/2] mm: vmalloc: dump page owner info if page is already mapped Hariom Panthi
2024-04-24 12:50   ` [PATCH 1/2] mm: page_owner: fixing wrong information in dump_page_owner Oscar Salvador

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.