[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b67c9197-c519-4759-8813-4388428d88f3@p183>
Date: Thu, 10 Jul 2025 19:46:48 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
David Hildenbrand <david@...hat.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>, Mike Rapoport <rppt@...nel.org>,
Suren Baghdasaryan <surenb@...gle.com>,
Michal Hocko <mhocko@...e.com>
Subject: Re: [PATCH] mm: implement "memory.oops_if_bad_pte=1" boot option
On Wed, Jul 09, 2025 at 03:37:51PM -0700, Andrew Morton wrote:
> On Wed, 9 Jul 2025 21:10:59 +0300 Alexey Dobriyan <adobriyan@...il.com> wrote:
>
> > Implement
> >
> > memory.oops_if_bad_pte=1
> >
> > boot option which oopses the machine instead of dreadful
> >
> > BUG: Bad page map in process
> >
> > message.
> >
> > This is intended
> > for people who want to panic at the slightest provocation and
> > for people who ruled out hardware problems which in turn means that
> > delaying vmcore collection is counter-productive.
> >
> > Linux doesn't (never?) panicked on PTE corruption and even implemented
> > ratelimited version of the message meaning it can go for minutes and
> > even hours without anyone noticing which is exactly the opposite of what
> > should be done to facilitate debugging.
> >
> > Not enabled by default.
> >
> > Not advertised.
> >
> > @@ -490,6 +498,13 @@ static inline void add_mm_rss_vec(struct mm_struct *mm, int *rss)
> > static void print_bad_pte(struct vm_area_struct *vma, unsigned long addr,
> > pte_t pte, struct page *page)
> > {
> > + /*
> > + * This line is a formality to collect vmcore ASAP. Real bug
> > + * (hardware or software) happened earlier, current registers and
> > + * backtrace aren't interesting.
> > + */
> > + BUG_ON(oops_if_bad_pte);
> > +
>
> Oh. A pretty simple thing to do with bpf?
Unless you need to explain how to set it up on QA machines :^)
The good thing about boot options -- they are very easy to use.
> A script to tell the kernel
> "dump vmcore if you get here" would have applications in places other
> than print_bad_pte()?
Sure!
> That's what bpf_panic() was for (https://lwn.net/Articles/901284/) but
> it apparently didn't get merged for <reasons>.
Powered by blists - more mailing lists