From: Petr Vorel <pvorel@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1 2/2] lib: moves test infrastructure states into a shared context structure
Date: Thu, 15 May 2025 15:16:34 +0200 [thread overview]
Message-ID: <20250515131634.GA493261@pevik> (raw)
In-Reply-To: <20250515015855.68510-3-liwang@redhat.com>
Hi Li,
> This patch introduces a new struct context to consolidate various
> runtime state variables previously maintained as global variables
> in tst_test.c. The goal is to support better state sharing between
> parent and child processes particularly in scenarios that involve
> checkpointing or fork/exec patterns.
> To achieve this, a new struct ipc_region is defined, which encapsulates
> three components: a magic field for validation, a context structure for
> runtime metadata, and a results structure for test result counters.
> Optionally, a futex array is appended for test checkpoint synchronization.
> Test library IPC region (only one page size):
> +----------------------+
> | Magic Number |
> +----------------------+
> | struct context |
> +----------------------+
> | struct results |
> +----------------------+
> | futexes[], or N/A |
> +----------------------+
> The shared memory region is allocated with a single page using mmap()
> and is zero-initialized with memset() to ensure a clean initial state.
> The patch refactors setup_ipc() and tst_reinit() to map this shared
> region and properly initialize internal pointers to the `context`,
> `results`, and `futexes` regions.
> Overall, this refactor reduces global state pollution, centralizes the
> runtime state management, and enables safe and efficient state sharing
> across test lifecycle phases. It also sets the foundation for future
> improvements such as multi-threaded test coordination or enhanced IPC
> mechanisms.
Nice work, hopefully I haven't overlooked anything.
Of course not for the release (merged after).
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2025-05-15 13:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-15 1:58 [LTP] [PATCH v1 0/2] Refactor test state handling and clarify naming in lib Li Wang via ltp
2025-05-15 1:58 ` [LTP] [PATCH v1 1/2] lib: rename tid to tcid Li Wang via ltp
2025-06-04 9:45 ` Cyril Hrubis
2025-06-05 2:28 ` Li Wang via ltp
2025-05-15 1:58 ` [LTP] [PATCH v1 2/2] lib: moves test infrastructure states into a shared context structure Li Wang via ltp
2025-05-15 13:16 ` Petr Vorel [this message]
2025-06-04 7:04 ` Li Wang via ltp
2025-06-04 11:55 ` Cyril Hrubis
2025-06-05 3:32 ` Li Wang via ltp
2025-06-05 12:40 ` Cyril Hrubis
2025-06-05 6:56 ` Petr Vorel
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=20250515131634.GA493261@pevik \
--to=pvorel@suse.cz \
--cc=liwang@redhat.com \
--cc=ltp@lists.linux.it \
/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