From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=193.142.43.55 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796319771; b=mgEoPgi9OgzsjJ7V37JOfJh5RtG2VmMIVwPPcU+u6WfDln0QdldL7zprBvcS3AEgOr/2 LF+cMRthC+waG+QD9F/qVoxiITqwOM2HCyHtLrtBYbUSnnotXcQ4WanrFJsIj20qpySal ihvhgHJsaBXOFysh2DeBZcolMe2h3JT2C9BBH+gvZFKY8SnK1YuxxSf0Byac+NrLzrUs4 Fvk/qaJdTKLbm0BpEEA5DOawD3nrnzPSkmDKrB6D2leevVWQoKp+nsr9nhquvObyiEN/9 5uq6ni/x4NtyBjV+1AHmNXSQpE57j6dZuK/xW7kkNUF9OcmKu0ZvgTKrM1lc8PVJUKA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796319771; h=DMARC-Filter:Date:DKIM-Signature:DKIM-Signature:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=vISowYgZuENwy1UiNi/gu+O/8vrgL4kb9ksSJWkZ7f0=; b=mNiUzXBBVWcZIpZabScq/GMtTuWIUSHKQCwD1+Lc43brk+VRnGVBEfyXYMUWqLSN12WG A/Le+VMK/8+XOfdQ+qNQOHMvjqJfKD7EEhZG4zE0NS6/WF0yThh/yJrEZkvm7rzg4IuNn PHYc92ReOhalD52y/T2ll0TsbsdKbfInuR8wf6FlnepI4u6E5rw7mVVWaeEFx3GaVwLC7 OAU1DXxLRanAtZy6LlfyZbMscY0U1fnK3S5mnCzVGQ84WwPolDohP3/rE6a8OMbK+byb7 DLIweCTurSbWXk5YJQed4vbBQfJqvk/iHuuS3n5EOFXhLQBpqo6G7ju6fyxy7KfqbLA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=LRvkQg1v; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b="oaa8wJ/a"; arc=none smtp.remote-ip=193.142.43.55 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7CCF606A322 for ; Thu, 3 Dec 2026 17:42:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E7CCF606A322 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.a=rsa-sha256 header.s=2020 header.b=LRvkQg1v; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=oaa8wJ/a Date: Thu, 3 Dec 2026 18:42:46 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1796319768; h=from:from: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=vISowYgZuENwy1UiNi/gu+O/8vrgL4kb9ksSJWkZ7f0=; b=LRvkQg1vPRAjKxgi44QnLVi8PHd+bCcH9VeP9w2CG3jj2hSVUuw8mepm+9KZAO8txj1Mvm pHjWmVaPpdIo0GhMHCk5jk1645GFvpRxK4Y+h9itSPOGxJkjSe974mwKTkyPfaqor/JRYo aJBpwOyP+rVB+yGPPHPN3joQVhJBtlbmGm4SiPViBRksXBzQJUE1Po3IsIIWs1toYNuLUL F9ivIUn3kr/L3f+UN0wO9gEsLdIWPRz2Lv0BBINf37VQJm7nt5o81J+4tBK0UbiDVNasuj ejKXeBkgWBaaOW+F9MU9DReac3csAdDfMd3cyFZPpy1UlmN+PDmOJpKEhnQPaw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1796319768; h=from:from: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=vISowYgZuENwy1UiNi/gu+O/8vrgL4kb9ksSJWkZ7f0=; b=oaa8wJ/aCwjr1duqj8TcaYyS++UHSyCuv0nZOtEN3MFxbyITBfuCNeiwEYQo4pZScxI42y rlPsgM4xPWWfhKDQ== From: Sebastian Andrzej Siewior To: Peter Zijlstra Cc: Karl Mehltretter , linux-kernel@vger.kernel.org, syzbot , Thomas Gleixner , Radu Rendec , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak Subject: Re: [PATCH v3] sched: Reset cpumask if __migrate_task() failed for migration_cpu_stop() Message-ID: <20261203174246.q5_fUNj8@linutronix.de> References: <20261125172018.GD2668564@noisy.programming.kicks-ass.net> <20261125193735.qrxCdHTx@linutronix.de> <20261126104049.GC49833@noisy.programming.kicks-ass.net> <20261128172430.69629-1-kmehltretter@gmail.com> <20261202144240.GG2668564@noisy.programming.kicks-ass.net> <20261203130519.GC677025@noisy.programming.kicks-ass.net> <20261203141949.JSxiFc7A@linutronix.de> <20261203143355.GD677025@noisy.programming.kicks-ass.net> <20261203153738.GF83911@noisy.programming.kicks-ass.net> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20261203153738.GF83911@noisy.programming.kicks-ass.net> On 2026-12-03 16:37:38 [+0100], Peter Zijlstra wrote: > > \o/ > >=20 > > OK, let me go split this into a few patches and commit somewhere. >=20 > git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/urge= nt Still works. Mind to fold the snippet at the bottom? I don't hit the corner case: |__set_cpus_allowed_ptr_locked() |{ =E2=80=A6 | dest_cpu =3D cpumask_any_and_distribute(cpu_valid_mask, ctx->new_= mask); | if (dest_cpu >=3D nr_cpu_ids) { | ret =3D -EINVAL; | goto out; | } =E2=80=A6 |} =66rom ___migrate_enable() and I'm not sure why that is. It might be because the CPU mask is never invalid to begin with in this test case. But a CPU affinity change from userland on a thread which is in a mg-disabled section might do this. diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 54df37f18ba0e..514c4b5290244 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3341,9 +3341,9 @@ void force_compatible_cpus_allowed_ptr(struct task_st= ruct *p) alloc_cpumask_var(&new_mask, GFP_KERNEL); =20 /* - * __migrate_task() can fail silently in the face of concurrent - * offlining of the chosen destination CPU, so take the hotplug - * lock to ensure that the migration succeeds. + * migration_cpu_stop() can silently choose a different CPU in the face + * of concurrent offlining of the chosen destination CPU, so take the + * hotplug lock to ensure that the migration succeeds. */ cpus_read_lock(); if (!cpumask_available(new_mask)) Sebastian