Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DCA82222D0 for ; Thu, 21 May 2026 19:32:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779391925; cv=none; b=toMU5N3aWJXRlfyi5ONrszKYrKlzDWn83QNoQVZa42rPE3Fucra4T4vsp6aLgekCRapPeJcO8nmHSwVCWXVNSQ43M3cO+796wO2YGH7rljnvdp4unRmGoqGKWNR1/XcFVtQff1QvjUxaDSqRJYQhmhBlJwseKR+33ks5/vI46w8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779391925; c=relaxed/simple; bh=18FiwIHEflHKv8xizMheRh9LgmM2NAO59go2uYWDZXQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=HHXG5JMdPUR9P8XFXZEy0zpLkQrlCmYHSs7IKk7Z13bGqSAZfTmlFig/bPbw0Sk+7Am6d/uVQLF4Pc2tyyggKWKZLNOKR62KfTwpJAClJirXUy/8Z9jsj9dLlB3L/YBF8KmD/oD4mHr/6xQrcSGo4aCsDllLo90xp8D4TlKik+k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--skhawaja.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=DijOWb5V; arc=none smtp.client-ip=209.85.215.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--skhawaja.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="DijOWb5V" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-c828cee4fcdso3216931a12.3 for ; Thu, 21 May 2026 12:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1779391924; x=1779996724; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Skwk48BYilyHQDMbYjOBqYYKx+CCGojb2mWZPJknBhk=; b=DijOWb5VRPlx/hlcK/BGGuOm1LqTnS1+bWvJYz+mJbRGtvPYZGSA33gW7quMVqCRpM kPqKhXxAiO+HgFxyZwVZwUX8ojoiHK+ga8mruknipvN9pw4lqi6hmQNugKWFCwqqJcEs yL7WmAdCO1E/zskD1JVlQrg1YCDw0l+O8k7eFYTUhGIuv/pUbWvaSifFcAQIFjv1Gze9 p25PHEF7y8TaA3kU9lSjersjQs570KbCYGWXW/0yMo7oH93GVS7mozFFC3PVDj2IgBRq 3Fw9rkZmzsfi+tCNVx47u0lzI2diyJZZghX2JnXiVEdwmU4Ou/YEKlIlZpL14DdZJg6v VKHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779391924; x=1779996724; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Skwk48BYilyHQDMbYjOBqYYKx+CCGojb2mWZPJknBhk=; b=YQCIYmLqwxVNUUiwTO0CeoKyvLuk9qWLXeqUCE436U16KLPttf1lSZG3PI+PpyVK6F jIDPd5v3Rc140VCgUxbAz1rbg4yWG5F+MbOATv+PliCRxrM5eWqg7p4E6s2EoQagnwg8 XAAL2A/Zqv9G7ZkqCkNA4um8RsKyscDLJyhlvR5sXG7UFsxeVhSTrbp2JLxaTQaay94l 3TUsrP6jYTyY8TU+N+6aybNkNgpvCw5DO+/sE+AoUqiWnIjQAkt4UI9ykT4quMpQCRHx sEVPzJV6TDo6BpoBJse/u2DFW3NYnFPBmI7Wz35XnjuOFR1GzOep1dDFMXlYIz/GWMX3 jNoQ== X-Forwarded-Encrypted: i=1; AFNElJ/HkyA4V9DugVNgmeqVxoYF7QqtpS5KmaQWkNNKlQk2zG6sDf1VqpH0oG14SGuWbGtZZNhEsNA9XKeq0EU=@vger.kernel.org X-Gm-Message-State: AOJu0Yyd2Qlm23G2vmfXMuOYd1rq71ftpm6sPvN2QGOjaW1N0kTfNpNp gtEURYa7Ep7sR+tW3ZU33aLhy4AjdGL+qTl4Wt4u9nMBf2kwdL0TIicV2viIBuX/OzfYJFgTLWh CKnb78l2neG7bbg== X-Received: from pggk2.prod.google.com ([2002:a63:d102:0:b0:c74:664d:4080]) (user=skhawaja job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:32a0:b0:39b:a997:9e40 with SMTP id adf61e73a8af0-3b328eeeac0mr350862637.46.1779391923585; Thu, 21 May 2026 12:32:03 -0700 (PDT) Date: Thu, 21 May 2026 19:32:00 +0000 In-Reply-To: <20260521193202.746810-1-skhawaja@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260521193202.746810-1-skhawaja@google.com> X-Mailer: git-send-email 2.54.0.746.g67dd491aae-goog Message-ID: <20260521193202.746810-2-skhawaja@google.com> Subject: [PATCH v2 1/3] kho: Add kunit static stubs From: Samiullah Khawaja To: Pasha Tatashin , Mike Rapoport , Pratyush Yadav , Alexander Graf Cc: Samiullah Khawaja , David Matlack , open list , "open list:KEXEC HANDOVER (KHO)" , "open list:KEXEC HANDOVER (KHO)" Content-Type: text/plain; charset="UTF-8" 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 --- kernel/liveupdate/kexec_handover.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c index 11855e275397..902019f36c24 100644 --- a/kernel/liveupdate/kexec_handover.c +++ b/kernel/liveupdate/kexec_handover.c @@ -10,6 +10,8 @@ #define pr_fmt(fmt) "KHO: " fmt +#include + #include #include #include @@ -423,7 +425,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; } @@ -445,6 +451,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.746.g67dd491aae-goog