Re: [PATCH v2 6/6] sched/core: Pause KCOV in wake_up_new_task()

Peter Zijlstra <[email protected]>
Newsgroups dev.linux.lists.linux-rt-devel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Tue, Aug 11, 2026 at 05:41:11PM +0200, Karl Mehltretter wrote:
> wake_up_new_task() is uninstrumented, but CPU selection and enqueue call
> instrumented helpers. During a KCOV-enabled fork, they can record
> scheduler, hrtimer and clockevent coverage into the parent.
> 
> The paths depend on runqueue and CPU state, so coverage varies between
> identical forks. Pause KCOV for the whole function, extending the
> scheduler exclusion to new-task wakeups.
> 
> Fixes: 5c9a8750a640 ("kernel: add kcov code coverage")
> Assisted-by: Claude:claude-fable-5
> Signed-off-by: Karl Mehltretter <[email protected]>
> ---
> Notes:
>     v2:
>      - take guard(kcov_pause)()
>      - reword the pause comment
> 
>  kernel/sched/core.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index e863fac02e38f..f7ddfbbb5a494 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -4947,6 +4947,9 @@ void wake_up_new_task(struct task_struct *p)
>  	struct rq *rq;
>  	int wake_flags = WF_FORK;
>  
> +	/* Instrumented callees would leak coverage into current. */
> +	guard(kcov_pause)();

I'm sure you know what I'm about to say now, right?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.