Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp2501579rdg; Mon, 14 Aug 2023 04:53:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHv8xG6u5R6Xq/XdidTif8A4uJtEisWGSuhh45iJeFZFpp/XxgMVoJZxfIUIgJENCSL7mGb X-Received: by 2002:a19:2d45:0:b0:4f8:5600:9e5e with SMTP id t5-20020a192d45000000b004f856009e5emr5303358lft.47.1692014007831; Mon, 14 Aug 2023 04:53:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692014007; cv=none; d=google.com; s=arc-20160816; b=mdwSbTxQ/WeXq+hrXJwES7v41WTqhNZ8ZuBD/0VtG7eJyKcbE/JUzNwVO0D5wPp2bJ IaLWEKK+WSO8Pch4/ggdDdoCLvJzRyagNN+wiR1YYmImDQa1c9Uxa3iuZBXsVuy5IC5p 5jQtknd0gIkn1TrV1k4KyJrcx3YxGA2Gd8ehvLi6G3DJNVwUgtvBFZrJZC3SecnKK9bc bTBIShXQdvK43Lmj7RhMEw5Rm+7/6DInnhg9ITW6DJIiSxurCEm7fTfQjPDEScYIgq5r CznQ9pXTtEaQgIX9pYgAKpVkL87a40/XpIg6Y2rXwKFiRy01oJXFtaZEszN/KrIXP2kZ jD3A== 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=ErfS2y8qItlREdXWuNkGttCjb/q6nrNKzOfNpBqoMVU=; fh=t3DOYEJ3nJWGIl07q2Bzapv2A0vt7RNSPKSl8ZpNg30=; b=tQVd3gM8JmwHSmPt9bjHCQJu3iB+RcoKDp5MNoYOTSEeYwOteSOJJ6d540E0UHKFW1 jD9sWRetyGASC9D3JhunsK90FD3qpKGZ1UzOhfOAeB8HMuelwAvBaqZT5eLG/Rqya70n Ecb+lLVu+2R9nWRongA09ewi5Ubmtf/6XtV7mN+NUkeAmTE4GhUATLFUmCYQkFrLESah kNl4+vouPiOE/gBgSF83030ZWhDXNR8toywugKgy8bAsM+SPohb7h2M748r3+u0VPZcX tpPPvrSJWeJnPKlv92pX/kYJ/3X0Tl79KKf8TNHlYUbDljwOETD4SEOB4bRm5xYN0UZk r6Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=HQvDh0K4; 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 c2-20020a056402120200b005234ea96c70si7935483edw.46.2023.08.14.04.53.03; Mon, 14 Aug 2023 04:53:27 -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=HQvDh0K4; 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 S231727AbjHNKgX (ORCPT + 99 others); Mon, 14 Aug 2023 06:36:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233543AbjHNKfy (ORCPT ); Mon, 14 Aug 2023 06:35:54 -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 474D612D for ; Mon, 14 Aug 2023 03:35:53 -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=ErfS2y8qItlREdXWuNkGttCjb/q6nrNKzOfNpBqoMVU=; b=HQvDh0K4bfWxqdr3y/DiC5L2bO 5N86af3XF5swSNerZ73e5bKwCE2ChSMtN1t4j6nyunManXmdmreQG8DWPLQY43uO0BZNXVHzE6hL5 u3oiCy/M09/M1610EIkWgNE3ngfxjFd3PzP3+Jn0drzms1kr8HjPB8YSlP6cRxnaZUhcI2OC7IEsx 1KxTigAbihGFzC7Vnp9cATkzi9eMNsMNDrgZzbsJuZKIONZAwmbFc/RZK6Of+b6N+ZxvhD4cigm7O Z4Phb8wq5/gfEk5NoIfJQ+eF4JOEK8GxyO2b3fxUMMw8FxwzfLuq8lsItMSLn87v6+ure6ImIbGG6 MWGvObyA==; 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 1qVUv1-00AW7h-1x; Mon, 14 Aug 2023 10:35:27 +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)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 395AC30020B; Mon, 14 Aug 2023 12:35:27 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 2B68920C1700F; Mon, 14 Aug 2023 12:35:27 +0200 (CEST) Date: Mon, 14 Aug 2023 12:35:27 +0200 From: Peter Zijlstra To: Borislav Petkov Cc: x86@kernel.org, linux-kernel@vger.kernel.org, David.Kaplan@amd.com, Andrew.Cooper3@citrix.com, jpoimboe@kernel.org, gregkh@linuxfoundation.org Subject: Re: [RFC][PATCH 07/17] x86/cpu/kvm: Provide UNTRAIN_RET_VM Message-ID: <20230814103527.GD776869@hirez.programming.kicks-ass.net> References: <20230809071218.000335006@infradead.org> <20230809072200.922634286@infradead.org> <20230813103657.GCZNiySRVa8TcT7SAW@fat_crate.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230813103657.GCZNiySRVa8TcT7SAW@fat_crate.local> 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 Sun, Aug 13, 2023 at 12:36:57PM +0200, Borislav Petkov wrote: > On Wed, Aug 09, 2023 at 09:12:25AM +0200, Peter Zijlstra wrote: > > With the difference being that UNTRAIN_RET_VM uses > > X86_FEATURE_IBPB_ON_VMEXIT instead of X86_FEATURE_ENTRY_IBPB. > > > > This cures VMEXIT doing potentially unret+IBPB or double IBPB. > > Can't - I have a separate flag for that and I set it only when !IBPB: > > case SRSO_CMD_IBPB_ON_VMEXIT: > if (IS_ENABLED(CONFIG_CPU_SRSO)) { > if (!boot_cpu_has(X86_FEATURE_ENTRY_IBPB) && has_microcode) { > setup_force_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT); > Of course you can, just also set it with regular IBPB :-)