From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="G5pqxlWO" 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-Google-Smtp-Source: AGHT+IEyX+BvqryxMRr9G0bMzgAJHpudMNKKmYw7eyQeJ8a3uw3AhkQsT+dsqu7wlsIWbs8crlNnEDE965o= 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.