diff options
author | Jason A. Donenfeld <[email protected]> | 2022-10-01 01:10:50 +0200 |
---|---|---|
committer | Jason A. Donenfeld <[email protected]> | 2022-12-04 14:37:08 +0100 |
commit | 1c21fe00eda76e4081535c739cf9f4bbb5dcb0ce (patch) | |
tree | 82c2465b448f54b4aa202ff1ce0e5124d4541f43 /scripts/generate_rust_analyzer.py | |
parent | 0e42d14be23f4cdb68a06ea40106eccf7db0b4bc (diff) |
random: spread out jitter callback to different CPUs
Rather than merely hoping that the callback gets called on another CPU,
arrange for that to actually happen, by round robining which CPU the
timer fires on. This way, on multiprocessor machines, we exacerbate
jitter by touching the same memory from multiple different cores.
There's a little bit of tricky bookkeeping involved here, because using
timer_setup_on_stack() + add_timer_on() + del_timer_sync() will result
in a use after free. See this sample code: <https://xn--4db.cc/xBdEiIKO/c>.
Instead, it's necessary to call [try_to_]del_timer_sync() before calling
add_timer_on(), so that the final call to del_timer_sync() at the end of
the function actually succeeds at making sure no handlers are running.
Cc: Sultan Alsawaf <[email protected]>
Cc: Dominik Brodowski <[email protected]>
Cc: Sebastian Andrzej Siewior <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Signed-off-by: Jason A. Donenfeld <[email protected]>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
0 files changed, 0 insertions, 0 deletions