From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 056E82798E5 for ; Wed, 14 Jan 2026 16:55:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768409735; cv=none; b=K+K/Nb7iDD2UI4S64buK7A1Q5xcE0dMRoW7hXDMReY4a3tkMpFzyovMuTcKIiTT+jY6x7IQfR9JlqX/JCidiHjt1GOiJIpelZtH5HW5QFhyL6NlDlYlWtt5k0ftKSiYQieGpZTKIhxRBRt2REfCOnLhQjTR98CY43ZQKFTGZfi0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768409735; c=relaxed/simple; bh=QejQhjBMM5h7AWsceCq9AC06bxVTWkjs0XH1r2FG920=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=oiwtN6J+zW9vjGI6hDnPo9i2s0jr+Tgbw0P0qFU5pJ3/gr8z+dv0LyKO9pU5RD6ioflx58aOZZThoFIxpYBTy25vXnZgL/zvZsV8IfQf057FtaHyBEGEce77m5xuqXtw17AvhoMUaCinlOFxlXJl5nhbkjX9vNUoEtVYHsKrCmQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=l9cMh3NY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="l9cMh3NY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D462FC4CEF7; Wed, 14 Jan 2026 16:55:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768409734; bh=QejQhjBMM5h7AWsceCq9AC06bxVTWkjs0XH1r2FG920=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=l9cMh3NYa7Vune+62JflcUh/D6FsoXVcIncMsmx9m1uHAvsMOsJ0VBRtSWsQFkdKm q0T25Zpz+3L4U/qdB52PuM4TlLl+mjHslNNC7rdsTvueMvj7IBx5xeELmQA887Kd5g r/q9ZVcRQ0R+CN78HxplGXk6u4WGm9V78oge/WgY1Hfj5jHls+HGsSNf2zbxjeofIU AObRipt1LcQligXXB7KD5EId1Uxf2f0HlyyrVCqRZ359G5WK9QXr8zkf8f2jsIAdp+ R1aioUFFtCTyNUDXeCUHpLv+sVv0QTbmluTuGvLNDU4qyXX2RDmwLe7uHgSjkMxJ4z rn3xvM2v3P6ag== From: Pratyush Yadav To: ranxiaokai627@163.com Cc: graf@amazon.com, rppt@kernel.org, pasha.tatashin@soleen.com, pratyush@kernel.org, akpm@linux-foundation.org, surenb@google.com, kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, ran.xiaokai@zte.com.cn Subject: Re: [PATCH v2] kho: init alloc tags when restoring pages from reserved memory In-Reply-To: <20260113033403.161869-1-ranxiaokai627@163.com> (ranxiaokai's message of "Tue, 13 Jan 2026 03:34:03 +0000") References: <20260113033403.161869-1-ranxiaokai627@163.com> Date: Wed, 14 Jan 2026 16:55:31 +0000 Message-ID: <2vxztswoi16k.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Hi Ran, On Tue, Jan 13 2026, ranxiaokai627@163.com wrote: > From: Ran Xiaokai > > Memblock pages (including reserved memory) should have their allocation > tags initialized to CODETAG_EMPTY via clear_page_tag_ref() before being > released to the page allocator. When kho restores pages through > kho_restore_page(), missing this call causes mismatched > allocation/deallocation tracking and below warning message: > alloc_tag was not set > WARNING: include/linux/alloc_tag.h:164 at ___free_pages+0xb8/0x260, CPU#1: swapper/0/1 > RIP: 0010:___free_pages+0xb8/0x260 > kho_restore_vmalloc+0x187/0x2e0 > kho_test_init+0x3c4/0xa30 > do_one_initcall+0x62/0x2b0 > kernel_init_freeable+0x25b/0x480 > kernel_init+0x1a/0x1c0 > ret_from_fork+0x2d1/0x360 > > Add missing clear_page_tag_ref() annotation in kho_restore_page() to > fix this. > > Fixes: fc33e4b44b27 ("kexec: enable KHO support for memory preservation") > Signed-off-by: Ran Xiaokai > Reviewed-by: Mike Rapoport (Microsoft) > Reviewed-by: Suren Baghdasaryan > --- > kernel/liveupdate/kexec_handover.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c > index cd6b3fb9dcae..2d47f2c50bd8 100644 > --- a/kernel/liveupdate/kexec_handover.c > +++ b/kernel/liveupdate/kexec_handover.c > @@ -268,6 +268,7 @@ static struct page *kho_restore_page(phys_addr_t phys, bool is_folio) > else > kho_init_pages(page, nr_pages); > > + clear_page_tag_ref(page); You are only clearing the tag for the head page. The tail pages are still un-initialized. Is that intentional? What about non-compound pages (the ones you get from kho_restore_pages(), aka when is_folio is false)? Do we need to clear the tag on all pages in that case? > adjust_managed_page_count(page, nr_pages); > return page; > }