From: Alexander Holler <holler@ahsoftware.de>
To: John Stultz <john.stultz@linaro.org>
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
rtc-linux@googlegroups.com, Thomas Gleixner <tglx@linutronix.de>,
Alessandro Zummo <a.zummo@towertech.it>
Subject: Re: [PATCH 6/9 v3] RFC: timekeeping: rtc: remove CONFIG_RTC_HCTOSYS and RTC_HCTOSYS_DEVICE
Date: Sat, 22 Jun 2013 10:00:12 +0200 [thread overview]
Message-ID: <51C5598C.30203@ahsoftware.de> (raw)
In-Reply-To: <51BB6ACF.9050702@linaro.org>
Am 14.06.2013 21:11, schrieb John Stultz:
> On 06/14/2013 09:52 AM, Alexander Holler wrote:
>> Those config options don't make sense anymore with the new hctosys
>> mechanism introduced with the previous patch.
>>
>> That means two things:
>>
>> - If a (hardware) clock is available it will be used to set the time at
>> boot. This was already the case for system which have a "persistent"
>> clock, e.g. most x86 systems. The only way to specify the device used
>> for hctosys is now by using the kernel parameter hctosys= introduced
>> with a previous patch.
>>
>> - If a hardware clock was used for hctosys before suspend, this clock
>> will be used to adjust the clock at resume. Again, this doesn't change
>> anything on systems with a "persistent" clock.
>>
>> What's missing:
>>
>> I don't know much about those "persistent" clocks and I haven't had a
>> deep look at them. That's especially true for the suspend/resume
>> mechanism used by them. The mechanism I want to use is the following:
>> The RTC subsystem now maintains the ID of the RTC device which was used
>> for hctosys (in rtc_hctosys_dev_id) and therefor specifies the device
>> which should be used to adjust the time after resume. Additionaly the
>> (new) flag systime_was_set will be set to false at suspend and on resume
>> this flag will be set to true if either the clock will be adjusted by
>> the device used for hctosys or by userspace (through do_settimeofday()).
>>
>> That all should already work as expected for RTCs, what's missing for
>> "persistent" clocks is that the flag systime_was_set is set to false on
>> suspend and set to true on resume. Currently it just stays at true
>> (which is set through hctosys if a "persistent" clock is found.
>> But because "persistent" clocks don't go away (as it is possible with
>> RTCs by removing the driver or the RTC itself), nor do "persistent"
>> clocks might have two instances, this shouldn't be a problem at all.
>
> This one concerns me a bit. Since you're removing quite a bit and it
> looks like it may break userland expectations.
The only thing I remove from a user point of view is a broken (because
undetermined) informational entry (/proc/driver/rtc) if persistent
clocks are used.
>
> I ran into this myself recently, when I found some distros look for
> /sys/class/rtc/rtcN/hctosys in order to determine which rtc device
> should be synced with from userland.
The patches don't change anything in /sys.
>
> So I'd probably suggest instead to re-factor this so you leave all the
> hctosys bits alone, but just change it from being called by a
> late_initcall() and instead have it called when we register the RTC that
> matches CONFIG_RTC_HCTOSYS_DEVICE.
>
> I suspect it will end up being a much smaller change that way.
>
> Then the last bit is just a matter of adding the
> timekeeping_systimeset() check to the hctosys bits.
This doesn't work because the current hctosys approach is (imho) broken
by design, at least how it currently works. Of course, this might be the
result of changes, refused patches or whatever, I don't know the history
of the current hctosys.
First it's only a kernel configuration, that means most users can't even
change it. Second, it just defines the N in rtcN, which is based on the
order RTC drivers are loaded (undefined). Third, it ignores persistent
clocks, and if persistent clocks are used, the informational entry in
/proc is misleading and just might fit because of some lucky circumstance.
As it seems hard to understand the changes, here they are again, maybe
my second description is more understandable.
1. Replacment of the Kernel config option CONFIG_RTC_HCTOSYS by a kernel
command line parameter hctosys=.
- Kernel config options are unavailable for most users.
A kernel command line parameter gives them the possibility to
change it.
- The current config option ignores persistent clocks at all. It
doesn't allow to disable persistent clocks and therefor it is
misleading. I assume most users don't even know persistent clocks
do exist. Fixed with the new kernel command line parameter.
2. Replacement of RTC_HCTOSYS_DEVICE by a kernel command line parameter
hctosys=.
- Again, it's a kernel config option only, not changeable by most
users. The new hctosys= allows ordinary (non-kernel-compiling) users
to change that.
- The current config option is based on the order RTC drivers are
loaded, which is non-deterministic thus undefined. The new hctosys=
allows to choose the used RTC driver by name.
- The config option ignores persistent clocks, the new hctosys=
kernel commandline parameter doesn't.
3. Removal of /proc/driver/rtc if and only if a persistent clock is used.
- If a persistent clock is used, the informational entry in /proc
might be totally wrong because it is based on the first loaded RTC
driver. The first loaded RTC driver doesn't have to be the
corresponding rtc-driver which uses the same hardware clock as the
persistent clock and might describe a totally different hardware
clock.
- If a persistent clock is used, it describes the abilities of the
RTC driver, but not those of the persistent clock driver. This
might be misleading because only the persistent clock driver is
used and not the corresponding (described) RTC driver.
- No changes for users of any RTC driver. The entry in /proc will
still be there.
Regards,
Alexander Holler
next prev parent reply other threads:[~2013-06-22 8:02 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-19 15:14 [PATCH 0/3] rtc: rtc-hid-sensor-time Alexander Holler
2013-04-19 15:14 ` [PATCH 1/3 RESEND] rtc: rtc-hid-sensor-time: allow full years (16bit) in HID reports Alexander Holler
2013-04-19 15:14 ` [PATCH 2/3] rtc: rtc-hid-sensor-time: allow 16 and 32 bit values for all attributes Alexander Holler
2013-04-19 15:14 ` [PATCH 3/3] rtc: rtc-hid-sensor-time; add option hctosys to set time at boot Alexander Holler
2013-04-22 23:38 ` Andrew Morton
2013-04-23 8:51 ` Alexander Holler
2013-04-23 10:08 ` Alexander Holler
2013-04-23 10:13 ` Alexander Holler
2013-04-23 10:17 ` Alexander Holler
2013-04-23 15:47 ` Alexander Holler
2013-04-24 21:14 ` Andrew Morton
2013-04-25 6:55 ` Alexander Holler
2013-05-05 11:21 ` [PATCH 0/4] rtc: rtc-hid-sensor-time: some changes Alexander Holler
2013-05-05 11:21 ` [PATCH 1/4] rtc: rtc-hid-sensor-time: allow full years (16bit) in HID reports Alexander Holler
2013-05-05 11:21 ` [PATCH 2/4] rtc: rtc-hid-sensor-time: allow 16 and 32 bit values for all attributes Alexander Holler
2013-05-05 11:21 ` [PATCH 3/4] rtc: rtc-hid-sensor-time: add option hctosys to set time at boot Alexander Holler
2013-05-21 21:42 ` Andrew Morton
2013-05-21 22:02 ` John Stultz
2013-05-21 23:15 ` Alexander Holler
2013-05-28 19:37 ` John Stultz
2013-05-29 4:42 ` Alexander Holler
2013-06-04 13:41 ` Alexander Holler
2013-06-05 17:15 ` [PATCH 0/3] RFC: timekeeping: rtc: change hctosys mechanism Alexander Holler
2013-06-05 17:15 ` [PATCH 1/3] RFC: timekeeping: introduce flag systime_was_set Alexander Holler
2013-06-05 17:15 ` [PATCH 2/3] RFC: timekeeping: rtc: Introduce new kernel parameter hctosys Alexander Holler
2013-06-05 17:15 ` [PATCH 3/3] RFC: timekeeping: rtc: remove CONFIG_RTC_HCTOSYS and RTC_HCTOSYS_DEVICE Alexander Holler
2013-06-06 10:51 ` [PATCH 0/3 v2] RFC: timekeeping: rtc: change hctosys mechanism Alexander Holler
2013-06-06 10:51 ` [PATCH 1/3 RESEND] RFC: timekeeping: introduce flag systime_was_set Alexander Holler
2013-06-06 10:51 ` [PATCH 2/3 v2] RFC: timekeeping: rtc: Introduce new kernel parameter hctosys Alexander Holler
2013-06-13 19:39 ` Alexander Holler
2013-06-14 16:52 ` [PATCH 0/9 v3] RFC: timekeeping: rtc: change hctosys mechanism Alexander Holler
2013-06-14 16:52 ` [PATCH 1/9 RESEND] rtc: rtc-hid-sensor-time: allow full years (16bit) in HID reports Alexander Holler
2013-06-14 16:52 ` [PATCH 2/9 RESEND] rtc: rtc-hid-sensor-time: allow 16 and 32 bit values for all attributes Alexander Holler
2013-06-14 16:52 ` [PATCH 3/9] rtc: rtc-hid-sensor-time: delay registering as rtc into a work Alexander Holler
2013-06-20 10:39 ` [PATCH 3/9 v2] " Alexander Holler
2013-06-26 19:55 ` Andrew Morton
2013-06-26 21:34 ` [rtc-linux] " Alexander Holler
2013-06-26 22:07 ` Greg KH
2013-06-26 23:51 ` Alexander Holler
2013-07-06 8:55 ` Alexander Holler
2013-07-06 18:21 ` Jiri Kosina
2013-07-07 7:35 ` Alexander Holler
2013-07-08 9:12 ` [PATCH 0/2] rtc: rtc-hid-sensor-time: enable HID input processing early Alexander Holler
2013-07-08 9:12 ` [PATCH 1/2] rtc: rtc-hid-sensor-time: improve error handling when rtc register fails Alexander Holler
2013-07-08 9:12 ` [PATCH 2/2] rtc: rtc-hid-sensor-time: enable HID input processing early Alexander Holler
2013-06-28 1:29 ` [rtc-linux] Re: [PATCH 3/9 v2] rtc: rtc-hid-sensor-time: delay registering as rtc into a work Alexander Holler
2013-06-14 16:52 ` [PATCH 4/9 RESEND] RFC: timekeeping: introduce flag systime_was_set Alexander Holler
2013-06-14 17:41 ` John Stultz
2013-06-14 18:05 ` [rtc-linux] " Alexander Holler
2013-06-14 18:28 ` John Stultz
2013-06-15 6:01 ` Alexander Holler
2013-06-17 18:10 ` John Stultz
2013-06-20 10:15 ` Alexander Holler
2013-06-20 17:27 ` John Stultz
2013-06-20 18:45 ` Alexander Holler
2013-06-20 19:28 ` John Stultz
2013-06-20 23:10 ` Alexander Holler
2013-06-14 16:52 ` [PATCH 5/9 v3] RFC: timekeeping: rtc: Introduce new kernel parameter hctosys Alexander Holler
2013-06-14 19:24 ` John Stultz
2013-06-14 16:52 ` [PATCH 6/9 v3] RFC: timekeeping: rtc: remove CONFIG_RTC_HCTOSYS and RTC_HCTOSYS_DEVICE Alexander Holler
2013-06-14 19:11 ` John Stultz
2013-06-22 8:00 ` Alexander Holler [this message]
2013-06-14 16:52 ` [PATCH 7/9] RFC: rtc: implement rtc_read_timeval() Alexander Holler
2013-06-14 17:23 ` John Stultz
2013-06-14 17:43 ` Alexander Holler
2013-06-14 19:18 ` John Stultz
2013-06-14 17:28 ` John Stultz
2013-06-14 16:52 ` [PATCH 8/9] RFC: rtc: hctosys: support rtc_read_timeval() for high precision clocks Alexander Holler
2013-06-14 19:20 ` John Stultz
2013-06-14 16:52 ` [PATCH 9/9] RFC: rtc: rtc-hid-sensor-time: add support for rtc_read_timeval() Alexander Holler
2013-06-14 17:27 ` [PATCH 0/9 v3] RFC: timekeeping: rtc: change hctosys mechanism John Stultz
2013-06-06 10:51 ` [PATCH 3/3 v2] RFC: timekeeping: rtc: remove CONFIG_RTC_HCTOSYS and RTC_HCTOSYS_DEVICE Alexander Holler
2013-06-04 9:38 ` [PATCH] rtc: rtc-hid-sensor-time: fix possible bug on driver_remove Alexander Holler
2013-06-08 8:56 ` Alexander Holler
2013-05-05 11:21 ` [PATCH 4/4] rtc: rtc-hid-sensor-time: add support for milliseconds Alexander Holler
2013-04-20 23:46 ` [PATCH 0/3] rtc: rtc-hid-sensor-time Jiri Kosina
2013-04-21 6:38 ` Alexander Holler
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=51C5598C.30203@ahsoftware.de \
--to=holler@ahsoftware.de \
--cc=a.zummo@towertech.it \
--cc=akpm@linux-foundation.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 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).