public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Fixes related to lx-slabinfo, lx-slabtrace
@ 2026-04-27 14:24 Illia Ostapyshyn
  2026-04-27 14:24 ` [PATCH 1/2] scripts/gdb: mm: Cast untyped symbols in x86_page_ops Illia Ostapyshyn
  2026-04-27 14:24 ` [PATCH 2/2] scripts/gdb: slab: Update field names of struct kmem_cache Illia Ostapyshyn
  0 siblings, 2 replies; 5+ messages in thread
From: Illia Ostapyshyn @ 2026-04-27 14:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: Hao Li, Harry Yoo, Vlastimil Babka (SUSE), Illia Ostapyshyn,
	Andrew Morton, Seongjun Hong, Kieran Bingham, Jan Kiszka,
	Florian Fainelli

Hi all,

calling slab-related commands in gdb scripts currently fails because
of two reasons.  Firstly, x86 mm page ops try to cast symbols without
type information to int, which causes an exception.  Secondly, struct
kmem_cache was changed in commit 55f8b4518d14b743 ("scripts/gdb:
implement x86_page_ops in mm.py") to factor out per-node data into a
separate struct, which the gdb scripts do not reflect yet.

These two patches fix these issues.

Illia Ostapyshyn (2):
  scripts/gdb: mm: Cast untyped symbols in x86_page_ops
  scripts/gdb: slab: Update field names of struct kmem_cache

 scripts/gdb/linux/mm.py   | 6 +++---
 scripts/gdb/linux/slab.py | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)


base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
-- 
2.51.2


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

* [PATCH 1/2] scripts/gdb: mm: Cast untyped symbols in x86_page_ops
  2026-04-27 14:24 [PATCH 0/2] Fixes related to lx-slabinfo, lx-slabtrace Illia Ostapyshyn
@ 2026-04-27 14:24 ` Illia Ostapyshyn
  2026-04-27 14:24 ` [PATCH 2/2] scripts/gdb: slab: Update field names of struct kmem_cache Illia Ostapyshyn
  1 sibling, 0 replies; 5+ messages in thread
From: Illia Ostapyshyn @ 2026-04-27 14:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: Hao Li, Harry Yoo, Vlastimil Babka (SUSE), Illia Ostapyshyn,
	Andrew Morton, Seongjun Hong, Kieran Bingham, Jan Kiszka,
	Florian Fainelli

The symbols phys_base, _text, and _end, used in x86_page_ops are either
defined in assembly or implicitly by the linker.  Thus, they lack type
information and cause a conversion error after gdb.parse_and_eval.
Explicitly cast these expressions to unsigned long.

Fixes: 55f8b4518d14 ("scripts/gdb: implement x86_page_ops in mm.py")
Signed-off-by: Illia Ostapyshyn <illia@yshyn.com>
---
 scripts/gdb/linux/mm.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/gdb/linux/mm.py b/scripts/gdb/linux/mm.py
index d78908f6664d..dffadccbb01d 100644
--- a/scripts/gdb/linux/mm.py
+++ b/scripts/gdb/linux/mm.py
@@ -40,11 +40,11 @@ class x86_page_ops():
 
         self.PAGE_OFFSET = int(gdb.parse_and_eval("page_offset_base"))
         self.VMEMMAP_START = int(gdb.parse_and_eval("vmemmap_base"))
-        self.PHYS_BASE = int(gdb.parse_and_eval("phys_base"))
+        self.PHYS_BASE = int(gdb.parse_and_eval("(unsigned long) phys_base"))
         self.START_KERNEL_map = 0xffffffff80000000
 
-        self.KERNEL_START = gdb.parse_and_eval("_text")
-        self.KERNEL_END = gdb.parse_and_eval("_end")
+        self.KERNEL_START = gdb.parse_and_eval("(unsigned long) &_text")
+        self.KERNEL_END = gdb.parse_and_eval("(unsigned long) &_end")
 
         self.VMALLOC_START = int(gdb.parse_and_eval("vmalloc_base"))
         if self.VMALLOC_START == 0xffffc90000000000:
