Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp456815rdg; Thu, 12 Oct 2023 10:17:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGZSdgqFWwhaeh2mwB+yVDxKrLguBdyr8t+KCpUu+Ci/F+N6eqKYoFxvbAY/m13Kg1NRn4f X-Received: by 2002:a05:6870:e393:b0:1dd:4271:3a88 with SMTP id x19-20020a056870e39300b001dd42713a88mr26977974oad.58.1697131037214; Thu, 12 Oct 2023 10:17:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697131037; cv=none; d=google.com; s=arc-20160816; b=Aji17OOvVdPtNktud5UXc+sc6vEt6K3xOgYZiooO1IlXqkfDhp2cadz3q6kQHJYf7W hyvovrqN7Ewgo8ArdoJUyS0uGWr1UHq3hKJmOmm1Dt7XkaBYYHJNswIAp356WM53lxiy ieIi6F54msmh5eha1h7ttj/8iZoSyMG8xm6tnvtF44UkcBvZ87Dr6TJLjvVBqX3yNmak 4Q0+c6Z1vHfEzGfpJ41JzDrplu0XKa4EXCmER3LGbSjPTILRFOlpdMbbZQfc6TuRKTKR cP/j78HQiZs3nTLYhNoNMPOOTf3fsTL8ChO5PqvMTiLRPXg7qe9mHoMP9h+MLiooHqNB CYLQ== 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=wFXiKIURKZBCGix17NH07fGcqKfM7DqUcRWS63HZQM0=; fh=2W7QWOT4LLEZc93hpAJV9qeXTsNW2Zd+/+ufcs7IIZU=; b=Ae7gsPJ4/e1Avfueru/MojPgn7qIDsn0nveF3Bk1LeJ3r94hdNXxcw8hDq+kJ0Gjuz kgnqVjQoENakwLibjf9CrnNJ2dYRyxhBufdZaEMdY4Z8duU9qj2Gl6g4igZoZSorQZx7 EQslozjzGRh8e4V663FskguVA/PDzlSxkkbKeiSR3cDpZ4/eQmFvvJu+2+JeaSeUne6c hJzcKykkmbTau4A/bFpr0n7fRrDJPDoreQWE6uMXp3owsVFmFlvX3dV5CDNi3On7RP8y Sz8wueGexexjNSkVaKd0ln93htabLPfya5t1zo7Lv2ZhdN4zWj7fJkL5vZWjfOKxyj8R Hteg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=BLIhoj2d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id y70-20020a638a49000000b00578a91ac520si2721334pgd.326.2023.10.12.10.17.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 10:17:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=BLIhoj2d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 0F39B826374A; Thu, 12 Oct 2023 10:17:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379562AbjJLRRG (ORCPT + 99 others); Thu, 12 Oct 2023 13:17:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347339AbjJLRRF (ORCPT ); Thu, 12 Oct 2023 13:17:05 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64D50C6 for ; Thu, 12 Oct 2023 10:17:03 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-99bdeae1d0aso201006566b.1 for ; Thu, 12 Oct 2023 10:17:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1697131021; x=1697735821; 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=wFXiKIURKZBCGix17NH07fGcqKfM7DqUcRWS63HZQM0=; b=BLIhoj2dAcUQY35Scp7r7h9OGOlfUl+asJ1I9dZgGPqVxKzPCDKQEuaK+2QZ6+OJ+N y1EBqzGHT2RBLQaQEPWHtS10sa63N+yMMo0kLqijDRyBeRGXmf6U+6lfafQRWg9+ERxl QE7G/utCrJx5v52/uPL/fc79vToqbNfgWC3eI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697131021; x=1697735821; 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=wFXiKIURKZBCGix17NH07fGcqKfM7DqUcRWS63HZQM0=; b=UGBL+R/hpYu/aCbC6aV0DCVd9qwPvlsLyrqnh9vllfJ1rVyUO5XhVf24omQVU+Egze 6zUphQQkOQeVB5xcB7yPOOtspHNOXWzeoAdLvBeGo46ZqSShQKE3Jkh7ppk257kvsiZQ OCnsAmGnJ7tDcX7OUchPlecTtSn0CncqD/QSHaHrq6Ja3sObLFT7Xt9SIU1etsaDAk18 w0IijhAuIWOemlpW4H5W4QD/sZfloEWPm8lJw9obhXNBck3aQ3uJ52MYrD0612C19U0b 9XCQjOAXiMvvvuLGRcMxxYhrKUOYp+023Q00m6HaPpKXhY+PJZ6+rLkaYZpl5lm9jwsu dfSw== X-Gm-Message-State: AOJu0YxzgLFlsYK3XwO36YA7GWDUCBKpwjKul43tidb7EdrLdWcv3TMX vQyrTwj0CnqfCtCC0FZD9KosNdyOZFAUVk0DUrcrFaON X-Received: by 2002:a17:906:7697:b0:9b2:b119:4918 with SMTP id o23-20020a170906769700b009b2b1194918mr23759526ejm.13.1697131021724; Thu, 12 Oct 2023 10:17:01 -0700 (PDT) Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com. [209.85.218.44]) by smtp.gmail.com with ESMTPSA id cf7-20020a170906b2c700b009b296ce13a3sm11589882ejb.18.2023.10.12.10.17.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Oct 2023 10:17:01 -0700 (PDT) Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-9ad8a822508so203102366b.0 for ; Thu, 12 Oct 2023 10:17:01 -0700 (PDT) X-Received: by 2002:a17:906:8467:b0:9ae:62ec:f4a1 with SMTP id hx7-20020a170906846700b009ae62ecf4a1mr21592590ejc.33.1697131020742; Thu, 12 Oct 2023 10:17:00 -0700 (PDT) MIME-Version: 1.0 References: <20231010164234.140750-1-ubizjak@gmail.com> <0617BB2F-D08F-410F-A6EE-4135BB03863C@vmware.com> In-Reply-To: <0617BB2F-D08F-410F-A6EE-4135BB03863C@vmware.com> From: Linus Torvalds Date: Thu, 12 Oct 2023 10:16:43 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr() To: Nadav Amit Cc: Uros Bizjak , "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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Thu, 12 Oct 2023 10:17:15 -0700 (PDT) On Thu, 12 Oct 2023 at 08:19, Nadav Amit wrote: > > +/* > + * Hold a constant alias for current_task, which would allow to avoid caching of > + * current task. > + * > + * We must mark const_current_task with the segment qualifiers, as otherwise gcc > + * would do redundant reads of const_current_task. > + */ > +DECLARE_PER_CPU(struct pcpu_hot const __percpu_seg_override, const_pcpu_hot); Hmm. The only things I'm not super-happy about with your patch is (a) it looks like this depends on the alias analysis knowing that the __seg_gs isn't affected by normal memory ops. That implies that this will not work well with compiler versions that don't do that? (b) This declaration doesn't match the other one. So now there are two *different* declarations for const_pcpu_hot, which I really don't like. That second one would seem to be trivial to just fix (or maybe not, and you do it that way for some horrible reason). The first one sounds bad to me - basically making the *reason* for this patch go away - but maybe the compilers that don't support address spaces are so rare that we can ignore it. Linus