From nobody Fri Dec 19 17:57:00 2025 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 BBD7D32E12D for ; Thu, 4 Dec 2025 10:43:36 +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=1764845019; cv=none; b=NM4zyPDS3B9kPB4WO2VtF/TXb6Tw3RxnmP1m2oZYbOGfb9axZ0qyzNVOmTPkc6SEy+uAEPocpchRLJsDCK9Ifwuk8thj/15S60EHTbM5ro4x4xfhUUhV6K2pGq7TuEtl8AkNQKxprkFLN5fd0glWvoGr8OSM5HRnNEXJcF/Clek= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764845019; c=relaxed/simple; bh=eD/2pR9P3xgR2SQCV60TSX0P1jTVr5Cmv4iJtSSmTNg=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=GDq6ATJxy0Oi38xl5JIYEbLz/JCFRNj+HB8yH1pp+LVf9i2/O30is9PFVQ87zN+mGQhgHK+c7+U1QvebAsl0yQwxWGbNd8Gcs7RNFeL4NyrKQE08iXOik+pVTJOkOLyQfVOjwX/We841z8i8pc02O6ZhzPXTqHiXlhcK/cLz200= 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=iN0UGT/I; 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="iN0UGT/I" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:In-Reply-To:References; bh=99CbDGzK2Pr9BLERjjfES8OJcCXC8D5R7QeDmmxm7Xg=; b=iN0UGT/IIkzXNyJgNZ47XZEhfq qYcva9kDxdd0o29RMe6N57SkR1gvwPXf4aXP85Kiavw7mKO9q0OlE+F8tp6nae+7LnYDqAjlGRm4l xc+kXWBTVsJ5g0P6p4VL31hKOZeSV4/r5R7ZIujDCqZ2e71Wiof0jqDyjslMhioAx8LjTEbt8+lyM zXCBCU4AwhfrfpJjr5IrOw5q2m9dHChCTKK+Ux/ODfn7e8TwKrT1mOmGNErCfxShEsiIJ+3JyODOr z3IlKPQANrECN8uAkfVdP7iDnQCiMFsr5IAB4slxPOkM+C8cS7Dzfr6rZrk5G9HoTUmIuddX2Br+9 ASNq1tQg==; Received: from 2001-1c00-8d85-5700-266e-96ff-fe07-7dcc.cable.dynamic.v6.ziggo.nl ([2001:1c00:8d85:5700:266e:96ff:fe07:7dcc] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1vR6o9-000000043wc-3Np2; Thu, 04 Dec 2025 10:43:34 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id CFF8A3004B8; Thu, 04 Dec 2025 11:43:32 +0100 (CET) Date: Thu, 4 Dec 2025 11:43:32 +0100 From: Peter Zijlstra To: arnd@arndb.de, mingo@kernel.org, oleg@redhat.com Cc: linux-kernel@vger.kernel.org Subject: seqlock: Cure some more scoped_seqlock() optimization fails Message-ID: <20251204104332.GG2528459@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-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- For tip/locking/urgent include/linux/seqlock.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h index a8a8661839b6..221123660e71 100644 --- a/include/linux/seqlock.h +++ b/include/linux/seqlock.h @@ -1224,7 +1224,7 @@ struct ss_tmp { spinlock_t *lock_irqsave; }; =20 -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 =20 -static inline void +static __always_inline void __scoped_seqlock_next(struct ss_tmp *sst, seqlock_t *lock, enum ss_state t= arget) { switch (sst->state) {