Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp208504rdb; Thu, 19 Oct 2023 01:55:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF8Xi1FGanm/bTWtvFrlTox3tOtnZTNExMLElE6JJEQjSXxPHYH0GPJSfG7F6o5dlpAEipG X-Received: by 2002:a05:6a00:150c:b0:693:4a43:1c7e with SMTP id q12-20020a056a00150c00b006934a431c7emr1345939pfu.29.1697705725979; Thu, 19 Oct 2023 01:55:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697705725; cv=none; d=google.com; s=arc-20160816; b=CUPI8u1mbMA2v7osgsimFJqT7Zn/Y9cy4npWMQe3jzUNFU3wn0gc9FzGKf8XmUctUb 0/WfY/qUedZVChfKuMFXflksGNx7vtz0dX79XmIoqG10wX3pJPr1u5PQlccgoSf7R51R fUfGAmfRNoB6VTM6FXfM95uaFBJXUrtKMl8jZ5j7CKlw43A8kVlvfUUnB4PfR+TgeTlS Qid6Z5ngdAURVb6AsnjLlYLFrm5Q/86A6pyRo5OXE2ymeZPAhpAV9Q+XYVyrtSPYS3Go 14RErfEJXLw2RTTa8PI1wJqAdUh/n31H4siZb0mViyyw1D4EJq92cUYQx8DDvYC4878U AFpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rBlcqozqb9PEqqWS5+27nL/e6vnrwo7p0Rz9TLGfws8=; fh=S7/5y/BGEz+mOJd1ujes2n4AQwqvvnwDwyLSH15u0Zw=; b=O9OzvH5W0CccnFh+jHRA2SrOt//k3rqocb3ckh+U56aRjfPrnSpYWBB7jHuVZ7clGz 0af469/x/zZw0SIw4FfugOTZVGcdpPoEv8QCez3a0QUSB2HBz4ZTTayV5MhoIxIFfRnF grjuaOfX7WhPNUvj7SvifU7Q4g0QJDSVy2giSLmda+9jN26QZiJQPCm5oodcD6AL5Y32 kuFQjM5xB+Yc5S4ISbeVId61a8wUAwnlFzQ9p8rhiLKbMtQyoIqSM6N+CUcik03PiAzH 8Py9xJFd6j3kM3xT6ghpHqbvUVLV8mVNIWPRe2p80ax0n4+jFFn+jXbKluFMIWx5endM kVIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=QQaLURf7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id u8-20020a056a00158800b0069347c30c86si6049009pfk.253.2023.10.19.01.55.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 01:55:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=QQaLURf7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 21DF1826EB49; Thu, 19 Oct 2023 01:55:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344996AbjJSIzC (ORCPT + 99 others); Thu, 19 Oct 2023 04:55:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235256AbjJSIy7 (ORCPT ); Thu, 19 Oct 2023 04:54:59 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C22CE10F for ; Thu, 19 Oct 2023 01:54:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=rBlcqozqb9PEqqWS5+27nL/e6vnrwo7p0Rz9TLGfws8=; b=QQaLURf7X9dzo6EYuq47jY3PSS rqMw+Xltl3zrtwNCUOa1mnELoQvSQ5h7JK+08foOa6nC0jisHy0lEAU+4+J6VgFFbGpsddAZP97Nu fZFMpG918bwkg5IfSu510rmS/X9kKo5ZDSi71lRD952SXJKQ5iCDnzpkxe75yGi5k5Pb6wjxMVgjH Kgs9k/tH5z+mfZrzQkVvD4cF+AjeCzEMX89RbwTFhJw7Y8E/WPxVJvJVlgW6JVkfGQ6FHzO5RoBcR JweOeREPZEQt0eDu6LZQ0OrT0UcIlJO9mfTcdI8MfMVE8XuEn7FaYoV06WeK7x0v2jXBBjwq580Q7 odE6jlFw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qtOnY-009j1Y-2C; Thu, 19 Oct 2023 08:54:33 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 59493300392; Thu, 19 Oct 2023 10:54:32 +0200 (CEST) Date: Thu, 19 Oct 2023 10:54:32 +0200 From: Peter Zijlstra To: Linus Torvalds Cc: Uros Bizjak , Nadav Amit , the arch/x86 maintainers , Linux Kernel Mailing List , Andy Lutomirski , Brian Gerst , Denys Vlasenko , "H . Peter Anvin" , Thomas Gleixner , Josh Poimboeuf , Nick Desaulniers Subject: Re: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr() Message-ID: <20231019085432.GQ33217@noisy.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 19 Oct 2023 01:55:23 -0700 (PDT) On Wed, Oct 18, 2023 at 03:40:05PM -0700, Linus Torvalds wrote: > Look at the *REAL* sequence counter code in . Notice > how in raw_read_seqcount_begin() we have > > unsigned _seq = __read_seqcount_begin(s); > smp_rmb(); > > because it actually does the proper barriers. Notice how the garbage > code in __cyc2ns_read() doesn't have them - and how it was buggy as a > result. > > (Also notice how this all predates our "we should use load_acquire() > instead of smb_rmb()", but whatever). seqlock actually wants rmb even today, the pattern is: do { seq = load-seq rmb load-data rmb } while (seq != re-load-seq) we specifically only care about loads, and the data loads must be between the sequence number loads. As such, load-acquire is not a natural match.