From 1396c093d2ce7e7ae22afb3642a5d61c032a25e7 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Mon, 26 Feb 2024 09:17:01 -1000 Subject: [PATCH] scx: Fix spurious ops verification failure due to missing jiffies conversion ops->timeout_ms wasn't being converted to jiffies before testing against SCX_WATHCDOG_MATX_TIMEOUT which led to spurious verification failures when with lower HZ kernels. Fix it. Link: https://github.com/sched-ext/scx/issues/151 (cherry picked from commit 90b8f6ee04e28a0c7a41fff17cbbb04f48715c2e) --- kernel/sched/ext.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c index 327fcdfb6b564..b74d1a0bc78a3 100644 --- a/kernel/sched/ext.c +++ b/kernel/sched/ext.c @@ -4057,7 +4057,8 @@ static int bpf_scx_init_member(const struct btf_type *t, return -EINVAL; return 1; case offsetof(struct sched_ext_ops, timeout_ms): - if (*(u32 *)(udata + moff) > SCX_WATCHDOG_MAX_TIMEOUT) + if (msecs_to_jiffies(*(u32 *)(udata + moff)) > + SCX_WATCHDOG_MAX_TIMEOUT) return -E2BIG; ops->timeout_ms = *(u32 *)(udata + moff); return 1;