Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp300244rda; Sat, 21 Oct 2023 08:12:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFptl+6vykBj2GZPKmo7j2Mktsd8BrWl1Kn3zUrBatLXMIw2Iiwk7jInAfyFz37xa1gU0Mk X-Received: by 2002:a05:6a00:1405:b0:6b4:d17b:25ab with SMTP id l5-20020a056a00140500b006b4d17b25abmr5338912pfu.25.1697901140108; Sat, 21 Oct 2023 08:12:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697901140; cv=none; d=google.com; s=arc-20160816; b=MgRngtxm3k97gJ9HatKLa5LQC6PoTo7VVZgWhc22OdfAC8I9Uw2kR8fy+MiWMhnzVH Jn5BiYjqcgwXGMo9gHp4WxK9oXkZ3JfsSP1FbHSK6w5qyyITnZ42q63Oo07PMVcgleW8 SR5RdtJZRL4PdP/kBGu0cIoO7HLFdHjM+Edn1zuxIFwFEsnHvOX9NTYe5gptT/2aTXKZ ssa736SrkNMsHETnYs5s0wqZ/XnweqqaJ4sB+TerCXdXwzZNeS7UCvJPyO5UVp7DUC6j cmsxoTd/ADrkpyqsOxJbgTVYksprWv5BMJaynOKZDUFW0d/47JQH1akIb6XAUwhitQi8 wAeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=fhPHBAAJZa6dFGyjheIVR9hGkiLpAwB9CbD4gzvkOzE=; fh=QpJFmWAc907lOvnam3n+12asMwjP/KwOhkze5e98Nug=; b=pzjFMnxs44Pzk3TQTAupOPXM7B1lj/x0xRfSbycooJ5RsFSToUBT4K84JSw+jHl5Xj IX/+ihJc9BXY1VUPMBTKuRbuWFU7AKvFnjf7ygk1ha/V9xQQfj9i+KcC8Cc7CaCQY1z1 /IXEJVtkj6f8qcP9Mjmz/NfTsPcCm4nu90dm9ddNiC6+2aTej+LxoC67y58aDEGthgna 85CqDwehRyVQQoBxE67Nww/vrjyCv6axqood49dzzY9jrOfVY5aNiDD8b6vp38eqwZlh HP3BYl6CMLELXu7MIqaK9Bjmgy/AStvFlWMGYeQfstleDGPWmr3ecTJgYzjE0rJ9qJop Mbtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Zbja3W1g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id z17-20020aa78891000000b006be390e15bcsi3803074pfe.76.2023.10.21.08.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 08:12:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Zbja3W1g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4AEFB8047793; Sat, 21 Oct 2023 08:12:19 -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 S231481AbjJUPMO (ORCPT + 99 others); Sat, 21 Oct 2023 11:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229583AbjJUPMN (ORCPT ); Sat, 21 Oct 2023 11:12:13 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2ACBE3 for ; Sat, 21 Oct 2023 08:12:11 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5401bab7525so396541a12.2 for ; Sat, 21 Oct 2023 08:12:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697901130; x=1698505930; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=fhPHBAAJZa6dFGyjheIVR9hGkiLpAwB9CbD4gzvkOzE=; b=Zbja3W1gqA1/gTEA+CpnitTkhuJXVrQva2JpcnDApgYGacw4bigmeaBjk9kMLtzcBo h3Del5soIYZVfENIeJIoysnL+4Dtbdt90TH98exOzfDeUyp/0U6JyaNjzrJBrdWlWfRx eFc5HFXQLeERRoF8MxWwxDgCdXoF4QlmEZHd3NSxiUPlGWhIULs6zTNMyoneS+3AtO3Y EQc3gHlfaWJGBz5lDlHwMzKRPX+4/WZSaXmn63AQTL0v82tbLw6UVrG5nzQAiT7FqhIE bgQBCXqBZn8ImhJ/HEUWZwW8K4gGYwQCVVrPfcdhXTS+FQtHxt79UHG+rLFC2IbG5AqL N0Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697901130; x=1698505930; h=content-transfer-encoding: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=fhPHBAAJZa6dFGyjheIVR9hGkiLpAwB9CbD4gzvkOzE=; b=Mjfsiq9C6hGuztRlQLRq7I6HUUrIER9D7G9RZGSKmWYXWCPwCVWKjDwmreXmkkTLm9 o9Q1VLjdwQL1UnhfmRXA0+h+zteTP4Dch8ksaI4wY2zWXzHN3fNJ+E1/EgWUrq0a10S9 dba9cAmuFTZuL9dmwIFCNmZmJr7Sru7eyEhH+1Qky/QIXtB12wtxnYr/2pNE0l/Q1cvr bJAoGTVfLzFuedTi3fegrhuG+BrZjaAFV3kPeYOSddFsSGVFkIUvwoYpkf4eYoahKD4q J0q4JOkyO5Ssv6z59lxV+2tQZa6HuGu84GLZyRvozEHsLly/iodA31/7Mw/p5ViLIxW4 4pYw== X-Gm-Message-State: AOJu0YwtPqezrzMyzIV8frlw5omQlHrlwr2LXDXNthk8JDAD+zXqwllZ AZplOJ98ln/zm9XiylwrVUGXAHEH97/5Mu+JKaY= X-Received: by 2002:a05:6402:254e:b0:53f:5467:cc5e with SMTP id l14-20020a056402254e00b0053f5467cc5emr3801466edb.19.1697901130084; Sat, 21 Oct 2023 08:12:10 -0700 (PDT) MIME-Version: 1.0 References: <20231021143739.843941-1-ubizjak@gmail.com> In-Reply-To: From: Uros Bizjak Date: Sat, 21 Oct 2023 17:11:58 +0200 Message-ID: Subject: Re: [PATCH -tip v2] x86/percpu: Introduce const-qualified const_pcpu_hot To: Ingo Molnar Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Andy Lutomirski , Brian Gerst , Denys Vlasenko , "H . Peter Anvin" , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , Josh Poimboeuf , Nadav Amit Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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]); Sat, 21 Oct 2023 08:12:19 -0700 (PDT) On Sat, Oct 21, 2023 at 5:00=E2=80=AFPM Ingo Molnar wrot= e: > > > * Uros Bizjak wrote: > > > arch/x86/include/asm/current.h | 7 +++++++ > > arch/x86/include/asm/percpu.h | 6 +++--- > > arch/x86/include/asm/processor.h | 3 +++ > > arch/x86/kernel/cpu/common.c | 1 + > > arch/x86/kernel/vmlinux.lds.S | 1 + > > include/linux/compiler.h | 2 +- > > 6 files changed, 16 insertions(+), 4 deletions(-) > > > > diff --git a/arch/x86/include/asm/current.h b/arch/x86/include/asm/curr= ent.h > > index a1168e7b69e5..0538d2436673 100644 > > --- a/arch/x86/include/asm/current.h > > +++ b/arch/x86/include/asm/current.h > > @@ -36,8 +36,15 @@ static_assert(sizeof(struct pcpu_hot) =3D=3D 64); > > > > DECLARE_PER_CPU_ALIGNED(struct pcpu_hot, pcpu_hot); > > > > +/* const-qualified alias to pcpu_hot, aliased by linker. */ > > +DECLARE_PER_CPU_ALIGNED(const struct pcpu_hot __percpu_seg_override, > > + const_pcpu_hot); > > The aliasing makes me a bit nervous. Could we at least prefix it a bit mo= re > prominently, like const__pcpu_hot? That way it's immediately obvious at a= ll > usage sites that it's "special". Sure, it can be renamed. The symbol - although aliased - may be used in a general way. It is const-qualified and placed in __seg_gs address space, so all the rules for const and __seg_gs qualifications apply. However, the values are not that constant, and can be changed behind the scenes via the pcpu_hot R/W alias. Uros.