Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1114403rwb; Fri, 7 Oct 2022 08:17:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7DSxvNpXfSnkPnRPmQnbF7Z7M+bCRR4Y6rzH6fXWaem2Wz0wY8GuqdDRW7H7TjhsJHaSN5 X-Received: by 2002:a17:907:e9f:b0:78d:3bab:e5df with SMTP id ho31-20020a1709070e9f00b0078d3babe5dfmr4498820ejc.65.1665155825941; Fri, 07 Oct 2022 08:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665155825; cv=none; d=google.com; s=arc-20160816; b=zxa0fxsoJ9YIOZc+/mdCWA2F3iQxI2WSDGh2cFK6Zvv3UsA/2qlmVb77szoheeXiqo A7m6HQLbTCVcBYJqT7sdzD8N6cCIO47N5QNLijl/39EI3VoPB4RZ5eBN1WCXKuGOG4bc FMAMgKfyYj0QHPpq4i8GpSE6LgxTBaQrRgOPJT4p5jIFs32G7X52Rzs2WmRTrwrbZz2P t49Xo0mIcr115SQDFaXOmtI5zmvDt7+aqnTgyDqTzauRzTM8vMm1/9as4b6bQtDiy+RS kR1delWzTAQJL+YNKcffDB0kVbFvEToKJflaOmh9/o668QkTVhGwvKX14dpGTUjZ5PYn fOIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=r59kNkXhpt4gtGyh6fpSoAengjLndWGi45RCYvEV0Z0=; b=RKWBKBaAxheKfMXqLNlpJultpZ75PK5hINbXIT5mob2cJe+K4bXfDi7SKi2zPSJyDf se/ndx/vxMGzsORWPWPlX1H+oLR49iaYoiQYQi6FAurwSo2h3ju39AAmv9es5Spd9CMN VP5JvxMaIaUkHaE1pWNPmhsjWjNdiitr9A3uWh45SwY1oVigmwpZlFxe/h0WOHVaPHxK KtYXk4y9xPgf2qqfxgrYy48odiITwO045oW0o4Yiu85A3EwJmi0mo40eFDJfcCOi0ONG 6M0hB42085/h65Q76UUUllabKg4BSrQELxAD4nGq///ceKqdgo2dnVZ2nARsDb2bjw4m QbOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=MP0SEjef; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg7-20020a1709072cc700b007303db545e6si2535511ejc.786.2022.10.07.08.16.37; Fri, 07 Oct 2022 08:17:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=MP0SEjef; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229508AbiJGOrr (ORCPT + 99 others); Fri, 7 Oct 2022 10:47:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbiJGOro (ORCPT ); Fri, 7 Oct 2022 10:47:44 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9323CD7E08 for ; Fri, 7 Oct 2022 07:47:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=r59kNkXhpt4gtGyh6fpSoAengjLndWGi45RCYvEV0Z0=; b=MP0SEjefJHb1UlmDvIcf8WQ1ye sQYTucWVE29MIjuasnxlYarz8ZKgAiKyCphRWag3k3RAbBS+tQxeo8JEt3H3yJmpBXgHq7yR2fkYV peo/NEKBmVSqlCnObAu6sqwC6RBKe9wO406q873JPH1efi9565CWqsFTK+noCcPyaNYDYwPjLizsy ISagdRFNRcaZ29hBUBCxYcG35yNwryhwri/HN/I4IORVF9mSIOt1RQu2b1IUZg9u4lsrmmE3fXH84 UaekJNZHFpTMn4yzZ/5JS6Ni3DKXpRpMFEVm8W1DNgSxz8B1axROOB6vpGQ+x5yjQbfynYYA9SHs8 ofT8GlRw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ogod5-001U6W-TR; Fri, 07 Oct 2022 14:47:12 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 38186300155; Fri, 7 Oct 2022 16:47:09 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id DCB0C2BDA8087; Fri, 7 Oct 2022 16:47:09 +0200 (CEST) Date: Fri, 7 Oct 2022 16:47:09 +0200 From: Peter Zijlstra To: Xin Li Cc: linux-kernel@vger.kernel.org, x86@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com Subject: Re: [PATCH 6/6] x86/gsseg: use the LKGS instruction if available for load_gs_index() Message-ID: References: <20221006154041.13001-1-xin3.li@intel.com> <20221006154041.13001-7-xin3.li@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221006154041.13001-7-xin3.li@intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 On Thu, Oct 06, 2022 at 08:40:41AM -0700, Xin Li wrote: > static inline void native_load_gs_index(unsigned int selector) > { > + u16 sel = selector; > + > + /* > + * Note: the fixup is used for the LKGS instruction, but > + * it needs to be attached to the primary instruction sequence > + * as it isn't something that gets patched. > + * > + * %rax is provided to the assembly routine as a scratch > + * register. > + */ > + alternative_io("1: call asm_load_gs_index\n" > + ".pushsection \".fixup\",\"ax\"\n" > + "2: xorl %k[sel], %k[sel]\n" > + " jmp 1b\n" > + ".popsection\n" > + _ASM_EXTABLE(1b, 2b), > + _ASM_BYTES(0x3e) LKGS_DI, > + X86_FEATURE_LKGS, > + ASM_OUTPUT2([sel] "+D" (sel), ASM_CALL_CONSTRAINT), > + ASM_NO_INPUT_CLOBBER(_ASM_AX)); > } I'm very sure none of this was tested... the .fixup section hasn't existed for almost a year now. e5eefda5aa51 ("x86: Remove .fixup section")