OSDN Git Service

x86/msr: Allow rdmsr_safe_on_cpu() to schedule
authorEric Dumazet <edumazet@google.com>
Fri, 23 Mar 2018 21:58:17 +0000 (14:58 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 27 Mar 2018 10:01:47 +0000 (12:01 +0200)
commit07cde313b2d21f728cec2836db7cdb55476f7a26
tree88e450ffab9354ddc069700898fb9d7d21c192b3
parent13cc36d76bc4f5a9801ae32630bc8240ba0cc522
x86/msr: Allow rdmsr_safe_on_cpu() to schedule

High latencies can be observed caused by a daemon periodically reading
various MSR on all cpus. On KASAN enabled kernels ~10ms latencies can be
observed simply reading one MSR. Even without KASAN, sending an IPI to a
CPU, which is in a deep sleep state or in a long hard IRQ disabled section,
waiting for the answer can consume hundreds of microseconds.

All usage sites are in preemptible context, convert rdmsr_safe_on_cpu() to
use a completion instead of busy polling.

Overall daemon cpu usage was reduced by 35 %, and latencies caused by
msr_read() disappeared.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Link: https://lkml.kernel.org/r/20180323215818.127774-1-edumazet@google.com
arch/x86/lib/msr-smp.c