Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1264813
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Thomas Gleixner <tglx@linutronix.de> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 03/19] clocksource: Add NPS400 timers driver |
| Date | Sat, 07 Nov 2015 12:30:01 +0100 |
| Message-ID | <qs9QZ-1CF-17@gated-at.bofh.it> (permalink) |
| References | <qpEeC-3hu-3@gated-at.bofh.it> <qs9QZ-1CF-19@gated-at.bofh.it> |
| X-Original-To | Noam Camus <noamc@ezchip.com> |
| User-Agent | Alpine 2.11 (DEB 23 2013-08-11) |
| MIME-Version | 1.0 |
| Content-Type | TEXT/PLAIN; charset=US-ASCII |
| X-Linutronix-Spam-Score | -1.0 |
| X-Linutronix-Spam-Level | - |
| X-Linutronix-Spam-Status | No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 46 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, talz@ezchip.com, gilf@ezchip.com, cmetcalf@ezchip.com, Daniel Lezcano <daniel.lezcano@linaro.org>, Rob Herring <robh+dt@kernel.org>, John Stultz <john.stultz@linaro.org> |
| X-Original-Date | Sat, 7 Nov 2015 12:26:10 +0100 (CET) |
| X-Original-Message-ID | <alpine.DEB.2.11.1511071222340.4032@nanos> |
| X-Original-References | <1446297327-16298-1-git-send-email-noamc@ezchip.com> <1446893557-29748-4-git-send-email-noamc@ezchip.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1264813 |
Show key headers only | View raw
On Sat, 7 Nov 2015, Noam Camus wrote:
> +/*
> + * To get the value from the Global Timer Counter register proceed as follows:
> + * 1. Read the upper 32-bit timer counter register
> + * 2. Read the lower 32-bit timer counter register
> + * 3. Read the upper 32-bit timer counter register again. If the value is
> + * different to the 32-bit upper value read previously, go back to step 2.
> + * Otherwise the 64-bit timer counter value is correct.
> + */
> +static cycle_t nps_clksrc_read(struct clocksource *clksrc)
> +{
> + u64 counter;
> + u32 lower, upper, old_upper;
> + void *lower_p, *upper_p;
> + int cluster = (smp_processor_id() >> NPS_CLUSTER_OFFSET);
> +
> + lower_p = nps_msu_reg_low_addr[cluster];
> + upper_p = lower_p + 4;
> +
> + upper = ioread32be(upper_p);
> + do {
> + old_upper = upper;
> + lower = ioread32be(lower_p);
> + upper = ioread32be(upper_p);
> + } while (upper != old_upper);
> +
> + counter = (upper << 32) | lower;
> + return (cycle_t)counter;
So that clocksource goes up to 1GHz. That means u32 fits ~4.29
seconds. Unless you are striving for NOHZ idle sleep times above that
there is no point in doing that 64bit dance.
The timekeeping code is perfectly fine with a 32bit value. You just
have to set the proper mask.
Thanks,
tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [PATCH v2 03/19] clocksource: Add NPS400 timers driver Thomas Gleixner <tglx@linutronix.de> - 2015-11-07 12:30 +0100
csiph-web