From: Waiman Long <waiman.long@hpe.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
<linux-kernel@vger.kernel.org>, <x86@kernel.org>,
Borislav Petkov <bp@suse.de>, Andy Lutomirski <luto@kernel.org>,
Prarit Bhargava <prarit@redhat.com>,
Scott J Norton <scott.norton@hpe.com>,
Douglas Hatch <doug.hatch@hpe.com>,
Randy Wright <rwright@hpe.com>
Subject: Re: [PATCH v5] x86/hpet: Reduce HPET counter read contention
Date: Fri, 12 Aug 2016 18:58:52 -0400 [thread overview]
Message-ID: <57AE54AC.1010800@hpe.com> (raw)
In-Reply-To: <57AE432A.9010201@intel.com>
On 08/12/2016 05:44 PM, Dave Hansen wrote:
> On 08/12/2016 02:25 PM, Waiman Long wrote:
>> + do {
>> + cpu_relax();
>> + new.lockval = READ_ONCE(hpet.lockval);
>> + } while ((new.value == old.value)&& raw_spin_is_locked(&new.lock));
> While it gets more far-fetched, this isn't guaranteed to make progress
> until the saved HPET value actually changes. You could have a constant
> stream of other CPUs going and doing hpet_readl() (and getting the same
> value back from a sloooow HPET). So each time through this loop, this
> processor sees (new.value == old.value), and sees the lock held.
That is the point. All CPUs that try to read the HPET simultaneously
will get the same value back instead of waiting in line to get a
slightly different value. They do need to wait until the lock holder
read the new HPET value. If you have n CPUs trying to read HPET and the
read latency is T, the latency for all the CPUs to read it is just T
instead of a worst case latency of nT or an average of (n+1)T/2.
What we don't want to see is to return some stale value that make it
looks like we go backward in time.
Cheers,
Longman
prev parent reply other threads:[~2016-08-12 22:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-12 21:25 [PATCH v5] x86/hpet: Reduce HPET counter read contention Waiman Long
2016-08-12 21:38 ` Dave Hansen
2016-08-12 22:50 ` Waiman Long
2016-08-12 21:44 ` Dave Hansen
2016-08-12 22:58 ` Waiman Long [this message]
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=57AE54AC.1010800@hpe.com \
--to=waiman.long@hpe.com \
--cc=bp@suse.de \
--cc=dave.hansen@intel.com \
--cc=doug.hatch@hpe.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=prarit@redhat.com \
--cc=rwright@hpe.com \
--cc=scott.norton@hpe.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