From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 E51313F8709 for ; Mon, 18 May 2026 14:35:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779114941; cv=none; b=Vyn27cviYd9yiqlpK+bV1AJPTJeRakOeAmeWuY38OUlnu7gGhcXVFl3coMNvDfVv2WmGd3tSH6LN8i8HM/FQodzl3NwfIkj2mlSg9dwk9SI7JKxegArCrdXPuEY8c9jxfkxx8LFy9KPq/lsbgC9FcrEvwaRds95uLrbvNJr2+TU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779114941; c=relaxed/simple; bh=KzzAVNndQT/TAUXrnEU0d7G/BtU7nvPIpDFQi/+Yq6A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Y3TmzwjC8sCiaXPOQje5jPYHUYajTad56LuWxFUhYAHNbj52qEi136b+/YvpRCfGuei98DuZdXP0J+IfPBjaeEuY9f+dk7bqZ0OHhGVKZgyDB66O8hs8bx3hr59OPmYChigolcUFn7PccaN4mWwDJnhYq0v6H6TK/jwsv1lHaFI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=MjcD5jfL; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="MjcD5jfL" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=g2oHaeAYR6vajhH00bxwn98FAvnNFml5Q9o1GmG24pw=; b=MjcD5jfLVVr705VWiYqNG8T/f6 gwmiE5DVpeB1IOExJCXmJhPV+4AWs2Oc3TGsnxTIRkmZinCSn6jiydutZctGC/FVk4IMIPdqJmmcl ovgd51lQXkSY8IRodgyABR9nAdyNhkbrEQAq3zCwDRl5AQ7Nm/00BRJ3IDKAdZIPwbzpOwQUi6lie aE3D46AR/5tFv/dJZ5v5KpEpEJtt0c7MuO2tIN8iYM9ztG/9vA5z7SLbUZTKirfYKCwiwlALEzs+Q mNUuy/B336IMZoMWlbZzDLTg7ZYYJItBwcuav6ECF8EOKYzEHvBU7T6AOyykSrZXiQ3dKoPp1rg/u I8WJA4Yw==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.99.1 #2 (Red Hat Linux)) id 1wOz3Q-00000004rSo-21cT; Mon, 18 May 2026 14:34:48 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 0C9F23001D0; Mon, 18 May 2026 16:34:47 +0200 (CEST) Date: Mon, 18 May 2026 16:34:46 +0200 From: Peter Zijlstra To: Tim Chen Cc: Ingo Molnar , K Prateek Nayak , Vincent Guittot , Chen Yu , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Madadi Vineeth Reddy , Hillf Danton , Shrikanth Hegde , Jianyong Wu , Yangyu Chen , Tingyin Duan , Vern Hao , Vern Hao , Len Brown , Aubrey Li , Zhao Liu , Chen Yu , Adam Li , Aaron Lu , Tim Chen , Josh Don , Gavin Guo , Qais Yousef , Libo Chen , Luo Gengkun , linux-kernel@vger.kernel.org Subject: Re: [Patch v4 12/16] sched/cache: Fix race condition during sched domain rebuild Message-ID: <20260518143446.GV3102624@noisy.programming.kicks-ass.net> References: <9afddf439687f04bb56b46625bd9f153eb8abad5.1778703694.git.tim.c.chen@linux.intel.com> 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: <9afddf439687f04bb56b46625bd9f153eb8abad5.1778703694.git.tim.c.chen@linux.intel.com> On Wed, May 13, 2026 at 01:39:23PM -0700, Tim Chen wrote: > /* > * Enable/disable cache aware scheduling according to > * user input and the presence of hardware support. > + * Expected to be protected by cpus_read_lock() and > + * sched_domains_mutex_lock() > */ > -static void sched_cache_active_set(bool locked) > +static void _sched_cache_active_set(void) Like so? --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -920,11 +920,12 @@ static bool alloc_sd_llc(const struct cp /* * Enable/disable cache aware scheduling according to * user input and the presence of hardware support. - * Expected to be protected by cpus_read_lock() and - * sched_domains_mutex_lock() */ static void _sched_cache_active_set(void) { + lockdep_assert_cpus_held(); + lockdep_assert_held(&sched_domains_mutex); + /* hardware does not support */ if (!static_branch_likely(&sched_cache_present)) { static_branch_disable_cpuslocked(&sched_cache_active);