-- 
2.51.2


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

* [PATCH 2/2] scripts/gdb: slab: Update field names of struct kmem_cache
  2026-04-27 14:24 [PATCH 0/2] Fixes related to lx-slabinfo, lx-slabtrace Illia Ostapyshyn
  2026-04-27 14:24 ` [PATCH 1/2] scripts/gdb: mm: Cast untyped symbols in x86_page_ops Illia Ostapyshyn
@ 2026-04-27 14:24 ` Illia Ostapyshyn
  2026-04-28  6:04   ` Harry Yoo (Oracle)
  2026-04-28  8:20   ` Vlastimil Babka (SUSE)
  1 sibling, 2 replies; 5+ messages in thread
From: Illia Ostapyshyn @ 2026-04-27 14:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: Hao Li, Harry Yoo, Vlastimil Babka (SUSE), Illia Ostapyshyn,
	Andrew Morton, Seongjun Hong, Kieran Bingham, Jan Kiszka,
	Florian Fainelli

The commit 5ba6bc27b1f9 ("slab: decouple pointer to barn from
kmem_cache_node") reorganized the struct kmem_cache to factor out the
per-node fields to the new struct kmem_cache_per_node_ptrs.  This causes
the gdb scripts for lx-slabinfo and lx-slabtrace fail as they still
reference the old structure.

Adjust the gdb scripts to match the current state of struct kmem_cache.

Fixes: 5ba6bc27b1f9 ("slab: decouple pointer to barn from kmem_cache_node")
Signed-off-by: Illia Ostapyshyn <illia@yshyn.com>
---
 scripts/gdb/linux/slab.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/gdb/linux/slab.py b/scripts/gdb/linux/slab.py
index 0e2d93867fe2..ddde25aeca8d 100644
--- a/scripts/gdb/linux/slab.py
+++ b/scripts/gdb/linux/slab.py
@@ -196,7 +196,7 @@ def slabtrace(alloc, cache_name):
 
     if target_cache['flags'] & SLAB_STORE_USER:
         for i in range(0, nr_node_ids):
-            cache_node = target_cache['node'][i]
+            cache_node = target_cache['per_node']['node'][i]
             if cache_node['nr_slabs']['counter'] == 0:
                 continue
             process_slab(loc_track, cache_node['partial'], alloc, target_cache)
@@ -300,7 +300,7 @@ def slabinfo():
         nr_free = 0
         nr_slabs = 0
         for i in range(0, nr_node_ids):
-            cache_node = cache['node'][i]
+            cache_node = cache['per_node']['node'][i]
             try:
                 nr_slabs += cache_node['nr_slabs']['counter']
                 nr_objs = int(cache_node['total_objects']['counter'])
-- 
2.51.2


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

* Re: [PATCH 2/2] scripts/gdb: slab: Update field names of struct kmem_cache
  2026-04-27 14:24 ` [PATCH 2/2] scripts/gdb: slab: Update field names of struct kmem_cache Illia Ostapyshyn
@ 2026-04-28  6:04   ` Harry Yoo (Oracle)
  2026-04-28  8:20   ` Vlastimil Babka (SUSE)
  1 sibling, 0 replies; 5+ messages in thread
From: Harry Yoo (Oracle) @ 2026-04-28  6:04 UTC (permalink / raw)
  To: Illia Ostapyshyn
  Cc: linux-kernel, Hao Li, Vlastimil Babka (SUSE), Andrew Morton,
	Seongjun Hong, Kieran Bingham, Jan Kiszka, Florian Fainelli

On Mon, Apr 27, 2026 at 04:24:48PM +0200, Illia Ostapyshyn wrote:
> The commit 5ba6bc27b1f9 ("slab: decouple pointer to barn from
> kmem_cache_node") reorganized the struct kmem_cache to factor out the
> per-node fields to the new struct kmem_cache_per_node_ptrs.  This causes
> the gdb scripts for lx-slabinfo and lx-slabtrace fail as they still
> reference the old structure.
> 
> Adjust the gdb scripts to match the current state of struct kmem_cache.
> 
> Fixes: 5ba6bc27b1f9 ("slab: decouple pointer to barn from kmem_cache_node")
> Signed-off-by: Illia Ostapyshyn <illia@yshyn.com>
> ---

Looks good to me,
Acked-by: Harry Yoo (Oracle) <harry@kernel.org>

-- 
Cheers,
Harry / Hyeonggon

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

* Re: [PATCH 2/2] scripts/gdb: slab: Update field names of struct kmem_cache
  2026-04-27 14:24 ` [PATCH 2/2] scripts/gdb: slab: Update field names of struct kmem_cache Illia Ostapyshyn
  2026-04-28  6:04   ` Harry Yoo (Oracle)
@ 2026-04-28  8:20   ` Vlastimil Babka (SUSE)
  1 sibling, 0 replies; 5+ messages in thread
From: Vlastimil Babka (SUSE) @ 2026-04-28  8:20 UTC (permalink / raw)
  To: Illia Ostapyshyn, linux-kernel
  Cc: Hao Li, Harry Yoo, Andrew Morton, Seongjun Hong, Kieran Bingham,
	Jan Kiszka, Florian Fainelli

On 4/27/26 16:24, Illia Ostapyshyn wrote:
> The commit 5ba6bc27b1f9 ("slab: decouple pointer to barn from
> kmem_cache_node") reorganized the struct kmem_cache to factor out the
> per-node fields to the new struct kmem_cache_per_node_ptrs.  This causes
> the gdb scripts for lx-slabinfo and lx-slabtrace fail as they still
> reference the old structure.
> 
> Adjust the gdb scripts to match the current state of struct kmem_cache.
> 
> Fixes: 5ba6bc27b1f9 ("slab: decouple pointer to barn from kmem_cache_node")
> Signed-off-by: Illia Ostapyshyn <illia@yshyn.com>

Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>

Thanks!

> ---
>  scripts/gdb/linux/slab.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/gdb/linux/slab.py b/scripts/gdb/linux/slab.py
> index 0e2d93867fe2..ddde25aeca8d 100644
> --- a/scripts/gdb/linux/slab.py
> +++ b/scripts/gdb/linux/slab.py
> @@ -196,7 +196,7 @@ def slabtrace(alloc, cache_name):
>  
>      if target_cache['flags'] & SLAB_STORE_USER:
>          for i in range(0, nr_node_ids):
> -            cache_node = target_cache['node'][i]
> +            cache_node = target_cache['per_node']['node'][i]
>              if cache_node['nr_slabs']['counter'] == 0:
>                  continue
>              process_slab(loc_track, cache_node['partial'], alloc, target_cache)
> @@ -300,7 +300,7 @@ def slabinfo():
>          nr_free = 0
>          nr_slabs = 0
>          for i in range(0, nr_node_ids):
> -            cache_node = cache['node'][i]
> +            cache_node = cache['per_node']['node'][i]
>              try:
>                  nr_slabs += cache_node['nr_slabs']['counter']
>                  nr_objs = int(cache_node['total_objects']['counter'])


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

end of thread, other threads:[~2026-04-28  8:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-27 14:24 [PATCH 0/2] Fixes related to lx-slabinfo, lx-slabtrace Illia Ostapyshyn
2026-04-27 14:24 ` [PATCH 1/2] scripts/gdb: mm: Cast untyped symbols in x86_page_ops Illia Ostapyshyn
2026-04-27 14:24 ` [PATCH 2/2] scripts/gdb: slab: Update field names of struct kmem_cache Illia Ostapyshyn
2026-04-28  6:04   ` Harry Yoo (Oracle)
2026-04-28  8:20   ` Vlastimil Babka (SUSE)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox