From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B03AE15B971; Mon, 1 Jun 2026 14:17:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780323444; cv=none; b=JmpsttXewICQNKhydGCpTSwQjfcvIfNIB9YTN0OTeQo9FEoHYECKjjekD0DSjkKPXMrM0Hc52UprCB+fRS90hXlRNhEszLwsPmV4oaS5fmZep1tFlqYrhUOl0EVBz5y/+3u3dsKjI187ALhFOzzAaOqtXBryzan/yiBiddfVZoo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780323444; c=relaxed/simple; bh=GI+OhZJywkw8qVO4rIJlR/3EPVnTzp/61jTYPIDGoQU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=mAzMcSbeac8faEcGZsC0ruw+m8a4jhalFFZFZ/iwOb5EcAAZqIZudZmUiCq/ESAkjqIPgsaAJdDivUWpvXs1g7I/DlUzSGq2FyPyevZIZo6xqc+O+96BY6tgvfltQ2fB0lW4tuoZLgYggCMxyH8UKNL1pCFk2Td7DsbTwj7PpuE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bCsLsbpF; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bCsLsbpF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E34081F00893; Mon, 1 Jun 2026 14:17:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780323443; bh=2hF44QBQfUGRJ9iAPSXn6oHYpoPJZaLfD83FbTWLpNs=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=bCsLsbpFf1I2jIhql6W7+uBxnx3jEUKFN5cFzZWZo6CIsF+hI2WutwsDUEbUPviJJ oRV9Ueh2aOziXxB+xBQbTl8qQi1ygOSeQJn8sPgZBnp/q98drLJgRrzSjs2sZjUbKp dWl9vlcRbvItA9+hdOCEXt95ytfWSdkos5XeWE20pDKnlXw1iL3XPENRPNKj8d95g2 Y0z9UgPbkn92Elp9yfffpJnylqQ19mbq3+h1N9eeOxp0e8itjuXTZ0bk+knwrzEVe2 Vq7KfwOqmH1gpKR3r4zRdBtwkSC7N1g01XBW3ixKM6x/rKTI0vf6+uV3xT26yDU7C0 SXGetPm8P9v/A== From: Pratyush Yadav To: Pasha Tatashin Cc: linux-kselftest@vger.kernel.org, rppt@kernel.org, shuah@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, skhan@linuxfoundation.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, corbet@lwn.net, dmatlack@google.com, kexec@lists.infradead.org, pratyush@kernel.org, skhawaja@google.com, graf@amazon.com Subject: Re: [PATCH v4 11/13] selftests/liveupdate: Test session and file limit removal In-Reply-To: <20260530221938.115978-12-pasha.tatashin@soleen.com> (Pasha Tatashin's message of "Sat, 30 May 2026 22:19:36 +0000") References: <20260530221938.115978-1-pasha.tatashin@soleen.com> <20260530221938.115978-12-pasha.tatashin@soleen.com> Date: Mon, 01 Jun 2026 16:17:19 +0200 Message-ID: <2vxz7boifiq8.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Sat, May 30 2026, Pasha Tatashin wrote: > With the removal of static limits on the number of sessions and files per > session, the orchestrator now uses dynamic allocation. > > Add new test cases to verify that the system can handle a large number of > sessions and files. These tests ensure that the dynamic block allocation > and reuse logic for session metadata and outgoing files work correctly > beyond the previous static limits. > > Acked-by: Mike Rapoport (Microsoft) > Signed-off-by: Pasha Tatashin Reviewed-by: Pratyush Yadav (Google) > --- > .../testing/selftests/liveupdate/liveupdate.c | 75 +++++++++++++++++++ > .../selftests/liveupdate/luo_test_utils.c | 24 ++++++ > .../selftests/liveupdate/luo_test_utils.h | 2 + > 3 files changed, 101 insertions(+) > > diff --git a/tools/testing/selftests/liveupdate/liveupdate.c b/tools/testing/selftests/liveupdate/liveupdate.c > index c7d94b9181e1..502fb3567e38 100644 > --- a/tools/testing/selftests/liveupdate/liveupdate.c > +++ b/tools/testing/selftests/liveupdate/liveupdate.c > @@ -26,6 +26,7 @@ > > #include > > +#include "luo_test_utils.h" > #include "../kselftest.h" > #include "../kselftest_harness.h" > > @@ -499,4 +500,78 @@ TEST_F(liveupdate_device, get_session_name_max_length) > ASSERT_EQ(close(session_fd), 0); > } > > +/* > + * Test Case: Manage Many Sessions > + * > + * Verifies that a large number of sessions can be created and then > + * destroyed during normal system operation. This specifically tests the > + * dynamic block allocation and reuse logic for session metadata management > + * without preserving any files. > + */ > +TEST_F(liveupdate_device, preserve_many_sessions) > +{ > +#define MANY_SESSIONS 2000 > + int session_fds[MANY_SESSIONS]; > + int ret, i; > + > + self->fd1 = open(LIVEUPDATE_DEV, O_RDWR); > + if (self->fd1 < 0 && errno == ENOENT) > + SKIP(return, "%s does not exist", LIVEUPDATE_DEV); > + ASSERT_GE(self->fd1, 0); > + > + ret = luo_ensure_nofile_limit(MANY_SESSIONS); > + if (ret == -EPERM) > + SKIP(return, "Insufficient privileges to set RLIMIT_NOFILE"); > + ASSERT_EQ(ret, 0); > + > + for (i = 0; i < MANY_SESSIONS; i++) { > + char name[64]; > + > + snprintf(name, sizeof(name), "many-session-%d", i); > + session_fds[i] = create_session(self->fd1, name); > + ASSERT_GE(session_fds[i], 0); > + } > + > + for (i = 0; i < MANY_SESSIONS; i++) > + ASSERT_EQ(close(session_fds[i]), 0); > +} > + > +/* > + * Test Case: Preserve Many Files > + * > + * Verifies that a large number of files can be preserved in a single session > + * and then destroyed during normal system operation. This tests the dynamic > + * block allocation and management for outgoing files. > + */ > +TEST_F(liveupdate_device, preserve_many_files) > +{ > +#define MANY_FILES 500 > + int mem_fds[MANY_FILES]; > + int session_fd, ret, i; > + > + self->fd1 = open(LIVEUPDATE_DEV, O_RDWR); > + if (self->fd1 < 0 && errno == ENOENT) > + SKIP(return, "%s does not exist", LIVEUPDATE_DEV); > + ASSERT_GE(self->fd1, 0); > + > + session_fd = create_session(self->fd1, "many-files-test"); > + ASSERT_GE(session_fd, 0); > + > + ret = luo_ensure_nofile_limit(MANY_FILES + 10); > + if (ret == -EPERM) > + SKIP(return, "Insufficient privileges to set RLIMIT_NOFILE"); > + ASSERT_EQ(ret, 0); > + > + for (i = 0; i < MANY_FILES; i++) { > + mem_fds[i] = memfd_create("test-memfd", 0); > + ASSERT_GE(mem_fds[i], 0); > + ASSERT_EQ(preserve_fd(session_fd, mem_fds[i], i), 0); > + } > + > + for (i = 0; i < MANY_FILES; i++) > + ASSERT_EQ(close(mem_fds[i]), 0); > + > + ASSERT_EQ(close(session_fd), 0); > +} > + > TEST_HARNESS_MAIN > diff --git a/tools/testing/selftests/liveupdate/luo_test_utils.c b/tools/testing/selftests/liveupdate/luo_test_utils.c > index 3c8721c505df..333a3530051b 100644 > --- a/tools/testing/selftests/liveupdate/luo_test_utils.c > +++ b/tools/testing/selftests/liveupdate/luo_test_utils.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -28,6 +29,29 @@ int luo_open_device(void) > return open(LUO_DEVICE, O_RDWR); > } > > +int luo_ensure_nofile_limit(long min_limit) > +{ > + struct rlimit hl; > + > + /* Allow to extra files to be used by test itself */ > + min_limit += 32; > + > + if (getrlimit(RLIMIT_NOFILE, &hl) < 0) > + return -errno; > + > + if (hl.rlim_cur >= min_limit) > + return 0; > + > + hl.rlim_cur = min_limit; > + if (hl.rlim_cur > hl.rlim_max) > + hl.rlim_max = hl.rlim_cur; > + > + if (setrlimit(RLIMIT_NOFILE, &hl) < 0) > + return -errno; > + > + return 0; > +} > + > int luo_create_session(int luo_fd, const char *name) > { > struct liveupdate_ioctl_create_session arg = { .size = sizeof(arg) }; > diff --git a/tools/testing/selftests/liveupdate/luo_test_utils.h b/tools/testing/selftests/liveupdate/luo_test_utils.h > index 90099bf49577..6a0d85386613 100644 > --- a/tools/testing/selftests/liveupdate/luo_test_utils.h > +++ b/tools/testing/selftests/liveupdate/luo_test_utils.h > @@ -26,6 +26,8 @@ int luo_create_session(int luo_fd, const char *name); > int luo_retrieve_session(int luo_fd, const char *name); > int luo_session_finish(int session_fd); > > +int luo_ensure_nofile_limit(long min_limit); > + > int create_and_preserve_memfd(int session_fd, int token, const char *data); > int restore_and_verify_memfd(int session_fd, int token, const char *expected_data); -- Regards, Pratyush Yadav