From: tip-bot for Dimitri Sivanich <sivanich@sgi.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
steiner@sgi.com, tglx@linutronix.de, sivanich@sgi.com,
mingo@elte.hu
Subject: [tip:x86/urgent] x86, UV: Fix RTC latency bug by reading replicated cachelines
Date: Wed, 27 Jan 2010 13:17:31 GMT [thread overview]
Message-ID: <tip-aca3bb5910119d4cf6c28568a642582efb4cc14a@git.kernel.org> (raw)
In-Reply-To: <20100122154140.GB4975@sgi.com>
Commit-ID: aca3bb5910119d4cf6c28568a642582efb4cc14a
Gitweb: http://git.kernel.org/tip/aca3bb5910119d4cf6c28568a642582efb4cc14a
Author: Dimitri Sivanich <sivanich@sgi.com>
AuthorDate: Fri, 22 Jan 2010 09:41:40 -0600
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 27 Jan 2010 11:33:53 +0100
x86, UV: Fix RTC latency bug by reading replicated cachelines
For SGI UV node controllers (HUB) rev 2.0 or greater, use
replicated cachelines to read the RTC timer. This optimization
allows faster simulataneous reads from a given socket.
Signed-off-by: Dimitri Sivanich <sivanich@sgi.com>
Cc: Jack Steiner <steiner@sgi.com>
LKML-Reference: <20100122154140.GB4975@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/uv_time.c | 13 ++++++++++++-
drivers/char/uv_mmtimer.c | 18 +++++++++++-------
2 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kernel/uv_time.c b/arch/x86/kernel/uv_time.c
index 3c84aa0..2b75ef6 100644
--- a/arch/x86/kernel/uv_time.c
+++ b/arch/x86/kernel/uv_time.c
@@ -282,10 +282,21 @@ static int uv_rtc_unset_timer(int cpu, int force)
/*
* Read the RTC.
+ *
+ * Starting with HUB rev 2.0, the UV RTC register is replicated across all
+ * cachelines of it's own page. This allows faster simultaneous reads
+ * from a given socket.
*/
static cycle_t uv_read_rtc(struct clocksource *cs)
{
- return (cycle_t)uv_read_local_mmr(UVH_RTC);
+ unsigned long offset;
+
+ if (uv_get_min_hub_revision_id() == 1)
+ offset = 0;
+ else
+ offset = (uv_blade_processor_id() * L1_CACHE_BYTES) % PAGE_SIZE;
+
+ return (cycle_t)uv_read_local_mmr(UVH_RTC | offset);
}
/*
diff --git a/drivers/char/uv_mmtimer.c b/drivers/char/uv_mmtimer.c
index 867b67b..c7072ba 100644
--- a/drivers/char/uv_mmtimer.c
+++ b/drivers/char/uv_mmtimer.c
@@ -89,13 +89,17 @@ static long uv_mmtimer_ioctl(struct file *file, unsigned int cmd,
switch (cmd) {
case MMTIMER_GETOFFSET: /* offset of the counter */
/*
- * UV RTC register is on its own page
+ * Starting with HUB rev 2.0, the UV RTC register is
+ * replicated across all cachelines of it's own page.
+ * This allows faster simultaneous reads from a given socket.
+ *
+ * The offset returned is in 64 bit units.
*/
- if (PAGE_SIZE <= (1 << 16))
- ret = ((UV_LOCAL_MMR_BASE | UVH_RTC) & (PAGE_SIZE-1))
- / 8;
+ if (uv_get_min_hub_revision_id() == 1)
+ ret = 0;
else
- ret = -ENOSYS;
+ ret = ((uv_blade_processor_id() * L1_CACHE_BYTES) %
+ PAGE_SIZE) / 8;
break;
case MMTIMER_GETRES: /* resolution of the clock in 10^-15 s */
@@ -115,8 +119,8 @@ static long uv_mmtimer_ioctl(struct file *file, unsigned int cmd,
ret = hweight64(UVH_RTC_REAL_TIME_CLOCK_MASK);
break;
- case MMTIMER_MMAPAVAIL: /* can we mmap the clock into userspace? */
- ret = (PAGE_SIZE <= (1 << 16)) ? 1 : 0;
+ case MMTIMER_MMAPAVAIL:
+ ret = 1;
break;
case MMTIMER_GETCOUNTER:
next prev parent reply other threads:[~2010-01-27 13:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-12 21:09 [PATCH] x86, UV: Add function retrieving node controller revision number Jack Steiner
2010-01-13 9:24 ` Ingo Molnar
2010-01-14 18:34 ` [PATCH] x86, UV: Read RTC using replicated cachelines Dimitri Sivanich
2010-01-19 14:41 ` [PATCH] x86, UV: Fix RTC latency bug by reading " Dimitri Sivanich
2010-01-20 8:10 ` Ingo Molnar
2010-01-22 15:40 ` Dimitri Sivanich
2010-01-22 15:41 ` Dimitri Sivanich
2010-01-27 13:17 ` tip-bot for Dimitri Sivanich [this message]
2010-01-15 19:24 ` [tip:x86/urgent] x86, uv: Add function retrieving node controller revision number tip-bot for Jack Steiner
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=tip-aca3bb5910119d4cf6c28568a642582efb4cc14a@git.kernel.org \
--to=sivanich@sgi.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=steiner@sgi.com \
--cc=tglx@linutronix.de \
/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
Powered by JetHome