From: Samiullah Khawaja <skhawaja@google.com>
To: Pasha Tatashin <pasha.tatashin@soleen.com>,
Mike Rapoport <rppt@kernel.org>,
Pratyush Yadav <pratyush@kernel.org>,
Alexander Graf <graf@amazon.com>
Cc: Samiullah Khawaja <skhawaja@google.com>,
David Matlack <dmatlack@google.com>,
tarunsahu@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: [RFC PATCH 5/6] selftests/liveupdate: Add API to preserve a batch of FDs
Date: Thu, 1 Oct 2026 00:57:33 +0000 [thread overview]
Message-ID: <20261001005734.1033516-6-skhawaja@google.com> (raw)
In-Reply-To: <20261001005734.1033516-1-skhawaja@google.com>
Add luo_session_preserve_fds() that can be used to preserve a batch of
FDs using the LIVEUPDATE_SESSION_PRESERVE_FDS ioctl.
Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
---
.../liveupdate/lib/include/libliveupdate.h | 2 ++
.../selftests/liveupdate/lib/lu_utils.c | 20 +++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/tools/testing/selftests/liveupdate/lib/include/libliveupdate.h b/tools/testing/selftests/liveupdate/lib/include/libliveupdate.h
index fa07fed08364..9aaf6f28ef56 100644
--- a/tools/testing/selftests/liveupdate/lib/include/libliveupdate.h
+++ b/tools/testing/selftests/liveupdate/lib/include/libliveupdate.h
@@ -29,6 +29,8 @@ int luo_get_session_name(int session_fd, char *name, size_t name_len);
int luo_ensure_nofile_limit(long min_limit);
int luo_session_preserve_fd(int session_fd, int fd, __u64 token);
+int luo_session_preserve_fds(int session_fd, const int *fds,
+ const __u64 *tokens, __u32 nr, __u32 *failed_idx);
int luo_session_retrieve_fd(int session_fd, __u64 token);
int create_and_preserve_memfd(int session_fd, int token, const char *data);
diff --git a/tools/testing/selftests/liveupdate/lib/lu_utils.c b/tools/testing/selftests/liveupdate/lib/lu_utils.c
index 74d41115c281..1290f27ff004 100644
--- a/tools/testing/selftests/liveupdate/lib/lu_utils.c
+++ b/tools/testing/selftests/liveupdate/lib/lu_utils.c
@@ -93,6 +93,26 @@ int luo_session_preserve_fd(int session_fd, int fd, __u64 token)
return 0;
}
+int luo_session_preserve_fds(int session_fd, const int *fds,
+ const __u64 *tokens, __u32 nr, __u32 *failed_idx)
+{
+ struct liveupdate_session_preserve_fds arg = {
+ .size = sizeof(arg),
+ .nr = nr,
+ .fds = (__u64)(uintptr_t)fds,
+ .tokens = (__u64)(uintptr_t)tokens,
+ };
+ int ret = 0;
+
+ if (ioctl(session_fd, LIVEUPDATE_SESSION_PRESERVE_FDS, &arg))
+ ret = -errno;
+
+ if (failed_idx)
+ *failed_idx = arg.out_failed_index;
+
+ return ret;
+}
+
int luo_session_retrieve_fd(int session_fd, __u64 token)
{
struct liveupdate_session_retrieve_fd arg = {
--
2.56.0.rc1.315.gc6ed9934b7-goog
next prev parent reply other threads:[~2026-10-01 0:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 0:57 [RFC PATCH 0/6] Introduce file handler dependency level Samiullah Khawaja
2026-10-01 0:57 ` [RFC PATCH 1/6] liveupdate: " Samiullah Khawaja
2026-10-01 0:57 ` [RFC PATCH 2/6] mm/memfd_luo: Set Liveupdate level of a memfd file handler Samiullah Khawaja
2026-10-01 0:57 ` [RFC PATCH 3/6] iommufd: Set liveupdate file handler level Samiullah Khawaja
2026-10-01 0:57 ` [RFC PATCH 4/6] vfio/pci: Set live update " Samiullah Khawaja
2026-10-01 0:57 ` Samiullah Khawaja [this message]
2026-10-01 0:57 ` [RFC PATCH 6/6] iommufd/selftests: Preserve all the FDs in a batch Samiullah Khawaja
2026-10-04 17:21 ` [RFC PATCH 0/6] Introduce file handler dependency level Pratyush Yadav
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=20261001005734.1033516-6-skhawaja@google.com \
--to=skhawaja@google.com \
--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=rppt@kernel.org \
--cc=tarunsahu@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
all inboxes | Powered by JetHome®