Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp619278rdb; Thu, 19 Oct 2023 14:07:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE+kdBfY9+m5RDHUImYiJL9sVxAqjBVLb2Tr2FIr5HZPfj4hP+4NQ96bWZfBAlaW7gV4IdK X-Received: by 2002:a05:6870:458a:b0:1e9:bda8:ba79 with SMTP id y10-20020a056870458a00b001e9bda8ba79mr80075oao.27.1697749624664; Thu, 19 Oct 2023 14:07:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697749624; cv=none; d=google.com; s=arc-20160816; b=sk45nm7Ic/Hq/GMjd78pSP139Y74RKt+IXBKivAuF23spBGEmAR7fo4g/UZuHV6bGd FspQD11V+qdkwHGzxexnv++AI5hgASRZ7yCd3u3H12lbWaDUXBve0Lr/RzQmJdIvwTRB 8FoJh7vG/2Yo5O4PMcj2g/RVcnQ8siZ3SrAwq/Y2zngODOHjT7qCKsVlLIsCuKk/cgSo iuxL9OrJZ6Swzkn3uPxsjsWYvFELuv9lgMWL73CQxFV+ITaio7dVJZgulEZCSlDMmXim aLUZKf43f7nLdpPtNLBsvsTpiwQJvlfqMeikl3Hs3Ncy/s6tl/t3Kw3FwOvygg0U8J+7 Y0ag== 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=Bsd5+hpDI8TsggPTWMSXCW7cLx+ZstaAm/o7xK/YLak=; fh=l1jjhj9N74C+OUMGFFZgEIqzo5fBEvmOeqFfpgIhBwI=; b=ELhZ8iEmxQbpWrm5KRs4XRgcTWRox7JG/sEelwMXgmgMGdseWlMRejqyMEzuBDt5X1 2dCU652duB1x62B65c+TumKfFprd3n2Ls1Ys1DviPqhzzbYTfEVJO3Vx4eVoAdYomjSI zV2R83phnMg5dWnss4VTreecAH9tUUKKNpPtkXFSUW5IXyxIJ1/GNs5mB+Kr96LTYHx4 1m0aaA6RqzIok/ipUUkWOy7PPREVSgIW+dgWPeudiVvr6zsX9zMlcvkEyCRckBtrfkdo wGtVnLRRjQIcYfuZDjanP/dFUTMzPFo+5aDNIv9JT+9s65oXh0Qtwpr4u+90yC7DvJy0 gpFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=L85AfNAo; 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 r2-20020a632b02000000b005add209e106si386777pgr.442.2023.10.19.14.07.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 14:07:04 -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=@linux-foundation.org header.s=google header.b=L85AfNAo; 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 384AE80AFB9C; Thu, 19 Oct 2023 14:06:00 -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 S232131AbjJSVFM (ORCPT + 99 others); Thu, 19 Oct 2023 17:05:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229892AbjJSVFL (ORCPT ); Thu, 19 Oct 2023 17:05:11 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB418C2 for ; Thu, 19 Oct 2023 14:05:08 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-98377c5d53eso26232466b.0 for ; Thu, 19 Oct 2023 14:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1697749507; x=1698354307; 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=Bsd5+hpDI8TsggPTWMSXCW7cLx+ZstaAm/o7xK/YLak=; b=L85AfNAo193uA8hzKnC+0BTApYIb1oEvVhFmMIfs/m4UtIswaZPbffJfUBRp5LdSx5 m0bdAKhyCEBj9uQzLXcwq8WbgkaZStVhyUQ2S8pZCJuhnYPsIdaXIHookKXu62wZOHLB ao3ZnQmSBEM29maxp2Wvp7Fk3cfv7BB0DmsQo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697749507; x=1698354307; 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=Bsd5+hpDI8TsggPTWMSXCW7cLx+ZstaAm/o7xK/YLak=; b=ZKYdfU2l1bEEMonm7L5mJzqpVkJdAw+SzsCH3IjSxu8/TGVP7c8nsPs212LbzuEE8I QMHU/liTAf9E4ptt9tCCi1l8GUG++z6iJaB6LVP6Jzsl+P6F7NrcIURY/6D7URuzuSP1 O9OK51tk0a99EnIDtqIevyfPyeuwpWFLMWskqwc2dkR8/NmVtYD86/Zy3K6QW67YcldI C0GRjPLL02xHuJiSQIq21jZdy79ba993I/ADJTpSvMvcHIeLOxn3tuaIm9L6ywVm4+rB R7LlK+RNU5mVp02PjGdOl0VPHU0pgJzFB6z7vBhPdeUv6FqNAIclLv5CnaTPJhgYat7g idfg== X-Gm-Message-State: AOJu0YxKoH2kiY174XdOREpzrHD4kq9UMer1uIfRCRwXSEd98BOhpBBY GCuWNTc+UYp9VdLfot50vAU3dmdvy2EIpVkrrhZhJG4B X-Received: by 2002:a17:907:a4b:b0:9ae:1872:d01a with SMTP id be11-20020a1709070a4b00b009ae1872d01amr2527613ejc.76.1697749506757; Thu, 19 Oct 2023 14:05:06 -0700 (PDT) Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com. [209.85.208.50]) by smtp.gmail.com with ESMTPSA id j12-20020a170906050c00b009c764341f74sm189900eja.71.2023.10.19.14.05.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 Oct 2023 14:05:06 -0700 (PDT) Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-53e2308198eso94152a12.1 for ; Thu, 19 Oct 2023 14:05:05 -0700 (PDT) X-Received: by 2002:a17:907:3dac:b0:9c6:64be:a3ac with SMTP id he44-20020a1709073dac00b009c664bea3acmr2932039ejc.49.1697749505619; Thu, 19 Oct 2023 14:05:05 -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 14:04:47 -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=-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 14:06:00 -0700 (PDT) On Thu, 19 Oct 2023 at 11:16, Uros Bizjak wrote: > > I wonder what are "certain circumstances" that the > documentation is referring to. Looking more at that "under certain circumstances" statement, I actually think it refers even to the situation *with* "asm volatile". In particular, when doing loop unrolling, gcc will obviously duplicate the asm (both with and without volatile). That would obviously lead to exactly the kinds of problems that snippet of documentation then talks about: "This can lead to unexpected duplicate symbol errors during compilation if your asm code defines symbols or labels" so that makes complete sense. It also matches up with the fact that this is all actually documented very much under the "volatile" label - ie this is a generic thing that happens even *with* volatile in place, and we should not expect that "one asm statement" will generate exactly one copy of the resulting assembler. It also matches up with the whole earlier preceding about "Note that the compiler can move even volatile asm instructions relative to other code, including across jump instructions". So I think what happened is exactly that somebody was declaring a variable or local label inside the asm, and then the docs were clarified to state that the asm can be duplicated in the output. Of course, this is all just by me reading the docs and looking at gcc output for way too many years. It's not based on any knowledge of the original issue. Linus