From nobody Sun Jun 14 15:55:22 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B514A390CAA; Fri, 3 Apr 2026 12:30:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775219428; cv=none; b=KJohWowJkTvbvTcvS8qF2RMHXx72lt2EN3M0PYNrFVyfxuBBy1psb4x++SGnBHcufgZN4emdp4Yxo8X7JmAY+MEyJXZpwShxR9QX7MMyA8IsxERUlqqEgZWxPhX9QNrzf3D8UOXzgUgpZJWNyKeYuZZfwQ0bBNraivDmMksExDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775219428; c=relaxed/simple; bh=8IqZRBif4ZJMgaiq7arQPFme1/tm1Nq3LbY3YpU9LS0=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=AsjEsPROSibOmfIyaHCFrUQDgal/BnHkA3jHzJwWj7f4xG+9/oJOIbojJYWT2Bu4wM+16a4Mgniz0/L5pT9FVtWEyA+k/ApWyN6Ldt6dTskKZovLpz3Y6cmw2qqvNkYw4f0zR9/cHhCTTSaoq0RSNJqNaAT4DyEEzj/imSI1bTs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Z+Egy8m7; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=86VcEx9/; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Z+Egy8m7"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="86VcEx9/" Date: Fri, 03 Apr 2026 12:30:23 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1775219424; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cNrH1sNmZx9x+aKZOuctwZDoggLVQtHf7yGnt0hf220=; b=Z+Egy8m71+U29GSdE+g9JiopSsgBGGVERQxVVaGpOzgfkUHyJK0S2teA86XKiN0cXiT+z+ 8/8VueF1Go53jE5YF1efkjI9ROtESEp8AUkT1YShE7UBcnra4FIGt+wYbYgeO16aa7g80j UstF+HWJQAWYJXG3Jlq1VVbragsXRVVTTfcgE0e5s7xdXGbWGGDgiTaaCk9INK7SC2L5lT 3NEnlfzjnZyCL2i3mhgSvaJF9demFX1M4gCUo1IEMHrCJID7hVPPjMLIwXXuQtK7/DbXq/ 9z/CG7Pd52ZzAqYaM8Pz/hbKmnqCllDy9ubHSQgFmTjMuLRXkFvLolFSq9twRQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1775219424; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cNrH1sNmZx9x+aKZOuctwZDoggLVQtHf7yGnt0hf220=; b=86VcEx9/TN3CXWv08cpXoSt4QGhMEJjShZVETpSuw5tfJJw/vB/7J302pCwSQOU5LBjEWr 39m4yyT7PyxWCaBw== From: "tip-bot2 for John Stultz" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched: Fix modifying donor->blocked on without proper locking Cc: John Stultz , "Peter Zijlstra (Intel)" , K Prateek Nayak , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260324191337.1841376-6-jstultz@google.com> References: <20260324191337.1841376-6-jstultz@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177521942343.1647592.2042967580248157828.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the sched/core branch of tip: Commit-ID: 56f4b24267a643b0b9ab73f09feaaabfee5a37ae Gitweb: https://git.kernel.org/tip/56f4b24267a643b0b9ab73f09feaaabfe= e5a37ae Author: John Stultz AuthorDate: Tue, 24 Mar 2026 19:13:20=20 Committer: Peter Zijlstra CommitterDate: Fri, 03 Apr 2026 14:23:39 +02:00 sched: Fix modifying donor->blocked on without proper locking Introduce an action enum in find_proxy_task() which allows us to handle work needed to be done outside the mutex.wait_lock and task.blocked_lock guard scopes. This ensures proper locking when we clear the donor's blocked_on pointer in proxy_deactivate(), and the switch statement will be useful as we add more cases to handle later in this series. Signed-off-by: John Stultz Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: K Prateek Nayak Link: https://patch.msgid.link/20260324191337.1841376-6-jstultz@google.com --- kernel/sched/core.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 1913dbc..bf4338f 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6568,7 +6568,7 @@ static struct task_struct *proxy_deactivate(struct rq= *rq, struct task_struct *d * as unblocked, as we aren't doing proxy-migrations * yet (more logic will be needed then). */ - donor->blocked_on =3D NULL; + clear_task_blocked_on(donor, NULL); } return NULL; } @@ -6592,6 +6592,7 @@ static struct task_struct *proxy_deactivate(struct rq= *rq, struct task_struct *d static struct task_struct * find_proxy_task(struct rq *rq, struct task_struct *donor, struct rq_flags = *rf) { + enum { FOUND, DEACTIVATE_DONOR } action =3D FOUND; struct task_struct *owner =3D NULL; int this_cpu =3D cpu_of(rq); struct task_struct *p; @@ -6625,12 +6626,14 @@ find_proxy_task(struct rq *rq, struct task_struct *= donor, struct rq_flags *rf) =20 if (!READ_ONCE(owner->on_rq) || owner->se.sched_delayed) { /* XXX Don't handle blocked owners/delayed dequeue yet */ - return proxy_deactivate(rq, donor); + action =3D DEACTIVATE_DONOR; + break; } =20 if (task_cpu(owner) !=3D this_cpu) { /* XXX Don't handle migrations yet */ - return proxy_deactivate(rq, donor); + action =3D DEACTIVATE_DONOR; + break; } =20 if (task_on_rq_migrating(owner)) { @@ -6688,6 +6691,13 @@ find_proxy_task(struct rq *rq, struct task_struct *d= onor, struct rq_flags *rf) */ } =20 + /* Handle actions we need to do outside of the guard() scope */ + switch (action) { + case DEACTIVATE_DONOR: + return proxy_deactivate(rq, donor); + case FOUND: + /* fallthrough */; + } WARN_ON_ONCE(owner && !owner->on_rq); return owner; }