summaryrefslogtreecommitdiff
path: root/drivers/net/wireguard/allowedips.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2022-08-02 14:56:10 +0200
committerJakub Kicinski <kuba@kernel.org>2022-08-02 13:47:50 -0700
commitb56cf61d29db79a557d53e1b60437c64be17408b (patch)
treeccfec5f833570aea2877548d0c507f45cce4f99d /drivers/net/wireguard/allowedips.c
parentcf9bc1eb1841984634d25a66adc96cfb377675a2 (diff)
downloadwireguard-linux-trimmed-b56cf61d29db79a557d53e1b60437c64be17408b.tar.gz
wireguard-linux-trimmed-b56cf61d29db79a557d53e1b60437c64be17408b.zip
wireguard: ratelimiter: use hrtimer in selftest
Using msleep() is problematic because it's compared against ratelimiter.c's ktime_get_coarse_boottime_ns(), which means on systems with slow jiffies (such as UML's forced HZ=100), the result is inaccurate. So switch to using schedule_hrtimeout(). However, hrtimer gives us access only to the traditional posix timers, and none of the _COARSE variants. So now, rather than being too imprecise like jiffies, it's too precise. One solution would be to give it a large "range" value, but this will still fire early on a loaded system. A better solution is to align the timeout to the actual coarse timer, and then round up to the nearest tick, plus change. So add the timeout to the current coarse time, and then schedule_hrtimer() until the absolute computed time. This should hopefully reduce flakes in CI as well. Note that we keep the retry loop in case the entire function is running behind, because the test could still be scheduled out, by either the kernel or by the hypervisor's kernel, in which case restarting the test and hoping to not be scheduled out still helps. Fixes: a8f1bc7bdea3 ("net: WireGuard secure network tunnel") Suggested-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/wireguard/allowedips.c')
0 files changed, 0 insertions, 0 deletions