diff options
author | Michael S. Tsirkin <[email protected]> | 2017-02-19 07:17:17 +0200 |
---|---|---|
committer | David S. Miller <[email protected]> | 2017-02-20 10:27:56 -0500 |
commit | e71695307114335be1ed912f4a347396c2ed0e69 (patch) | |
tree | f3a8f1e60b278f704a733f653fcd611cab6773f7 /tools/perf/scripts/python/call-graph-from-sql.py | |
parent | d4e854ccd6410687bf82af3fe49d2df9793d80b4 (diff) |
ptr_ring: fix race conditions when resizing
Resizing currently drops consumer lock. This can cause entries to be
reordered, which isn't good in itself. More importantly, consumer can
detect a false ring empty condition and block forever.
Further, nesting of consumer within producer lock is problematic for
tun, since it produces entries in a BH, which causes a lock order
reversal:
CPU0 CPU1
---- ----
consume:
lock(&(&r->consumer_lock)->rlock);
resize:
local_irq_disable();
lock(&(&r->producer_lock)->rlock);
lock(&(&r->consumer_lock)->rlock);
<Interrupt>
produce:
lock(&(&r->producer_lock)->rlock);
To fix, nest producer lock within consumer lock during resize,
and keep consumer lock during the whole swap operation.
Reported-by: Dmitry Vyukov <[email protected]>
Cc: [email protected]
Cc: "David S. Miller" <[email protected]>
Acked-by: Jason Wang <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/call-graph-from-sql.py')
0 files changed, 0 insertions, 0 deletions