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 3B3EB285068 for ; Sat, 6 Dec 2025 08:50:56 +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=1765011057; cv=none; b=mfQCOmbkVR1z6s9OJCxj2MVr9GcgXpr0964l6Py0BsGpIOgZFQkR8jeJeupg7Lvwjb3tOa8uEnAX+5kElCo4OaphaZwREFLCUFTUpm5koK/z3NqDTBtCNY9WcXg5eI/ezm9nn00BEWxeSx7MmEQquAZFHGKwZxoqEtmxFM3fvrI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765011057; c=relaxed/simple; bh=3cK4ZIDeqBlalfTWkBKvpd++mAxsaoQtVfnjEqFPQwE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fYfnKLpWTkRynjt3HY/8JPAEPzaXn7lWJ96Z6iIUjj6T55+3FQYRyR0P+gRIcRvUUnF7CIoqWpbzm5bIuZGLwfi5Ex9guD2YR/18z9X6yg6p5p90+GSSINyKoJZ49BgcHCOcOWn8cXUgdqCywg8mSxE2jONMkKU7dWjp9TMEHd8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eXVX6qDD; 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="eXVX6qDD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F564C4CEF5; Sat, 6 Dec 2025 08:50:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765011056; bh=3cK4ZIDeqBlalfTWkBKvpd++mAxsaoQtVfnjEqFPQwE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eXVX6qDDOEsovVIpjmqK6m96zbSVZaPDsMQMo/UzOjLDE5tHHqCknSRgXw+YCbVqu qtldfu+/kC882Sv6LHYSlVbOjz+5C9vg1LyzKTDKoSTIKhdJDUb276BlP8ObjkvHuX lUsjZAhEKkTercckXTCuZSdpmtxjltF5WLFu7bY4RVQuh8misb3Vpzw2m6SGF6TKUx VRfZDdu4gILAtlg2YrDOYEziAW+fsFeCBmd8bin+lJIu/nRK66IsDBpkgk7KbBqayy MF0ehxSdphlSEvurBVfIlJ7oIcpQOI3ZFa5/CAEaCAEU97lTWxQHEKp2p3Nx31l4N8 DyxZ/jLtxAg7w== Date: Sat, 6 Dec 2025 09:50:52 +0100 From: Ingo Molnar To: Arnd Bergmann Cc: Peter Zijlstra , Oleg Nesterov , linux-kernel@vger.kernel.org Subject: Re: seqlock: Cure some more scoped_seqlock() optimization fails Message-ID: References: <20251204104332.GG2528459@noisy.programming.kicks-ass.net> <9f6a864e-f608-4543-874e-09ab034717e9@app.fastmail.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: <9f6a864e-f608-4543-874e-09ab034717e9@app.fastmail.com> * Arnd Bergmann wrote: > On Thu, Dec 4, 2025, at 11:43, Peter Zijlstra wrote: > > Arnd reported an x86 randconfig using gcc-15 tripped over > > __scoped_seqlock_bug(). Turns out GCC chose not to inline the > > scoped_seqlock helper functions and as such was not able to optimize > > properly. > > > > Reported-by: Arnd Bergmann > > Signed-off-by: Peter Zijlstra (Intel) > > Tested-by: Arnd Bergmann > > > > > -static inline void __scoped_seqlock_cleanup(struct ss_tmp *sst) > > +static __always_inline void __scoped_seqlock_cleanup(struct ss_tmp *sst) > > { > > if (sst->lock) > > spin_unlock(sst->lock); > > @@ -1252,7 +1252,7 @@ static inline void __scoped_seqlock_bug(void) { } > > extern void __scoped_seqlock_bug(void); > > #endif > > > > -static inline void > > +static __always_inline void > > __scoped_seqlock_next(struct ss_tmp *sst, seqlock_t *lock, enum > > ss_state target) > > { > > switch (sst->state) { > > It looks I got close: I had tried the __always_inline on > __scoped_seqlock_next but missed the one on __scoped_seqlock_cleanup, > so that was not enough. Same here, I ran into that build failure and ended up finding this as a side-effect: 24bc5ea5c01a ("seqlock, procfs: Match scoped_seqlock_read() critical section vs. RCU ordering in do_task_stat() to do_io_accounting()") And like you I was trying to work around the compiler failure via forced-inlining of __scoped_seqlock_next(), but missed __scoped_seqlock_cleanup() ... :-) > > Your version addresses the issue for me, thanks a lot for the fix! Works for me too, and I've applied the fix to tip:locking/urgent. Thanks, Ingo