Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1295843rdb; Fri, 1 Dec 2023 12:03:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IGdKtJb6lbl9oUMUHt5N5IbAgTGi1mj6esaDNPaMPu0kGV9ZB0v3+vPHUQA8nW+0/H1oCZ8 X-Received: by 2002:a17:90b:300b:b0:286:6cc1:26b with SMTP id hg11-20020a17090b300b00b002866cc1026bmr25585pjb.54.1701461007255; Fri, 01 Dec 2023 12:03:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701461007; cv=none; d=google.com; s=arc-20160816; b=VMbnH63+NMDvcYQZuWnwlChZ7i+xsQz/ZESqb+oj2yaunb8WNW0Oi/WSZHyPbZ5vBP S3x3RzbLdvQmssy1H8TXOPZ0iNsbqdCh3NlSRiYDYpsOTpdrfyAHDK3uYkfZDgmGy5VN 4bZbMXsurBz9is5gsMEa90Zso26tfAH2VBvVJotN5bI4rz7rL0nCMfxZs+dSvRqKI37s 7j2C//r4jAfhBTRJwaovERM2ODg24ghf4xuitl/WZGsMA8uEMNU71h6UocXtiPOog/+K aZhekzExMObjToGD+Iw8AIk4if7CtkI5/eo43AS4G6WEQFVKbFH9V+a5RApsmwIFIIo/ MnAQ== 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=rB/UM2vnO8ADAaDZfITVXRz6im/8pq5fntSzN8Q2pxY=; fh=fn3Mli8hHmON3HPRYVq8bb/0kBhEcxKYt/5phEi34xo=; b=W9xzmCl8+/Qto+CmcvNZwpwRruztzC3vFtkta4phQ+Uy2CwzHXo7ppbsdNccdDmz24 rYB5Hwe1aElChZ8vz73aFz5xwdOVwZEL+gV0pYFuOgm5QoNCooZ1MFlkA5hmTGIM3N02 VdUWU4uDM92eW11roJR1S8G2FgAEBdLBcTu15R+uIa1hNNxj6vNnZLYJQGKePFwWHTxz CRnauoEnD0AATNvTzuXOXZ6kqMjuxs2CLiuDqWynLoP7tQYPLpU84p7UcV03Ahs349u3 sQ3sXmNlMxuQsEJ3NZopTl7xPJtgv1UP9nUY4FYy67VNw+747/HqEkk7MwC9Vb+P2Yh0 UT/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kBUFM1U3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id ep13-20020a17090ae64d00b002865160d522si2496643pjb.115.2023.12.01.12.03.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 12:03:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kBUFM1U3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id DE53580562D0; Fri, 1 Dec 2023 12:03:24 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379578AbjLAUDK (ORCPT + 99 others); Fri, 1 Dec 2023 15:03:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379565AbjLAUDK (ORCPT ); Fri, 1 Dec 2023 15:03:10 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4798CB2 for ; Fri, 1 Dec 2023 12:03:16 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAE5EC433C7; Fri, 1 Dec 2023 20:02:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701460995; bh=zlGJvgaDfOaydmVhAssBO1Q2xtvGzqBX82vPMeow6H8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kBUFM1U32mC5a5kuNSctBT/Fei8oX4ETaFZtXddMPB++K5JXpgPLe/pJmjPb6seMc LLxZ7zrTSEOFyYMDddaolGtJTT6BWMxR8MEtaIjW89DIZ/nl7F4kWfcABWasD/X6Uu RwJXWG5HphFmZXVTwMZQMLnJswrQI4jFBKkbwH64zOgUU1b/R/sUdgRDfwIglc3A1u /asI/HVmSEXQPIO0P7T8f2aCUej/5vQRM2qitHnCTk9KdHn8NE4aRHQwt61i1qdIfa GPVQzyWlFAWE83+BsHHiaWNaDYjK0qFsGyJMuztArG9nvN2VTEp4A9TFcgKPDCBU/A K6w/DEyCt32og== Date: Fri, 1 Dec 2023 12:02:47 -0800 From: Josh Poimboeuf To: Pawan Gupta Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Peter Zijlstra , Andy Lutomirski , Jonathan Corbet , Sean Christopherson , Paolo Bonzini , tony.luck@intel.com, ak@linux.intel.com, tim.c.chen@linux.intel.com, Andrew Cooper , Nikolay Borisov , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, Alyssa Milburn , Daniel Sneddon , antonio.gomez.iglesias@linux.intel.com, Greg Kroah-Hartman Subject: Re: [PATCH v4 6/6] KVM: VMX: Move VERW closer to VMentry for MDS mitigation Message-ID: <20231201200247.vui6enzdj5nzctf4@treble> References: <20231027-delay-verw-v4-0-9a3622d4bcf7@linux.intel.com> <20231027-delay-verw-v4-6-9a3622d4bcf7@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231027-delay-verw-v4-6-9a3622d4bcf7@linux.intel.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Fri, 01 Dec 2023 12:03:25 -0800 (PST) On Fri, Oct 27, 2023 at 07:39:12AM -0700, Pawan Gupta wrote: > - vmx_disable_fb_clear(vmx); > + /* > + * Optimize the latency of VERW in guests for MMIO mitigation. Skip > + * the optimization when MDS mitigation(later in asm) is enabled. > + */ > + if (!cpu_feature_enabled(X86_FEATURE_CLEAR_CPU_BUF)) > + vmx_disable_fb_clear(vmx); > > if (vcpu->arch.cr2 != native_read_cr2()) > native_write_cr2(vcpu->arch.cr2); > @@ -7248,7 +7256,8 @@ static noinstr void vmx_vcpu_enter_exit(struct kvm_vcpu *vcpu, > > vmx->idt_vectoring_info = 0; > > - vmx_enable_fb_clear(vmx); > + if (!cpu_feature_enabled(X86_FEATURE_CLEAR_CPU_BUF)) > + vmx_enable_fb_clear(vmx); > It may be cleaner to instead check X86_FEATURE_CLEAR_CPU_BUF when setting vmx->disable_fb_clear in the first place, in vmx_update_fb_clear_dis(). -- Josh