]> Git Repo - linux.git/commit
smp: Fix smp_call_function_single_async() locking
authorLinus Torvalds <[email protected]>
Wed, 11 Feb 2015 20:42:10 +0000 (12:42 -0800)
committerIngo Molnar <[email protected]>
Fri, 17 Apr 2015 07:57:52 +0000 (09:57 +0200)
commit8053871d0f7f67c7efb7f226ef031f78877d6625
treee73fabcd5872b6b5d3d7591fd7a45ee825bfb641
parentd7bc3197b41e0a1af6677e83f8736e93a1575ce0
smp: Fix smp_call_function_single_async() locking

The current smp_function_call code suffers a number of problems, most
notably smp_call_function_single_async() is broken.

The problem is that flush_smp_call_function_queue() does csd_unlock()
_after_ calling csd->func(). This means that a caller cannot properly
synchronize the csd usage as it has to.

Change the code to release the csd before calling ->func() for the
async case, and put a WARN_ON_ONCE(csd->flags & CSD_FLAG_LOCK) in
smp_call_function_single_async() to warn us of improper serialization,
because any waiting there can results in deadlocks when called with
IRQs disabled.

Rename the (currently) unused WAIT flag to SYNCHRONOUS and (re)use it
such that we know what to do in flush_smp_call_function_queue().

Rework csd_{,un}lock() to use smp_load_acquire() / smp_store_release()
to avoid some full barriers while more clearly providing lock
semantics.

Finally move the csd maintenance out of generic_exec_single() into its
callers for clearer code.

Signed-off-by: Linus Torvalds <[email protected]>
[ Added changelog. ]
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Rafael David Tinoco <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Link: http://lkml.kernel.org/r/CA+55aFz492bzLFhdbKN-Hygjcreup7CjMEYk3nTSfRWjppz-OA@mail.gmail.com
Signed-off-by: Ingo Molnar <[email protected]>
kernel/smp.c
This page took 0.054022 seconds and 4 git commands to generate.