Message ID | 20240223202104.3330974-3-seanjc@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-79094-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp825534dyb; Fri, 23 Feb 2024 12:23:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXbNEomCdP2wHfhZWczoWjWXW8fPh2WprpEDCtJV+t4hbohn/kZl1E96CdjdiykjlFWyO/SeSSz24JDaUkhfiUQmzJXPA== X-Google-Smtp-Source: AGHT+IEC6bi2TcLbKAsYjdBoY8xEh7feNpyUooD4D9EQSyZ0vVky8+qdXBUiX6Tk+5AY/KZvQ8Kx X-Received: by 2002:a05:6214:301c:b0:68f:6f11:912b with SMTP id ke28-20020a056214301c00b0068f6f11912bmr1060861qvb.21.1708719782700; Fri, 23 Feb 2024 12:23:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708719782; cv=pass; d=google.com; s=arc-20160816; b=Q+e1yKRYg8Opjf4DSMSsRrajHbZUeQwH1xmqjUXd3nKUe89t+OHILrAuXt47t/0vyJ borEONdSWoG/xnPWfHSlMo7W6HpR6NVjujfFAOLd3SDsIV0aDAVeha/ys4wtx79aMhy+ 8Fx1y8DoI0+xNHp7YAkN0Z7sAoU2xY7MnYUXk0+4ist8IPYAPvcxTjoX+0OzWwCmvG41 ShNmLZ7RaQ9NTmfbkwzzmh5bd2GKoRA1JiUsuF0qHLi0EGGsWgTeJFkBaMq/q9312OJ1 7mWtOwQVY3O8qXSHYdox7TuWLtkSLn+kywtKpe8e92oJQXu/tAmqOmTBckgknL2MzHeQ Mrlw== 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 :reply-to:dkim-signature; bh=SJIQNAlIsKGXsg0lFIYuueKE4jyUGKIK5OKq5RD486Q=; fh=ykUnnx4BgPvNrECOOXUzwP02ZFogvNldpJeDk+ROSoU=; b=ZYCiBK0P0WbZdhyKrrn08A7R5hhUhBkEMdDgJo8y4rD/PEO4VHBYwO3Iym6YYB2f+q sJBHZSeRR2IL2sXZGUrPN0Ya9dP/2EsoO0Tu9z0d/Mo5CNzGhr7uWYQUjuCms23EJA3C Rev5IOyNEcW8IWSKdWoMZVzH1CqnaALOdKc32RZQkfiLWkjaaiebMqgQARW+HZQ7tjQ4 QgQEY3lECHarbZxnJMtRM+ULehI6n1lzMzdlQ7ZIzN/26v2BvWrv1citGutFHt173Y2B 20vDXN6D+nVxRo5lC+76nMjBUteQ9jd56O9rJvhN8dLIDPcgIWCsqKX1g42p8/LGpH+j fbdw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=HXswtQXg; 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-79094-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79094-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id pt18-20020a056214049200b0068eda269640si16445051qvb.448.2024.02.23.12.23.02 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 12:23:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79094-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=HXswtQXg; 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-79094-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79094-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 7DC001C23BCD for <ouuuleilei@gmail.com>; Fri, 23 Feb 2024 20:23:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 47CB414D45B; Fri, 23 Feb 2024 20:21:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="HXswtQXg" Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.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 2D65C146E9B for <linux-kernel@vger.kernel.org>; Fri, 23 Feb 2024 20:21:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719672; cv=none; b=gSt+9OaFhZeJ9xSzdOu4bbEf8sBePWgpM7jw8KlbN1vythBz3RV1DUVi4WCzE7fYezj+Twn4WdbfERg4Co8E36qyp1Gwp+Hh8Y1WEr6p2YLh756UaxTwXZKO4NCQRH7xNiMY5+RRD/K/Ntb3CsGihEbgXpY9Q+JbfK20eb8TWTY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719672; c=relaxed/simple; bh=HGThLVUxXYbVSOOZxCrgBI4/8udXcy4h8pBaZ8gILd4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=eZc6UJqws00m8j1YwIcJEPv9pIRHexswxhafRDZ6uWQgRx/jI8WAJJM26AaskF1G0yDfnYZb7dS5Yjh66TC5ckH+72CyCosqGGeeTie/pbs2MtmDwe4Y3BI7jdjCHarCqpZUJUdpFuH9O7lDeqaN52AZ7lUk+xR/RmILI9C87Z8= 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=HXswtQXg; arc=none smtp.client-ip=209.85.210.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-pf1-f201.google.com with SMTP id d2e1a72fcca58-6e41d856114so901790b3a.1 for <linux-kernel@vger.kernel.org>; Fri, 23 Feb 2024 12:21:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708719670; x=1709324470; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=SJIQNAlIsKGXsg0lFIYuueKE4jyUGKIK5OKq5RD486Q=; b=HXswtQXgBREBdmoKabdRaJen+fLGcnUNFTYOZR0tnm9hpXuuoYpSAZNymOK8xD+le3 jYmcz0L+2WUypcToslY5SxvCEFPysoh21Iggl0rgdd1iS6rAONBBQNNfKRMGPcIjhD6W v55MlgkPuqkZYUbiBdtto5WuB4gOjTd3i4CW2fUv65qZ8huv4XlKiYYjklgLGJDPCr4t bQN7fHpdL4qOgJL40fZxWc56rXnPp58R4DBUfPNBGb4x/epv1uIqeStMICjtB1sJeEGa mujKs29fcmSIgxmfeb8hAUBf8140LMIffBdbI7DC8AJQV8uvEihwb8ozLO3J9QzwIdB/ liiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708719670; x=1709324470; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SJIQNAlIsKGXsg0lFIYuueKE4jyUGKIK5OKq5RD486Q=; b=Q4OwBLajm/O7nnpI+5pX9pMIKTBdAJL0vAiKcegdHgB2Z4zEl4pgFiZNIUC0uWGhst 8t506CpSSHuMGfCBNHjYPcHkfRnOVhw6EUuXjG0IkQ+NbiTq4L34YGhss0fLhuqBqXPG eC/g7YgcbZ10/EUGWKUauHu0lFMxuRF7dJcCLKIwp64XwkltKDje3Gzb44PZ2K29BlmL s6Vvhbtan5BlFRvGHNLG/pi6yABeqGBtYRjRaDgryhVQ4HyCERgwPvJcIUX6grhi3Glc sN87zu3LfLLAWKSCOHE1O4XqTtS8q8ohmmCXavLCjPNckUNeLjecNXtU20d2NzjkglCX Y9IA== X-Forwarded-Encrypted: i=1; AJvYcCXRDTBwSXLHLg0DoX2zLwkRrczUhR1XVLwNNrScACg6MgZ/461IurvyVeMT7jHTBSt4Qz02wwyVGaddbbo02IKSqELE9PyXQvEWph86 X-Gm-Message-State: AOJu0Yx/ME3k+bdjVdMF8mVq0NnRgZug9PKB0eStCu7eCcUCznt3Lrif BClt2KbiCtaVNW/FPiG4HRkbrgXJbte/2KDmibiQvYgCi1xLN+Lp3yI5RppJTDlCL/reYLkjhVx Vhg== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6a00:3cd1:b0:6e4:8aa4:387b with SMTP id ln17-20020a056a003cd100b006e48aa4387bmr67638pfb.1.1708719670527; Fri, 23 Feb 2024 12:21:10 -0800 (PST) Reply-To: Sean Christopherson <seanjc@google.com> Date: Fri, 23 Feb 2024 12:21:03 -0800 In-Reply-To: <20240223202104.3330974-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> Mime-Version: 1.0 References: <20240223202104.3330974-1-seanjc@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240223202104.3330974-3-seanjc@google.com> Subject: [PATCH v2 2/3] KVM: VMX: return early if msr_bitmap is not supported From: Sean Christopherson <seanjc@google.com> To: Sean Christopherson <seanjc@google.com>, Paolo Bonzini <pbonzini@redhat.com> Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Dongli Zhang <dongli.zhang@oracle.com> Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791722555043670160 X-GMAIL-MSGID: 1791722555043670160 |
Series |
KVM: VMX: MSR intercept/passthrough cleanup and simplification
|
|
Commit Message
Sean Christopherson
Feb. 23, 2024, 8:21 p.m. UTC
From: Dongli Zhang <dongli.zhang@oracle.com> The vmx_msr_filter_changed() may directly/indirectly calls only vmx_enable_intercept_for_msr() or vmx_disable_intercept_for_msr(). Those two functions may exit immediately if !cpu_has_vmx_msr_bitmap(). vmx_msr_filter_changed() -> vmx_disable_intercept_for_msr() -> pt_update_intercept_for_msr() -> vmx_set_intercept_for_msr() -> vmx_enable_intercept_for_msr() -> vmx_disable_intercept_for_msr() Therefore, we exit early if !cpu_has_vmx_msr_bitmap(). Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com> Signed-off-by: Sean Christopherson <seanjc@google.com> --- arch/x86/kvm/vmx/vmx.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 7470a7fb1014..014cf47dc66b 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -4127,6 +4127,9 @@ static void vmx_msr_filter_changed(struct kvm_vcpu *vcpu) struct vcpu_vmx *vmx = to_vmx(vcpu); u32 i; + if (!cpu_has_vmx_msr_bitmap()) + return; + /* * Redo intercept permissions for MSRs that KVM is passing through to * the guest. Disabling interception will check the new MSR filter and