- From e8ca16ec8ac0259c7d60bdb4a181995b7a5f3d61 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Thu, 12 Oct 2023 11:42:20 +0200
- Subject: [PATCH] libigb: Use PTHREAD_PRIO_INHERIT for mutex to avoid realtime
- issues
- libigb: Use the |PTHREAD_PRIO_INHERIT| thread priority inheritence
- protocol for the POSIX mutex to avoid realtime issues where one
- lower-priority thread can stall a higher-priority RT thread.
- Seen in real-life with our SERCOS software.
- Reviewed-by: Siegfried Wulsch <siegfried.wulsch@rovema.de>
- Signed-off-by: Marvin Wenzel <marvin.wenzel@rovema.de>
- ---
- lib/igb.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
- diff --git a/lib/igb.c b/lib/igb.c
- index 00a3560..647234f 100644
- --- a/lib/igb.c
- +++ b/lib/igb.c
- @@ -2562,6 +2562,14 @@ static int igb_create_lock(struct adapter *adapter)
- attr_allocated = true;
- +#if ((_POSIX_THREAD_ROBUST_PRIO_INHERIT-0) < 200809L)
- +/* Protect against libc implementations which do not support this */
- +#error Priority inheritence not supported for robust mutexes with this pthread implementation
- +#endif
- + // realtime applications usually require priority inheritence
- + if (pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT) != 0)
- + goto err;
- +
- // to be used for both inter-process and inter-thread synchronization
- if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED) != 0)
- goto err;
- --
- 2.30.2
igb_avb: patch for Realtime systems which require Priority inheritence
Posted by Anonymous on Thu 12th Oct 2023 10:54
raw | new post
modification of post by Anonymous (view diff)
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.