From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.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 07D942E6123 for ; Tue, 24 Jun 2025 19:41:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750794109; cv=none; b=QR3bGlMNWfOvks0lN/oclavgTj17f5hb1ZyNxBSUT5B40u9YzmeRcdDwIE45v/znKKMbnmlrUvpRtZc/bisbjHl9jjcRkG6IIK5/ogJHzX93vFTFqPgp1g/VcSaOIX5lz9Zlsry68k3kfeFd059ErDbZ5EtMfIjQhqNfCxKcvig= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750794109; c=relaxed/simple; bh=FTTRIldhGkByLvjO2kxWvCHu0NM0nVVVeJJdj3ADGzI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=JDI8poC78UK1qi3ZTfrYKfv7Z7j1dSqEKAbCCe5rVEYQ7s3vHTtp0+89kEjRdixnUOb/lO5fUu694+Wy8BxwoTbqziJ0GSgiJRz7WhoqQ5GLWQyyF6aTc4vpTxShO2mrr+EUxeY7FYHJHltVFJLxVs+XPklQoHPqqps6SsSnxYo= 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=kGmKdgch; arc=none smtp.client-ip=209.85.214.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="kGmKdgch" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-235f6b829cfso49264995ad.2 for ; Tue, 24 Jun 2025 12:41:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1750794107; x=1751398907; 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=OnEd2xV3VxW/TvoPWA9aDKAYF8qpz72nxTYDpmjJX/4=; b=kGmKdgch9AtqzaDvhUf0/ymZ6DcTOAhaPz1ZN7X4GYl0X3bdGYjZDhd4QQPzSOUY/P X2DyzVClPuaqO8akjzBzPfLnUNnX5kRT2mttA6gru5D/cN+GjLj2STs4VklnHz6fGPxG svbzUjqbIAij3bO4Dzzrd/D8R1qKQrpx/8u0TyPlDSkEk/jjdMdyOovgfhuVkNxGkK7P La2qN+yZ2bzwpRWrztLhGH95J+FbJgRyveTp1o+51p01GjiA536PcMtJB5b8XFhcngua +sSvfklov8h4aa4ovghj0t+lz5rBz0t/CpM4wPZY9GS1dG5Kl3I2JgrXQg0DUtj1L9le y4Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750794107; x=1751398907; 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=OnEd2xV3VxW/TvoPWA9aDKAYF8qpz72nxTYDpmjJX/4=; b=OUdFqQTXgPFttgIQ5lj5VdpiRNhHBlKDstb0jqJfrpSbW4gFqMv4I0vtI/IfUcNAhd 9Ay7PP263vZ59ZMaNL8H1QnCoc1+biNS0r7pN5dYjT7/QkcQV+tm47L+8ZAeqUgRxK1p 0n5WkZRstPkWMAA9FlvAhnqM+WYm+GXmUXOT87E0r6oYnMNUQiGl8RK/iobKyGt38X7U VEcakNvP8CXbOAVtcMdowmbFpkbHnyuZKbfMcY9BBOFfIq86hgBrezv8db0qBPLhZx2G /SML15xdStoPFBUZXTlbcaexFBbysHyC9+yU8L9evCY4oZmTMG/ynAwsPIVSX3CB9VeB Frlg== X-Forwarded-Encrypted: i=1; AJvYcCXhc2K5lQYol5RtjAoBsJD98zd0nHtnWaggmp0VJnNCecmKM2tZOsm5Xm/MQ8nTc4sonC3oA5qxJZ2dYoQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwGH592RBKw8+5pMeE9u/nRzGmJJAYsek/bZ/dMTncrMavFv3kc zNG96X2SWOR/9kfHr+Ay6N4/8qK8+AhGYXXy9vRCNY8sqXcqi+QklfGU3jkS2xcjoNQ/LYWi5K3 l5d2a+Q== X-Google-Smtp-Source: AGHT+IEJB9G+bAtW22AFPU+en9HzYU77bZJ3ZLcUmffMymYS1bchY8w1qMGeDjuTE5uzJxDnW9TJ3JknT2w= X-Received: from pgbda1.prod.google.com ([2002:a05:6a02:2381:b0:b31:c299:6723]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:ec91:b0:235:7c6:ebbf with SMTP id d9443c01a7336-23824047541mr9989625ad.35.1750794107362; Tue, 24 Jun 2025 12:41:47 -0700 (PDT) Date: Tue, 24 Jun 2025 12:38:32 -0700 In-Reply-To: <20250610225737.156318-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250610225737.156318-1-seanjc@google.com> X-Mailer: git-send-email 2.50.0.714.g196bf9f422-goog Message-ID: <175079324569.521185.10145114338048189462.b4-ty@google.com> Subject: Re: [PATCH v2 00/32] KVM: x86: Clean up MSR interception code From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Chao Gao , Borislav Petkov , Xin Li , Dapeng Mi , Francesco Lavra , Manali Shukla Content-Type: text/plain; charset="utf-8" On Tue, 10 Jun 2025 15:57:05 -0700, Sean Christopherson wrote: > Clean up KVM's MSR interception code (especially the SVM code, which is all > kinds of ugly). The main goals are to: > > - Make the SVM and VMX APIs consistent (and sane; the current SVM APIs have > inverted polarity). > > - Eliminate the shadow bitmaps that are used to determine intercepts on > userspace MSR filter update. > > [...] Applied to kvm-x86 misc, thanks! [01/32] KVM: SVM: Disable interception of SPEC_CTRL iff the MSR exists for the guest https://github.com/kvm-x86/linux/commit/674ffc650351 [02/32] KVM: SVM: Allocate IOPM pages after initial setup in svm_hardware_setup() https://github.com/kvm-x86/linux/commit/fb96d5cf0fda [03/32] KVM: SVM: Don't BUG if setting up the MSR intercept bitmaps fails https://github.com/kvm-x86/linux/commit/5ebd73730832 [04/32] KVM: SVM: Tag MSR bitmap initialization helpers with __init https://github.com/kvm-x86/linux/commit/f886515f9ba2 [05/32] KVM: SVM: Use ARRAY_SIZE() to iterate over direct_access_msrs https://github.com/kvm-x86/linux/commit/b241c50c4e30 [06/32] KVM: SVM: Kill the VM instead of the host if MSR interception is buggy https://github.com/kvm-x86/linux/commit/6353cd685c69 [07/32] KVM: x86: Use non-atomic bit ops to manipulate "shadow" MSR intercepts https://github.com/kvm-x86/linux/commit/b1bccf788390 [08/32] KVM: SVM: Massage name and param of helper that merges vmcb01 and vmcb12 MSRPMs https://github.com/kvm-x86/linux/commit/925149b6d054 [09/32] KVM: SVM: Clean up macros related to architectural MSRPM definitions https://github.com/kvm-x86/linux/commit/16e9584cc0a8 [10/32] KVM: nSVM: Use dedicated array of MSRPM offsets to merge L0 and L1 bitmaps https://github.com/kvm-x86/linux/commit/9b72c3d59f42 [11/32] KVM: nSVM: Omit SEV-ES specific passthrough MSRs from L0+L1 bitmap merge https://github.com/kvm-x86/linux/commit/f21ff2c8c997 [12/32] KVM: nSVM: Don't initialize vmcb02 MSRPM with vmcb01's "always passthrough" https://github.com/kvm-x86/linux/commit/4879dc9469e6 [13/32] KVM: SVM: Add helpers for accessing MSR bitmap that don't rely on offsets https://github.com/kvm-x86/linux/commit/c38595ad69ce [14/32] KVM: SVM: Implement and adopt VMX style MSR intercepts APIs https://github.com/kvm-x86/linux/commit/6b7315fe54ce [15/32] KVM: SVM: Pass through GHCB MSR if and only if VM is an SEV-ES guest https://github.com/kvm-x86/linux/commit/3a0f09b361e1 [16/32] KVM: SVM: Drop "always" flag from list of possible passthrough MSRs https://github.com/kvm-x86/linux/commit/cb53d079484c [17/32] KVM: x86: Move definition of X2APIC_MSR() to lapic.h https://github.com/kvm-x86/linux/commit/405a63d4d386 [18/32] KVM: VMX: Manually recalc all MSR intercepts on userspace MSR filter change https://github.com/kvm-x86/linux/commit/8a056ece45d2 [19/32] KVM: SVM: Manually recalc all MSR intercepts on userspace MSR filter change https://github.com/kvm-x86/linux/commit/160f143cc131 [20/32] KVM: x86: Rename msr_filter_changed() => recalc_msr_intercepts() https://github.com/kvm-x86/linux/commit/4ceca57e3f20 [21/32] KVM: SVM: Rename init_vmcb_after_set_cpuid() to make it intercepts specific https://github.com/kvm-x86/linux/commit/049dff172b6d [22/32] KVM: SVM: Fold svm_vcpu_init_msrpm() into its sole caller https://github.com/kvm-x86/linux/commit/40ba80e4b043 [23/32] KVM: SVM: Merge "after set CPUID" intercept recalc helpers https://github.com/kvm-x86/linux/commit/4880919aaf8d [24/32] KVM: SVM: Drop explicit check on MSRPM offset when emulating SEV-ES accesses https://github.com/kvm-x86/linux/commit/2f89888434bc [25/32] KVM: SVM: Move svm_msrpm_offset() to nested.c https://github.com/kvm-x86/linux/commit/5c9c08476363 [26/32] KVM: SVM: Store MSRPM pointer as "void *" instead of "u32 *" https://github.com/kvm-x86/linux/commit/7fe057804118 [27/32] KVM: nSVM: Access MSRPM in 4-byte chunks only for merging L0 and L1 bitmaps https://github.com/kvm-x86/linux/commit/52f82177429e [28/32] KVM: SVM: Return -EINVAL instead of MSR_INVALID to signal out-of-range MSR https://github.com/kvm-x86/linux/commit/5904ba517246 [29/32] KVM: nSVM: Merge MSRPM in 64-bit chunks on 64-bit kernels https://github.com/kvm-x86/linux/commit/54f1c770611b [30/32] KVM: SVM: Add a helper to allocate and initialize permissions bitmaps https://github.com/kvm-x86/linux/commit/73be81b3bb7c [31/32] KVM: x86: Simplify userspace filter logic when disabling MSR interception https://github.com/kvm-x86/linux/commit/bea44d199240 [32/32] KVM: selftests: Verify KVM disable interception (for userspace) on filter change https://github.com/kvm-x86/linux/commit/0792c71c1c94 -- https://github.com/kvm-x86/kvm-unit-tests/tree/next