From: Philippe Gerum <rpm@xenomai.org>
To: Hannes Diethelm <hannes.diethelm@gmail.com>
Cc: xenomai@lists.linux.dev
Subject: Re: [PATCH] test: hectic: sem_post task_init on failure
Date: Mon, 13 Jul 2026 08:55:23 +0200 [thread overview]
Message-ID: <871pd7750k.fsf@xenomai.org> (raw)
In-Reply-To: <20260712200749.9210-1-hannes.diethelm@gmail.com> (Hannes Diethelm's message of "Sun, 12 Jul 2026 22:07:49 +0200")
Hannes Diethelm <hannes.diethelm@gmail.com> writes:
> This fixes the issue where hectic doesn't exit on init failure when
> there are for example not enough resources due to to many available
> CPU's.
>
> Signed-off-by: Hannes Diethelm <hannes.diethelm@gmail.com>
> ---
> tests/hectic.c | 32 ++++++++++++++++++++++----------
> 1 file changed, 22 insertions(+), 10 deletions(-)
>
> diff --git a/tests/hectic.c b/tests/hectic.c
> index af8f988..b07e074 100644
> --- a/tests/hectic.c
> +++ b/tests/hectic.c
> @@ -270,6 +270,7 @@ static void *sleeper_switcher(void *cookie)
> CPU_SET(param->cpu->index, &cpu_set);
> if (sched_setaffinity(0, sizeof(cpu_set), &cpu_set)) {
> perror("sleeper: sched_setaffinity");
> + sem_post(&task_init);
> clean_exit(EXIT_FAILURE);
> }
>
> @@ -379,6 +380,7 @@ static void *fpu_stress(void *cookie)
> CPU_SET(param->cpu->index, &cpu_set);
> if (sched_setaffinity(0, sizeof(cpu_set), &cpu_set)) {
> perror("sleeper: sched_setaffinity");
> + sem_post(&task_init);
> clean_exit(EXIT_FAILURE);
> }
>
> @@ -399,19 +401,14 @@ static void *fpu_stress(void *cookie)
> return NULL;
> }
>
> -static void attach_thread(struct task_params *param)
> +static int attach_thread(struct task_params *param)
> {
> char buffer[64];
> - int efd;
>
> task_name(buffer, sizeof(buffer), param->cpu,param->swt.index);
>
> /* Make it a public thread only for demo purpose. */
> - efd = evl_attach_self("/%s:%d", buffer, getpid());
> - if (efd < 0) {
> - perror("evl_attach()");
> - clean_exit(EXIT_FAILURE);
> - }
> + return evl_attach_self("/%s:%d", buffer, getpid());
> }
>
> static void *rtup(void *cookie)
> @@ -423,12 +420,17 @@ static void *rtup(void *cookie)
> cpu_set_t cpu_set;
> unsigned i = 0;
>
> - attach_thread(param);
> + if (attach_thread(param) < 0) {
> + perror("evl_attach()");
> + sem_post(&task_init);
> + clean_exit(EXIT_FAILURE);
> + }
>
> CPU_ZERO(&cpu_set);
> CPU_SET(param->cpu->index, &cpu_set);
> if (sched_setaffinity(0, sizeof(cpu_set), &cpu_set)) {
> perror("rtup: sched_setaffinity");
> + sem_post(&task_init);
> clean_exit(EXIT_FAILURE);
> }
>
> @@ -503,12 +505,17 @@ static void *rtus(void *cookie)
> cpu_set_t cpu_set;
> unsigned i = 0;
>
> - attach_thread(param);
> + if (attach_thread(param) < 0) {
> + perror("evl_attach()");
> + sem_post(&task_init);
> + clean_exit(EXIT_FAILURE);
> + }
>
> CPU_ZERO(&cpu_set);
> CPU_SET(param->cpu->index, &cpu_set);
> if (sched_setaffinity(0, sizeof(cpu_set), &cpu_set)) {
> perror("rtus: sched_setaffinity");
> + sem_post(&task_init);
> clean_exit(EXIT_FAILURE);
> }
>
> @@ -600,12 +607,17 @@ static void *rtuo(void *cookie)
> cpu_set_t cpu_set;
> unsigned i = 0;
>
> - attach_thread(param);
> + if (attach_thread(param) < 0) {
> + perror("evl_attach()");
> + sem_post(&task_init);
> + clean_exit(EXIT_FAILURE);
> + }
>
> CPU_ZERO(&cpu_set);
> CPU_SET(param->cpu->index, &cpu_set);
> if (sched_setaffinity(0, sizeof(cpu_set), &cpu_set)) {
> perror("rtuo: sched_setaffinity");
> + sem_post(&task_init);
> clean_exit(EXIT_FAILURE);
> }
Merged, thanks.
--
Philippe.
next prev parent reply other threads:[~2026-07-13 6:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 11:43 EVL: hectic test fails when to many CPUs are available Hannes Diethelm
2026-07-07 13:34 ` Philippe Gerum
2026-07-12 20:07 ` [PATCH] test: hectic: sem_post task_init on failure Hannes Diethelm
2026-07-13 6:55 ` Philippe Gerum [this message]
2026-07-12 20:17 ` EVL: hectic test fails when to many CPUs are available Hannes Diethelm
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=871pd7750k.fsf@xenomai.org \
--to=rpm@xenomai.org \
--cc=hannes.diethelm@gmail.com \
--cc=xenomai@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.