All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Karl Mehltretter" <kmehltretter@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev
Subject: Re: [PATCH 4/5] sched: pause KCOV in try_to_wake_up()
Date: Fri, 07 Aug 2026 21:00:44 +0000	[thread overview]
Message-ID: <20260807210044.D89FA1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260807205027.31972-5-kmehltretter@gmail.com>

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@gmail.com>

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@gmail.com?part=4

  reply	other threads:[~2026-08-07 21:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 20:50 [PATCH 0/5] kcov: suppress timer and scheduler coverage leaks Karl Mehltretter
2026-08-07 20:50 ` [PATCH 1/5] kcov: add kcov_pause()/kcov_resume() helpers Karl Mehltretter
2026-08-08  1:16   ` Bradley Morgan
2026-08-07 20:50 ` [PATCH 2/5] hrtimer: pause KCOV during deferred rearm Karl Mehltretter
2026-08-08  1:19   ` Bradley Morgan
2026-08-07 20:50 ` [PATCH 3/5] sched: pause KCOV in __schedule() Karl Mehltretter
2026-08-08  1:21   ` Bradley Morgan
2026-08-07 20:50 ` [PATCH 4/5] sched: pause KCOV in try_to_wake_up() Karl Mehltretter
2026-08-07 21:00   ` sashiko-bot [this message]
2026-08-08  1:28   ` Bradley Morgan
2026-08-07 20:50 ` [PATCH 5/5] sched: pause KCOV in wake_up_new_task() Karl Mehltretter
2026-08-08  1:36   ` Bradley Morgan
2026-08-10 21:57     ` Karl Mehltretter
2026-08-08  8:44 ` [PATCH 0/5] kcov: suppress timer and scheduler coverage leaks Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260807210044.D89FA1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kmehltretter@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.