From: Matt Redfearn <matt.redfearn@mips.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: <linux-mips@linux-mips.org>,
Matt Redfearn <matt.redfearn@mips.com>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH 3/3] clocksource: mips-gic-timer: Add fastpath for local timer updates
Date: Wed, 11 Oct 2017 15:01:14 +0100 [thread overview]
Message-ID: <1507730474-8577-3-git-send-email-matt.redfearn@mips.com> (raw)
In-Reply-To: <1507730474-8577-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 dadac9f3e9c4..ca334431b0bc 100644
--- a/drivers/clocksource/mips-gic-timer.c
+++ b/drivers/clocksource/mips-gic-timer.c
@@ -39,6 +39,7 @@ 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;
@@ -46,8 +47,12 @@ static int gic_next_event(unsigned long delta, struct clock_event_device *evt)
local_irq_save(flags);
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);
+ }
local_irq_restore(flags);
res = ((int)(gic_read_count() - cnt) >= 0) ? -ETIME : 0;
return res;
--
2.7.4
next prev parent reply other threads:[~2017-10-11 14:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-11 14:01 [PATCH 1/3] clocksource/mips-gic-timer: Fix rcu_sched timeouts from multithreading Matt Redfearn
2017-10-11 14:01 ` [PATCH 2/3] clocksource/mips-gic-timer: Ensure IRQs disabled for read-update-write Matt Redfearn
2017-10-11 14:01 ` Matt Redfearn [this message]
2017-10-17 18:15 ` [PATCH 1/3] clocksource/mips-gic-timer: Fix rcu_sched timeouts from multithreading Daniel Lezcano
2017-10-18 20:34 ` Thomas Gleixner
2017-10-19 8:08 ` Matt Redfearn
2017-10-19 8:22 ` Thomas Gleixner
2017-10-19 9:15 ` Daniel Lezcano
2017-10-19 9:18 ` Thomas Gleixner
2017-10-19 9:27 ` Daniel Lezcano
2017-10-19 9:09 ` Daniel Lezcano
2017-10-19 9:21 ` Matt Redfearn
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=1507730474-8577-3-git-send-email-matt.redfearn@mips.com \
--to=matt.redfearn@mips.com \
--cc=daniel.lezcano@linaro.org \
--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
all inboxes | Powered by JetHome®