Re: infinite loop in read_hpet from ktime_get_boot_fast_ns

From: Jason A. Donenfeld
Date: Thu Jun 13 2019 - 12:39:22 EST


On Thu, Jun 13, 2019 at 6:26 PM Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> That does not make sense. The coarse time getters use
> tk->tkr_mono.base. base is updated every tick (or if the machine is
> completely idle right when the first CPU wakes up again).

Sense or not, it seems to be happening, at least on 5.2-rc4:

int __init mod_init(void)
{
for (;;) {
pr_err("%llu %llu %llu\n", get_jiffies_64(),
ktime_get_coarse_boottime(), local_clock());
msleep(200);
}
return 0;
}

[ 0.308166] wireguard: 4294892358 270211253 308165785
[ 0.512931] wireguard: 4294892410 270211253 512926052
[ 0.720930] wireguard: 4294892462 270211253 720925707
[ 0.928995] wireguard: 4294892514 270211253 928990019
[ 1.137011] wireguard: 4294892566 270211253 1137005585
[ 1.344948] wireguard: 4294892618 1270211253 1344943311
[ 1.552942] wireguard: 4294892670 1270211253 1552937363
[ 1.760963] wireguard: 4294892722 1270211253 1760957241
[ 1.969092] wireguard: 4294892774 1270211253 1969087174
[ 2.176951] wireguard: 4294892826 1270211253 2176946130
[ 2.385073] wireguard: 4294892878 2270211253 2385068075
[ 2.593033] wireguard: 4294892930 2270211253 2593025847
[ 2.801071] wireguard: 4294892982 2270211253 2801066369
[ 3.008895] wireguard: 4294893034 2270211253 3008892169
[ 3.216956] wireguard: 4294893086 2270211253 3216951160
[ 3.424965] wireguard: 4294893138 3270211253 3424960158
[ 3.632942] wireguard: 4294893190 3270211253 3632937133
[ 3.840947] wireguard: 4294893242 3270211253 3840942470
[ 4.048950] wireguard: 4294893294 3270211253 4048945319
[ 4.257078] wireguard: 4294893346 3270211253 4257072850
[ 4.464943] wireguard: 4294893398 4270211253 4464938724
[ 4.672934] wireguard: 4294893450 4270211253 4672929572
[ 4.880939] wireguard: 4294893502 4270211253 4880933901
[ 5.089015] wireguard: 4294893554 4270211253 5089010190
[ 5.297072] wireguard: 4294893606 4270211253 5297067556
[ 5.504935] wireguard: 4294893658 5270211253 5504929920
[ 5.712963] wireguard: 4294893710 5270211253 5712957452
[ 5.920949] wireguard: 4294893762 5270211253 5920944292
[ 6.128959] wireguard: 4294893814 5270211253 6128954684
[ 6.336968] wireguard: 4294893866 6270211253 6336962979
[ 6.544945] wireguard: 4294893918 6270211253 6544931514
[ 6.752963] wireguard: 4294893970 6270211253 6752958001
[ 6.961008] wireguard: 4294894022 6270211253 6961003309
[ 7.169073] wireguard: 4294894074 6270211253 7169068202
[ 7.376936] wireguard: 4294894126 7270211253 7376931429
[ 7.585022] wireguard: 4294894178 7270211253 7585016996
[ 7.793004] wireguard: 4294894230 7270211253 7792999324
[ 8.000953] wireguard: 4294894282 7270211253 8000947668
[ 8.208949] wireguard: 4294894334 7270211253 8208943630
[ 8.417090] wireguard: 4294894386 8270211253 8417085802
[ 8.625071] wireguard: 4294894438 8270211253 8625066012
[ 8.833086] wireguard: 4294894490 8270211253 8833081441
[ 9.041032] wireguard: 4294894542 8270211253 9041027362
[ 9.248948] wireguard: 4294894594 8270211253 9248943016
[ 9.456968] wireguard: 4294894646 9270211253 9456963019
[ 9.664955] wireguard: 4294894698 9270211253 9664950178
[ 9.872935] wireguard: 4294894750 9270211253 9872929704