Difference between
modified post e010cc0830 by Anonymous on Thu 12th Oct 2023 10:54
original post d0455e by Anonymous on Thu 12th Oct 2023 10:33
Download diff
Show
old version |
new version |
both versions
| 1 | - | # igb_avb patch for Realtime systems which require Priority inheritence | |
| 1 | + | From e8ca16ec8ac0259c7d60bdb4a181995b7a5f3d61 Mon Sep 17 00:00:00 2001 | |
| 2 | - | # based on https://github.com/Avnu/igb_avb.git | |
| 2 | + | From: Roland Mainz <roland.mainz@nrubsig.org> | |
| 3 | - | diff --git a/lib/igb.c b/lib/igb.c | |
| 3 | + | Date: Thu, 12 Oct 2023 11:42:20 +0200 | |
| 4 | - | index 00a3560..4a79e98 100644 | |
| 4 | + | Subject: [PATCH] libigb: Use PTHREAD_PRIO_INHERIT for mutex to avoid realtime | |
| 5 | - | --- a/lib/igb.c | |
| 5 | + | issues | |
| 8 | 6 | ||
| 9 | - | attr_allocated = true; | |
| 7 | + | libigb: Use the |PTHREAD_PRIO_INHERIT| thread priority inheritence | |
| 8 | + | protocol for the POSIX mutex to avoid realtime issues where one | |
| 10 | 10 | ||
| 11 | - | +#if ((_POSIX_THREAD_ROBUST_PRIO_INHERIT-0) < 200809L) | |
| 11 | + | Seen in real-life with our SERCOS software. | |
| 12 | - | +/* Protect against libc implementations which do not support this */ | |
| 12 | + | ||
| 13 | - | +#error Priority inheritence not supported for robust mutexes with this pthread implementation | |
| 13 | + | Reviewed-by: Siegfried Wulsch <siegfried.wulsch@rovema.de> | |
| 14 | - | +#endif | |
| 14 | + | Signed-off-by: Marvin Wenzel <marvin.wenzel@rovema.de> | |
| 15 | - | + // to be used for both inter-process and inter-thread synchronization | |
| 15 | + | --- | |
| 16 | - | + if (pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT) != 0) | |
| 16 | + | lib/igb.c | 8 ++++++++ | |
| 17 | - | + goto err; | |
| 17 | + | 1 file changed, 8 insertions(+) | |
| 22 | 18 | ||
| 23 | - | ||
| 19 | + | diff --git a/lib/igb.c b/lib/igb.c | |
| 24 | - | ||
| 20 | + | index 00a3560..647234f 100644 | |
| 25 | - | ||
| 21 | + | --- a/lib/igb.c | |
| 26 | - | ||
| 22 | + | +++ b/lib/igb.c | |
| 27 | - | ||
| 23 | + | @@ -2562,6 +2562,14 @@ static int igb_create_lock(struct adapter *adapter) | |
| 28 | 24 | ||
| 29 | - | ||
| 25 | + | attr_allocated = true; | |
| 30 | 26 | ||
| 31 | - | ||
| 27 | + | +#if ((_POSIX_THREAD_ROBUST_PRIO_INHERIT-0) < 200809L) | |
| 32 | - | ||
| 28 | + | +/* Protect against libc implementations which do not support this */ | |
| 33 | - | ||
| 29 | + | +#error Priority inheritence not supported for robust mutexes with this pthread implementation | |
| 34 | - | ||
| 30 | + | +#endif | |
| 35 | - | ||
| 31 | + | + // realtime applications usually require priority inheritence | |
| 36 | - | ||
| 32 | + | + if (pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT) != 0) | |
| 37 | - | ||
| 33 | + | + goto err; | |
| 38 | - | ||
| 34 | + | + | |
| 39 | - | ||
| 35 | + | // to be used for both inter-process and inter-thread synchronization | |
| 40 | - | ||
| 36 | + | if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED) != 0) | |
| 41 | - | ||
| 37 | + | goto err; | |
| 42 | - | ||
| 38 | + | -- | |
| 43 | - | ||
| 39 | + | 2.30.2 | |
| 44 | 40 | ||
| 45 | 41 |
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.
rovema.kpaste.net RSS