Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp499519rdb; Thu, 19 Oct 2023 10:09:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHtqVXwWviIcwJLHh7mE1mHEIKAflSCIZm9A//YN+Lkhe035IiWh35WZCq4axThn30wZWDm X-Received: by 2002:a17:90a:88f:b0:27d:8fbd:be8c with SMTP id v15-20020a17090a088f00b0027d8fbdbe8cmr2864817pjc.28.1697735371490; Thu, 19 Oct 2023 10:09:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697735371; cv=none; d=google.com; s=arc-20160816; b=iHW29vDP/vnEV6u7RdhdjZI2iSnM4RZTWwey8GgEZsBbRr/Fy5cSYV+Qrv0Bs8Mz8+ +RsMNTUlLh5bh7flNw+8VpF5ki+qZkjGGmVIBXHsqF+de77q9RFkB0Wkw1I5k/1m6HnF pyeQMroGV+YM89eoZK/7l+85zC2gKUDmVxtTnH/5JcqZsdSwMpWeYD7EAImOG7hjNJ8p yd65QWAUg/jz2wK1l+ofbv9GH9g5N1U800LSH29j0GdUdNf28tTKpIB4c4335PlAiM6/ kx7wIySxS8bIjdf8fuB5zLKEMHa1kD7D4ndIutC7lxi7sklHC8g3bf89ooqESPM3uw+f pRUA== 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=nE4fsIYsBmCRNwb93La93oAtrxtAoet3UHnKWJSghM0=; fh=3hMqaci1aSMG0AFmuDTcNcT9Fdla45I/j/Dj+Dy/pas=; b=mKyFxx3Y6cLV0YHuh0qOR4MU7+a6kR2E9gs59zX2tNORwNqd8llBFUUmKnVA7J8iY2 FWegkoD8FYEfF5QsqioOofTKhF8nM65gs0mDCP+MKov8zvF09dcSBvuDxlgFH92PD3CW FvZYhyzbVu0jtMrzOBQUaictBGvzVGF1tx8ul9qDbQ3XCWlg1+tYKEjAO0kTofCRE/TL ly6Y5B5/BZCXkbrj/AVNNYTyek/cLVJAKKvtmy57AqmGvyf2UH47eeStycjyLBVaQxga nBkG6H/IkfSfL0wBLxq4gUU9ePB2RoIqLI3WtxME299H15Cxq7/xmpM+VjeVgjkHwEF4 b2JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=gtWRrOt9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id bq8-20020a056a02044800b005ad727cfd10si19137pgb.132.2023.10.19.10.09.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 10:09:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=gtWRrOt9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 05DAB803DB2C; Thu, 19 Oct 2023 10:09:28 -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 S1345239AbjJSRJW (ORCPT + 99 others); Thu, 19 Oct 2023 13:09:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233273AbjJSRJV (ORCPT ); Thu, 19 Oct 2023 13:09:21 -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 DB498113 for ; Thu, 19 Oct 2023 10:09:19 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-9b6559cbd74so1403259866b.1 for ; Thu, 19 Oct 2023 10:09:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1697735358; x=1698340158; 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=nE4fsIYsBmCRNwb93La93oAtrxtAoet3UHnKWJSghM0=; b=gtWRrOt9b2tAkhgj/dEUUh+ZaLd0Ixv83391ydMFm3fFl86sA+1S9lzLakCIWDOzEv EHIdgq1DUoC+LWDG3xwRG/s9WEFQXGzOqjINeYMdRB7Sc/2BUtvCZnKEUowDBJAK8uBP 19KlLYsJc463J0zbX9NYI0aGdH8qRF9CVXQ3I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697735358; x=1698340158; 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=nE4fsIYsBmCRNwb93La93oAtrxtAoet3UHnKWJSghM0=; b=RqhGtsCpMehbhFFjdoPzwwWU1HBCsjscPL9P/Eqa/3tH9MGqnkLbCVipwZlFzVZZYm GbCwfZHQcMHP+ej1z0XdQzdLFea1cqCtaEbD94Au9N8yQoEx0MOfucABEzOeXqJGmx9p Zxzz10KScymBl0JFJgBRk8cmEe4tu6c9UoH0tGO2CTadhkMLgcMHs4WmgxBY6sRIdXmK Gn17bvXFWqjLZVd4RaCstm4RXDORVLp/DGgXMJW1s2Sq3yYwBrUuDJwgiklEjbgG5Ukx Y9l2Z26TSyb/5F9O36o0q8uFzyZpbuv/XqV4M66ByDhz9aUhSU4mqI66VvEmRYp4c7X1 roFA== X-Gm-Message-State: AOJu0Yy1LKUlWU5elonpUfNFLnbib7PgrmiclpiYVkUVZF/IgHbJCOgb 4iSpIPhzyXWMOhLeh22V4LXezux/IIlUNgYaP7hlQvVd X-Received: by 2002:a17:906:db07:b0:9ae:6388:e09b with SMTP id xj7-20020a170906db0700b009ae6388e09bmr2205919ejb.40.1697735358250; Thu, 19 Oct 2023 10:09:18 -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 j14-20020a170906104e00b009c5c5c2c5a4sm3814316ejj.219.2023.10.19.10.09.17 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 Oct 2023 10:09:17 -0700 (PDT) Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-9b95622c620so1403552366b.0 for ; Thu, 19 Oct 2023 10:09:17 -0700 (PDT) X-Received: by 2002:a17:906:fe45:b0:9a9:eef6:434a with SMTP id wz5-20020a170906fe4500b009a9eef6434amr2219550ejb.36.1697735357153; Thu, 19 Oct 2023 10:09:17 -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 10:08:59 -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: Nadav Amit , "the arch/x86 maintainers" , Linux Kernel Mailing List , Andy Lutomirski , Brian Gerst , Denys Vlasenko , "H . Peter Anvin" , Peter Zijlstra , Thomas Gleixner , Josh Poimboeuf , Nick Desaulniers Content-Type: text/plain; charset="UTF-8" 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 10:09:28 -0700 (PDT) On Thu, 19 Oct 2023 at 09:32, Uros Bizjak wrote: > > Perhaps you will be interested in chapter 6.47.2.1, "Volatile" of GCC > manual that says: > > " Under certain circumstances, GCC may duplicate (or remove duplicates > of) your assembly code when optimizing." > > The compiler may re-materialize non-volatile asm in the same way it > may re-materialize arguments from non-volatile memory. To avoid this, > volatile asm is necessary when unstable memory arguments are accessed > using this_* variants. That's disgusting. The whole (and only) point of rematerialization is as an optimization. When gcc doesn't know how expensive an inline asm is (and they can be very expensive indeed), doing remat on it would be an obvious mistake. I think what you say is "we're technically allowed to do it, but we'd be crazy to *actually* do it". The kernel does require a sane compiler. We will turn off options that make it do insane things - even when said insane things are allowed by a bad standard. Do you actually have gcc code that rematerializes an inline asm? Linus