From nobody Tue Feb 10 04:12:41 2026 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.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 788002DF68 for ; Sat, 18 Oct 2025 00:07:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760746051; cv=none; b=RmhSAE/HWKuvV4APDRmOT2eGju9zOILiY61q8G3mrqtvXg1QzqJZs/o4+RrhO9o2i6wzi49gufbmeHnKRpz66yVWlepJrn8nDOnjjDHGyb2edNPhqtekqznCyDsv5691ZgzXuIaTIMEhJtlnZoEYNHyVdO/emT7z48izh9vUmqw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760746051; c=relaxed/simple; bh=J9W4VofzNPHVJcydvT+7yYMBRwGznJMzR/aHNqN3grE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ql4ckVsAj0oUVef5e8NBiU9wISLZhPDYREwDjVKLskzzyOmj22FY6j7fdxT3ovNP3dQUzmrEOPXPzikGOV5Q11nI6QIq2qBvBPiNUv1a+Q8l4WmTC8z9jriwjR00KMLpOXygI/wwJaFRj276iXuXbRRA++AZ32/h9wW0ZHkAn0Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--vipinsh.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=QEabLOPQ; arc=none smtp.client-ip=209.85.214.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--vipinsh.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="QEabLOPQ" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-290b13c5877so46627085ad.0 for ; Fri, 17 Oct 2025 17:07:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1760746049; x=1761350849; 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=zrXpTUXsPRdectGWUXdK6/cWMJ1EivPtVPHR+juuW6U=; b=QEabLOPQUwbbLyMxpVp3U0LZmIJklkAhqX6/xeKJuJPje/Eg4CBGpcc7dQVSgYK3XK 1pxRZacq3zM4Fsapzvt6F/7cCvlVUHfqdjRjphlJBymj6eX8uLBhkJmGyDTgttr34f6/ qdMGOKZpeTwrQben9U8Xi/AvX136X2ygl1i+WVRj1n/1A0XjXTw2TOGEpdvrH/TCXCgb UVqnXsDaIgrSDJgZsrZha7czFF6MirNcZzkE92T5EYt6ZZkvqSyy/l3anKg1E5u5ZoOg PF9xwe2yywCoyy4j8kyCZuT7R0CScKCcwjVNX5NVtRjOk7xrWAeVfxbxGNYuMbOlsdfj jWDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760746049; x=1761350849; 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=zrXpTUXsPRdectGWUXdK6/cWMJ1EivPtVPHR+juuW6U=; b=lPemHpfaj05EFN8KpeG8K8DVxCa3MyrjWHmLA74iB6OtItMWNnaa2n6EqVpB32ULlJ ZQxqzZ9zVSYxiIZ5z6MfGkOvkxK+FRGwWQfm51hG1XQSdjhM0Pv+ZxzMiJ4jDHNSH4in Y1oxHAQ4mxHFMo/FCfoDPIX+lqt3JZBFJ+CpxXzioGDsy2CIfAJ98L/KWNQurXq4rmYx waaZ5LprfCtevnxHPsP8G8L+5dvaFBY3sLbLusM1eo2j6K2jSdF13ldAzvsqhtchTWom an1uo6Qn5SR0jU4CH19/N+McIvaBqxkUAZKeERQP9DrAyyD6x/QDP7BylQE81gmF/XLc e8Yg== X-Forwarded-Encrypted: i=1; AJvYcCXAbccb3LC7a7JuWBHD3B7TEsgXsXS0mrCwbfKPO69hLbW/j1IzDQB/jD9WuRWdGCwlyq930MWHzeVHKeE=@vger.kernel.org X-Gm-Message-State: AOJu0YwVnSuZL2I5XyYY17Mcx3WcZgq+bcanNmu+QMtw8WdwQTiVEONt QcinYYvFuAzirGpnU9pIzv4DMdK24NdToCmLRYzYYcMyfGlS8Kdf0WPU91j3yjkfIjZmFlL3em0 oq0+unHZyWw== X-Google-Smtp-Source: AGHT+IHW64ddk30kYxy1u6aO7zkiAGN29Y3gtXXrzh6xaAbx/wQ5vxDGnCf0Gb8SvNpdO7t14/3mEhrMGD6V X-Received: from plri16.prod.google.com ([2002:a17:903:32d0:b0:268:11e:8271]) (user=vipinsh job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:ce12:b0:279:daa1:6780 with SMTP id d9443c01a7336-290cba41dd2mr64939455ad.52.1760746048654; Fri, 17 Oct 2025 17:07:28 -0700 (PDT) Date: Fri, 17 Oct 2025 17:06:55 -0700 In-Reply-To: <20251018000713.677779-1-vipinsh@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251018000713.677779-1-vipinsh@google.com> X-Mailer: git-send-email 2.51.0.858.gf9c4a03a3a-goog Message-ID: <20251018000713.677779-4-vipinsh@google.com> Subject: [RFC PATCH 03/21] selftests/liveupdate: Move do_kexec.sh script to liveupdate/lib From: Vipin Sharma To: bhelgaas@google.com, alex.williamson@redhat.com, pasha.tatashin@soleen.com, dmatlack@google.com, jgg@ziepe.ca, graf@amazon.com Cc: pratyush@kernel.org, gregkh@linuxfoundation.org, chrisl@kernel.org, rppt@kernel.org, skhawaja@google.com, parav@nvidia.com, saeedm@nvidia.com, kevin.tian@intel.com, jrhilke@google.com, david@redhat.com, jgowans@amazon.com, dwmw2@infradead.org, epetron@amazon.de, junaids@google.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, Vipin Sharma Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move do_kexec.sh to lib directory in the liveupdate selftest directory. Add code in libliveupdate.mk to copy the script to generated libliveupdate directory during the build. Script allows liveupdate library users to initiate kexec for liveupdate test flows. Signed-off-by: Vipin Sharma --- tools/testing/selftests/liveupdate/Makefile | 2 -- .../selftests/liveupdate/{ =3D> lib}/do_kexec.sh | 0 .../liveupdate/lib/include/liveupdate_util.h | 2 ++ .../testing/selftests/liveupdate/lib/libliveupdate.mk | 1 + .../selftests/liveupdate/lib/liveupdate_util.c | 11 +++++++++++ tools/testing/selftests/liveupdate/luo_multi_file.c | 2 -- tools/testing/selftests/liveupdate/luo_multi_kexec.c | 2 -- .../testing/selftests/liveupdate/luo_multi_session.c | 2 -- tools/testing/selftests/liveupdate/luo_unreclaimed.c | 1 - 9 files changed, 14 insertions(+), 9 deletions(-) rename tools/testing/selftests/liveupdate/{ =3D> lib}/do_kexec.sh (100%) diff --git a/tools/testing/selftests/liveupdate/Makefile b/tools/testing/se= lftests/liveupdate/Makefile index 79d1c525f03c..f203fd681afe 100644 --- a/tools/testing/selftests/liveupdate/Makefile +++ b/tools/testing/selftests/liveupdate/Makefile @@ -9,8 +9,6 @@ LUO_MANUAL_TESTS +=3D luo_multi_kexec LUO_MANUAL_TESTS +=3D luo_multi_session LUO_MANUAL_TESTS +=3D luo_unreclaimed =20 -TEST_FILES +=3D do_kexec.sh - LUO_MAIN_TESTS +=3D liveupdate =20 # --- Automatic Rule Generation (Do not edit below) --- diff --git a/tools/testing/selftests/liveupdate/do_kexec.sh b/tools/testing= /selftests/liveupdate/lib/do_kexec.sh similarity index 100% rename from tools/testing/selftests/liveupdate/do_kexec.sh rename to tools/testing/selftests/liveupdate/lib/do_kexec.sh diff --git a/tools/testing/selftests/liveupdate/lib/include/liveupdate_util= .h b/tools/testing/selftests/liveupdate/lib/include/liveupdate_util.h index f938ce60edb7..6ee9e124a1a4 100644 --- a/tools/testing/selftests/liveupdate/lib/include/liveupdate_util.h +++ b/tools/testing/selftests/liveupdate/lib/include/liveupdate_util.h @@ -11,10 +11,12 @@ #include =20 #define LUO_DEVICE "/dev/liveupdate" +#define KEXEC_SCRIPT "libliveupdate/do_kexec.sh" =20 int luo_open_device(void); int luo_create_session(int luo_fd, const char *name); int luo_retrieve_session(int luo_fd, const char *name); +int luo_session_preserve_fd(int session_fd, int fd, int token); =20 int luo_set_session_event(int session_fd, enum liveupdate_event event); int luo_set_global_event(int luo_fd, enum liveupdate_event event); diff --git a/tools/testing/selftests/liveupdate/lib/libliveupdate.mk b/tool= s/testing/selftests/liveupdate/lib/libliveupdate.mk index b3fc2580a7cf..ddb9b1a4363b 100644 --- a/tools/testing/selftests/liveupdate/lib/libliveupdate.mk +++ b/tools/testing/selftests/liveupdate/lib/libliveupdate.mk @@ -8,6 +8,7 @@ LIBLIVEUPDATE_O :=3D $(patsubst %.c, $(LIBLIVEUPDATE_OUTPUT= )/%.o, $(LIBLIVEUPDATE_ =20 LIBLIVEUPDATE_O_DIRS :=3D $(shell dirname $(LIBLIVEUPDATE_O) | uniq) $(shell mkdir -p $(LIBLIVEUPDATE_O_DIRS)) +$(shell cp -n $(LIBLIVEUPDATE_SRCDIR)/do_kexec.sh $(LIBLIVEUPDATE_OUTPUT)) =20 CFLAGS +=3D -I$(LIBLIVEUPDATE_SRCDIR)/include =20 diff --git a/tools/testing/selftests/liveupdate/lib/liveupdate_util.c b/too= ls/testing/selftests/liveupdate/lib/liveupdate_util.c index 1e6fd9dd8fb9..26fd6a7763a2 100644 --- a/tools/testing/selftests/liveupdate/lib/liveupdate_util.c +++ b/tools/testing/selftests/liveupdate/lib/liveupdate_util.c @@ -30,6 +30,17 @@ int luo_create_session(int luo_fd, const char *name) return arg.fd; } =20 +int luo_session_preserve_fd(int session_fd, int fd, int token) +{ + struct liveupdate_session_preserve_fd arg =3D { + .size =3D sizeof(arg), + .fd =3D fd, + .token =3D token + }; + + return ioctl(session_fd, LIVEUPDATE_SESSION_PRESERVE_FD, &arg) < 0; +} + int luo_retrieve_session(int luo_fd, const char *name) { struct liveupdate_ioctl_retrieve_session arg =3D { .size =3D sizeof(arg) = }; diff --git a/tools/testing/selftests/liveupdate/luo_multi_file.c b/tools/te= sting/selftests/liveupdate/luo_multi_file.c index ae38fe8aba4c..1a4f95046c75 100644 --- a/tools/testing/selftests/liveupdate/luo_multi_file.c +++ b/tools/testing/selftests/liveupdate/luo_multi_file.c @@ -7,8 +7,6 @@ =20 #include "luo_test_utils.h" =20 -#define KEXEC_SCRIPT "./do_kexec.sh" - #define SESSION_NAME "multi_file_session" #define TOKEN_A 101 #define TOKEN_B 102 diff --git a/tools/testing/selftests/liveupdate/luo_multi_kexec.c b/tools/t= esting/selftests/liveupdate/luo_multi_kexec.c index 1f350990ee67..5cfecbc6d269 100644 --- a/tools/testing/selftests/liveupdate/luo_multi_kexec.c +++ b/tools/testing/selftests/liveupdate/luo_multi_kexec.c @@ -7,8 +7,6 @@ =20 #include "luo_test_utils.h" =20 -#define KEXEC_SCRIPT "./do_kexec.sh" - #define NUM_SESSIONS 3 =20 /* Helper to set up one session and all its files */ diff --git a/tools/testing/selftests/liveupdate/luo_multi_session.c b/tools= /testing/selftests/liveupdate/luo_multi_session.c index 9ea96d7b997f..389d4b559cb3 100644 --- a/tools/testing/selftests/liveupdate/luo_multi_session.c +++ b/tools/testing/selftests/liveupdate/luo_multi_session.c @@ -8,8 +8,6 @@ #include "luo_test_utils.h" #include "../kselftest.h" =20 -#define KEXEC_SCRIPT "./do_kexec.sh" - #define NUM_SESSIONS 5 #define FILES_PER_SESSION 5 =20 diff --git a/tools/testing/selftests/liveupdate/luo_unreclaimed.c b/tools/t= esting/selftests/liveupdate/luo_unreclaimed.c index c3921b21b97b..b31bb354bfc3 100644 --- a/tools/testing/selftests/liveupdate/luo_unreclaimed.c +++ b/tools/testing/selftests/liveupdate/luo_unreclaimed.c @@ -8,7 +8,6 @@ #include "luo_test_utils.h" #include "../kselftest.h" =20 -#define KEXEC_SCRIPT "./do_kexec.sh" =20 #define SESSION_NAME "unreclaimed_session" #define TOKEN_A 100 --=20 2.51.0.858.gf9c4a03a3a-goog