Received: by 2002:ab2:6f44:0:b0:1fd:c486:4f03 with SMTP id l4csp1193lqq; Wed, 12 Jun 2024 14:19:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWKweuCFdq7KjGTATMH8QfC8ZOKxBptXYk5XzLzPeSsQAcQuDhCbdKedxQRqTeq5wVzZKzqnqjmq0/GD/Qa+ucvrLy+nU1luTsfb86LCQ== X-Google-Smtp-Source: AGHT+IH/+zmsOfubw2vuvoT9W0QhggbQ6rMCiA5vRM1Wv4ZBQiRNIi6T9pe6cTy1JfnOpGJgQ0Qg X-Received: by 2002:a17:90a:ba90:b0:2c4:be1c:1aa7 with SMTP id 98e67ed59e1d1-2c4be1c1e59mr958730a91.4.1718227155619; Wed, 12 Jun 2024 14:19:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718227155; cv=pass; d=google.com; s=arc-20160816; b=t+qjdKCYs7FLDFWy2LwnLW2N419D6fcM2WPmqX4dzEv6VDxCS/N6pBff4lDF6crhes 6FeyUasOhw9W0nws2aWjqw9vRGiHJ58lAZCN7DyHE8Lao/bmksUEIo8GD/jvZL7G1tG3 xRwIcmpo2jlzRmBz9J76xUlN+6dvP5c6BTf+Wg5pgWL729S9XtzjyZrRVHa8lS0I8hht NrH6QtjE7B/waeTDPMYbHdg7VJ2HsXYOW5QC9Y6WW1A+TxADq3KLESJULHSNNt6OBBdk /qVtHk3ui+ovCE8KxU3bP8rL6pE7OR7IhGATCzKZM8ZBjGwK33UnGFjvDXnhnksoheT2 AIpQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=ZgahXDJi4rwKNqUUVFC+2hJQOZ9hbHHAlaLc98a2hms=; fh=uzCrZMsEnMDs/MfHVUnv96LpYzP7XoyfHkNMvKnZn4s=; b=K5o/VZKDetjzVCgmZDQ7z51xR+GwVcWmNIA7feX6z3FN5SXIU7wa3b6VGx6RrWjecg LXDGi+2ZjrhkomHbs21UcAjxE+ShNT1r52imqDCI9dZqasaZp7/6ALQgA8TIoUf/LOkI 1Z0gqwBSOg1vrQmhGchWNsDnykzwrENRy3yBYU9PQu621a9HDBFzcLDBx6K5aWhBdShv PQIJj3gdTm7xrbZu5jdj2OFIj50cCdpUsvN6ZfCL4PiqpeABPjd0jc8YmlIKjB3SyS+h eNTzbwxWZGI3x1XQmOMZPQ45Fo0f0RSwHo9pstGtxcT32XCO8kMYK++BmiBCEqqVPS19 MA0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=G5pqxlWO; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-212271-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212271-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c4c476de77si32696a91.149.2024.06.12.14.19.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 14:19:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212271-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=G5pqxlWO; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-212271-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212271-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CCC6C28395E for ; Wed, 12 Jun 2024 21:19:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0759F8662E; Wed, 12 Jun 2024 21:19:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="G5pqxlWO" Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F080B84E0A for ; Wed, 12 Jun 2024 21:19:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718227146; cv=none; b=GEPAZjoW95AdXyTAwL54t0QVKKii3kyoYz6IOSYRGCBvE2MaXDdb/ZdMt16Usb/nxGxoVAkcUPsCT6RpzL1XvaT2SuYz7r++XOXCgZJIaqN0xdn739uKeI2VFCLzmnLJuOJ1UOQemgTe7G3ipgOdE+PX29MzE9o+zKf+xr2Bjco= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718227146; c=relaxed/simple; bh=MLQYv2BaMO1JDh6FRxrn0183u2i/RhneG1bZBn24Djw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Elyp2zE24N9tof/8SLhnVBfEMmFoHs9i1MPXo3hIWUkPF3stwOUk+LnZ+EhDTesITU0syK3W+GJhc0fJnBfg5PIiwz777TRPxKV1EP2S8wuRQ0SuicjQZwnQjNN8kEYhqZNHZyyTJoM38QgO8fn4p0Af4Zvs7wjCKiLBf/wHVOE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=G5pqxlWO; arc=none smtp.client-ip=209.85.215.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-6f18f1ec8d8so261369a12.3 for ; Wed, 12 Jun 2024 14:19:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718227144; x=1718831944; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ZgahXDJi4rwKNqUUVFC+2hJQOZ9hbHHAlaLc98a2hms=; b=G5pqxlWOVTlPvxIPYTb6ajek2CMU9ErhvUwqRFJ98IjN9n4GVFiqbemxT4129b9puw dUnJ+7k7avpS5B/6VXMJLbrbkOVSuuDBYxpKHk0AnTyy1CC5oL315PbVcPB8iFpuQcLc 9uSjNDPPhxVHpINbPujkEq9OvSWd3Z2c6smuTXPDUMeUy+vPSy+W/aUFQD0XKMGk0IVq 51xIfLhIxNaVeEBFate14JJsLqDm1YLI7Pqg/EYbOUZWlsVkZzsb28YdLr4Vw5uzCN1O 9MIXrZG8OqsAbLdfkQzrzW4ixYOGNEHNrHq9YR/oXdwzpMRpFbfb+VRlh4wVLAzOUstq ZPZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718227144; x=1718831944; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZgahXDJi4rwKNqUUVFC+2hJQOZ9hbHHAlaLc98a2hms=; b=Cc+h1X2dZ0b0BboRz1ZoJ1/YB/+4hi3QSRyz10SMSJrQjI1eBgwIBL94cJkL7qaPk7 LoQnUDjsy8JDOCqpKNBbp0Qz2CIcFR6KhDLW55Kdkp+8KGpWOJlmmmvl6xEVuo9yX0BL 0iChKwAYUYCmCRMC3CJeDi1HoltywvxUCjnkU3LPW8zy38IDvsMNiR3/Zhcq6zi7rOe2 uX5EoZpczHnc/wGxJJXWQoA8IblEUS/+tg+MEFZJEaX5042G/uuSpogvGFlRTWTTncFu dbkWq6SI6Pwqo3FGo2otoqvLr9VwY+YJMczVnLKjx+WNLH9F9EryA+Ynrrfjz/pESO9e Rfow== X-Gm-Message-State: AOJu0YxViQvUgPAUTvmNr5fk7ttW7+x3X2Dgwa1wBLzRH8WBriJ2GygG y2ZZTtSMtkVccF6OA7YLO0dgrCGGDhWWRhV63eFOqbcwlvL48ObEYYpFu+WIXeo99sCNN0ZQtBH JXg== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6a02:451:b0:6e9:66a5:408d with SMTP id 41be03b00d2f7-6fae27627b0mr6025a12.1.1718227144135; Wed, 12 Jun 2024 14:19:04 -0700 (PDT) Date: Wed, 12 Jun 2024 14:19:02 -0700 In-Reply-To: <20240207172646.3981-7-xin3.li@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240207172646.3981-1-xin3.li@intel.com> <20240207172646.3981-7-xin3.li@intel.com> Message-ID: Subject: Re: [PATCH v2 06/25] KVM: VMX: Defer enabling FRED MSRs save/load until after set CPUID From: Sean Christopherson To: Xin Li Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, pbonzini@redhat.com, corbet@lwn.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, shuah@kernel.org, vkuznets@redhat.com, peterz@infradead.org, ravi.v.shankar@intel.com, xin@zytor.com Content-Type: text/plain; charset="us-ascii" On Wed, Feb 07, 2024, Xin Li wrote: > Clear FRED VM entry/exit controls when initializing a vCPU, and set > these controls only if FRED is enumerated after set CPUID. > > FRED VM entry/exit controls need to be set to establish context > sufficient to support FRED event delivery immediately after VM entry > and exit. However it is not required to save/load FRED MSRs for > a non-FRED guest, which aren't supposed to access FRED MSRs. Does this actually provide a measurable performance boost? If not, just do the unnecessary load/store on entry/exit. Generally speaking, the only time KVM dynamically toggles entry/exit controls is when KVM wants to run the guest with a host value, e.g. with the host's PERF_GLOBAL_CTRL.