Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp775778rdb; Fri, 17 Nov 2023 12:19:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2R29yLpKnVYTli1laTg+UtwvUGhDEFaCVNQqLUo0TUTgdPxbXwNX/BF3zmROn4A07X5NA X-Received: by 2002:a05:6a20:8e10:b0:187:f6b3:3ca5 with SMTP id y16-20020a056a208e1000b00187f6b33ca5mr283972pzj.52.1700252373962; Fri, 17 Nov 2023 12:19:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700252373; cv=none; d=google.com; s=arc-20160816; b=IbpJ7h2b39H7/xRw+es2jo6RfaPT7SKeYv2ZLkaZNvYiI4gwvrx3dN8IL5A8H3LL4Z yBdIG+P2E4vefXbii9NpDsdUe2FMvbDGdIiuJg3WB14qbA/VVpB+XjH8bsM/MULJB21a shuPxtWGJQQLDPtbcaeq6C9svyKDxJ5r8vAxbT0IkgKbI4jlhkDqTTe1de+rCwNCl0MH SKFpH9ovNpQMohkKvSTYUcpk8h2Tx+7daodt7SfIntO0nrIGYosgZ2mEKOCbTJqkN1jh ORvzThAzcj2Fog7caHWWp1K4RkkQ2TJKasfvty5nsWh2Zk60R0mYoMwDdaL804WieOnp LhoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-filter; bh=dRGdu0HcrSmC2htUtuixOXNvzjT2XsGAptdlNE8aBkQ=; fh=W/AF4e8vtKY9fHpGe4e2bpeBlY3BJl6DW6zuOP4dH5g=; b=QSPbh0s/RNtJCgNpXxxPKJvHvD/45tCtk0Cvup+d08DuwzMqF1cZvngFWqMNcx6JdM GXFMU17oN/X3steEhrklk2F7rWlQFIP1ZywtjI6OLDKSo8YoMqqNlkCrmYpOZBSML1YB Wv1hkEX1YvCvGmnz3XJ4GlGQIQXZx93h74DGtf321aZK9Ges0I0LhbMT0GcePEki/xBK PwQfyqAeB6G0OHeQCATWefJnWb8firiR6padTW1uDysgrWprtSzl46HnIc0pCLU+JYIZ 5vs+3Qj8CGsNFcMCz+5Zw2JfKCHZYZr0K2EZ9F+bGjg7vLzec/PYML4gzTjKhyrCJyAX QeBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2023111101 header.b=ZeIvx2zc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id b14-20020a63cf4e000000b005bdb6dbffe7si2399325pgj.273.2023.11.17.12.19.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 12:19:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2023111101 header.b=ZeIvx2zc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 2E2E6805E01C; Fri, 17 Nov 2023 12:19:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346189AbjKQUTU (ORCPT + 99 others); Fri, 17 Nov 2023 15:19:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235771AbjKQUTI (ORCPT ); Fri, 17 Nov 2023 15:19:08 -0500 Received: from mail.zytor.com (unknown [IPv6:2607:7c80:54:3::138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 611D01BD9 for ; Fri, 17 Nov 2023 12:18:41 -0800 (PST) Received: from [IPV6:2601:646:9a00:1821:450e:710e:ed94:8bf9] ([IPv6:2601:646:9a00:1821:450e:710e:ed94:8bf9]) (authenticated bits=0) by mail.zytor.com (8.17.1/8.17.1) with ESMTPSA id 3AHKI3Ra357876 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Fri, 17 Nov 2023 12:18:04 -0800 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 3AHKI3Ra357876 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2023111101; t=1700252285; bh=dRGdu0HcrSmC2htUtuixOXNvzjT2XsGAptdlNE8aBkQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ZeIvx2zc0S0MQFNQ6hWhFf9xO/3B3o4I92vxaeklPeAm1eFSYn69hdDuQMOML5jCF uaImua6YGgdXP4COBK6Io4k2Sk3MZMNAV1iQTMDCuGrpKOxkBbYP1rGyHZ7VVp2EYd K/mJiMfJe7NSWkiGGSC11kRaXbnPYB9Y/ZEBMD0GRfBq3qISS1LbAf9v6ssvDGeCmR Ia4C8uRTjhGt592HS6vfxAlsOYFBLiUltIiTsR2sNCey/64tsGqY0eEcb6RCm8wlcS pMy2lWmW7U0XsPT3i4sdPbI9zIRWAYJAD/7q8Xw/F0n17ozL9hyx3kMAKh/u+0aOmS ZW3TrI8TsYSBw== Message-ID: <45a7d005-ec54-43c8-8111-7712c3c2561f@zytor.com> Date: Fri, 17 Nov 2023 12:17:58 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH -tip] x86/mm: Use %RIP-relative address in untagged_addr() To: Brian Gerst Cc: Uros Bizjak , x86@kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Peter Zijlstra References: <20231116191127.3446476-1-ubizjak@gmail.com> Content-Language: en-US From: "H. Peter Anvin" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Fri, 17 Nov 2023 12:19:31 -0800 (PST) On 11/17/23 11:43, Brian Gerst wrote:>> >> Why don't we simply have %gs_base == 0 as an invariant for !SMP? > > The reason is stack protector, which is still stuck at %gs:40. So > GSBASE has to point at fixed_percpu_data, even on a UP build. That is > corrected by the patch series I recently posted, though. > Right, that problem is gone. >> If we >> *REALLY* care to skip SWAPGS on !SMP systems, we could use alternativesYep, that is >> to patch out %gs: and lock (wouldn't even have to be explicit: this is >> the kind of thing that objtool does really well.) We can use >> alternatives without anything special, since it only matters after we >> have entered user spae for the first time and would be concurrent with >> patching out SWAPGS itself. > > There is already support to patch out LOCK prefixes when running an > SMP build on a single CPU (.smp_locks section). Patching out the GS > prefix would only work if the initial percpu area is not freed. > Beyond that I don't think other optimizations are worth the effort, > and would get very little testing. Yes, that is basically my point. -hpa