All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xunlei Pang <pang.xunlei@linaro.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: lkml <linux-kernel@vger.kernel.org>,
	"rtc-linux@googlegroups.com" <rtc-linux@googlegroups.com>,
	Alessandro Zummo <a.zummo@towertech.it>,
	John Stultz <john.stultz@linaro.org>,
	Arnd Bergmann <arnd.bergmann@linaro.org>
Subject: Re: [PATCH v2 3/3] time: clocksource: Add a comment to CLOCK_SOURCE_SUSPEND_NONSTOP
Date: Thu, 29 Jan 2015 00:00:07 +0800	[thread overview]
Message-ID: <CADcy93VetnSr2ic_M37Zr+bwGfLzzW6-YgrC+q66s_nY5v0kuQ@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.11.1501241746210.5526@nanos>

Hi Thomas,

On 25 January 2015 at 01:07, Thomas Gleixner <tglx@linutronix.de> wrote:
> On Sat, 24 Jan 2015, Xunlei Pang wrote:
>
>> Before this, I tried to add some code to catch such problem at the
>> time of registering the clocksource, like using the
>> CLOCKSOURCE_MASK(), for example 64bit counter will never wrap for
>> us. But there may be other values like CLOCKSOURCE_MASK(56), I just
>> can't figure out exactly how to do this judge.
>
> I don't think there is a good way to do so. Registration time is the
> wrong place anyway because the problem depends on:
>
>  - The width of the counter
>  - The frequency of the counter
>
> The frequency of the counter might even change after registration. Now
> add the unknown duration of the suspend to the picture and you're
> completely lost.
>
> All we can do is provide information about the actual wraparound time,
> if the CLOCK_SOURCE_SUSPEND_NONSTOP flag is set and the wraparound
> time is less than some reasonable margin.
>

Yes, we can only deal with it approximately. How about this?

1) Add a new member about reference wraparound time(max system suspend
period allowed) to struct  clocksource. In
__clocksource_updatefreq_scale(), we can use  "sec" which already
applys 12.5% margin as its value.

2) Add a new tuneable sysctl threshold with a default time period
value(for example, 365 days)
    We can also printk its value when booting or changing its value to
notice people about this.

3) then,  in timekeeping_resume(), we can compare the reference
wraparound of the nonstop clocksource with the sysctl threshold to
decide if it is dependable to use.

Thanks,
Xunlei

>
>
>
>

  reply	other threads:[~2015-01-29  3:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22 12:01 [PATCH v2 1/3] time: Don't bother to run rtc_resume() for the nonstop clocksource Xunlei Pang
2015-01-22 12:01 ` [PATCH v2 2/3] rtc: Remove redundant rtc_valid_tm() from rtc_resume() Xunlei Pang
2015-01-22 12:01 ` [PATCH v2 3/3] time: clocksource: Add a comment to CLOCK_SOURCE_SUSPEND_NONSTOP Xunlei Pang
2015-01-22 21:07   ` Thomas Gleixner
2015-01-23 17:53     ` Xunlei Pang
2015-01-24 17:07       ` Thomas Gleixner
2015-01-28 16:00         ` Xunlei Pang [this message]
2015-01-22 18:30 ` [PATCH v2 1/3] time: Don't bother to run rtc_resume() for the nonstop clocksource John Stultz
2015-01-23 18:00   ` Xunlei Pang

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=CADcy93VetnSr2ic_M37Zr+bwGfLzzW6-YgrC+q66s_nY5v0kuQ@mail.gmail.com \
    --to=pang.xunlei@linaro.org \
    --cc=a.zummo@towertech.it \
    --cc=arnd.bergmann@linaro.org \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.