From: Eric Dumazet <eric.dumazet@gmail.com>
To: "H. Peter Anvin" <hpa@zytor.com>,
Eric Dumazet <edumazet@google.com>, x86 <x86@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Borislav Petkov <bp@alien8.de>, Ingo Molnar <mingo@redhat.com>,
Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH v3 2/2] x86, cpuid: allow cpuid_read() to schedule
Date: Fri, 23 Mar 2018 18:01:07 -0700 [thread overview]
Message-ID: <df40ad66-8bab-67ca-bce7-b82f09083f2e@gmail.com> (raw)
In-Reply-To: <3622b64c-bae6-00db-6a61-3ccf760144aa@zytor.com>
On 03/23/2018 03:17 PM, H. Peter Anvin wrote:
> 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.
Indeed, assuming a daemon can have threads running on all cpus :/
Some environments like to partition cpus for different jobs/containers.
Yes, we can avoid IPI by carefully re-designing these user programs.
next prev parent reply other threads:[~2018-03-24 1:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-23 21:58 [PATCH v3 1/2] x86, msr: allow rdmsr_safe_on_cpu() to schedule Eric Dumazet
2018-03-23 21:58 ` [PATCH v3 2/2] x86, cpuid: allow cpuid_read() " Eric Dumazet
2018-03-23 22:17 ` H. Peter Anvin
2018-03-24 1:01 ` Eric Dumazet [this message]
2018-03-25 22:11 ` H. Peter Anvin
2018-03-27 10:10 ` [tip:x86/cleanups] x86/cpuid: Allow " tip-bot for Eric Dumazet
2018-03-24 8:09 ` [PATCH v3 1/2] x86, msr: allow rdmsr_safe_on_cpu() " Ingo Molnar
2018-03-24 10:50 ` Thomas Gleixner
2018-03-24 14:29 ` Eric Dumazet
2018-03-25 14:12 ` Borislav Petkov
2018-03-26 1:21 ` H. Peter Anvin
2018-03-26 6:40 ` Ingo Molnar
[not found] ` <CANn89iKy_jVpBvAebJFm1UKVKfG=p+R4B1tXmC4waeK7YzZh2g@mail.gmail.com>
2018-03-26 14:23 ` Thomas Gleixner
2018-03-27 9:36 ` Ingo Molnar
2018-03-27 10:10 ` [tip:x86/cleanups] x86/msr: Allow " tip-bot for Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=df40ad66-8bab-67ca-bce7-b82f09083f2e@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=bp@alien8.de \
--cc=edumazet@google.com \
--cc=hpa@zytor.com \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).