On Tue, Apr 14 2026, Pasha Tatashin wrote:

> Add a new test that creates 2000 LUO sessions before a kexec
> reboot and verifies their presence after the reboot. This ensures
> that the linked-block serialization mechanism works correctly for
> a large number of sessions.
>
> Signed-off-by: Pasha Tatashin <[email protected]>
> ---
> diff --git a/tools/testing/selftests/liveupdate/luo_test_utils.c 
> b/tools/testing/selftests/liveupdate/luo_test_utils.c
> index 3c8721c505df..37c330b9bb36 100644
> --- a/tools/testing/selftests/liveupdate/luo_test_utils.c
> +++ b/tools/testing/selftests/liveupdate/luo_test_utils.c
> @@ -20,6 +20,7 @@
>  #include <sys/stat.h>
>  #include <errno.h>
>  #include <stdarg.h>
> +#include <sys/resource.h>
>  
>  #include "luo_test_utils.h"
>  
> @@ -28,6 +29,30 @@ int luo_open_device(void)
>       return open(LUO_DEVICE, O_RDWR);
>  }
>  
> +void luo_ensure_nofile_limit(long min_limit)

Since you are adding this to luo_test_utils anyway, I think you should
do it in patch 3 and use it there too.

LGTM otherwise.

> +{
> +     struct rlimit hl;
> +
> +     if (getrlimit(RLIMIT_NOFILE, &hl) < 0)
> +             ksft_exit_fail_msg("getrlimit failed: %s\n", strerror(errno));
> +
> +     if (hl.rlim_cur >= min_limit)
> +             return;
> +
> +     hl.rlim_cur = min_limit;
> +     if (hl.rlim_cur > hl.rlim_max)
> +             hl.rlim_max = hl.rlim_cur;
> +
> +     if (setrlimit(RLIMIT_NOFILE, &hl) < 0) {
> +             if (errno == EPERM) {
> +                     ksft_exit_skip("Insufficient privileges to set 
> RLIMIT_NOFILE to %ld\n",
> +                                    hl.rlim_cur);
> +             }
> +             ksft_exit_fail_msg("setrlimit to %ld failed: %s\n",
> +                                hl.rlim_cur, strerror(errno));
> +     }
> +}
> +
>  int luo_create_session(int luo_fd, const char *name)
>  {
>       struct liveupdate_ioctl_create_session arg = { .size = sizeof(arg) };

-- 
Regards,
Pratyush Yadav

Reply via email to