From 9c699cfdb87a0d09a7d84c354a6943c8c8878431 Mon Sep 17 00:00:00 2001 From: claudio Date: Tue, 9 Jul 2024 08:44:36 +0000 Subject: [PATCH] In sched_toidle() only call the TRACEPOINT if curproc is set. sched_toidle() is called by cpu_hatch() to start APs and then curproc may be NULL. OK mpi@ --- sys/kern/kern_sched.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c index 3cf220c7f82..0ee96518332 100644 --- a/sys/kern/kern_sched.c +++ b/sys/kern/kern_sched.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sched.c,v 1.99 2024/07/08 16:15:42 mpi Exp $ */ +/* $OpenBSD: kern_sched.c,v 1.100 2024/07/09 08:44:36 claudio Exp $ */ /* * Copyright (c) 2007, 2008 Artur Grabowski * @@ -261,8 +261,9 @@ sched_toidle(void) idle->p_stat = SRUN; uvmexp.swtch++; - TRACEPOINT(sched, off__cpu, idle->p_tid + THREAD_PID_OFFSET, - idle->p_p->ps_pid); + if (curproc != NULL) + TRACEPOINT(sched, off__cpu, idle->p_tid + THREAD_PID_OFFSET, + idle->p_p->ps_pid); cpu_switchto(NULL, idle); panic("cpu_switchto returned"); } -- 2.20.1