[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3622b64c-bae6-00db-6a61-3ccf760144aa@zytor.com>
Date:   Fri, 23 Mar 2018 15:17:44 -0700
From:   "H. Peter Anvin" <hpa@...or.com>
To:     Eric Dumazet <edumazet@...gle.com>, x86 <x86@...nel.org>
Cc:     lkml <linux-kernel@...r.kernel.org>,
        Eric Dumazet <eric.dumazet@...il.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Borislav Petkov <bp@...en8.de>, Ingo Molnar <mingo@...hat.com>,
        Hugh Dickins <hughd@...gle.com>
Subject: Re: [PATCH v3 2/2] x86, cpuid: allow cpuid_read() to schedule
On 03/23/18 14:58, Eric Dumazet wrote:
> I noticed high latencies caused by a daemon periodically reading various
> MSR and cpuid on all cpus. KASAN kernels would see ~10ms latencies
> simply reading one cpuid. Even without KASAN, sending IPI to CPU
> in deep sleep state or blocking hard IRQ in a a long section,
> then waiting for the answer can consume hundreds of usec or more.
> 
> Switching to smp_call_function_single_async() and a completion
> allows to reschedule and not burn cpu cycles.
That being said, the Right Way for a daemon to read multiple MSRs and
CPUIDs on multiple CPUs is to spawn a thread for each CPU and use CPU
affinity to lock them down.  No IPI is needed to access MSRs on the
current CPU, and CPUID doesn't even need kernel entry.
	-hpa
Powered by blists - more mailing lists