Package: chrony
Version: 1.20-6
Followup-For: Bug #294030
after a little stracing, I came to the conclusion that chrony
alternating calls to ioctl(fd, RTC_UIE_ON, 0) and ioctl(fd, RTC_UIE_OFF, 0)
is responsible for the freezes.
the program attached (that must be run by root after ensuring nobody
else is using /dev/rtc) should print approximately one line every 0.1 sec.
on my PC, when genrtc.ko is loaded, lines with a plus sign
(corresponding to the RTC_UIE_ON calls) have delays ranging from 0.2 sec
to 0.9 sec.
I have no idea whether the calls make sense, or whether the kernel
module behaviour is correct, because I don't know what the ioctls are
supposed to do. Maybe someone should ask the kernel people...
hope it helps
g.b.
-- System Information:
Debian Release: 3.1
APT prefers testing
APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.8-2-686
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Versions of packages chrony depends on:
ii libc6 2.3.2.ds1-20 GNU C Library: Shared libraries an
ii libncurses5 5.4-4 Shared libraries for terminal hand
ii libreadline4 4.3-11 GNU readline and history libraries
-- no debconf information
#include <fcntl.h>
#include <time.h>
#include <linux/rtc.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <stdlib.h>
#define delta(x, y) ( (x.tv_usec-y.tv_usec) + (x.tv_sec-y.tv_sec)*1000000 )
int main()
{
int i;
struct timespec rem, delay = { 0, 100000000L }; /* 100 msec delay */
struct timeval t, t0;
int iv[] = { RTC_UIE_OFF, RTC_UIE_ON };
int rtc;
gettimeofday(&t0, NULL);
if ((rtc = open("/dev/rtc", O_RDWR)) < 0) {
perror("can't open RTC");
return EXIT_FAILURE;
}
for (i = 100; i--; ) {
int f = i & 0x7; /* i % 8 */
int r;
r = nanosleep(&delay, &rem);
gettimeofday(&t, NULL);
printf("%8ld %d %c\n", delta(t, t0), r, (f ? ' ' : '+'));
if (f < 2)
ioctl(rtc, iv[f], 0);
t0 = t;
}
return EXIT_SUCCESS;
}