OSDN Git Service

x86/cpuid: Allow cpuid_read() to schedule
authorEric Dumazet <edumazet@google.com>
Fri, 23 Mar 2018 21:58:18 +0000 (14:58 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 27 Mar 2018 10:01:48 +0000 (12:01 +0200)
commit67bbd7a8d6bcdc44cc27105ae8c374e9176ceaf1
treeaa876adde482382ffae7c3447a3179f9afde385d
parent07cde313b2d21f728cec2836db7cdb55476f7a26
x86/cpuid: Allow cpuid_read() to schedule

High latencies can be observed caused by a daemon periodically reading
CPUID on all cpus. On KASAN enabled kernels ~10ms latencies can be
observed. 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.

cpuid_read() is invoked in preemptible context, so it can be converted to
sleep instead of busy wait.

Switching to smp_call_function_single_async() and a completion allows to
reschedule and reduces CPU usage and latencies.

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-2-edumazet@google.com
arch/x86/kernel/cpuid.c