From: Jiaxun Yang <jiaxun.yang@flygoat.com>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Serge Semin <fancer.lancer@gmail.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>
Cc: "Maciej W. Rozycki" <macro@orcam.me.uk>,
linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
Jiaxun Yang <jiaxun.yang@flygoat.com>
Subject: [PATCH v2 6/7] clocksource: mips-gic-timer: Refine rating computation
Date: Wed, 12 Jun 2024 09:54:33 +0100 [thread overview]
Message-ID: <20240612-mips-clks-v2-6-a57e6f49f3db@flygoat.com> (raw)
In-Reply-To: <20240612-mips-clks-v2-0-a57e6f49f3db@flygoat.com>
It is a good clocksource which usually go as fast as CPU core
and have a low access latency, so raise the base of rating
from Good to desired when we know that it has a stable frequency.
Increase frequency addend dividend to 10000000 (10MHz) to
reasonably accommodate multi GHz level clock, also cap rating
within current level.
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
v2: Fix number of zeros for 10 MHz
---
drivers/clocksource/mips-gic-timer.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c
index b3ae38f36720..7a03d94c028a 100644
--- a/drivers/clocksource/mips-gic-timer.c
+++ b/drivers/clocksource/mips-gic-timer.c
@@ -197,7 +197,11 @@ static int __init __gic_clocksource_init(void)
gic_clocksource.mask = CLOCKSOURCE_MASK(count_width);
/* Calculate a somewhat reasonable rating value. */
- gic_clocksource.rating = 200 + gic_frequency / 10000000;
+ if (mips_cm_revision() >= CM_REV_CM3 || !IS_ENABLED(CONFIG_CPU_FREQ))
+ gic_clocksource.rating = 300; /* Good when frequecy is stable */
+ else
+ gic_clocksource.rating = 200;
+ gic_clocksource.rating += clamp(gic_frequency / 10000000, 0, 99);
ret = clocksource_register_hz(&gic_clocksource, gic_frequency);
if (ret < 0)
--
2.43.0
next prev parent reply other threads:[~2024-06-12 8:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-12 8:54 [PATCH v2 0/7] MIPS: clocksource cumulative enhancements Jiaxun Yang
2024-06-12 8:54 ` [PATCH v2 1/7] MIPS: csrc-r4k: Refine rating computation Jiaxun Yang
2024-06-12 8:54 ` [PATCH v2 2/7] MIPS: csrc-r4k: Apply verification clocksource flags Jiaxun Yang
2024-08-06 4:09 ` Guenter Roeck
2024-08-06 5:06 ` Jiaxun Yang
2024-08-06 5:13 ` Guenter Roeck
2024-08-06 15:06 ` Guenter Roeck
2024-08-08 7:35 ` Jiaxun Yang
2024-06-12 8:54 ` [PATCH v2 3/7] MIPS: csrc-r4k: Select HAVE_UNSTABLE_SCHED_CLOCK if SMP && 64BIT Jiaxun Yang
2024-06-12 8:54 ` [PATCH v2 4/7] MIPS: csrc-r4k: Don't register as sched_clock if unfit Jiaxun Yang
2024-06-12 8:54 ` [PATCH v2 5/7] MIPS: sync-r4k: Rework based on x86 tsc_sync Jiaxun Yang
2024-06-12 8:54 ` Jiaxun Yang [this message]
2024-06-21 11:18 ` [PATCH v2 6/7] clocksource: mips-gic-timer: Refine rating computation Jiaxun Yang
2024-06-12 8:54 ` [PATCH v2 7/7] clocksource: mips-gic-timer: Correct sched_clock width Jiaxun Yang
2024-07-03 5:59 ` [PATCH v2 0/7] MIPS: clocksource cumulative enhancements Jiaxun Yang
2024-07-03 15:24 ` Thomas Bogendoerfer
2024-07-08 16:40 ` Daniel Lezcano
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=20240612-mips-clks-v2-6-a57e6f49f3db@flygoat.com \
--to=jiaxun.yang@flygoat.com \
--cc=daniel.lezcano@linaro.org \
--cc=fancer.lancer@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=macro@orcam.me.uk \
--cc=tglx@linutronix.de \
--cc=tsbogend@alpha.franken.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;
as well as URLs for NNTP newsgroup(s).