* makedumpfile: 4.5 kernel commit breaks page filtering
[not found] <349750156.30030224.1455814657685.JavaMail.zimbra@redhat.com>
@ 2016-02-18 17:05 ` Dave Anderson
2016-02-18 17:40 ` Laurence Oberman
2016-02-22 4:18 ` Atsushi Kumagai
0 siblings, 2 replies; 8+ messages in thread
From: Dave Anderson @ 2016-02-18 17:05 UTC (permalink / raw)
To: ats-kumagai
Cc: Joe Lawrence, Laurence Oberman, kexec,
Discussion list for crash utility usage, maintenance and development
Hello Atsushi,
I've recently had a couple 4.5-era vmcores issues reported to me as crash bugs
because they generate numerous initialization-time errors of the type:
crash: page excluded: kernel virtual address: ffff880075459000 type: "fill_task_struct"
Initially I thought it was related to this crash-7.1.4 fix that you posted:
Fix for the handling of dynamically-sized task_struct structures in
Linux 4.2 and later kernels, which contain these commits:
commit 5aaeb5c01c5b6c0be7b7aadbf3ace9f3a4458c3d
x86/fpu, sched: Introduce CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT and
use it on x86
commit 0c8c0f03e3a292e031596484275c14cf39c0ab7a
x86/fpu, sched: Dynamically allocate 'struct fpu'
Without the patch, when running on a filtered kdump dumpfile, it is
possible that error messages like this will be seen when gathering
the tasks running on a system: "crash: page excluded: kernel virtual
address: <task_struct address> type: "fill_task_struct".
(ats-kumagai@wm.jp.nec.com)
But upon further investigation of a suspect vmcore, there are many other
"page excluded" errors for several other data structure types. Joe Lawrence
of Stratus did some kernel-bisecting, and narrowed it down to this recent
4.5 commit:
commit 1c290f642101e64f379e38ea0361d097c08e824d
Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Date: Fri Jan 15 16:52:07 2016 -0800
mm: sanitize page->mapping for tail pages
We don't define meaning of page->mapping for tail pages. Currently it's
always NULL, which can be inconsistent with head page and potentially
lead to problems.
Let's poison the pointer to catch all illigal uses.
page_rmapping(), page_mapping() and page_anon_vma() are changed to look
on head page.
The only illegal use I've caught so far is __GPF_COMP pages from sound
subsystem, mapped with PTEs. do_shared_fault() is changed to use
page_rmapping() instead of direct access to fault_page->mapping.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Jérôme Glisse <jglisse@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Christoph Lameter <cl@linux.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Steve Capper <steve.capper@linaro.org>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
And related to the above, and the one that affects makedumpfile, is this one:
commit 822cdd1152265d87fcfc974e06c3b68f762987fd
Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Date: Fri Jan 15 16:52:03 2016 -0800
page-flags: look at head page if the flag is encoded in page->mapping
PageAnon() and PageKsm() look at lower bits of page->mapping to check if
the page is Anon or KSM. page->mapping can be overloaded in tail pages.
Let's always look at head page to avoid false-positives.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Christoph Lameter <cl@linux.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Steve Capper <steve.capper@linaro.org>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Jerome Marchand <jmarchan@redhat.com>
Cc: Jérôme Glisse <jglisse@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 818fa39..190f191 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -176,7 +176,7 @@ static inline int PageCompound(struct page *page)
#define PF_NO_TAIL(page, enforce) ({ \
VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page); \
compound_head(page);})
-#define PF_NO_COMPOUND(page, enforce) ({ \
+#define PF_NO_COMPOUND(page, enforce) ({ \
VM_BUG_ON_PGFLAGS(enforce && PageCompound(page), page); \
page;})
@@ -381,6 +381,7 @@ PAGEFLAG(Idle, idle, PF_ANY)
static inline int PageAnon(struct page *page)
{
+ page = compound_head(page);
return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0;
}
@@ -393,6 +394,7 @@ static inline int PageAnon(struct page *page)
*/
static inline int PageKsm(struct page *page)
{
+ page = compound_head(page);
return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) ==
(PAGE_MAPPING_ANON | PAGE_MAPPING_KSM);
}
Note that PAGE_MAPPING_ANON is now only set in the compound_head page,
so when makedumpfile walks though the pages, it will have to look
at each page's head page for the bit setting.
As it is now, makedumpfile runs amok filtering pages that still have
stuff left in page->mapping. For example, all of the addresses in
my "filtered.list" input file are those of legitimate kernel data
structures that have been incorrectly filtered because PAGE_MAPPING_ANON
(bit 1) has been left set:
crash> kmem -p < filtered.list
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffea0011b29040 46ca41000 dead0000ffffffff 0 0 3ffff800000000
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffea0011b29040 46ca41000 dead0000ffffffff 0 0 3ffff800000000
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffea0011b29640 46ca59000 dead0000ffffffff 0 0 3ffff800000000
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffea0011b29640 46ca59000 dead0000ffffffff 0 0 3ffff800000000
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffea0001d51640 75459000 dead0000ffffffff 0 0 1ffff800000000
...
In earlier kernels, the page->mapping fields above would not have
their PAGE_MAPPING_ANON set.
Dave
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: makedumpfile: 4.5 kernel commit breaks page filtering
2016-02-18 17:05 ` makedumpfile: 4.5 kernel commit breaks page filtering Dave Anderson
@ 2016-02-18 17:40 ` Laurence Oberman
2016-02-18 19:24 ` Dave Anderson
2016-02-18 22:11 ` Joe Lawrence
2016-02-22 4:18 ` Atsushi Kumagai
1 sibling, 2 replies; 8+ messages in thread
From: Laurence Oberman @ 2016-02-18 17:40 UTC (permalink / raw)
To: Dave Anderson
Cc: Joe Lawrence, ats-kumagai, kexec,
Discussion list for crash utility usage, maintenance and development
Dave, I confirmed that if I use -d17 for makedumpfile I can then capture a usable core.
I am on 4.5.0-0.rc3.git3.1
Thanks
Laurence
Laurence Oberman
Principal Software Maintenance Engineer
Red Hat Global Support Services
----- Original Message -----
From: "Dave Anderson" <anderson@redhat.com>
To: ats-kumagai@wm.jp.nec.com
Cc: kexec@lists.infradead.org, "Discussion list for crash utility usage, maintenance and development" <crash-utility@redhat.com>, "Joe Lawrence" <joe.lawrence@stratus.com>, "Laurence Oberman" <loberman@redhat.com>
Sent: Thursday, February 18, 2016 12:05:11 PM
Subject: makedumpfile: 4.5 kernel commit breaks page filtering
Hello Atsushi,
I've recently had a couple 4.5-era vmcores issues reported to me as crash bugs
because they generate numerous initialization-time errors of the type:
crash: page excluded: kernel virtual address: ffff880075459000 type: "fill_task_struct"
Initially I thought it was related to this crash-7.1.4 fix that you posted:
Fix for the handling of dynamically-sized task_struct structures in
Linux 4.2 and later kernels, which contain these commits:
commit 5aaeb5c01c5b6c0be7b7aadbf3ace9f3a4458c3d
x86/fpu, sched: Introduce CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT and
use it on x86
commit 0c8c0f03e3a292e031596484275c14cf39c0ab7a
x86/fpu, sched: Dynamically allocate 'struct fpu'
Without the patch, when running on a filtered kdump dumpfile, it is
possible that error messages like this will be seen when gathering
the tasks running on a system: "crash: page excluded: kernel virtual
address: <task_struct address> type: "fill_task_struct".
(ats-kumagai@wm.jp.nec.com)
But upon further investigation of a suspect vmcore, there are many other
"page excluded" errors for several other data structure types. Joe Lawrence
of Stratus did some kernel-bisecting, and narrowed it down to this recent
4.5 commit:
commit 1c290f642101e64f379e38ea0361d097c08e824d
Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Date: Fri Jan 15 16:52:07 2016 -0800
mm: sanitize page->mapping for tail pages
We don't define meaning of page->mapping for tail pages. Currently it's
always NULL, which can be inconsistent with head page and potentially
lead to problems.
Let's poison the pointer to catch all illigal uses.
page_rmapping(), page_mapping() and page_anon_vma() are changed to look
on head page.
The only illegal use I've caught so far is __GPF_COMP pages from sound
subsystem, mapped with PTEs. do_shared_fault() is changed to use
page_rmapping() instead of direct access to fault_page->mapping.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Jérôme Glisse <jglisse@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Christoph Lameter <cl@linux.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Steve Capper <steve.capper@linaro.org>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
And related to the above, and the one that affects makedumpfile, is this one:
commit 822cdd1152265d87fcfc974e06c3b68f762987fd
Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Date: Fri Jan 15 16:52:03 2016 -0800
page-flags: look at head page if the flag is encoded in page->mapping
PageAnon() and PageKsm() look at lower bits of page->mapping to check if
the page is Anon or KSM. page->mapping can be overloaded in tail pages.
Let's always look at head page to avoid false-positives.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Christoph Lameter <cl@linux.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Steve Capper <steve.capper@linaro.org>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Jerome Marchand <jmarchan@redhat.com>
Cc: Jérôme Glisse <jglisse@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 818fa39..190f191 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -176,7 +176,7 @@ static inline int PageCompound(struct page *page)
#define PF_NO_TAIL(page, enforce) ({ \
VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page); \
compound_head(page);})
-#define PF_NO_COMPOUND(page, enforce) ({ \
+#define PF_NO_COMPOUND(page, enforce) ({ \
VM_BUG_ON_PGFLAGS(enforce && PageCompound(page), page); \
page;})
@@ -381,6 +381,7 @@ PAGEFLAG(Idle, idle, PF_ANY)
static inline int PageAnon(struct page *page)
{
+ page = compound_head(page);
return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0;
}
@@ -393,6 +394,7 @@ static inline int PageAnon(struct page *page)
*/
static inline int PageKsm(struct page *page)
{
+ page = compound_head(page);
return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) ==
(PAGE_MAPPING_ANON | PAGE_MAPPING_KSM);
}
Note that PAGE_MAPPING_ANON is now only set in the compound_head page,
so when makedumpfile walks though the pages, it will have to look
at each page's head page for the bit setting.
As it is now, makedumpfile runs amok filtering pages that still have
stuff left in page->mapping. For example, all of the addresses in
my "filtered.list" input file are those of legitimate kernel data
structures that have been incorrectly filtered because PAGE_MAPPING_ANON
(bit 1) has been left set:
crash> kmem -p < filtered.list
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffea0011b29040 46ca41000 dead0000ffffffff 0 0 3ffff800000000
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffea0011b29040 46ca41000 dead0000ffffffff 0 0 3ffff800000000
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffea0011b29640 46ca59000 dead0000ffffffff 0 0 3ffff800000000
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffea0011b29640 46ca59000 dead0000ffffffff 0 0 3ffff800000000
PAGE PHYSICAL MAPPING INDEX CNT FLAGS
ffffea0001d51640 75459000 dead0000ffffffff 0 0 1ffff800000000
...
In earlier kernels, the page->mapping fields above would not have
their PAGE_MAPPING_ANON set.
Dave
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: makedumpfile: 4.5 kernel commit breaks page filtering
2016-02-18 17:40 ` Laurence Oberman
@ 2016-02-18 19:24 ` Dave Anderson
2016-02-18 22:11 ` Joe Lawrence
1 sibling, 0 replies; 8+ messages in thread
From: Dave Anderson @ 2016-02-18 19:24 UTC (permalink / raw)
To: Laurence Oberman
Cc: Joe Lawrence, ats-kumagai, kexec,
Discussion list for crash utility usage, maintenance and development
----- Original Message -----
> Dave, I confirmed that if I use -d17 for makedumpfile I can then capture a
> usable core.
> I am on 4.5.0-0.rc3.git3.1
> Thanks
> Laurence
>
> Laurence Oberman
> Principal Software Maintenance Engineer
> Red Hat Global Support Services
OK, good. And actually, you might be able to get away with filtering
cache-with-private and cache-without-private pages as well. Looking
further at the makedumpfile code, only user-pages check for bit 1 to
be set. The two page-cache variants look for it to be 0:
/*
* Exclude the non-private cache page.
*/
else if ((info->dump_level & DL_EXCLUDE_CACHE)
&& (isLRU(flags) || isSwapCache(flags))
&& !isPrivate(flags) && !isAnon(mapping)) {
pfn_counter = &pfn_cache;
}
/*
* Exclude the cache page whether private or non-private.
*/
else if ((info->dump_level & DL_EXCLUDE_CACHE_PRI)
&& (isLRU(flags) || isSwapCache(flags))
&& !isAnon(mapping)) {
if (isPrivate(flags))
pfn_counter = &pfn_cache_private;
else
pfn_counter = &pfn_cache;
}
/*
* Exclude the data page of the user process.
* - anonymous pages
* - hugetlbfs pages
*/
else if ((info->dump_level & DL_EXCLUDE_USER_DATA)
&& (isAnon(mapping) || isHugetlb(compound_dtor))) {
pfn_counter = &pfn_user;
}
The isAnon() function looks like this:
static inline int
isAnon(unsigned long mapping)
{
return ((unsigned long)mapping & PAGE_MAPPING_ANON) != 0;
}
Note above that only DL_EXCLUDE_USER_DATA uses isAnon(), whereas the
other two use !isAnon(). So if my logic is correct, if you try to
filter out page-cache pages as well -- i.e., with "-d23" -- worst case
it may result in some pages *not* being filtered. And I'm not even
sure of that, given the page->flags checks that go along with it.
Dave
>
> ----- Original Message -----
> From: "Dave Anderson" <anderson@redhat.com>
> To: ats-kumagai@wm.jp.nec.com
> Cc: kexec@lists.infradead.org, "Discussion list for crash utility usage,
> maintenance and development" <crash-utility@redhat.com>, "Joe Lawrence"
> <joe.lawrence@stratus.com>, "Laurence Oberman" <loberman@redhat.com>
> Sent: Thursday, February 18, 2016 12:05:11 PM
> Subject: makedumpfile: 4.5 kernel commit breaks page filtering
>
>
>
> Hello Atsushi,
>
> I've recently had a couple 4.5-era vmcores issues reported to me as crash
> bugs
> because they generate numerous initialization-time errors of the type:
>
> crash: page excluded: kernel virtual address: ffff880075459000 type:
> "fill_task_struct"
>
> Initially I thought it was related to this crash-7.1.4 fix that you posted:
>
> Fix for the handling of dynamically-sized task_struct structures in
> Linux 4.2 and later kernels, which contain these commits:
>
> commit 5aaeb5c01c5b6c0be7b7aadbf3ace9f3a4458c3d
> x86/fpu, sched: Introduce CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT and
> use it on x86
> commit 0c8c0f03e3a292e031596484275c14cf39c0ab7a
> x86/fpu, sched: Dynamically allocate 'struct fpu'
>
> Without the patch, when running on a filtered kdump dumpfile, it is
> possible that error messages like this will be seen when gathering
> the tasks running on a system: "crash: page excluded: kernel virtual
> address: <task_struct address> type: "fill_task_struct".
> (ats-kumagai@wm.jp.nec.com)
>
> But upon further investigation of a suspect vmcore, there are many other
> "page excluded" errors for several other data structure types. Joe Lawrence
> of Stratus did some kernel-bisecting, and narrowed it down to this recent
> 4.5 commit:
>
> commit 1c290f642101e64f379e38ea0361d097c08e824d
> Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Date: Fri Jan 15 16:52:07 2016 -0800
>
> mm: sanitize page->mapping for tail pages
>
> We don't define meaning of page->mapping for tail pages. Currently it's
> always NULL, which can be inconsistent with head page and potentially
> lead to problems.
>
> Let's poison the pointer to catch all illigal uses.
>
> page_rmapping(), page_mapping() and page_anon_vma() are changed to look
> on head page.
>
> The only illegal use I've caught so far is __GPF_COMP pages from sound
> subsystem, mapped with PTEs. do_shared_fault() is changed to use
> page_rmapping() instead of direct access to fault_page->mapping.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Reviewed-by: Jérôme Glisse <jglisse@redhat.com>
> Cc: Andrea Arcangeli <aarcange@redhat.com>
> Cc: Hugh Dickins <hughd@google.com>
> Cc: Dave Hansen <dave.hansen@intel.com>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Rik van Riel <riel@redhat.com>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Cc: Steve Capper <steve.capper@linaro.org>
> Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: Jerome Marchand <jmarchan@redhat.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
>
> And related to the above, and the one that affects makedumpfile, is this one:
>
> commit 822cdd1152265d87fcfc974e06c3b68f762987fd
> Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Date: Fri Jan 15 16:52:03 2016 -0800
>
> page-flags: look at head page if the flag is encoded in page->mapping
>
> PageAnon() and PageKsm() look at lower bits of page->mapping to check if
> the page is Anon or KSM. page->mapping can be overloaded in tail pages.
>
> Let's always look at head page to avoid false-positives.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Andrea Arcangeli <aarcange@redhat.com>
> Cc: Hugh Dickins <hughd@google.com>
> Cc: Dave Hansen <dave.hansen@intel.com>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Rik van Riel <riel@redhat.com>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Cc: Steve Capper <steve.capper@linaro.org>
> Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: Jerome Marchand <jmarchan@redhat.com>
> Cc: Jérôme Glisse <jglisse@redhat.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
>
> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> index 818fa39..190f191 100644
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h
> @@ -176,7 +176,7 @@ static inline int PageCompound(struct page *page)
> #define PF_NO_TAIL(page, enforce) ({ \
> VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page); \
> compound_head(page);})
> -#define PF_NO_COMPOUND(page, enforce) ({
> \
> +#define PF_NO_COMPOUND(page, enforce) ({ \
> VM_BUG_ON_PGFLAGS(enforce && PageCompound(page), page); \
> page;})
>
> @@ -381,6 +381,7 @@ PAGEFLAG(Idle, idle, PF_ANY)
>
> static inline int PageAnon(struct page *page)
> {
> + page = compound_head(page);
> return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0;
> }
>
> @@ -393,6 +394,7 @@ static inline int PageAnon(struct page *page)
> */
> static inline int PageKsm(struct page *page)
> {
> + page = compound_head(page);
> return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) ==
> (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM);
> }
>
> Note that PAGE_MAPPING_ANON is now only set in the compound_head page,
> so when makedumpfile walks though the pages, it will have to look
> at each page's head page for the bit setting.
>
> As it is now, makedumpfile runs amok filtering pages that still have
> stuff left in page->mapping. For example, all of the addresses in
> my "filtered.list" input file are those of legitimate kernel data
> structures that have been incorrectly filtered because PAGE_MAPPING_ANON
> (bit 1) has been left set:
>
> crash> kmem -p < filtered.list
> PAGE PHYSICAL MAPPING INDEX CNT FLAGS
> ffffea0011b29040 46ca41000 dead0000ffffffff 0 0 3ffff800000000
> PAGE PHYSICAL MAPPING INDEX CNT FLAGS
> ffffea0011b29040 46ca41000 dead0000ffffffff 0 0 3ffff800000000
> PAGE PHYSICAL MAPPING INDEX CNT FLAGS
> ffffea0011b29640 46ca59000 dead0000ffffffff 0 0 3ffff800000000
> PAGE PHYSICAL MAPPING INDEX CNT FLAGS
> ffffea0011b29640 46ca59000 dead0000ffffffff 0 0 3ffff800000000
> PAGE PHYSICAL MAPPING INDEX CNT FLAGS
> ffffea0001d51640 75459000 dead0000ffffffff 0 0 1ffff800000000
> ...
>
> In earlier kernels, the page->mapping fields above would not have
> their PAGE_MAPPING_ANON set.
>
> Dave
>
>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: makedumpfile: 4.5 kernel commit breaks page filtering
2016-02-18 17:40 ` Laurence Oberman
2016-02-18 19:24 ` Dave Anderson
@ 2016-02-18 22:11 ` Joe Lawrence
1 sibling, 0 replies; 8+ messages in thread
From: Joe Lawrence @ 2016-02-18 22:11 UTC (permalink / raw)
To: Laurence Oberman, Dave Anderson
Cc: ats-kumagai, kexec,
Discussion list for crash utility usage, maintenance and development
On 02/18/2016 12:40 PM, Laurence Oberman wrote:
> Dave, I confirmed that if I use -d17 for makedumpfile I can then capture a usable core.
> I am on 4.5.0-0.rc3.git3.1
> Thanks
> Laurence
FWIW I can confirm successful capture andread of vmcore on 4.5.0-rc4
when filtering with -d17.
-- Joe
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: makedumpfile: 4.5 kernel commit breaks page filtering
2016-02-18 17:05 ` makedumpfile: 4.5 kernel commit breaks page filtering Dave Anderson
2016-02-18 17:40 ` Laurence Oberman
@ 2016-02-22 4:18 ` Atsushi Kumagai
2016-02-26 0:35 ` [Crash-utility] " Atsushi Kumagai
1 sibling, 1 reply; 8+ messages in thread
From: Atsushi Kumagai @ 2016-02-22 4:18 UTC (permalink / raw)
To: Dave Anderson
Cc: Joe Lawrence, Laurence Oberman, kexec@lists.infradead.org,
Discussion list for crash utility usage, maintenance and development
Hello Dave,
>Hello Atsushi,
>
>I've recently had a couple 4.5-era vmcores issues reported to me as crash bugs
>because they generate numerous initialization-time errors of the type:
>
> crash: page excluded: kernel virtual address: ffff880075459000 type: "fill_task_struct"
>
>Initially I thought it was related to this crash-7.1.4 fix that you posted:
>
> Fix for the handling of dynamically-sized task_struct structures in
> Linux 4.2 and later kernels, which contain these commits:
>
> commit 5aaeb5c01c5b6c0be7b7aadbf3ace9f3a4458c3d
> x86/fpu, sched: Introduce CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT and
> use it on x86
> commit 0c8c0f03e3a292e031596484275c14cf39c0ab7a
> x86/fpu, sched: Dynamically allocate 'struct fpu'
>
> Without the patch, when running on a filtered kdump dumpfile, it is
> possible that error messages like this will be seen when gathering
> the tasks running on a system: "crash: page excluded: kernel virtual
> address: <task_struct address> type: "fill_task_struct".
> (ats-kumagai@wm.jp.nec.com)
>
>But upon further investigation of a suspect vmcore, there are many other
>"page excluded" errors for several other data structure types. Joe Lawrence
>of Stratus did some kernel-bisecting, and narrowed it down to this recent
>4.5 commit:
>
> commit 1c290f642101e64f379e38ea0361d097c08e824d
> Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Date: Fri Jan 15 16:52:07 2016 -0800
>
> mm: sanitize page->mapping for tail pages
>
> We don't define meaning of page->mapping for tail pages. Currently it's
> always NULL, which can be inconsistent with head page and potentially
> lead to problems.
>
> Let's poison the pointer to catch all illigal uses.
>
> page_rmapping(), page_mapping() and page_anon_vma() are changed to look
> on head page.
>
> The only illegal use I've caught so far is __GPF_COMP pages from sound
> subsystem, mapped with PTEs. do_shared_fault() is changed to use
> page_rmapping() instead of direct access to fault_page->mapping.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Reviewed-by: Jérôme Glisse <jglisse@redhat.com>
> Cc: Andrea Arcangeli <aarcange@redhat.com>
> Cc: Hugh Dickins <hughd@google.com>
> Cc: Dave Hansen <dave.hansen@intel.com>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Rik van Riel <riel@redhat.com>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Cc: Steve Capper <steve.capper@linaro.org>
> Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: Jerome Marchand <jmarchan@redhat.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
>
>And related to the above, and the one that affects makedumpfile, is this one:
>
> commit 822cdd1152265d87fcfc974e06c3b68f762987fd
> Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Date: Fri Jan 15 16:52:03 2016 -0800
>
> page-flags: look at head page if the flag is encoded in page->mapping
>
> PageAnon() and PageKsm() look at lower bits of page->mapping to check if
> the page is Anon or KSM. page->mapping can be overloaded in tail pages.
>
> Let's always look at head page to avoid false-positives.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Andrea Arcangeli <aarcange@redhat.com>
> Cc: Hugh Dickins <hughd@google.com>
> Cc: Dave Hansen <dave.hansen@intel.com>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Rik van Riel <riel@redhat.com>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Cc: Steve Capper <steve.capper@linaro.org>
> Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: Jerome Marchand <jmarchan@redhat.com>
> Cc: Jérôme Glisse <jglisse@redhat.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
>
>diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
>index 818fa39..190f191 100644
>--- a/include/linux/page-flags.h
>+++ b/include/linux/page-flags.h
>@@ -176,7 +176,7 @@ static inline int PageCompound(struct page *page)
> #define PF_NO_TAIL(page, enforce) ({ \
> VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page); \
> compound_head(page);})
>-#define PF_NO_COMPOUND(page, enforce) ({ \
>+#define PF_NO_COMPOUND(page, enforce) ({ \
> VM_BUG_ON_PGFLAGS(enforce && PageCompound(page), page); \
> page;})
>
>@@ -381,6 +381,7 @@ PAGEFLAG(Idle, idle, PF_ANY)
>
> static inline int PageAnon(struct page *page)
> {
>+ page = compound_head(page);
> return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0;
> }
>
>@@ -393,6 +394,7 @@ static inline int PageAnon(struct page *page)
> */
> static inline int PageKsm(struct page *page)
> {
>+ page = compound_head(page);
> return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) ==
> (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM);
> }
>
>Note that PAGE_MAPPING_ANON is now only set in the compound_head page,
>so when makedumpfile walks though the pages, it will have to look
>at each page's head page for the bit setting.
Thanks for your report.
As you said, it seems checking the head page like kernel does is necessary.
I'll try to work it out, please give me some time.
Thanks,
Atsushi Kumagai
>As it is now, makedumpfile runs amok filtering pages that still have
>stuff left in page->mapping. For example, all of the addresses in
>my "filtered.list" input file are those of legitimate kernel data
>structures that have been incorrectly filtered because PAGE_MAPPING_ANON
>(bit 1) has been left set:
>
>crash> kmem -p < filtered.list
> PAGE PHYSICAL MAPPING INDEX CNT FLAGS
>ffffea0011b29040 46ca41000 dead0000ffffffff 0 0 3ffff800000000
> PAGE PHYSICAL MAPPING INDEX CNT FLAGS
>ffffea0011b29040 46ca41000 dead0000ffffffff 0 0 3ffff800000000
> PAGE PHYSICAL MAPPING INDEX CNT FLAGS
>ffffea0011b29640 46ca59000 dead0000ffffffff 0 0 3ffff800000000
> PAGE PHYSICAL MAPPING INDEX CNT FLAGS
>ffffea0011b29640 46ca59000 dead0000ffffffff 0 0 3ffff800000000
> PAGE PHYSICAL MAPPING INDEX CNT FLAGS
>ffffea0001d51640 75459000 dead0000ffffffff 0 0 1ffff800000000
>...
>
>In earlier kernels, the page->mapping fields above would not have
>their PAGE_MAPPING_ANON set.
>
>Dave
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [Crash-utility] makedumpfile: 4.5 kernel commit breaks page filtering
2016-02-22 4:18 ` Atsushi Kumagai
@ 2016-02-26 0:35 ` Atsushi Kumagai
2016-02-27 14:03 ` Joe Lawrence
0 siblings, 1 reply; 8+ messages in thread
From: Atsushi Kumagai @ 2016-02-26 0:35 UTC (permalink / raw)
To: anderson@redhat.com
Cc: Joe Lawrence, kexec@lists.infradead.org, Laurence Oberman,
Discussion list for crash utility usage, maintenance and development
Hello Dave,
>>Note that PAGE_MAPPING_ANON is now only set in the compound_head page,
>>so when makedumpfile walks though the pages, it will have to look
>>at each page's head page for the bit setting.
>
>Thanks for your report.
>As you said, it seems checking the head page like kernel does is necessary.
>I'll try to work it out, please give me some time.
Reading head page's page->mapping for each tail page will take extra time,
so I contrived another way.
It's just skipping compound tail pages for filtering.
If makedumpfile excludes compound pages, it will be done at a time by
exclude_range() at the time of checking the compound head page. We don't
need to check compound tail pages individually.
I made the patch, could you test the *compound* branch below ?
This version requires a new unexported symbol, you need to specify
-x vmlinux for now.
https://sourceforge.net/p/makedumpfile/code/ci/compound/tree/
Thanks,
Atsushi Kumagai
>>As it is now, makedumpfile runs amok filtering pages that still have
>>stuff left in page->mapping. For example, all of the addresses in
>>my "filtered.list" input file are those of legitimate kernel data
>>structures that have been incorrectly filtered because PAGE_MAPPING_ANON
>>(bit 1) has been left set:
>>
>>crash> kmem -p < filtered.list
>> PAGE PHYSICAL MAPPING INDEX CNT FLAGS
>>ffffea0011b29040 46ca41000 dead0000ffffffff 0 0 3ffff800000000
>> PAGE PHYSICAL MAPPING INDEX CNT FLAGS
>>ffffea0011b29040 46ca41000 dead0000ffffffff 0 0 3ffff800000000
>> PAGE PHYSICAL MAPPING INDEX CNT FLAGS
>>ffffea0011b29640 46ca59000 dead0000ffffffff 0 0 3ffff800000000
>> PAGE PHYSICAL MAPPING INDEX CNT FLAGS
>>ffffea0011b29640 46ca59000 dead0000ffffffff 0 0 3ffff800000000
>> PAGE PHYSICAL MAPPING INDEX CNT FLAGS
>>ffffea0001d51640 75459000 dead0000ffffffff 0 0 1ffff800000000
>>...
>>
>>In earlier kernels, the page->mapping fields above would not have
>>their PAGE_MAPPING_ANON set.
>>
>>Dave
>
>--
>Crash-utility mailing list
>Crash-utility@redhat.com
>https://www.redhat.com/mailman/listinfo/crash-utility
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Crash-utility] makedumpfile: 4.5 kernel commit breaks page filtering
2016-02-26 0:35 ` [Crash-utility] " Atsushi Kumagai
@ 2016-02-27 14:03 ` Joe Lawrence
2016-02-29 5:56 ` Atsushi Kumagai
0 siblings, 1 reply; 8+ messages in thread
From: Joe Lawrence @ 2016-02-27 14:03 UTC (permalink / raw)
To: Atsushi Kumagai, anderson@redhat.com
Cc: kexec@lists.infradead.org, Laurence Oberman,
Discussion list for crash utility usage, maintenance and development
On 02/25/2016 07:35 PM, Atsushi Kumagai wrote:
> Hello Dave,
>
>>> Note that PAGE_MAPPING_ANON is now only set in the compound_head page,
>>> so when makedumpfile walks though the pages, it will have to look
>>> at each page's head page for the bit setting.
>>
>> Thanks for your report.
>> As you said, it seems checking the head page like kernel does is necessary.
>> I'll try to work it out, please give me some time.
>
> Reading head page's page->mapping for each tail page will take extra time,
> so I contrived another way.
>
> It's just skipping compound tail pages for filtering.
> If makedumpfile excludes compound pages, it will be done at a time by
> exclude_range() at the time of checking the compound head page. We don't
> need to check compound tail pages individually.
>
> I made the patch, could you test the *compound* branch below ?
> This version requires a new unexported symbol, you need to specify
> -x vmlinux for now.
>
> https://sourceforge.net/p/makedumpfile/code/ci/compound/tree/
Hi Atsushi, Dave,
Running the makedumpfile compound branch on 4.5-rc5 and this kdump.conf
setting:
core_collector makedumpfile -l --message-level 1 -d 31 -x
/kdumproot/var/crash/vmlinux
I was able to collect and successfully read a few test dumps without
incident. This was inside a VM without any interesting system load, but
was regularly giving me issues before the patch.
Regards,
-- Joe
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [Crash-utility] makedumpfile: 4.5 kernel commit breaks page filtering
2016-02-27 14:03 ` Joe Lawrence
@ 2016-02-29 5:56 ` Atsushi Kumagai
0 siblings, 0 replies; 8+ messages in thread
From: Atsushi Kumagai @ 2016-02-29 5:56 UTC (permalink / raw)
To: Joe Lawrence, anderson@redhat.com
Cc: kexec@lists.infradead.org, Laurence Oberman,
Discussion list for crash utility usage, maintenance and development
Hello Joe,
>On 02/25/2016 07:35 PM, Atsushi Kumagai wrote:
>> Hello Dave,
>>
>>>> Note that PAGE_MAPPING_ANON is now only set in the compound_head page,
>>>> so when makedumpfile walks though the pages, it will have to look
>>>> at each page's head page for the bit setting.
>>>
>>> Thanks for your report.
>>> As you said, it seems checking the head page like kernel does is necessary.
>>> I'll try to work it out, please give me some time.
>>
>> Reading head page's page->mapping for each tail page will take extra time,
>> so I contrived another way.
>>
>> It's just skipping compound tail pages for filtering.
>> If makedumpfile excludes compound pages, it will be done at a time by
>> exclude_range() at the time of checking the compound head page. We don't
>> need to check compound tail pages individually.
>>
>> I made the patch, could you test the *compound* branch below ?
>> This version requires a new unexported symbol, you need to specify
>> -x vmlinux for now.
>>
>> https://sourceforge.net/p/makedumpfile/code/ci/compound/tree/
>
>Hi Atsushi, Dave,
>
>Running the makedumpfile compound branch on 4.5-rc5 and this kdump.conf
>setting:
>
>core_collector makedumpfile -l --message-level 1 -d 31 -x
>/kdumproot/var/crash/vmlinux
>
>I was able to collect and successfully read a few test dumps without
>incident. This was inside a VM without any interesting system load, but
>was regularly giving me issues before the patch.
Great, thanks for your help.
I'll post the kernel side patch to export the necessary symbol
"OFFSET(page.compound_head)" soon.
Thanks,
Atsushi Kumagai
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-02-29 5:57 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <349750156.30030224.1455814657685.JavaMail.zimbra@redhat.com>
2016-02-18 17:05 ` makedumpfile: 4.5 kernel commit breaks page filtering Dave Anderson
2016-02-18 17:40 ` Laurence Oberman
2016-02-18 19:24 ` Dave Anderson
2016-02-18 22:11 ` Joe Lawrence
2016-02-22 4:18 ` Atsushi Kumagai
2016-02-26 0:35 ` [Crash-utility] " Atsushi Kumagai
2016-02-27 14:03 ` Joe Lawrence
2016-02-29 5:56 ` Atsushi Kumagai
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.