diff options
author | Íñigo Huguet <[email protected]> | 2023-02-21 14:06:16 +0100 |
---|---|---|
committer | Jakub Kicinski <[email protected]> | 2023-02-22 21:23:48 -0800 |
commit | 67d93ffc0f3c47094750bde6d62e7c5765dc47a6 (patch) | |
tree | a2e688d8de0990c9bd3497512f31b3925ff7af22 /tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/EventClass.py | |
parent | 5b7c4cabbb65f5c469464da6c5f614cbd7f730f2 (diff) |
ptp: vclock: use mutex to fix "sleep on atomic" bug
vclocks were using spinlocks to protect access to its timecounter and
cyclecounter. Access to timecounter/cyclecounter is backed by the same
driver callbacks that are used for non-virtual PHCs, but the usage of
the spinlock imposes a new limitation that didn't exist previously: now
they're called in atomic context so they mustn't sleep.
Some drivers like sfc or ice may sleep on these callbacks, causing
errors like "BUG: scheduling while atomic: ptp5/25223/0x00000002"
Fix it replacing the vclock's spinlock by a mutex. It fix the mentioned
bug and it doesn't introduce longer delays.
I've tested synchronizing various different combinations of clocks:
- vclock->sysclock
- sysclock->vclock
- vclock->vclock
- hardware PHC in different NIC -> vclock
- created 4 vclocks and launch 4 parallel phc2sys processes with
lockdep enabled
In all cases, comparing the delays reported by phc2sys, they are in the
same range of values than before applying the patch.
Link: https://lore.kernel.org/netdev/[email protected]/
Fixes: 5d43f951b1ac ("ptp: add ptp virtual clock driver framework")
Reported-by: Yalin Li <[email protected]>
Suggested-by: Richard Cochran <[email protected]>
Tested-by: Miroslav Lichvar <[email protected]>
Signed-off-by: Íñigo Huguet <[email protected]>
Acked-by: Richard Cochran <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/EventClass.py')
0 files changed, 0 insertions, 0 deletions