From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2C79B37647F for ; Mon, 30 Mar 2026 20:09:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774901388; cv=none; b=kF8xP4O3R5tu57ZzGw65v6iWtrOoi7P/7MUcEVqbZyhDMwa3s2kynGNecv8fVWPrlkp+jsCRqiua62eY33ek1nnHWZL8GnU0dyj1DVvVVuAP1bvOSxQk1F0Grgtf8u/F04kct5Bzbb7VqCJqa4FkZykByj1rsWDloUM1jIkZCNE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774901388; c=relaxed/simple; bh=qcy0wsmFb6DM2weTOy1c79a28JDxGmcAK+gT71jLsXE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UI7t1i2eoTKZCb+OUm1+rqXWqrFNkc/X2TCVSIHaApDkGrOrc6Uk8keSs8/5GxHnR58zhb+tDSg11RUZGCJb6K3DmUvNJcmGMLJQJfdCNgiOEjgsXw+n/cdYFyonRrP+q1mGISLWQuobSkzfQPJdEA7X1sRyPbtkZI/ef3i4zzw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Hp17YubH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Hp17YubH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB48AC4CEF7; Mon, 30 Mar 2026 20:09:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774901387; bh=qcy0wsmFb6DM2weTOy1c79a28JDxGmcAK+gT71jLsXE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Hp17YubHP8yTF4PoZuqMISG40zXSzF7ybqBteOjZdKKRQJmqSh3Iz3/K+STUtvN/G 2ACjsYuUjsMAU5MwqWjJfoj8zkcBQoNXB5At4Zbb0mX2qkQHvfBg6XhOCmn5z5pUO6 rYVjFw8cD2gT9o2jlOiFeXoVVRAsaPAdcnshf1KO/Z4CfaF3N+Nd6N6fvEDz8Qa7tK oZxsw2bSREay9Q0sMfEP4kZKRFpi8/XwGYeQ0Qv2GL9+uPEXck/qROxrK8ahXSiTmV Tk3QM/IpNGV0bBzDmfx+sozL1ymx6VgI7jit7yJUPrBM/fNqpNGh7nM9ULStW9fUKs 8kSpx6HB2BnOQ== Date: Mon, 30 Mar 2026 10:09:46 -1000 From: Tejun Heo To: Peter Zijlstra Cc: Yu Peng , mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, jiangshanlai@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sched,workqueue: Use READ_ONCE()/WRITE_ONCE() for wake_cpu accesses Message-ID: References: <20260327073007.254673-1-pengyu@kylinos.cn> <20260327092739.GB3739027@noisy.programming.kicks-ass.net> <20260330143629.GP3738010@noisy.programming.kicks-ass.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260330143629.GP3738010@noisy.programming.kicks-ass.net> Hello, Peter. On Mon, Mar 30, 2026 at 04:36:29PM +0200, Peter Zijlstra wrote: > > Hmmm... it would trigger KCSAN. Maybe a better way to do it is exposing > > sched interface that does WRITE_ONCE wrapping? How do you want it resolved? > > Perhaps a try_to_wake_up() variant that takes a cpumask (see the > completely untested code below). But I'm not entirely sure. The current > thing very much relies on a bunch of implementation details that aren't > guaranteed. > > The below will 'fake' the task cpumask for a while; and note that the > caller has to be careful to provide a mask that only includes tasks that > were set in the current task, otherwise 'funny' things will happen. > Also, it will only use this mask if it ends up doing CPU selection at > all. > > Ooh, I suppose I should make sure wake_cpu is inside the provided map > too... Does it need to be? I think all select_task_rq() implementations ignore it if it's outside allowed. I think all we'd need is cpumask_subset() test to reject (and trigger WARN_ON_ONCE()) if the preferred mask is not within the allowed. Thanks. -- tejun