Skip to content
Commit 13684e96 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Andrew Morton
Browse files

lib: dhry: fix unstable smp_processor_id(_) usage

When running the in-kernel Dhrystone benchmark with
CONFIG_DEBUG_PREEMPT=y:

    BUG: using smp_processor_id() in preemptible [00000000] code: bash/938

Fix this by not using smp_processor_id() directly, but instead wrapping
the whole benchmark inside a get_cpu()/put_cpu() pair.  This makes sure
the whole benchmark is run on the same CPU core, and the reported values
are consistent.

Link: https://lkml.kernel.org/r/b0d29932bb24ad82cea7f821e295c898e9657be0.1678890070.git.geert+renesas@glider.be
Fixes: d5528cc1

 ("lib: add Dhrystone benchmark test")
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reported-by: default avatarTobias Klausmann <klausman@schwarzvogel.de>
  Link: https://bugzilla.kernel.org/show_bug.cgi?id=217179


Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent d2e44a50
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment