From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.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 960FB355F54 for ; Tue, 12 May 2026 19:51:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778615498; cv=none; b=UTbuy7BB1CHZmhrKCej1VNPSY6vFV4eYF4Xe9BqrZgnbzmH/atJniJc38zVO/XKsVnU/rHW7Ta93J2Qco78S9zTCO/3x2cvW8h2xnjnMDUQDeA6teneGFpFrw4V4Vgq/i/jvNQF5Ak7EFw8Pus1o57A5ifwOrVfzCXtW/jIT2a0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778615498; c=relaxed/simple; bh=ZP06RG78JDKI245J2bZG+Ch9/EULhQE/vhcg5S/jhLk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Mxj1pCWxj2k21upWft9IgX08xvLpw7V9Zqt52++jWfrozWPxNestwDiMaYLk9yOuI3j/kvsFek0N/I4kcajDTvlOTSrxwqQvsaYRGyW44ad6MSvERf/PcZQPqTUfahuA5Ax7EQjWoIXqCUyH7UjenXinshraQvIM1m+MCk7iJGs= 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=gkKaUtYm; arc=none smtp.client-ip=209.85.214.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="gkKaUtYm" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2bc7f9b2213so27709335ad.0 for ; Tue, 12 May 2026 12:51:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1778615497; x=1779220297; 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=Ljg+98L2Wc2yizBAt6Gvu0fP3XnfuPS9FfSkO2m0vXM=; b=gkKaUtYmD7hDvLjbUlqueLSyv5TjHlxPGEoCO4lqnSKaEE0ShRBAoFgWG960o+03jw 5bgs/lSeu2kmxuv+CtcXhZTqBmDC1MognYGXbFwswV4QJEaj+c9LOmk9kT2jsh6ygVvy gjgV9GSN5AiPhcMXzjSeZj7uSMafVIxhy4bZbisnQvB1LTQuDWneKXM1FifBRLonSjKc 2auqzptcbRFjlIljhmpt2iOSooJT55vHmQw5lsB1M4dr1jADnO9OTpgN3I0HVWMtGXm/ dShZo5XqBYinQWQ30mCyHNcTFXtgzZeCHMtp1GnzOn9abKKHfKR8XubUWfUTuoCAI2// ypQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778615497; x=1779220297; 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=Ljg+98L2Wc2yizBAt6Gvu0fP3XnfuPS9FfSkO2m0vXM=; b=Fz9rrZwmtoWxf2y/bDaaOVk1BSULsb5BxUhchAC8gi4mV/o7keOjYWgTrcEWV/MaR0 iLpLcJ9g3SfbgzDuYIl2ncKSSCxJLfKzVNsU4jcZQlkAd/lMtfHcg8VX4RtdZjUPHMIa L3Eqh8D5O+Lrn8HuSBeyOTH2p6uHtDpxDrATC8fY/++jvnAVLRNDADxf0Hatu16Y1w1I hd5+rLOj65RJyRlTyboLFJ+bKjxEmx5V9Kke078d2UYS6LnsIH8eSpa44v65pk6Zw7k4 oM2BGcpx8JWo44DOarUUIciLJOjaPfXd1V1ppH4cRf5ncn5ed9CBofs6RR9wupoVgfYD YWZw== X-Forwarded-Encrypted: i=1; AFNElJ8K3dmLFwtFqcNEX5z6OJNfjWF1YicAI2ZZy7oxcJXWkkXcyi0VU4nhzg/GtTH8Tuhv/s8EAKCES1l48/s=@vger.kernel.org X-Gm-Message-State: AOJu0YyZYmtyD97NKp1+A2TqyFX3Jt1sScN4DriD/uknb7dkcMkk1gIp ysMA/oCc/7PWNwF8cEkoQ6zGGxeUO+npgnuu4HfSionM4gjiiggM+V/Ki2hwsBuBNEuwOcqBNRg Wj/N98VkYGFfuXQ== X-Received: from play21.prod.google.com ([2002:a17:902:e195:b0:2bd:15bf:f9c7]) (user=skhawaja job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:1b45:b0:2b0:a957:304 with SMTP id d9443c01a7336-2bd270fb799mr4241965ad.6.1778615496629; Tue, 12 May 2026 12:51:36 -0700 (PDT) Date: Tue, 12 May 2026 19:51:33 +0000 In-Reply-To: <20260512195135.804833-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: <20260512195135.804833-1-skhawaja@google.com> X-Mailer: git-send-email 2.54.0.563.g4f69b47b94-goog Message-ID: <20260512195135.804833-2-skhawaja@google.com> Subject: [PATCH 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 | 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 +#include #include #include #include @@ -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