From: Mike Rapoport <rppt@kernel.org>
To: Samiullah Khawaja <skhawaja@google.com>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>,
Pratyush Yadav <pratyush@kernel.org>,
Alexander Graf <graf@amazon.com>,
David Matlack <dmatlack@google.com>,
open list <linux-kernel@vger.kernel.org>,
"open list:KEXEC HANDOVER (KHO)" <kexec@lists.infradead.org>,
"open list:KEXEC HANDOVER (KHO)" <linux-mm@kvack.org>
Subject: Re: [PATCH 1/3] kho: Add kunit static stubs
Date: Sat, 16 May 2026 10:39:43 +0300 [thread overview]
Message-ID: <aggfP-0A-i-bYlP7@kernel.org> (raw)
In-Reply-To: <20260512195135.804833-2-skhawaja@google.com>
Hi Sami,
On Tue, May 12, 2026 at 07:51:33PM +0000, Samiullah Khawaja wrote:
> Add kunit stubs in kho_restore_folio() and kho_restore_pages() so the
> users can mock these functions in kunit tests.
>
> Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
> ---
> kernel/liveupdate/kexec_handover.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
> index d5718bef6d4d..1375291d9b07 100644
> --- a/kernel/liveupdate/kexec_handover.c
> +++ b/kernel/liveupdate/kexec_handover.c
> @@ -11,6 +11,7 @@
> #define pr_fmt(fmt) "KHO: " fmt
>
> #include <linux/cleanup.h>
> +#include <kunit/static_stub.h>
Can we include kunit headers before linux headers?
> #include <linux/cma.h>
> #include <linux/kmemleak.h>
> #include <linux/count_zeros.h>
> @@ -437,7 +438,11 @@ static struct page *kho_restore_page(phys_addr_t phys, bool is_folio)
> */
> struct folio *kho_restore_folio(phys_addr_t phys)
> {
> - struct page *page = kho_restore_page(phys, true);
> + struct page *page;
> +
> + KUNIT_STATIC_STUB_REDIRECT(kho_restore_folio, phys);
> +
> + page = kho_restore_page(phys, true);
>
> return page ? page_folio(page) : NULL;
> }
> @@ -459,6 +464,8 @@ struct page *kho_restore_pages(phys_addr_t phys, unsigned long nr_pages)
> const unsigned long end_pfn = start_pfn + nr_pages;
> unsigned long pfn = start_pfn;
>
> + KUNIT_STATIC_STUB_REDIRECT(kho_restore_pages, phys, nr_pages);
> +
> while (pfn < end_pfn) {
> const unsigned int order =
> min(count_trailing_zeros(pfn), ilog2(end_pfn - pfn));
> --
> 2.54.0.563.g4f69b47b94-goog
>
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2026-05-16 7:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 19:51 [PATCH 0/3] kho: Add support for kunit mocking KHO restore API Samiullah Khawaja
2026-05-12 19:51 ` [PATCH 1/3] kho: Add kunit static stubs Samiullah Khawaja
2026-05-16 7:39 ` Mike Rapoport [this message]
2026-05-12 19:51 ` [PATCH 2/3] kho: Add helper function to check if pages are preserved Samiullah Khawaja
2026-05-12 19:51 ` [PATCH 3/3] kho: Add kunit test to verify preserve/restore pages and folio Samiullah Khawaja
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=aggfP-0A-i-bYlP7@kernel.org \
--to=rppt@kernel.org \
--cc=dmatlack@google.com \
--cc=graf@amazon.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pasha.tatashin@soleen.com \
--cc=pratyush@kernel.org \
--cc=skhawaja@google.com \
/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