Hi, -----Original Message----- > Hi, > > I have update patch to v2 and test it is ok. Thank you for the v2 patch and testing, we will move on with this. Lianbo, I've updated its subject and indents etc. a little, attached. Thanks, Kazu > > From 9284131e93fd2f0af20239a9f7ec1fb0eb3081e2 Mon Sep 17 00:00:00 2001 > From: xiaer1921 <xiaer1921@xxxxxxxxx> > Date: Thu, 7 Apr 2022 15:05:17 +0800 > Subject: [PATCH] Fix for "kmem -s|-S" on Linux 5.17.0+ > > Since the following kernel commits split slab info from struct page > into struct slab, crash cannot get several slab related offsets from > struct page. > > d122019bf061 ("mm: Split slab into its own type") > 401fb12c68c2 ("mm: Differentiate struct slab fields by sl*b implementations") > 07f910f9b729 ("mm: Remove slab from struct page") > > Without the patch, "kmem -s|-S" options cannot work correctly on kernels > configured with CONFIG_SLAB with the following error: > > crash> kmem -s > kmem: invalid structure member offset: page_active > FILE: memory.c LINE: 12225 FUNCTION: verify_slab_overload_page() > > Signed-off-by: xiaer1921 <xiaer1921@xxxxxxxxx> > --- > memory.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/memory.c b/memory.c > index 8448ddc..c8eed28 100644 > --- a/memory.c > +++ b/memory.c > @@ -541,6 +541,15 @@ vm_init(void) > ANON_MEMBER_OFFSET_INIT(page_s_mem, "page", "s_mem"); > ANON_MEMBER_OFFSET_INIT(page_freelist, "page", "freelist"); > ANON_MEMBER_OFFSET_INIT(page_active, "page", "active"); > + /* > + * Moved to struct slab in Linux 5.17 > + */ > + if (INVALID_MEMBER(page_s_mem)) > + MEMBER_OFFSET_INIT(page_s_mem, "slab", "s_mem"); > + if (INVALID_MEMBER(page_freelist)) > + MEMBER_OFFSET_INIT(page_freelist, "slab", "freelist"); > + if (INVALID_MEMBER(page_active)) > + MEMBER_OFFSET_INIT(page_active, "slab", "active"); > } > > if (!VALID_STRUCT(kmem_slab_s) && VALID_STRUCT(slab_s)) { > -- > 2.7.4 > > > 在 2022/4/4 下午1:59, HAGIO KAZUHITO(萩尾 一仁) 写道: > > Hi, > > > > Thank you for the patch. > > > >> -----Original Message----- > >> Hi. > >> > >> update patch: > >> > >> From 0f5d39e416b2fa12d6afdb0a0222b2734e139455 Mon Sep 17 00:00:00 2001 > >> From: xiaer1921 <xiaer1921@xxxxxxxxx> > >> Date: Tue, 29 Mar 2022 20:03:03 +0800 > >> Subject: [PATCH] Fix for "kmem -s|-S" on Linux 5.17.0+ > >> > >> Since the following kernel commits split slab info from struct page > >> into struct slab, crash cannot get several slab related offsets from > >> struct page. > >> > >> d122019bf061 ("mm: Split slab into its own type") > >> 401fb12c68c2 ("mm: Differentiate struct slab fields by sl*b implementations") > >> 07f910f9b729 ("mm: Remove slab from struct page") > >> > >> Without the patch, "kmem -s|-S" options cannot work > >> correctly with the following errors: > > > > It would be preferable to mention CONFIG_SLAB: > > > > Without the patch, "kmem -s|-S" options cannot work correctly on kernels > > configured with CONFIG_SLAB with the following error: > > > >> > >> crash> kmem -s > >> kmem: invalid structure member offset: page_active > >> FILE: memory.c LINE: 12225 FUNCTION: verify_slab_overload_page() > >> > > > >> [/usr/bin/crash] error trace: 532526 => 53353a => 5e0a6a => 5e09dc > >> [Detaching after fork from child process 28299] > >> > >> 5e09dc: OFFSET_verify.part.36+92 > >> [Detaching after fork from child process 28301] > >> 5e0a6a: OFFSET_verify+58 > >> [Detaching after fork from child process 28303] > >> 53353a: verify_slab_overload_page+588 > >> [Detaching after fork from child process 28305] > >> 532526: do_slab_chain_slab_overload_page+1171 > >> > >> kmem: invalid structure member offset: page_active > >> FILE: memory.c LINE: 12225 FUNCTION: verify_slab_overload_page() > > > > Please drop these extra errors. > > > >> > >> Signed-off-by: xiaer1921 <xiaer1921@xxxxxxxxx> > >> --- > >> memory.c | 12 ++++++++++++ > >> 1 file changed, 12 insertions(+) > >> > >> diff --git a/memory.c b/memory.c > >> index 8448ddc..6240d4c 100644 > >> --- a/memory.c > >> +++ b/memory.c > >> @@ -680,6 +680,12 @@ vm_init(void) > >> MEMBER_OFFSET_INIT(slab_s_mem, "slab", "s_mem"); > >> MEMBER_OFFSET_INIT(slab_inuse, "slab", "inuse"); > >> MEMBER_OFFSET_INIT(slab_free, "slab", "free"); > >> + if (INVALID_MEMBER(page_s_mem)) > >> + MEMBER_OFFSET_INIT(page_s_mem, "slab", "s_mem"); > >> + if (INVALID_MEMBER(page_active)) > >> + MEMBER_OFFSET_INIT(page_active, "slab", "active"); > >> + if (INVALID_MEMBER(page_freelist)) > >> + MEMBER_OFFSET_INIT(page_freelist, "slab", "freelist"); > >> /* > >> * slab members were moved to an anonymous union in 2.6.39. > >> */ > >> @@ -691,6 +697,12 @@ vm_init(void) > >> ANON_MEMBER_OFFSET_INIT(slab_inuse, "slab", "inuse"); > >> if (INVALID_MEMBER(slab_free)) > >> ANON_MEMBER_OFFSET_INIT(slab_free, "slab", "free"); > >> + if (INVALID_MEMBER(page_s_mem)) > >> + ANON_MEMBER_OFFSET_INIT(page_s_mem, "slab", "s_mem"); > >> + if (INVALID_MEMBER(page_active)) > >> + ANON_MEMBER_OFFSET_INIT(page_active, "slab", "active"); > >> + if (INVALID_MEMBER(page_freelist)) > >> + ANON_MEMBER_OFFSET_INIT(page_freelist, "slab", "freelist"); > > > > Hmm, probably these additional ANON_MEMBER_OFFSET_INIT() were used for anonymous > > union. Looking at the current kernel source, they will not be needed. > > > > And these OFFSET(page_s_mem) and etc. are set in the block for SLAB_OVERLOAD_PAGE, > > so I think it would be more readable to do this here: > > > > diff --git a/memory.c b/memory.c > > index 8448ddc3a16c..7339f0cd0224 100644 > > --- a/memory.c > > +++ b/memory.c > > @@ -541,6 +541,15 @@ vm_init(void) > > ANON_MEMBER_OFFSET_INIT(page_s_mem, "page", "s_mem"); > > ANON_MEMBER_OFFSET_INIT(page_freelist, "page", "freelist"); > > ANON_MEMBER_OFFSET_INIT(page_active, "page", "active"); > > + /* > > + * Moved to struct slab in Linux 5.17 > > + */ > > + if (INVALID_MEMBER(page_s_mem)) > > + MEMBER_OFFSET_INIT(page_s_mem, "slab", "s_mem"); > > + if (INVALID_MEMBER(page_freelist)) > > + MEMBER_OFFSET_INIT(page_freelist, "slab", "freelist"); > > + if (INVALID_MEMBER(page_active)) > > + MEMBER_OFFSET_INIT(page_active, "slab", "active"); > > } > > > > if (!VALID_STRUCT(kmem_slab_s) && VALID_STRUCT(slab_s)) { > > > > Could you try this and update your patch if it's ok? > > > > Thanks, > > Kazu > > > >> } > >> > >> MEMBER_OFFSET_INIT(array_cache_avail, "array_cache", "avail"); > >> -- > >> 2.7.4 > >>
Attachment:
0001-Fix-for-kmem-s-S-on-Linux-5.17-with-CONFIG_SLAB.patch
Description: 0001-Fix-for-kmem-s-S-on-Linux-5.17-with-CONFIG_SLAB.patch
-- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/crash-utility Contribution Guidelines: https://github.com/crash-utility/crash/wiki