Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp5588735rwb; Wed, 9 Aug 2023 06:31:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFVqcrU+/1SfzWDVinGpuCVsYTIq3zVTql4J0eR8oSCVnsISUShTRKi48JvuwbSM7ctgAeq X-Received: by 2002:a17:906:9bca:b0:99b:cc2f:c47c with SMTP id de10-20020a1709069bca00b0099bcc2fc47cmr2057433ejc.53.1691587901887; Wed, 09 Aug 2023 06:31:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691587901; cv=none; d=google.com; s=arc-20160816; b=ADEecV5Lmk0nlRDt/C/sHhGyMLVCKCG/iY4zopx99lq4GL4DhaA2Q+ffUqexQFXu9F nxPlMH8xQ5Wo20T4S5tas99GIq4Cq+7MtFGboiqK/pgRqrhPA7yU2f23GBAgQpK8pzr/ QIqLhNozFPcJ4HkP6GsDMOiIHy4pkzcQaEE4Aq9BZVYfdrScnGuAexjhZQJnKlFNtIKe bSMLmzwPjBQpQzYRhLctDNIg5o0qBym9jQjTXuriRfNy/j3epOlltVkmWXFGdce3VaE9 9uDWCexAIaPcAG4+eCupwngkFUkwW3rH+FCCMRM5qvbqVkCp8oUrwUbixaldiwYVRaSn vGJA== 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=KMfbP4dBOevFA5GkOUq4eQ2mNbjqR+JoOTQOD+f/DJM=; fh=wwOyFuazgpdYO+9CT3d8jIboeo5z9SV69ekfqHoEaWo=; b=qOf1RqCQ/iHZFVpCmpSXZZgoAt3rWf9XrFGsOa3xPMn+4KvxXRev90qXVLF6uJahVQ GPcgWUwFbz1vI3Zr+2mBpBOs6Swlyqrpi8N9xCacnZrchiCuDIF1yLPjEOwMr/6UfSAV 7dG3xuuNL3D6f/q+kzjFaC5meB16v6+qDxIGR6h8sRUJLww0MXOhd3LJNspXLwRN2kR+ T3fp1SZT0Dhl7NABY9fkIuiPrHMBFzVcEMxSZ1kr0s1lvq0JZ0x+HjoRjmeXJBF1Otwm 4U2/mD2+AIKwCE5dDSTOWE4GOk+nXxNENCs1PY+OTvscpgQ93E4UKKC+opoato1Uq57/ 82Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=gIvCQN81; 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 lf7-20020a170906ae4700b00992071c984fsi8966073ejb.954.2023.08.09.06.31.16; Wed, 09 Aug 2023 06:31:41 -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=gIvCQN81; 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 S232045AbjHINMx (ORCPT + 99 others); Wed, 9 Aug 2023 09:12:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231902AbjHINMw (ORCPT ); Wed, 9 Aug 2023 09:12:52 -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 4F24A1FF9 for ; Wed, 9 Aug 2023 06:12:51 -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=KMfbP4dBOevFA5GkOUq4eQ2mNbjqR+JoOTQOD+f/DJM=; b=gIvCQN81IdLZdAVxlNb1Ouoxj4 cpCCMvXxsD/0NzaW0GxJVy1AB6WyYdqrvgRhrufluLdIkajC8VFMI/8r/QkPIjUfk74+f1JpMxnKw SSokZ/jnXeLKtrY73t/r1ZJmKsHXi0QeDhRkli6s0gjiL/pvsqFWXAM98+vHWdA+ROmOqpmxWNzmr DifH/JkEb49qzLSPxR6Fur81JhQkEmDIk5zbVn50Ubsz9SehnAl7U4DpplqGxfZ78ztxO0uvwwRjA KO/ivZaQeV+IcGA7OyDHyaAqdZxAFgEeWuI/HgIg9AI5sCyIS/kUwIkKaxuRmCstV0wi+GbKRAj7Y Ft0l4CBw==; 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.96 #2 (Red Hat Linux)) id 1qTizT-005epw-2b; Wed, 09 Aug 2023 13:12:44 +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 4DEE430003A; Wed, 9 Aug 2023 15:12:43 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 31E1D206DF88D; Wed, 9 Aug 2023 15:12:43 +0200 (CEST) Date: Wed, 9 Aug 2023 15:12:43 +0200 From: Peter Zijlstra To: Josh Poimboeuf Cc: x86@kernel.org, linux-kernel@vger.kernel.org, David.Kaplan@amd.com, Andrew.Cooper3@citrix.com, gregkh@linuxfoundation.org Subject: Re: [RFC][PATCH 05/17] x86/cpu: Cleanup the untrain mess Message-ID: <20230809131243.GK212435@hirez.programming.kicks-ass.net> References: <20230809071218.000335006@infradead.org> <20230809072200.782716727@infradead.org> <20230809125101.xxwhuipfvj7kbasn@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230809125101.xxwhuipfvj7kbasn@treble> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED 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 Wed, Aug 09, 2023 at 08:51:01AM -0400, Josh Poimboeuf wrote: > On Wed, Aug 09, 2023 at 09:12:23AM +0200, Peter Zijlstra wrote: > > Since there can only be one active return_thunk, there only needs be > > one (matching) untrain_ret. It fundamentally doesn't make sense to > > allow multiple untrain_ret at the same time. > > > > Fold all the 3 different untrain methods into a single (temporary) > > helper stub. > > > > Signed-off-by: Peter Zijlstra (Intel) > > --- > > arch/x86/include/asm/nospec-branch.h | 19 +++++-------------- > > arch/x86/lib/retpoline.S | 7 +++++++ > > 2 files changed, 12 insertions(+), 14 deletions(-) > > > > --- a/arch/x86/include/asm/nospec-branch.h > > +++ b/arch/x86/include/asm/nospec-branch.h > > @@ -272,9 +272,9 @@ > > .endm > > > > #ifdef CONFIG_CPU_UNRET_ENTRY > > -#define CALL_ZEN_UNTRAIN_RET "call zen_untrain_ret" > > +#define CALL_UNTRAIN_RET "call entry_untrain_ret" > > #else > > -#define CALL_ZEN_UNTRAIN_RET "" > > +#define CALL_UNTRAIN_RET "" > > #endif > > > > /* > > @@ -293,15 +293,10 @@ > > defined(CONFIG_CALL_DEPTH_TRACKING) || defined(CONFIG_CPU_SRSO) > > VALIDATE_UNRET_END > > ALTERNATIVE_3 "", \ > > - CALL_ZEN_UNTRAIN_RET, X86_FEATURE_UNRET, \ > > + CALL_UNTRAIN_RET, X86_FEATURE_UNRET, \ > > SRSO doesn't have X86_FEATURE_UNRET set. Argh.. this stuff doesn't exist at the end anymore, but yeah, that's unfortunate. I'll see if I can find another intermediate step.