Re: infinite loop in read_hpet from ktime_get_boot_fast_ns

Jason A. Donenfeld
2019-06-13T16:41:55Z

Or in case that's not clear enough:

int __init mod_init(void)
{
u64 j1 = 0, j2, k1 = 0, k2, l1 = 0, l2;
for (;;) {
j2 = jiffies64_to_nsecs(get_jiffies_64());
k2 = ktime_get_coarse_boottime();
l2 = local_clock();
pr_err("%llu %llu %llu\n", j2 - j1, k2 - k1, l2 - l1);
j1 = j2;
k1 = k2;
l1 = l2;
msleep(200);
}
return 0;
}

[ 0.289469] wireguard: 17179569424000000 18446744073155127569 289468886
[ 0.495002] wireguard: 208000000 1000000000 205528400
[ 0.702857] wireguard: 208000000 0 207855129
[ 0.910836] wireguard: 208000000 0 207979087
[ 1.118871] wireguard: 208000000 0 208034819
[ 1.326964] wireguard: 208000000 0 208093122
[ 1.534941] wireguard: 208000000 1000000000 207976614
[ 1.742868] wireguard: 208000000 0 207927167
[ 1.950877] wireguard: 208000000 0 208009538
[ 2.158865] wireguard: 208000000 0 207987922
[ 2.367012] wireguard: 208000000 0 208146016
[ 2.574931] wireguard: 208000000 1000000000 207918184
[ 2.782871] wireguard: 208000000 0 207939645
[ 2.991017] wireguard: 208000000 0 208148426
[ 3.198943] wireguard: 208000000 0 207925281
[ 3.406959] wireguard: 208000000 0 208014262
[ 3.614892] wireguard: 208000000 1000000000 207934524
[ 3.822869] wireguard: 208000000 0 207976970
[ 4.030994] wireguard: 208000000 0 208125835
[ 4.238792] wireguard: 208000000 0 207800186
[ 4.446853] wireguard: 208000000 0 208056350
[ 4.654978] wireguard: 208000000 1000000000 208126753
[ 4.862801] wireguard: 208000000 0 207822955
[ 5.070999] wireguard: 208000000 0 208198517
[ 5.278818] wireguard: 208000000 0 207820902
[ 5.486879] wireguard: 208000000 1000000000 208059285
[ 5.694959] wireguard: 208000000 0 208066514
[ 5.903011] wireguard: 208000000 0 208065258
[ 6.111015] wireguard: 208000000 0 208004056
[ 6.318856] wireguard: 208000000 0 207841271