All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-rt-users@vger.kernel.org
Cc: John Kacur <jkacur@redhat.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH 3/5] cyclictest: Make break_thread_id_lock a PI lock
Date: Wed, 26 Aug 2026 15:21:50 +0200	[thread overview]
Message-ID: <20260826132153.2476006-4-bigeasy@linutronix.de> (raw)
In-Reply-To: <20260826132153.2476006-1-bigeasy@linutronix.de>

break_thread_id_lock is acquired at the end once the application is
about to terminate and the lock ensures that only the first thread
writes/ updates the termination reason.

Given its usage there is no requirement to have it as PI lock but having
it as PI will keep the RV-monitor quiet so let's do it.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 src/cyclictest/cyclictest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 29ddf2d98bbe1..257b6f1b70cf6 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -200,7 +200,7 @@ static int smi = 0;
 static pthread_cond_t refresh_on_max_cond = PTHREAD_COND_INITIALIZER;
 static pthread_mutex_t refresh_on_max_lock;
 
-static pthread_mutex_t break_thread_id_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t break_thread_id_lock;
 static pid_t break_thread_id = 0;
 static uint64_t break_thread_value = 0;
 
@@ -1958,6 +1958,7 @@ int main(int argc, char **argv)
 	pthread_mutexattr_init(&mattr);
 	pthread_mutexattr_setprotocol(&mattr, PTHREAD_PRIO_INHERIT);
 	pthread_mutex_init(&refresh_on_max_lock, &mattr);
+	pthread_mutex_init(&break_thread_id_lock, &mattr);
 
 	/* lock all memory (prevent swapping) */
 	if (lockall)
-- 
2.55.0


  parent reply	other threads:[~2026-08-26 13:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 13:21 [PATCH 0/5] cyclictest: Little tweaks here and there Sebastian Andrzej Siewior
2026-08-26 13:21 ` [PATCH 1/5] rt-tests: cyclicdeadline: Remove unused `alloverflows' Sebastian Andrzej Siewior
2026-08-31 16:40   ` John Kacur
2026-08-26 13:21 ` [PATCH 2/5] cyclictest: Acquire a lock before invoking pthread_cond_signal() Sebastian Andrzej Siewior
2026-08-31 16:41   ` John Kacur
2026-09-01  8:19   ` D, Suneeth
2026-09-01  8:34     ` Tomas Glozar
2026-09-01  8:39     ` Sebastian Andrzej Siewior
2026-08-26 13:21 ` Sebastian Andrzej Siewior [this message]
2026-08-31 16:42   ` [PATCH 3/5] cyclictest: Make break_thread_id_lock a PI lock John Kacur
2026-08-26 13:21 ` [PATCH 4/5] cyclictest: Make trigger_lock " Sebastian Andrzej Siewior
2026-08-31 16:43   ` John Kacur
2026-08-26 13:21 ` [PATCH 5/5] cyclictest: Add a timestamp of the last update Sebastian Andrzej Siewior
2026-08-28 14:26   ` John Kacur
2026-08-28 16:10     ` Sebastian Andrzej Siewior

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=20260826132153.2476006-4-bigeasy@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=jkacur@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    /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.