From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) (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 EC4EA352F86 for ; Tue, 12 May 2026 19:51:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778615498; cv=none; b=bhoOGzmpjWNxYTzbd+1KAHrRuLFa8eqWvfl6dh6sJBwoeQWmPka4n8hfS3fjaQcyUCmN1keovLkNg3qFYGs8TW26Xwq7H2xL/n7K86QfmZj8KRoGh/sN+fCkXnxRkUXas+VWPZSBjuEWmEE1cXL4AJ4nvWlAo9pn6XXLrKijUnQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778615498; c=relaxed/simple; bh=iH0F+bTWA2RPWO6eCPtu8LUvox+GQI1L7JAjMiMQ1Vg=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=anwP7dWcHIlYXM5GaUSWXrFSggycPjFiQ9+Cy6wYa9sb8xA/1GOEy3qWK4nx5d9D6znGs7UmbDihv/TfBNbvHw/J6aehhUZNaYM2ob5ULwZtFnRcXLHaMZGiGfjBQopYt6SWGo3M6dGeGFgcB1G9zZRZwpF7ULYU89XiL4KQk0A= 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=QSUcAA9+; arc=none smtp.client-ip=209.85.210.201 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="QSUcAA9+" Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-8230d6d54a5so5077897b3a.1 for ; Tue, 12 May 2026 12:51:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1778615496; x=1779220296; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=XMGmjrgacA7FJIZhwbjaKrLrnllX5lCbrSfU7CyJlss=; b=QSUcAA9+a3B5qdH+D5/Mlihguwn9O9TKGLao7Eph5Y1PqDg6BLZti+YwDYV/DdcUqk foJXGURnu1kHuAodbYWW0wECoaC3II6hkjEo4V4HR87FEscPTqgXEEDmaK3hrd8CUR3J HkCJlYcl9RIl/k5TSWQKdLEByDdNnMzvrz2MZu7mHHwQ1wotkMtn1+icC03gfxBkFjOP mrbk/S4/bJfjNDNkLymuRXeuL1NTxekNGRqsnrRntRnvmOZzgJNDvMYbT9lHFDFdh92D KqfnYHeHlpcNOokUDBgiDpwBjteX4VobxZ0gCMfK7SrR4hM2z11r7l4dNx0YrLvl7muP nK+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778615496; x=1779220296; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=XMGmjrgacA7FJIZhwbjaKrLrnllX5lCbrSfU7CyJlss=; b=D/yumVBYHe9eV0/pPyTopbeIZzNIgpucC4T3Ajxb0wAmQ+9QLOLypifkrBBMqOgNSF DUaLNiLrfJKNaulWJDh8mb28U5LVUiIKLdH0eKHpLmMyyDDG2uJWxwS+Zyt/8jhOVVAY +jrNuXKuoQoaYK9evc/7v1bQBxggii8vPF1/dn0Uvoed334c1ji4C6kdnmnGpEPPcrrw 4WQjaT9slqF4DADh340/8usvbPFUjV/ttMeW0Q+dmRFYOFkmXJKOY79hX61mvl9dXE8t O92JPrW05xzYb/0zHHIyDjLvk4ZZ3wzxhbCp5cWoTzjbG5pwnrxWZlNzrSpdCsFOnyyd GqMg== X-Forwarded-Encrypted: i=1; AFNElJ8xeXaFdgTVCopqT2CgurTXYzxpIlFyMSLEJejjgqy5kQjwxrFxe5ZWH2PY4KWcN+gGsprw0XZggdcsyI4=@vger.kernel.org X-Gm-Message-State: AOJu0Yw65592JA8v6QYeS8V9d57U9/2EdU5W66mz3QmkJYjf+JMKzZWX b2Nlji2Olr/vuICLOdxG8Pd6WVQuc8shqr6dcKV6zJdn5b5pls9Q9xvRG33BZ3dr/ZgdRf7+MWd TmWMq1Az19Pdlew== X-Received: from pfbmd2.prod.google.com ([2002:a05:6a00:7702:b0:82f:4183:2832]) (user=skhawaja job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:2d9f:b0:82f:4725:f6d0 with SMTP id d2e1a72fcca58-83ee83ed7b2mr4983816b3a.29.1778615495829; Tue, 12 May 2026 12:51:35 -0700 (PDT) Date: Tue, 12 May 2026 19:51:32 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.54.0.563.g4f69b47b94-goog Message-ID: <20260512195135.804833-1-skhawaja@google.com> Subject: [PATCH 0/3] kho: Add support for kunit mocking KHO restore API 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" To write kunit tests for preservation and restoration of liveupdate state in various subsystems without triggering the actual kexec, the KHO restore API needs to be mocked by the test writer. The mocking is done to allow testing of the individual components or functions in isolation. The patch series adds the following to support kunit testing when using the KHO API: - Add static stub hooks to mock the KHO restore API so the restore path can be tested without triggering kexec. - Add helper function that can be used by the test writer to check if memory is preserved in KHO tree. Finally, it adds a KUnit test for the KHO API that verifies the allocation of preserved memory, and the preservation/restoration of pages and folios. KHO Kunit test run: KTAP version 1 1..1 KTAP version 1 # Subtest: kho_test # module: kexec_handover_test 1..3 ok 1 kho_test_alloc_preserve ok 2 kho_test_preserve_pages ok 3 kho_test_preserve_folio # kho_test: pass:3 fail:0 skip:0 total:3 # Totals: pass:3 fail:0 skip:0 total:3 ok 1 kho_test Samiullah Khawaja (3): kho: Add kunit static stubs kho: Add helper function to check if pages are preserved kho: Add kunit test to verify preserve/restore pages and folio include/linux/kexec_handover.h | 5 + kernel/liveupdate/Kconfig | 10 ++ kernel/liveupdate/Makefile | 1 + kernel/liveupdate/kexec_handover.c | 61 ++++++++++- kernel/liveupdate/kexec_handover_test.c | 130 ++++++++++++++++++++++++ 5 files changed, 206 insertions(+), 1 deletion(-) create mode 100644 kernel/liveupdate/kexec_handover_test.c base-commit: 9974969c14031a097d6b45bcb7a06bb4aa525c40 -- 2.54.0.563.g4f69b47b94-goog