Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp5588536rwb; Wed, 9 Aug 2023 06:31:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFQMnXDDOt365WfDo5Vq6upluqXigBpUdkjcbXqvTOk86P3B1g5ZSQvi0YdnEX38wbdsGKj X-Received: by 2002:a17:906:311a:b0:992:ef60:aadd with SMTP id 26-20020a170906311a00b00992ef60aaddmr2820181ejx.13.1691587894435; Wed, 09 Aug 2023 06:31:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691587894; cv=none; d=google.com; s=arc-20160816; b=LWMb0H/ZBPRc0GkaxGq85b3vD5Dq0IxLtQ++k5Mfkc30M8FJp7JiVdu7wCWifMf3ot qIVcG88eEl+6kiSQt8Y3GzGtYkv4CywV8yl+PWbeTR08TRyRf1RE4fA8JxzEL7OgWeCg u5vcncT5I7m+cgpBnKPPzBxQuhRRs53NxQ2iF2iD3lTX0jdPAQsaxGgp2UHa8pgiJFe2 y5OH3OBAVLx/jZeDrP3p5tYpG3XPpvogfAXWkbzD+wocP987Z0FyUEKukp7mkCZBAFD7 y+dmcE6R39h/0qbGcF+IEs4RnJCENFDrBCbIGLHWWvagoOAwn7F76nhJAl1yZ8HkjcJF wXvg== 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=FWPAcByPS/R41QokNooWuug72X+46l3eQNOKNI1iGwY=; fh=nIqJPQrB4V45MOdRoOCBABHD990j3QSMCgsf+X0qIaI=; b=rzY49DdU9J2uQcbQ9DyFIW2vo3VgzvD8/33PQbQAhhoVMNMi+7ksqJ9GyF2WI4xYHG HKTsULxXr07gzuqby7NouEA/2f1rLBZQmnNZKFOUnubv3YC37QC5PK5MY0+mCQHE0+1O A2C1GW7L1+m/+jQTpKuBayiX3ev4FL3u40QhE5tX1VPTOZ9FNvGTch6PQA0wRXOZdrym cCOeP9Tdz/pSLzS9BAxv3+0c2rw9CE+PKj+QeGxyBCNC6GlI/umEn++PfcmP/K2mvMlr NJJLJt+Cw/4AIMCmK/0fQgSwDAP7+SEONg4y+uVcLgE2MbjpiFTemYy/UNCGrJi84PmT jlbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=udgSnQdl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c21-20020a170906d19500b009939765332dsi9546221ejz.329.2023.08.09.06.31.09; Wed, 09 Aug 2023 06:31:34 -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=@kernel.org header.s=k20201202 header.b=udgSnQdl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232733AbjHIMvi (ORCPT + 99 others); Wed, 9 Aug 2023 08:51:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232771AbjHIMv2 (ORCPT ); Wed, 9 Aug 2023 08:51:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00BBD213F for ; Wed, 9 Aug 2023 05:51:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9A8A66393D for ; Wed, 9 Aug 2023 12:51:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48FEDC433C8; Wed, 9 Aug 2023 12:51:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691585465; bh=T48WHjFLhEm2vnv/v96J9aS+qVl+eNSnEiw9tCjz1as=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=udgSnQdlyTumAcwM4KtsmCSL3TBAHAAyztt7yjLCZywoeMpd1klrstmzIqNoedo5L 0fr3aE/XPOl4/iMt9HjLC+I69zAByapY3PCgoCzBNonqPrb8GErAEUoWCFX+OAh4b/ B8mz9xvpcjqrm0cs4LU/mKhUvADOOmGNOZHsjQ0E3dTJiyOPFUKk/OdGmIfp/AsEAv sM0s840JToj7t/4x6NXY+4z4l2vTxrXD+zlY0KsP0Y49wdbs3b/1+TgUai7vnUWhl0 V1kELtE8exjg3CahJb3O7qYd16kV2fHBogZsba+ZO5C+4JlOW76rpYAqUhTC/vK2F4 jDC6AMoreAyPQ== Date: Wed, 9 Aug 2023 08:51:01 -0400 From: Josh Poimboeuf To: Peter Zijlstra 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: <20230809125101.xxwhuipfvj7kbasn@treble> References: <20230809071218.000335006@infradead.org> <20230809072200.782716727@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230809072200.782716727@infradead.org> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 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. -- Josh