On Wed, Dec 11, 2019 at 5:42 PM Miroslav Lichvar <mlich...@redhat.com>
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-requ...@chrony.tuxfamily.org with
> "unsubscribe" in the subject.
> For help email chrony-dev-requ...@chrony.tuxfamily.org with "help" in the
> subject.
> Trouble?  Email listmas...@chrony.tuxfamily.org.
>
>

-- 
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd

Reply via email to