Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3991197rdg; Wed, 18 Oct 2023 11:29:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEIyT4G1T4kAPbhx1yUR+6HG7Guw8RWVhvlA/meIB13TT7IJQP8eN34Lha3jLl2Cgiq+RMw X-Received: by 2002:a05:6a20:6a27:b0:15a:6733:24e2 with SMTP id p39-20020a056a206a2700b0015a673324e2mr9015665pzk.25.1697653768626; Wed, 18 Oct 2023 11:29:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697653768; cv=pass; d=google.com; s=arc-20160816; b=TscepwCGKJc2HpPNVgZ6RE5LHLPP+9nZ4Ja0qalNKdHm0HyJFVMdb41tPfgmRlGVk1 AxFmCE/Jo4CUBwM+x8A0RwPtDQRsvN0LccI59rVUpkvbM2ncm2gTL5rKrsCGyTgetKzv gLPkAnxSXNeD6FxSgRwQlyrVvILVQ6Yy4IUyOFuHxrMCOb28/ZOG4kCPWP2SruozVxn4 nfoiLO7rnyzTxakhMtjGmGqKDHs+TSycXprzvvkhzgUWb4L7V1Gurya8AQ2LoZiqHZTQ Emz9RKkM6bakAk5ENsTBMC+kID5vQQ8hoeaTpjdhrZSP1u4+atzR/npIoU70VnOKmmAE 9zfw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=7TQ8OqxxE/AubFi6PC211xDdAzZt2IJIEf6rzY7lzm0=; fh=L+BhABKm8G0oQD2HzkONJzwqwx0vqCfH/8Q1kb0QMRc=; b=r+0uXTT+dr3yIWWnxf73CwISc7xo3Zy8rtEP8opUDv3yTFU/UNK1UxsSkKtmqxUU7N bPTYmGE4e7eKroTEm5WSVUt7IT/qDpgYqNe3Pi5I+kyQudM4SO08z1DGoGM230RSna3Y FXIHuOrNMlLYGnSib30JH5Uzn3yeRdbIprai9jQ8zykY+WZweHGgsJyoNM5d5UjThYe6 SgTuHtsRbYgabpQIuCB4kKEBf2wecK+j/qtWPQxnf3BPW2b5JHku213ujUDznC6BmRq4 vtE48jPjTh2L56xtnWE9heGZs1oo0kMLzsdnkWNLUzOJeWjsC0Xolk6D8mN2p+hQ/h5E O00w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vmware.com header.s=selector2 header.b=W92AKtrS; arc=pass (i=1 spf=pass spfdomain=vmware.com dkim=pass dkdomain=vmware.com dmarc=pass fromdomain=vmware.com); 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id w8-20020a63f508000000b005ac2d06099esi1749174pgh.478.2023.10.18.11.29.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 11:29:28 -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=@vmware.com header.s=selector2 header.b=W92AKtrS; arc=pass (i=1 spf=pass spfdomain=vmware.com dkim=pass dkdomain=vmware.com dmarc=pass fromdomain=vmware.com); 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 911BD822113B; Wed, 18 Oct 2023 11:29:24 -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 S231492AbjJRS3N (ORCPT + 99 others); Wed, 18 Oct 2023 14:29:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230396AbjJRS3L (ORCPT ); Wed, 18 Oct 2023 14:29:11 -0400 Received: from MW2PR02CU001.outbound.protection.outlook.com (mail-westus2azon11012010.outbound.protection.outlook.com [52.101.48.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59D46119 for ; Wed, 18 Oct 2023 11:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wtr7YFaTpb6hfGNUCkiz5BsXLLPUL/oUjWa5p2GTWtX70sUAZDzXPI+DZTimbwLJ+5KdIHqcsjJFNljbPlG/Sw5kItiUblaWnhXL9APqxqc8nmj8e0977z8CkMTQpFvYxuL+E8WfYTBFXEGiC42hMO54LNanVpqAAY62TpP4JVMaJn4VBg6azefQ7Kyx3uW82vgveKoh3KrLHYYNXHZdfRt0FvVGxQuxjaqjJ5QMYoxJPKBEKHUk3KcMXdh+adrFTdpLqEgkhPkBB5sFjKjBd1C8Y7kmexbvaItQcwDdexm4Opp2i1eEvQP1UYVOZrroY/lSxMZgfTyBmHBBQycgYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7TQ8OqxxE/AubFi6PC211xDdAzZt2IJIEf6rzY7lzm0=; b=eiI6lQyEHGAppweZp3XMfvcQUehrg7Pt6qzfbxV8sJNDCv6i1UMh2G+r79Ad9XCfYS21m3r8ixkJ42KnsubWkoJYqor2UfydHVGYVzgwtO1OivMAGOybRzVQYzzTOg1FLKQl1WCJvjP8+37ZY1sg0Rpjhn5xO9zryIoJXET8lJ/7SbxMFIQwSFAXF3TNka9p4ePx/dhdOasitZ2Odw1mg8LJSohdUoRxQ7ZelnCD/Nwz2cLVntGSCtlhio13JzLXd3YtwW5qirgX3B+30ggF2kZ7DlPEGv5uv5TCE7lYaR2Og3O1mlFSl20eb58o0Ww6+RnJQdSwTePXuVLR/KprRQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7TQ8OqxxE/AubFi6PC211xDdAzZt2IJIEf6rzY7lzm0=; b=W92AKtrSITjXbeSVF/XJAeFHzEsIlfFSq1zhz8xAq7Ph+5Ed1WnaxVJ2orfDAet6p7nwcgGWAmvaZsMNmkjNcoDPcVIpR4n5G5uMvfJMGk1r+uaM437kHZhzFqM1Dxuv9N+Au4vFkWicLA/H6Q/9SXU5B5wqsw46SmFvYxqltj0= Received: from BY3PR05MB8531.namprd05.prod.outlook.com (2603:10b6:a03:3ce::6) by PH0PR05MB7946.namprd05.prod.outlook.com (2603:10b6:510:a0::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Wed, 18 Oct 2023 18:29:06 +0000 Received: from BY3PR05MB8531.namprd05.prod.outlook.com ([fe80::e6fb:726:9aa2:fa13]) by BY3PR05MB8531.namprd05.prod.outlook.com ([fe80::e6fb:726:9aa2:fa13%6]) with mapi id 15.20.6886.039; Wed, 18 Oct 2023 18:29:06 +0000 From: Nadav Amit To: Uros Bizjak CC: Linus Torvalds , 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 Subject: Re: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr() Thread-Topic: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr() Thread-Index: AQHZ+5jZGZywpkB5zE2yxvhqDFo/FrBDSECAgAAOE4CAAAQxgIABoxnfgAAgI4CAAAYlgIAHqOMRgAAI04CAADzyiIABTsvzgAADAQCAAB/hAIAADVOAgAClpgCAABXQAIAANUA7gAAQyoCAACJcPoAAE0DxgAAcTYCAAAW/gA== Date: Wed, 18 Oct 2023 18:29:06 +0000 Message-ID: <6D0B6A98-9C4B-4889-896E-3C412BFC5397@vmware.com> 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: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Apple Mail (2.3731.700.6) authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vmware.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BY3PR05MB8531:EE_|PH0PR05MB7946:EE_ x-ms-office365-filtering-correlation-id: 478a2e00-f019-4ba8-5095-08dbd0081ca3 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fJDIPFeS9fSVINPAqc5yLF59RrPuYE8ycu6P3kJiZ2fvlRJQRK5ZgG+pm0i3ruFC9xS3kmFhwvWecnhzcCPg9FyhSOCCvUnRxlRD211q9H/AZfY+f75668zkkINDujG0jP/qYLfZXRQjLYcmZmoT3VjpSbIlpmphQSKGAx8ipFSid/O0o/KlGK651AukZjxdGh7iKc0X8GLa9f8UdYl8/2kgDKKDPaq3UjhpOEiEEj2bkxhed5ScjUz53AUOTL6ebPX/tM/FE/ZmDRpXvaftP1NKq/tRboITm2CTxvD7VNoPw0nkYd5dzui/rT9E5wj/RfCNH06k99MApNIn1Cib7+k/FAJFY0EvEKvK5twI1nadbe9zh4iYICHIF96PCvwYIfoEtAJgpGPjIevT5xrUYmTLotrvBlwjH9iiIauK+9fH71JJnG9/VFf/wmNiLmZhtA3Xpd4QZV67Dq/8OT6OIVPntdt5cHHELJVVUIjdXcz1NtibFIOzaCXGeKMrYHciU59EIIx41KTF5uhvPftuZuPEYEO2X36JOhPsy4PoR0ikFhiJhE4Ns/URIpAwm5ESra0/dnwtNsyA5169+529Sh2kLzPdx4cHMlVK6Hx5w/dZarrjGhz6bIqV+5lx09mSMPRyb0ZRfimm3LcpvXoswwm6sQNqFUZd86SrPJxBce6NFe2E7Oqog6a1V9wHiR/xNRBc/b9l1S08Vl9bYGF5LA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY3PR05MB8531.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(346002)(136003)(396003)(376002)(366004)(230922051799003)(1800799009)(451199024)(186009)(64100799003)(6506007)(53546011)(71200400001)(5660300002)(2906002)(26005)(4744005)(83380400001)(122000001)(2616005)(33656002)(38100700002)(86362001)(38070700005)(6512007)(7416002)(66476007)(316002)(478600001)(36756003)(6486002)(66446008)(41300700001)(66556008)(91956017)(6916009)(76116006)(64756008)(54906003)(66946007)(8676002)(8936002)(4326008)(45980500001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?/hIDP6wqTGZ5EamGmnFcIwP+5N7Wo0CS6Ni8o7Rn9dvhTvHytqnP6+QiiIl9?= =?us-ascii?Q?Yx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TGIqV4UYkme2zynQ5worPnZDXc?= =?us-ascii?Q?xYIaeDsPIXcdE/Tsvb4r1S3A9+9HYjJysQ0qzyqfegsTKwOim+xC6tLrwwAb?= =?us-ascii?Q?KqHenDu4Ui+2G+1KH/wAHTyGO1onp47WvCPUti7UadAtQAzWURWn3WyMlcDc?= =?us-ascii?Q?GvjaErk43SY0AP5Aet+Zg4c1PoQymHtHBTaB6yxmN0lwfjTbJc3iDNTTCMWf?= =?us-ascii?Q?4RamhzUd0BdDLEWLAecP/72T2bXXF27EJ2BxAYpr+l7Y33difOaTCl1JlkgG?= =?us-ascii?Q?nGVJDBVlW4I8W4L5DjZqSwVGF51gPDix6319NpiW77RNKExDinG0PjY+DxKr?= =?us-ascii?Q?o3n1MczZiylpnZ+td9LvDqY5rSMgk3Nt3ynqNei7RN6ogjBHdKx/ap230gAe?= =?us-ascii?Q?KCyYr/uvEn9tY/EhOcJDO2uvZPtyE4rOXasUOFT35sy5gCyWO+AeNglwNQ82?= =?us-ascii?Q?tYl3oVh23EqadhsYpgwVlua2MtIYUyOrrOU/GJl7B6B3uOdxGMfu7DKgsfbg?= =?us-ascii?Q?3uE5r663ADZBVI+9bZIwoYbY0LaTGiJULg//AmynE/EpEPUDoiwKrwJ/FMYC?= =?us-ascii?Q?b5KPQS1QKsfTCrWhcDs9Pg1PD7HQpawK+X+oLRygxjCCjZpONVysoYhQ93kc?= =?us-ascii?Q?/vGdfyhkBLdCY3bPcXLCWI7GkbljsPiWIGV7j7AS?= Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY3PR05MB8531.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 478a2e00-f019-4ba8-5095-08dbd0081ca3 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2023 18:29:06.1233 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: WtoP0CZKbInlGjCV4Y2X1EmfrCtWLIc+744OFRGT27v9cDC/YDJE1ffNBGO4djgUJ5kT8nH/x6DTwbxxuktkyQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR05MB7946 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,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]); Wed, 18 Oct 2023 11:29:24 -0700 (PDT) > On Oct 18, 2023, at 9:08 PM, Uros Bizjak wrote: >=20 > We can use alias to __seg_gs non-const memory, so the value can be > accessed without asm. __barrier() will then force reload. Please note > that any memory clobber, hidden inside asm will also force reload. For the record, at the time I tried to find a creative solution to have fine granularity barrier control. I looked into address-spaces, pure and const function attributes, and use of the restrict keyword. I did not find a better solution. The behavior of most of these mechanisms was non-intuitive for me and inconsistent across compilers. You may succeed where I have failed as you seem more familiar with the compiler code, but be aware it is a rabbit hole...