The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Kiryl Shutsemau <kas@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	 David Hildenbrand <david@kernel.org>,
	Lorenzo Stoakes <ljs@kernel.org>,
	 "Liam R. Howlett" <liam@infradead.org>,
	Vlastimil Babka <vbabka@kernel.org>,
	 Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	 Michal Hocko <mhocko@suse.com>,
	Baoquan He <baoquan.he@linux.dev>,
	 Pasha Tatashin <pasha.tatashin@soleen.com>,
	Pratyush Yadav <pratyush@kernel.org>,
	 Miaohe Lin <linmiaohe@huawei.com>,
	Naoya Horiguchi <nao.horiguchi@gmail.com>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org,
	kexec@lists.infradead.org, rmikey@meta.com, riel@surriel.com,
	 kernel-team@meta.com
Subject: Re: [PATCH v4] kexec: keep the next kernel off hardware-poisoned pages
Date: Mon, 10 Aug 2026 05:19:14 -0700	[thread overview]
Message-ID: <annBaxudb5hcpSuU@gmail.com> (raw)
In-Reply-To: <anmb9FHMEMygENiO@thinkstation>

On Mon, Aug 10, 2026 at 10:49:16AM +0100, Kiryl Shutsemau wrote:
> On Fri, Aug 07, 2026 at 07:05:09AM -0700, Breno Leitao wrote:
> > diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
> > index dc770b9a6d053..e097e980b1439 100644
> > --- a/kernel/kexec_core.c
> > +++ b/kernel/kexec_core.c
> > @@ -212,6 +212,16 @@ int sanity_check_segment_list(struct kimage *image)
> >  	}
> >  #endif
> >  
> > +	/*
> > +	 * Reject destinations that land on hardware-poisoned memory: the
> > +	 * relocation copy would machine-check on the bad frame.
> > +	 */
> > +	for (i = 0; i < nr_segments; i++) {
> > +		if (range_first_hwpoison(image->segment[i].mem,
> > +					 image->segment[i].memsz) != PHYS_ADDR_MAX)
> > +			return -EADDRNOTAVAIL;
> 
> Other -EADDRNOTAVAIL usage indicate error on user side. But this is not
> a user fault. Maybe -EHWPOISON instead.

Ack!

> > +		if (!PageHWPoison(page))
> > +			/* page is good, let's go to the next one */
> > +			continue;
> 
> If you don't care about re-using clean part of poisoned hugetlb folio,
> use is_page_hwpoison(page).
> 
> This would do:
> 
> 		if (!page || !is_page_hwpoison(page))
> 			continue;
> 
> You would spin a bit on the same folio, but shouldn't be a big deal.

right, it will spin a bit more when there is a poisoned page in the
hugetlbfs folio, but it keep the code simpler, which might be a good
trade-off.

Let me update it and respin,
--breno

      reply	other threads:[~2026-08-10 12:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 14:05 [PATCH v4] kexec: keep the next kernel off hardware-poisoned pages Breno Leitao
2026-08-10  9:49 ` Kiryl Shutsemau
2026-08-10 12:19   ` Breno Leitao [this message]

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=annBaxudb5hcpSuU@gmail.com \
    --to=leitao@debian.org \
    --cc=akpm@linux-foundation.org \
    --cc=baoquan.he@linux.dev \
    --cc=david@kernel.org \
    --cc=kas@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kexec@lists.infradead.org \
    --cc=liam@infradead.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=nao.horiguchi@gmail.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=pratyush@kernel.org \
    --cc=riel@surriel.com \
    --cc=rmikey@meta.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox