All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>,
	Breno Leitao <leitao@debian.org>
Cc: Miaohe Lin <linmiaohe@huawei.com>,
	Naoya Horiguchi <nao.horiguchi@gmail.com>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>, SJ Park <sj@kernel.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-riscv@lists.infradead.org, kernel-team@meta.com
Subject: Re: [PATCH v2] tools/mm: add hwpoison-panic tool
Date: Mon, 7 Sep 2026 14:42:06 +0200	[thread overview]
Message-ID: <1ecffc76-55da-4831-8f21-04c97ce90ec8@kernel.org> (raw)
In-Reply-To: <20260829193758.b251f3c89f8201bdc585a305@linux-foundation.org>

On 8/30/26 04:37, Andrew Morton wrote:
> On Mon, 03 Aug 2026 04:31:20 -0700 Breno Leitao <leitao@debian.org> wrote:
> 
>> Add a tool that enables the vm.panic_on_unrecoverable_memory_failure
>> sysctl, picks a kernel-owned PFN and writes its physical address to
>> hard_offline_page.  Three page kinds are selectable with -k: rodata
>> (default), slab or pgtable. In all cases the host should panic.
>>
>> Example:
>>
>>         # ./hwpoison-panic -k slab --yes-panic-my-kernel
>>         injecting hwpoison at phys 0x100032000 (pfn 0x100032, kind=slab)
>>         expecting kernel panic: 'Memory failure: <pfn>: unrecoverable page'
>>
>> In dmesg, you will see:
>>
>>         Memory failure: 0x100032: unhandlable page.
>>         Memory failure: 0x100032: recovery action for reserved kernel page: Ignored
>>         Kernel panic - not syncing: Memory failure: 0x100032: unrecoverable page
>>
>> This lives in tools/mm rather than selftests/mm because every successful
>> run crashes the machine, which is not something to run from CI.
> 
> I wonder if we can fix this.  Add a knob which tells the kernel not to
> panic/oops/crash/etc.  Instead it sends a message "i tried to crash but
> you told me not to" and proceeds.
> 
> Set that knob around your hwpoison-panic tool and voila, it's now a
> selftest.

We just shot down a random "kernel-owned PFN" (marking it hwpoison etc).

That's really not something you want to do from a selftest.

You'd need some kind of hwpoison simulation mode.

-- 
Cheers,

David


WARNING: multiple messages have this Message-ID (diff)
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>,
	Breno Leitao <leitao@debian.org>
Cc: Miaohe Lin <linmiaohe@huawei.com>,
	Naoya Horiguchi <nao.horiguchi@gmail.com>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>, SJ Park <sj@kernel.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-riscv@lists.infradead.org, kernel-team@meta.com
Subject: Re: [PATCH v2] tools/mm: add hwpoison-panic tool
Date: Mon, 7 Sep 2026 14:42:06 +0200	[thread overview]
Message-ID: <1ecffc76-55da-4831-8f21-04c97ce90ec8@kernel.org> (raw)
In-Reply-To: <20260829193758.b251f3c89f8201bdc585a305@linux-foundation.org>

On 8/30/26 04:37, Andrew Morton wrote:
> On Mon, 03 Aug 2026 04:31:20 -0700 Breno Leitao <leitao@debian.org> wrote:
> 
>> Add a tool that enables the vm.panic_on_unrecoverable_memory_failure
>> sysctl, picks a kernel-owned PFN and writes its physical address to
>> hard_offline_page.  Three page kinds are selectable with -k: rodata
>> (default), slab or pgtable. In all cases the host should panic.
>>
>> Example:
>>
>>         # ./hwpoison-panic -k slab --yes-panic-my-kernel
>>         injecting hwpoison at phys 0x100032000 (pfn 0x100032, kind=slab)
>>         expecting kernel panic: 'Memory failure: <pfn>: unrecoverable page'
>>
>> In dmesg, you will see:
>>
>>         Memory failure: 0x100032: unhandlable page.
>>         Memory failure: 0x100032: recovery action for reserved kernel page: Ignored
>>         Kernel panic - not syncing: Memory failure: 0x100032: unrecoverable page
>>
>> This lives in tools/mm rather than selftests/mm because every successful
>> run crashes the machine, which is not something to run from CI.
> 
> I wonder if we can fix this.  Add a knob which tells the kernel not to
> panic/oops/crash/etc.  Instead it sends a message "i tried to crash but
> you told me not to" and proceeds.
> 
> Set that knob around your hwpoison-panic tool and voila, it's now a
> selftest.

We just shot down a random "kernel-owned PFN" (marking it hwpoison etc).

That's really not something you want to do from a selftest.

You'd need some kind of hwpoison simulation mode.

-- 
Cheers,

David

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2026-09-07 12:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 11:31 [PATCH v2] tools/mm: add hwpoison-panic tool Breno Leitao
2026-08-03 11:31 ` Breno Leitao
2026-08-13  7:32 ` Miaohe Lin
2026-08-13  7:32   ` Miaohe Lin
2026-08-13 10:19   ` Breno Leitao
2026-08-13 10:19     ` Breno Leitao
2026-08-30  2:37 ` Andrew Morton
2026-08-30  2:37   ` Andrew Morton
2026-09-07 12:42   ` David Hildenbrand (Arm) [this message]
2026-09-07 12:42     ` David Hildenbrand (Arm)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1ecffc76-55da-4831-8f21-04c97ce90ec8@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=kernel-team@meta.com \
    --cc=leitao@debian.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=nao.horiguchi@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=sj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.