Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1046016rdg; Wed, 11 Oct 2023 12:41:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+iluMx4VJGZvcQh/YZIUm2+QiFFxADzOlH8TwqWqzoyFV+5oa7HjGu87aeorPsaVQTQkN X-Received: by 2002:a05:6a20:918d:b0:12e:73bb:cbb6 with SMTP id v13-20020a056a20918d00b0012e73bbcbb6mr23254638pzd.14.1697053280383; Wed, 11 Oct 2023 12:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697053280; cv=none; d=google.com; s=arc-20160816; b=nIHBezn5WQ+yS6SO/oPPa4xyRTCaUca7HEGCTStlKCTdGue9yFPjvi98D743f4ZYju T87RihTQa4WcdJzXoNyCzO2xoREQHQKRCE3zDymbHQsUXfYpDBoBnDcC5L13qsK9QSXp 1H+cLmB2GoncGVrjm395MijZ1uMELaSpj/8uEIYb6wvDP6l0J1fOjK8FgQb7Uiv3POkk JbPylJ+eKzNvjRFBd6cgdwVRRuN/raiTEqdxsE0G5XZR5JSIz4isjP8B9ll/gqBUClAN 4tAJzF9ObK8A1X/BYYJTg+kjhxIuIq75kc1AvCVMdKbTtaCx8m31JDuB0KqNABUUyiSa Zx4Q== 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=qVl38Ae3MA1xvwdhRWvEEbB9B8NTnsPXuOCuz2mqvUg=; fh=7KUfrZGZf/EAj3r522dEJiH1mntVxCNU0xlLCVeoX68=; b=wktkYQECgLeuX558Z23lTod+oBs/fiYxq+AYQVuzzWx/NmWY13RLdiH6k3t+Q9sfDU OOrUEzBdB0JtJd9mi5YCGZgaXiLYriZmhUds7ARP4jxPww/YB9a+WAUelh8T//A2RoO3 QtW8QW7y2zgnyvqASSZLEeOkq4DnKTcmWHBu5zEdUC6F1ygKbKQuMSzh/lm0Oiji3apS jwhmCyDgJSx7u/Hiyfwkdxw2DjAM1AC6BXS6gNdXLfTZJ4+ZpdFdfEF0HFTkhDR35ofs DvPQU3aO1og3WtKlH1Ijq2kItIu1PkfNoqh4ThD32LctPq2l+U25WAvz2pcdhqbsDyPL xX9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=SvshN5Em; 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 j2-20020a17090276c200b001c9cd55e31bsi397396plt.287.2023.10.11.12.41.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 12:41:20 -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=SvshN5Em; 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 A6609807C573; Wed, 11 Oct 2023 12:40:45 -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 S233366AbjJKTkd (ORCPT + 99 others); Wed, 11 Oct 2023 15:40:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233119AbjJKTkb (ORCPT ); Wed, 11 Oct 2023 15:40:31 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C824F90 for ; Wed, 11 Oct 2023 12:40:29 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-9b1ebc80d0aso30487066b.0 for ; Wed, 11 Oct 2023 12:40:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1697053228; x=1697658028; 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=qVl38Ae3MA1xvwdhRWvEEbB9B8NTnsPXuOCuz2mqvUg=; b=SvshN5Em05dtrahJYtzGtQNyKD7hPvvOZrzChC1GVBDNoGMKpYAvV/uKWe5wanEWw/ dTtIWaIIv9bw1+EQ/OMeRWsyD8YQL0y8EDtvOkUOFIvcSL3T+SDr/prKYv4O2bQ6EIWj zPErdAUUB7bkB+moVpMwz/QBqdAsrxg0JSTEA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697053228; x=1697658028; 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=qVl38Ae3MA1xvwdhRWvEEbB9B8NTnsPXuOCuz2mqvUg=; b=OLfmeJ8sgYaBvCDoYZozSNKr2Q/m2PIyY6GllIZgsMWb6C7BCT3XwpjaUbQAyrSNBh bLrdC0KW5pVF6hsqKgR+9Ed8amU6VKtia91W2YUmLjLNww+5BVVMCsOj4VFI+WMEcdBJ 3QWFbL0E0j3VjADdZQmnl+tq4CdQBs8erfA1GyC/RD+7tfpf0wHUuq540qGMYH55mscK o0vm1f2ATO4JEqa4/foN9ZN7X2ACGHOvRwEAAa2VqCYQyKr1rSiXyCmnucKQtBxZZhyu T+r6BxeKtTsic9Ft5sx3qM0lBT6crXqwJGsiVG43c/H96I2hsqT7rhzMKTAjFGmR1VSf uCAg== X-Gm-Message-State: AOJu0Yxq36JHro3fxLPzn+y1F8vlHIPIqhSMMKqkRJNyCkb3laUK1XIK gBRiqsWguR0EmmB507s3lidu/DLV+NbPUZJr094IiFyf X-Received: by 2002:a17:906:738b:b0:9ae:3f7a:f777 with SMTP id f11-20020a170906738b00b009ae3f7af777mr21111261ejl.9.1697053228021; Wed, 11 Oct 2023 12:40:28 -0700 (PDT) Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com. [209.85.208.48]) by smtp.gmail.com with ESMTPSA id a1-20020a1709064a4100b009b65a698c5csm10288962ejv.57.2023.10.11.12.40.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Oct 2023 12:40:26 -0700 (PDT) Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-5384975e34cso494429a12.0 for ; Wed, 11 Oct 2023 12:40:26 -0700 (PDT) X-Received: by 2002:a05:6402:1812:b0:52c:e607:3866 with SMTP id g18-20020a056402181200b0052ce6073866mr19918632edy.32.1697053226359; Wed, 11 Oct 2023 12:40:26 -0700 (PDT) MIME-Version: 1.0 References: <20231010164234.140750-1-ubizjak@gmail.com> In-Reply-To: From: Linus Torvalds Date: Wed, 11 Oct 2023 12:40:09 -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: x86@kernel.org, linux-kernel@vger.kernel.org, Nadav Amit , Andy Lutomirski , Brian Gerst , Denys Vlasenko , "H . Peter Anvin" , Peter Zijlstra , Thomas Gleixner , Josh Poimboeuf Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no 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, 11 Oct 2023 12:40:45 -0700 (PDT) X-Spam-Level: ** On Wed, 11 Oct 2023 at 00:45, Uros Bizjak wrote: > > In fact, rdgsbase is available only for 64-bit targets. Not even all 64-bit targets. That's why I did that ALTERNATIVE() thing with X86_FEATURE_FSGSBASE, which uses the kernel instruction re-writing. So that suggested asm of mine defaults to loading the value from memory through %gs, but with X86_FEATURE_FSGSBASE it gets rewritten to use rdgsbase. And again - I'm not sure it's any faster, but it's _potentially_ certainly better in that it doesn't use the cache-line. Linus