Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1664591 > unrolled thread

Re: [PATCH V2 2/2] timer: imx-tpm: add imx tpm timer support

Started byAlexander Stein <alexander.stein@systec-electronic.com>
First post2017-06-13 10:30 +0200
Last post2017-06-19 17:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH V2 2/2] timer: imx-tpm: add imx tpm timer support Alexander Stein <alexander.stein@systec-electronic.com> - 2017-06-13 10:30 +0200
    Re: [PATCH V2 2/2] timer: imx-tpm: add imx tpm timer support Dong Aisheng <dongas86@gmail.com> - 2017-06-19 17:40 +0200

#1664591 — Re: [PATCH V2 2/2] timer: imx-tpm: add imx tpm timer support

FromAlexander Stein <alexander.stein@systec-electronic.com>
Date2017-06-13 10:30 +0200
SubjectRe: [PATCH V2 2/2] timer: imx-tpm: add imx tpm timer support
Message-ID<tRPn3-5Bu-5@gated-at.bofh.it>
On Tuesday 13 June 2017 15:58:45, Dong Aisheng wrote:
> diff --git a/drivers/clocksource/timer-imx-tpm.c
> b/drivers/clocksource/timer-imx-tpm.c new file mode 100644
> index 0000000..940a4f75
> --- /dev/null
> +++ b/drivers/clocksource/timer-imx-tpm.c
> @@ -0,0 +1,227 @@
> [...]
> +static int tpm_set_next_event(unsigned long delta,
> +				struct clock_event_device *evt)
> +{
> +	unsigned long next, now;
> +
> +	next = readl(timer_base + TPM_CNT) + delta;
> +	writel(next, timer_base + TPM_C0V);
> +	now = readl(timer_base + TPM_CNT);

What about:
> now = readl(timer_base + TPM_CNT);
> next = now + delta;
> writel(next, timer_base + TPM_C0V);
> return 0;

> +	return (int)((next - now) <= 0) ? -ETIME : 0;

Can this error actually happen, even with your implementation?

Best regards,
Alexander

[toc] | [next] | [standalone]


#1669326

FromDong Aisheng <dongas86@gmail.com>
Date2017-06-19 17:40 +0200
Message-ID<tU6Wx-4tx-103@gated-at.bofh.it>
In reply to#1664591
On Tue, Jun 13, 2017 at 10:19:47AM +0200, Alexander Stein wrote:
> On Tuesday 13 June 2017 15:58:45, Dong Aisheng wrote:
> > diff --git a/drivers/clocksource/timer-imx-tpm.c
> > b/drivers/clocksource/timer-imx-tpm.c new file mode 100644
> > index 0000000..940a4f75
> > --- /dev/null
> > +++ b/drivers/clocksource/timer-imx-tpm.c
> > @@ -0,0 +1,227 @@
> > [...]
> > +static int tpm_set_next_event(unsigned long delta,
> > +				struct clock_event_device *evt)
> > +{
> > +	unsigned long next, now;
> > +
> > +	next = readl(timer_base + TPM_CNT) + delta;
> > +	writel(next, timer_base + TPM_C0V);
> > +	now = readl(timer_base + TPM_CNT);
> 
> What about:
> > now = readl(timer_base + TPM_CNT);
> > next = now + delta;
> > writel(next, timer_base + TPM_C0V);
> > return 0;
> 
> > +	return (int)((next - now) <= 0) ? -ETIME : 0;
> 
> Can this error actually happen, even with your implementation?

Yes, i did observe some -ETIME when testing with nanosleep or
hrtimer during programing min_delta event, especially when system
is high loading. e.g. run GPU stress test.

Please also refer to another mail for details i just replied to Daniel.

Regards
Dong Aisheng

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web