Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp492190rdb; Thu, 19 Oct 2023 10:00:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGj+XMwy1BlPn3wJDsRsVI30SEbkYyVYuQsgfdQut+T5WRKhZaMjniyQ2Bc4lxWF/BCWdFy X-Received: by 2002:a05:6a00:21c7:b0:6b7:18c1:c09a with SMTP id t7-20020a056a0021c700b006b718c1c09amr2316948pfj.5.1697734812665; Thu, 19 Oct 2023 10:00:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697734812; cv=none; d=google.com; s=arc-20160816; b=acRjShulq7AwwX/+/UsFq207vcVxnlexApoHyIuAwvExyfZ2qQqKdyrjBkOv90lMjQ Yvh4KkEk0ItLm55ItXFZhvKMkwVa27OaM5VXF7N7GiC3zqi68pgsrpOxbfSCXTxXh9E9 Iwf8mODFh5N/OW9bAKUtnCCqaVUO70XOI2tl28PejxZRYdGLpU3g2g9bx0BRaYvFrukX 5FfgFRZ20m04OAVSCAXbmrMAVumE64aHqiGfRQ3cnCq+CG/9I5UsCoibesw6180YwsFC WAWnJ+dB+6raj4Nds+bnZ70KPq/0fhnxL9pr1r6QaV1IT00vwpke0hXllvVqIptxVgkJ v+0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Pp7DjBy4yEdH9XhZTLmenXL9Ia/EidVAE+FzX9SfFGw=; fh=l1jjhj9N74C+OUMGFFZgEIqzo5fBEvmOeqFfpgIhBwI=; b=MJkBVEtdR+NNoPbCuGcr4bwHaB5RB+/J4btYdAXp44yPNGqt2j8ihIy2aQDlKkLlpI OrVBPR2rM9V5hbsq2L37Lv8J1+5YVfzH6gexvpZOlcichKiaFpRcudweRTFxsc7gW4uK YmS7COQ8OauCQ5SobMSFAKf8otuoAvT7/U9eMgqgUSjk+GDgs3PszyVKFcHfsifbMlIk oCjgppUR4vfZqHHdNxT0YSRlB6xAAlTFFrQe1aUZ8WJzjt2mUmtcjnFQqygsAW43L7Ok b5ilbQHP8zmcx4YHjIysjWGdQc0Ah1j6dBUvIpHtH4FEF/CYJHu77L8BLGjy39gSbMZT RdsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=DgWkQhdm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id h17-20020a056a001a5100b006bde4f430afsi62407pfv.70.2023.10.19.10.00.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 10:00:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=DgWkQhdm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 220D8826DBC9; Thu, 19 Oct 2023 10:00:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345115AbjJSRAF (ORCPT + 99 others); Thu, 19 Oct 2023 13:00:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235462AbjJSRAE (ORCPT ); Thu, 19 Oct 2023 13:00:04 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B58F9E for ; Thu, 19 Oct 2023 10:00:02 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-9becde9ea7bso224771066b.0 for ; Thu, 19 Oct 2023 10:00:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1697734800; x=1698339600; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Pp7DjBy4yEdH9XhZTLmenXL9Ia/EidVAE+FzX9SfFGw=; b=DgWkQhdmOTdcEy/Yv3wGRBig5iTeL8dva4ZMKQZsyEQX1iUx6Mk7cMGt/Bsj1So5u3 RaQU38deeAVY3msVX0thsgCN8oiEVP9ZFt5ALYzR6xf532j4dmXxQ6EhLPuOwSUA1k8V dxOXVZEn+7187txCn/+C+oH/UegywENf+g/wU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697734800; x=1698339600; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Pp7DjBy4yEdH9XhZTLmenXL9Ia/EidVAE+FzX9SfFGw=; b=XnDR6HJ6F7ADLNF9tvieRkwNaohkhmii/a2yBQu36mq/QClYF8ABYBKLuW1cLWN441 7g3hNrXHKzNGUe8rXNlT5TQaoD5z0QpfPV3e13IlfAHmDBEFTbCet8WMd+/e0gQtMKdV 5e0vwatpBmAaOv0lwiOqO5Fh6JLhHme9ccJw8Dzp6Q/Sa0f4f5LP1GWLzqCTr5OXQ6ql fm3/iE35aLWaQy48GknG4hz3qRRRSg78d0x5qv85iCLGQkQbTx1QGTa0mrAlgCx8v18G 4eqSp9SejmYNJs4b3zEfSxPY//vi4Z7mNzLRDu/x5A/VnlqxSbMu9302DU3W6Q1W/hVv sGcA== X-Gm-Message-State: AOJu0Yxt0qv37PeBl+5lklxqN/XyjIDISbVu6ZZpOFaGPsqlQJAfmW9b Gq9EeVyuAc8x4hmaO4FAReSPrs3XrClsis3SujTyU//+ X-Received: by 2002:a17:906:c149:b0:9b2:cee1:1f82 with SMTP id dp9-20020a170906c14900b009b2cee11f82mr2093558ejc.7.1697734800647; Thu, 19 Oct 2023 10:00:00 -0700 (PDT) Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com. [209.85.218.52]) by smtp.gmail.com with ESMTPSA id a15-20020a170906684f00b00997d7aa59fasm3930534ejs.14.2023.10.19.09.59.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 Oct 2023 09:59:59 -0700 (PDT) Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-9adb9fa7200so224310866b.0 for ; Thu, 19 Oct 2023 09:59:59 -0700 (PDT) X-Received: by 2002:a17:907:7295:b0:9a9:f0e6:904e with SMTP id dt21-20020a170907729500b009a9f0e6904emr2171331ejc.16.1697734799075; Thu, 19 Oct 2023 09:59:59 -0700 (PDT) MIME-Version: 1.0 References: <20231010164234.140750-1-ubizjak@gmail.com> <0617BB2F-D08F-410F-A6EE-4135BB03863C@vmware.com> <7D77A452-E61E-4B8B-B49C-949E1C8E257C@vmware.com> <9F926586-20D9-4979-AB7A-71124BBAABD3@vmware.com> <3F9D776E-AD7E-4814-9E3C-508550AD9287@vmware.com> <28B9471C-4FB0-4AB0-81DD-4885C3645E95@vmware.com> In-Reply-To: From: Linus Torvalds Date: Thu, 19 Oct 2023 09:59:42 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr() To: Uros Bizjak Cc: peterz@infradead.org, 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Thu, 19 Oct 2023 10:00:11 -0700 (PDT) On Thu, 19 Oct 2023 at 00:04, Uros Bizjak wrote: > > Let me explain how the compiler handles volatile. We're talking past each other. You are talking about the volatile *memory* ops, and the the difference that "raw" vs "this" would cause with and without the "volatile". While *I* am now convinced that the memory ops aren't even an option, because they will generate worse code, because pretty much all users use the "this" version (which would have to use volatile), Because if we just stick with inline asms, the need for "volatile" simply goes away. The existing volatile on those percpu inline asms is *wrong*. It's a historical mistake. And with just a plain non-volatile inline asm, the inline asm wins. It doesn't have the (bad) read-once behavior of a volatile memory op. And it also doesn't have the (horrible correctness issue) rematerialization behavior of a non-volatile memory op. A compiler that were to rematerializes an inline asm (instead of spilling) would be a bad joke. That's not an optimization, that's just a crazy bad compiler with a code generation bug. Linus