Re: [chrony-dev] Re: [PATCH] test: check if RTC is RTC_UIE_ON capable

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]




On Wed, Dec 11, 2019 at 5:42 PM Miroslav Lichvar <mlichvar@xxxxxxxxxx> wrote:
On Wed, Dec 11, 2019 at 04:13:23PM +0100, Christian Ehrhardt wrote:
> That means the first switch_interrupts call from RTC_Initialise ->
> RTC_Linux_Initialise -> switch_interrupts has _on_off_=0 and that doesn't
> trigger the issue at initialization phase.
> Later on on RTC_TimeInit -> switch_interrupts argument _on_off_=1 and the
> issue occurs.
> Turns out our "problematic" RTCs only trigger the issue on _on_off_=1.

Interesting. When I added that code I checked the kernel source code
and it looked like enabling and disabling the interrupt should both
return the same error.

What RTC driver is used on the machine?

I think I mentioned this before, the two failing ones are:
PPC64
# dmesg | grep -i rtc   
[    0.241872] rtc-generic rtc-generic: registered as rtc0
[    0.270221] rtc-generic rtc-generic: setting system clock to 2019-12-06T08:18:19 UTC (1575620299)
ARM64
# dmesg | grep -i rtc
[    0.876198] rtc-efi rtc-efi: registered as rtc0
[    1.046869] rtc-efi rtc-efi: setting system clock to 2019-12-10T11:44:59 UTC (1575978299)
 
>    /* Make sure the RTC supports interrupts */
> -  if (!switch_interrupts(0)) {
> +  if (!switch_interrupts(1) || switch_interrupts(0)) {
>      close(fd);
>      return 0;
>    }

I'd prefer this approach, but I think there is a missing "!" before
the second call of switch_interrupts().

Agreed

With that it behaves like the following (hang fixed):
# ./run -d 101-rtc    
101-rtc   Testing real-time clock:
 non-default settings:
   extra_chronyd_directives=rtcfile /home/ubuntu/chrony/test/system/tmp/rtcfile
   extra_chronyd_options=-s
   minimal_config=1
 starting chronyd                                              OK
 stopping chronyd                                              OK
 checking message "\(clock off from RTC\|RTC time before last\)"       BAD
FAIL


SUMMARY:
 TOTAL  1
 PASSED 0
 FAILED 1    (101-rtc)
 SKIPPED 0   ()
root@bos01-ppc64-chrony-adt-issue:/home/ubuntu/chrony/test/system# tail -n 20 tmp/*    
==> tmp/chronyd.conf <==
pidfile /home/ubuntu/chrony/test/system/tmp/chronyd.pid
bindcmdaddress /home/ubuntu/chrony/test/system/tmp/chronyd.sock
port 17575
cmdport 14432
rtcfile /home/ubuntu/chrony/test/system/tmp/rtcfile

==> tmp/chronyd.log <==
2019-12-12T07:20:35Z chronyd version DEVELOPMENT starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP -SCFILTER -SIGND +ASYNCDNS +SECHASH +IPV6 -DEBUG)
2019-12-12T07:20:35Z Disabled control of system clock
2019-12-12T07:20:35Z Could not enable RTC interrupt : Invalid argument
2019-12-12T07:20:35Z chronyd exiting

==> tmp/chronyd.out <==

==> tmp/driftfile <==
0.0 10000

==> tmp/keys <==
1 MD5 abcdefghijklmnopq

==> tmp/rtcfile <==
1 1576135235 0.0 0.0

==> tmp/tempcomp <==
0.0


> I've understood that you wanted it to hard-fail and bail out of -s was set
> but RTC init failed right?

No, it should continue to run (using other time sources as configured).
 
Thanks for explaining that - that seems correct for the general case (outside of the tests).

But that still means the test would flag "chrony broken" for test 101-rtc in places where we know the reason are RTC clocks not supporting an option.
I'd suggest to also add the initial patch I had that skips the test in those cases.

I'll send a v2 (for internationalization) and add a commit for the switch_interrupts 0+1 as discussed above

--
Miroslav Lichvar


--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.



--
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/