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 5005D1A9B49; Thu, 19 Dec 2024 17:53:38 +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=1734630819; cv=none; b=uxJRp0+kxwAeROrtGapngPzqS142hGIDu4vz7tcdcscUE7VMp2rnhijUbIJWAWB94H2Fgpr+tgXPd8i9n7LkJhfYDCjvTDhNVfniSTchsbxK7EmE5/S39Hyl/4h8ZgY+bEXiDNRIGDtiyAIB83PP72IPU38Sh37CZFex+Pq7Gag= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734630819; c=relaxed/simple; bh=+MS8WsvyH4wurctyB4h2sjodSd09eiAmG8oqiiYkCac=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BTimgE5NeZ8vQQpRPzQpjg8l3bymLI+8NNs6g2bjFZiHlvLQFw0IbgB3FZPfF1JMjI4q1Kd+bsRzLyO7aiDPZLEkE2wuhmbULB4i3hRklyE/xpptbFzTAE5Rj8OPwW5A8HEQ4XtuISZVBUWJE8g1Awd3/+BnITOsNSYauwkH0cA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (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=mwzJHLCJ; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (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="mwzJHLCJ" 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=IcbFb4XLo/2+UExPKSMe9Lg9+FlducLszU1JA2hYqRY=; b=mwzJHLCJeLh5m6YpIQjt9xI2/J RDCSOg/8YItvhtsDxqZQmXUqehAhZ95QYOvcVflMW8DMku4NZjQPMQIPD8GW8xMWtu3NQ6FKp3Zgx 999dbyiQ8lkJoNbTPYP2emETiOuePKUXRoPCtzt3ktmnqGiaJNEg52NrqhfabKofkk+aL0meNQf8d sEAyyE+1/PY1/fPttH0dfg3dAJolbeLssXgpnlTdqr5933exGc9PZt/KwZ/zvpWFqH6+Dn1TerrKB l0fzt96peimX+OUdupVX5bw9Q9p8/w0EloyqNvVe00tlynOQQztnqrdjdM5f4GxlLbXi22ojYk42E oel0TSBg==; Received: from 77-249-17-89.cable.dynamic.v4.ziggo.nl ([77.249.17.89] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tOKiL-00000004dlP-2KMs; Thu, 19 Dec 2024 17:53:34 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 9553E30031E; Thu, 19 Dec 2024 18:53:33 +0100 (CET) Date: Thu, 19 Dec 2024 18:53:33 +0100 From: Peter Zijlstra To: Florian Weimer Cc: "Paul E. McKenney" , Daniel Xu , mingo@redhat.com, will@kernel.org, longman@redhat.com, boqun.feng@gmail.com, linux-kernel@vger.kernel.org, linux-toolchains@vger.kernel.org Subject: Re: [PATCH] seqlock: Use WRITE_ONCE() when updating sequence Message-ID: <20241219175333.GE26279@noisy.programming.kicks-ass.net> References: <0eaea03ecc9df536649763cfecda356fc38b6938.1734477414.git.dxu@dxuuu.xyz> <20241218103000.GK11133@noisy.programming.kicks-ass.net> <20241218162325.GH2354@noisy.programming.kicks-ass.net> <20241218162934.GJ12500@noisy.programming.kicks-ass.net> <9b6d585a-c17f-4dd1-9518-b28ac2dfd855@paulmck-laptop> <20241218171241.GN2354@noisy.programming.kicks-ass.net> <87v7vgzrxk.fsf@oldenburg.str.redhat.com> <87v7vfwrj8.fsf@oldenburg.str.redhat.com> Precedence: bulk X-Mailing-List: linux-toolchains@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: <87v7vfwrj8.fsf@oldenburg.str.redhat.com> On Thu, Dec 19, 2024 at 05:45:15PM +0100, Florian Weimer wrote: > > Peter's "(*(volatile unsigned int *)&s->sequence)++;" qualifies as sane. > > I think the reference was originally to machine code. Correct; however more tinkering with godbolt got me: https://godbolt.org/z/6xoxjdYPx Where we can see that clang can even optimize the WRITE_ONCE(foo, READ_ONCE(foo) + 1) case, which I though it would not be able to do. So perhaps we just need to get GCC fixed.