Re: [PATCH 4/5] sched: pause KCOV in try_to_wake_up()
From: sashiko-bot
Date: Fri Aug 07 2026 - 17:00:52 EST
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The patch mixes a goto-based manual cleanup with a `guard()` declaration in the same function, violating cleanup subsystem guidelines.
--
--- Patch [4]: [PATCH 4/5] sched: pause KCOV in try_to_wake_up() ---
commit 96c5de7cc097dcbb15a79c4c86f4148070fd31cf
Author: Karl Mehltretter <kmehltretter@xxxxxxxxx>
sched: pause KCOV in try_to_wake_up()
This patch pauses KCOV instrumentation around try_to_wake_up() to prevent
instrumented helpers from recording into current while in task context. It
saves the pause state and manually resumes it at the function's exit label.
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -4252,6 +4252,8 @@ int try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
> {
> guard(preempt)();
> int cpu, success = 0;
> + /* KCOV: sched/ is uninstrumented but the wakeup callees are not. */
> + unsigned int kcov_paused = kcov_pause(current);
[ ... ]
> @@ -4418,6 +4420,7 @@ int try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
> if (success)
> ttwu_stat(p, task_cpu(p), wake_flags);
>
> + kcov_resume(current, kcov_paused);
> return success;
> }
[Severity: Low]
Does this mix manual goto-based cleanup with scope-based guard() declarations?
The cleanup subsystem guidelines recommend that goto-based error handling and
cleanup helpers should not be mixed in the same function, as it can confuse
ownership semantics and increase the risk of resource leaks if early returns
are added later.
In try_to_wake_up(), guard(preempt)() is used at the top of the function,
but this patch introduces a manual kcov_resume() cleanup step at the out:
label.
Could this KCOV pause and resume be handled using a scope-based cleanup helper
to match the existing guard() usage, preventing the mixed paradigms?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260807205027.31972-1-kmehltretter@xxxxxxxxx?part=4