From: linuxtestproject.agent@gmail.com
To: Stephen Bertram <sbertram@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] semctl01: fix SEM_STAT failures under parallel LTP runs
Date: Wed, 29 Jul 2026 20:20:24 +0000 [thread overview]
Message-ID: <20260729202024.11272-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260729193307.4187107-1-sbertram@redhat.com>
Hi Stephen,
On Wed, Jul 29, 2026 at 03:33:05PM -0400, Stephen Bertram wrote:
> semctl01: fix SEM_STAT failures under parallel LTP runs
> SEM_STAT was using the global high index from IPC_INFO, which is not
> stable when other IPC tests run in parallel and can abort the test with
> TBROK.
The commit message describes only the SEM_STAT index fix.
The patch also replaces the IPC_INFO check in func_iinfo() with a
completely different one (seminfo limits vs /proc/sys/kernel/sem).
That part is not required by the SEM_STAT fix: dropping the
"sem_index = hidx;" assignment is enough.
Could this be split into two patches, one fixing the SEM_STAT index
lookup and one changing what IPC_INFO verifies? Otherwise the new
IPC_INFO check needs a paragraph in the commit message explaining
why it replaces the old one.
> - if (hidx >= 0) {
> - sem_index = hidx;
> - tst_res(TPASS, "the highest index is correct");
> + int semmsl, semmns, semopm, semmni;
> +
> + /*
> + * Return value is the highest used index; SAFE_SEMCTL already
> + * rejects negatives. Limits are what IPC_INFO actually fills.
> + */
> + tst_res(TINFO, "IPC_INFO highest index %d (our index %d)",
> + hidx, sem_index);
The comment does not describe the code below it, and the remark about
negatives is moot: semctl_info() in ipc/sem.c returns
"(max_idx < 0) ? 0 : max_idx", so IPC_INFO never returns a negative
value on success.
With this hunk the IPC_INFO return value is no longer verified at all,
only printed. A check that is stable under parallel runs is still
available here: our own set is alive, so the highest used index must be
at least our index, i.e. hidx >= sem_index.
> +static int get_sem_idx_from_id(int sem_id)
> +{
The parameter shadows the file-scope "static int sem_id". Would "id"
be a better name here?
> + arg.__buf = &info;
> + /* SEM_INFO ignores semid; but SAFE_SEMCTL requires an lvalue */
> + max_idx = SAFE_SEMCTL(sem_id, 0, SEM_INFO, arg);
Both statements check out (semctl_info() ignores semid, and SAFE_SEMCTL
assigns to its semid argument), so this only reads oddly because of the
shadowing above.
> + tst_res(TINFO, "sem_id=%i maps to kernel index=%i", sem_id, sem_index);
%i instead of %d; the rest of the tree uses %d.
Verdict - Needs revision
Pre-existing issues, not introduced by this patch:
func_rmid() runs after SAFE_SEMCTL(*(tc->semid), 0, IPC_RMID, ...), and
SAFE_SEMCTL sets its semid argument to -1 when cmd is IPC_RMID. So
sem_id is already -1 there and
TST_EXP_FAIL(semop(sem_id, &sops, 1), EINVAL, ...)
really tests semop(-1, ...), which returns EINVAL whether or not the
set was removed. Saving the id before the IPC_RMID test case would make
that check meaningful.
---
Note:
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-07-29 20:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-14 16:49 [LTP] [PATCH v2] semctl: updates for multi worker testing Stephen Bertram via ltp
2026-04-14 17:15 ` [LTP] " linuxtestproject.agent
2026-07-20 22:49 ` [LTP] [PATCH v3] semctl01: tolerate SEM_STAT races under parallel LTP runs Stephen Bertram via ltp
2026-07-20 23:13 ` [LTP] " linuxtestproject.agent
2026-07-20 23:56 ` [LTP] [PATCH v4] " Stephen Bertram via ltp
2026-07-21 2:38 ` [LTP] " linuxtestproject.agent
2026-07-21 13:55 ` [LTP] [PATCH v5] " Stephen Bertram via ltp
2026-07-21 14:40 ` [LTP] " linuxtestproject.agent
2026-07-28 13:06 ` [LTP] [PATCH v5] " Andrea Cervesato via ltp
2026-07-28 16:23 ` [LTP] [PATCH v6] " Stephen Bertram via ltp
2026-07-28 17:31 ` [LTP] " linuxtestproject.agent
2026-07-28 20:33 ` [LTP] [PATCH v7] semctl01: look up SEM_STAT index for this test's sem_id Stephen Bertram via ltp
2026-07-28 21:12 ` [LTP] " linuxtestproject.agent
2026-07-29 14:53 ` [LTP] [PATCH v8] semctl01: fix SEM_STAT failures under parallel LTP runs Stephen Bertram via ltp
2026-07-29 16:26 ` [LTP] " linuxtestproject.agent
2026-07-29 17:56 ` [LTP] [PATCH v9] " Stephen Bertram via ltp
2026-07-29 18:14 ` [LTP] " linuxtestproject.agent
2026-07-29 19:33 ` [LTP] [PATCH v10] " Stephen Bertram via ltp
2026-07-29 20:20 ` linuxtestproject.agent [this message]
2026-07-29 21:00 ` [LTP] [PATCH v11] " Stephen Bertram via ltp
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=20260729202024.11272-1-linuxtestproject.agent@gmail.com \
--to=linuxtestproject.agent@gmail.com \
--cc=ltp@lists.linux.it \
--cc=sbertram@redhat.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