From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E3D36C98302 for ; Tue, 22 Sep 2026 13:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vQogC0AaDJB13p395CjVa0K8IHFuyempieXINkDBjmI=; b=gzAQa34u7r5mEuoDmGSstdxwUM 4D268gTGGPKPtb5CrJAXnzDzQoFIR71tMrT13khNGtpV1VfZAtV6JIKNc5kPFTbAxOlHU5uuHoUaV RPxtecIyLPZOwCMGuDEDjahbrIKrg85fwzShIpTXfqF27vrqZFw2qjbo8uLDJmg6HuJ7ucT56wsBA vaTE62GOVnRdxiPyiSqucyhyJ155DhuADf/pKTLp2DVnHTC3AINJ4OIndTlIeWNbSLXs4yHyZY8f3 MeSjX0xMx1Wpq3VePxZJW0YVQDLz36ox7+/YtJ3fYseBD/vytYcpsoU0qwt0BZ7x5HRKbJx36miCh DxhWzcBQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x90o7-00000005aPR-0vAb; Tue, 22 Sep 2026 13:45:15 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x90o6-00000005aPC-1nqO for kexec@lists.infradead.org; Tue, 22 Sep 2026 13:45:14 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id A82EC6024D; Tue, 22 Sep 2026 13:45:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B96561F00893; Tue, 22 Sep 2026 13:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790084713; bh=vQogC0AaDJB13p395CjVa0K8IHFuyempieXINkDBjmI=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=nXn4KJ5YCt7msZuBG7rmlIi53n8XfETgu6aRe4PZFQxj1jg1WctsRsI2laIFPKxcq KFMjOH9RfXFKsqQOGPuzUbM1RgW0kn9wvT8gHMwy6Ph6yX9efU/mBk0nhmEGM1d23+ 1u7KQ5pwBezqsOs+QxAjhex7Kad0ZPmmkOhxooTgsWA5epfHfE5rHF+9hp9ODHG9eG wGF9mgKd9HvUwnBMxAUyfAtAv8S4k4QW7tED3m8IwIQnoh+QcXgam+BAV5yJSeZNCv mXg9ZdNE+JflO8CbRUQCBwti/hKJlm1tIbegXIgF56GBM8wz088RoehPQhlg9uCrFf 35pYat0LXjbHQ== Date: Tue, 22 Sep 2026 14:45:11 +0100 From: Harry Yoo To: Kiryl Shutsemau Cc: "David Hildenbrand (Arm)" , Breno Leitao , Ard Biesheuvel , Ilias Apalodimas , Miaohe Lin , Naoya Horiguchi , Andrew Morton , kexec@lists.infradead.org, Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Brendan Jackman , Johannes Weiner , Zi Yan , Oscar Salvador , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , hannes@cmpxchg.or, shakeel.butt@linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, rmikey@meta.com, riel@surriel.com, linux-cxl@vger.kernel.org, driver-core@lists.linux.dev, kernel-team@meta.com Subject: Re: [PATCH v5 7/9] drivers/base/memory: count inherited poisoned frames into the block Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kexec" Errors-To: kexec-bounces+kexec=archiver.kernel.org@lists.infradead.org On Tue, Sep 22, 2026 at 01:51:08PM +0100, Kiryl Shutsemau wrote: > On Tue, Sep 22, 2026 at 01:33:51PM +0200, David Hildenbrand (Arm) wrote: > > On 9/21/26 16:31, Breno Leitao wrote: > > > On Fri, Sep 18, 2026 at 10:16:25PM +0200, David Hildenbrand (Arm) wrote: > > >> On 9/18/26 17:22, Breno Leitao wrote: > > >>> > > >>> Right, we have two source for poisoned page information, today. > > >>> > > >>> 1) LINUX_EFI_POISONED_MEMORY: Used to track memory block that got > > >>> poisioned, and will be passed around during kexec. > > >>> 2) PG_hwpoison on struct page: Used by the memory subsystem to avoid > > >>> touching it. > > >> > > >> How are both kept in sync? See below. > > > > > > The EFI table is only written when there is a memory failure. That is > > > the only thing that writes to it: > > > > > > action_result() -> efi_hwpoison_record_pfn() -> set_bit() > > > > > > You can see it on patch "mm/memory-failure: efi: record > > > hardware-poisoned frames into the poisoned-memory table" > > > > > > Then, when the kernel kexecs into a second kernel, the EFI config table > > > is queried and the pages are poisoned from it at boot, as they are > > > getting into the buddy allocator, in __free_pages_core(). > > > > I am not sure that is really the right place. That means we only poison free > > memory. Shouldn't we poison as soon as we initialize the memmap, and check > > whether any memblock allocations ended up on that poisoned memory and bail out? > > __free_pages_core() is how we hand over pages from memblock to page allocator > initially -- from memblock_free_pages(), deferred_free_pages() and > hotplug. It is the right place to never allow them on free lists. One limitation with that is that (as David mentioned) by poisoning memory when freeing memory from memblock to the buddy, the kernel might end up allocating the bad memory from memblock during the early boot process. I don't think we have a functionality to poison memory in memblock. Hmm, will it be a problem if we just reserve area memblock....? Well, that was the case in v2! https://lore.kernel.org/all/aohldTtzE2GJ76md@thinkstation IIUC the problem there was: when the architecture does not keep memblock metadata, nothing prevents kexec from allocating memory from the reserved space. So, what should we do know? Reserve the poisoned areas in memblock AND free those reserved spaces to the buddy to pass poison information? ;-) -- Cheers, Harry / Hyeonggon