From: Matt Redfearn <matt.redfearn@mips.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: James Hogan <james.hogan@mips.com>, <linux-mips@linux-mips.org>,
"Matt Redfearn" <matt.redfearn@mips.com>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH V2 3/3] clocksource: mips-gic-timer: Add fastpath for local timer updates
Date: Thu, 19 Oct 2017 12:55:35 +0100 [thread overview]
Message-ID: <1508414135-29123-3-git-send-email-matt.redfearn@mips.com> (raw)
In-Reply-To: <1508414135-29123-1-git-send-email-matt.redfearn@mips.com>
Always accessing the compare register via the CM redirect region is
(relatively) slow. If the timer being updated is the current CPUs
then this can be shortcutted by writing to the CM VP local region.
Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
---
drivers/clocksource/mips-gic-timer.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c
index 8e8e3aa25b3f..e8dee5491227 100644
--- a/drivers/clocksource/mips-gic-timer.c
+++ b/drivers/clocksource/mips-gic-timer.c
@@ -39,14 +39,19 @@ static u64 notrace gic_read_count(void)
static int gic_next_event(unsigned long delta, struct clock_event_device *evt)
{
+ int cpu = cpumask_first(evt->cpumask);
unsigned long flags;
u64 cnt;
int res;
cnt = gic_read_count();
cnt += (u64)delta;
- write_gic_vl_other(mips_cm_vp_id(cpumask_first(evt->cpumask)));
- write_gic_vo_compare(cnt);
+ if (cpu == raw_smp_processor_id()) {
+ write_gic_vl_compare(cnt);
+ } else {
+ write_gic_vl_other(mips_cm_vp_id(cpu));
+ write_gic_vo_compare(cnt);
+ }
res = ((int)(gic_read_count() - cnt) >= 0) ? -ETIME : 0;
return res;
}
--
2.7.4
next prev parent reply other threads:[~2017-10-19 12:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-19 11:55 [PATCH 1/3] clockevents: Retry programming min delta up to 10 times Matt Redfearn
2017-10-19 11:55 ` [PATCH 2/3] clocksource/mips-gic-timer: Remove pointless irq_save,restore Matt Redfearn
2017-10-19 13:23 ` Daniel Lezcano
2017-10-19 21:57 ` Daniel Lezcano
2017-10-19 11:55 ` Matt Redfearn [this message]
2017-10-19 13:31 ` [PATCH V2 3/3] clocksource: mips-gic-timer: Add fastpath for local timer updates Daniel Lezcano
2017-10-19 12:43 ` [PATCH 1/3] clockevents: Retry programming min delta up to 10 times Thomas Gleixner
2017-10-19 13:21 ` Matt Redfearn
2017-10-19 13:29 ` Thomas Gleixner
2017-10-19 14:17 ` [PATCH v2] " Matt Redfearn
2017-10-19 15:45 ` [tip:timers/core] " tip-bot for James Hogan
2017-10-19 15:04 ` [PATCH 1/3] " Martin Schwidefsky
2017-10-19 15:11 ` Thomas Gleixner
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=1508414135-29123-3-git-send-email-matt.redfearn@mips.com \
--to=matt.redfearn@mips.com \
--cc=daniel.lezcano@linaro.org \
--cc=james.hogan@mips.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--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