Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp78377rbb; Fri, 23 Feb 2024 12:22:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV6cPZiLyC0AZ5CFa/rua1IODackfNH6xdNJupS1Z6KPtIdyXuEdNl9jVquelEVY2Yw9s2h+df0p/49LSHNb44sSEmIwva44WTScQVyKg== X-Google-Smtp-Source: AGHT+IGwyE4/dPzoScnxRZscMu+Pwr7+atdvC9oQJWyIvbdx+86HUiZ1o7T/tf1+OtVfN+fYw1SQ X-Received: by 2002:ad4:5ec6:0:b0:68f:5d44:b80 with SMTP id jm6-20020ad45ec6000000b0068f5d440b80mr1098580qvb.29.1708719732027; Fri, 23 Feb 2024 12:22:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708719732; cv=pass; d=google.com; s=arc-20160816; b=ca9cDZn6QECd4uXD7D1B4rVs4WzwavbFKAUqUTDS3Bh3kGYyO9LiG8wl7odj4W8FKV kod3ZyAflXZoO9Frk79jl6C5HuFzEF7eUHRkz4wfHLOsuhv93KKtVrlCPBNSku5276v5 jw+eldK1E9k0jNygbF/koilGsj7hEaIePNnZt5cnHhXCiRIeLXanYFfcU7nA8Bbg/3kX zvf4KbnXeXn3OtyXno1MVvh4X8ccMlSEUHnRGUCiLWqrrQLfWFKaVBDd+nRb5qh/Pvla 29yRGtawAhJMYEvw5urUH3L9HbxCMRdu1kpxf/AatzI5TyjJPRfw+/PCjBEqOsOy9n1f nQnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:reply-to:dkim-signature; bh=uMOKrbIKnJ6TKtSp5dRNn05/ENEXJGPDCIutix2Nmno=; fh=lyB6k0D/p8hurvnXhRY+dztu+J1mvbh0XspxwyT7GqY=; b=rI7JLceZ4Qh4fzkU8gEqBtLc+lL9T9O1OPXwoBS1er4scbvmULDHuVBgOsN4VKVLbx ODseal2ICxRqKO0rRuJyEbPrZ5IgHDUB2D69FwqdfQxhvGY/+IEkEunIOx8IV3Ne5MCH ptS9BzCxzTOous1876a3U9Zentf0h3hSbAKH7R3lhH3rY9BotSL+ZcQ9N7LXhM8dPrEk GbZHB7AOXM2K3q0kLZDe2Di5PGnCPMbLOZD0VEEjgQpJMuHooEIyhY7iG38Ob+waf9Dk /puEgBd85q1kgvSlNQ89jb8AF4Izhmwa1ZY2agm31SulmpETFuCZAJ2Yx0Z2hEgeveY7 Qphg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=USxebXXe; 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-79092-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79092-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 2-20020a0562140dc200b0068f07fbcbffsi17247387qvt.43.2024.02.23.12.22.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 12:22:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79092-linux.lists.archive=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=USxebXXe; 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-79092-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79092-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C38731C20C59 for ; Fri, 23 Feb 2024 20:22:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE55A1474C7; Fri, 23 Feb 2024 20:21:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="USxebXXe" Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (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 3DB23823CD for ; Fri, 23 Feb 2024 20:21:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719669; cv=none; b=ncm5GDN9RWQ1el32i6UjoXnHQKfaC4Gh8v8Ede7uMEIzQ6rNgzw6URchycVdRrYkcRLW34WbAGBdm7stp8IZLAdHYPU+UYCt77ViHgidrh/bQ4xl+qg6bZX2eBvbazi1b0rL+VzgzhdhFvbGXt6B0QL9XA7BRn/NH7vgIHgEUwg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708719669; c=relaxed/simple; bh=1bmnyFrNrxcCLjE3S/+oXjFKsestIbMgUBvvfSSy+OA=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=AHdWh7fZ8lMLXaNgovUjIzM0vTS7vyOZEqEWhmxxm1b4+X/2X2kHTsx1Bhe0Pz1cxLN1qq40hUaHIIMQZi3dp3naaZZ7rJxyh9eSbREiviDk+Egiv0bfce4PZcK1zhX83ASR49ciCcn6YcqVPEaLRMcNWvJmykYCdbAAyIzRqpQ= 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=USxebXXe; arc=none smtp.client-ip=209.85.214.202 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-pl1-f202.google.com with SMTP id d9443c01a7336-1dc758f4264so4615295ad.3 for ; Fri, 23 Feb 2024 12:21:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708719666; x=1709324466; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:reply-to:from:to:cc :subject:date:message-id:reply-to; bh=uMOKrbIKnJ6TKtSp5dRNn05/ENEXJGPDCIutix2Nmno=; b=USxebXXerT99qzSHcujpnpMzyGBUM8k2BxQbJd2jwZFxX+o4lcuxA9mVSpnWg0rJVY Kh7u8oj5ILoFJpTL+XbWBtSsYonNzWRV2qLiZPAQrxgoxLc+fcuunZqiOpzhw8Z8ZNgB 13qvrO1s2o1WFuV+7cobjzrIwSHjv+EUKrS1IpWJZ9D+yGvCfXy86HvnQpWhWEK6xKuE RHftZI8TQWvxYxJkl6ZTPKLwNu0zwEJazYa03xKVda1Vh5vPqgaWzMyWlY7cY3kGrXlf RsywgVZpe4xgc+JgMI0RUMOfGhAD1HMeMK6+gcIqxsnFBLHBx+flFHi7d6ArGxoWxd3h XjNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708719666; x=1709324466; h=cc:to:from:subject:message-id:mime-version:date:reply-to :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uMOKrbIKnJ6TKtSp5dRNn05/ENEXJGPDCIutix2Nmno=; b=MqakbZo5vXoUTqLYu+Sq+080PB7WR41EZnO7p8j5V8HvKIcn6ruovc3S8ln62tYW/V 81a4kYX+n2eztUdbDQr820LAWTGjEMDmBNXi394cX30yhILq/XBRJIHSsrfrLGGDCQ/G 3BXrNNw/9Evfz0VRVCddThKJVJQyxBvbcbTO0Dt8/Lc/aU8rqTHW/xN1lJ01FXuyMOtA YORVdUuTxE/Uot6jVH1tsmKrQeBL0Ga+ztDob/GPX872nkp6m6DWXJiE42CU5SiINGy/ swcnIUMrJOuh0iy+TGGYFTKuS8Q1vSP82T2z5jApiJGtnQLi69Z2RFGGRem2DmCSZQcK eI9g== X-Forwarded-Encrypted: i=1; AJvYcCXcG6pD0tUmhvxbJJreKjZAYUsWCM9+EolRPBMl3tdvPzJcqq+zB8f9MaUEthR0efGCNVwrvbSIknzYKPPSMlDMntiqBaAFFSB7IZLS X-Gm-Message-State: AOJu0YwLbCVg1Zzd9dlIUvA0RqQjcsnTC5ss0+fT5cSNzqEaIOHYTMX2 cp6XzbBynjlTGrkJxV7ywU8oPmwys1X5MCYkBnPmszFQoGj90XEgPwC/h4qfu+4qXw3BKG0hqtS 6Ug== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:902:d50b:b0:1db:cf63:b87b with SMTP id b11-20020a170902d50b00b001dbcf63b87bmr56644plg.7.1708719666432; Fri, 23 Feb 2024 12:21:06 -0800 (PST) Reply-To: Sean Christopherson Date: Fri, 23 Feb 2024 12:21:01 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240223202104.3330974-1-seanjc@google.com> Subject: [PATCH v2 0/3] KVM: VMX: MSR intercept/passthrough cleanup and simplification From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Dongli Zhang Content-Type: text/plain; charset="UTF-8" Clean up VMX's MSR passthrough code, in particular the portion that deals with userspace MSR filters (KVM needs to force interception if userspace wants to intercept even if KVM wants to passthrough). As pointed out by Dongli, KVM does a linear walk twice in quick succession, which is wasteful, confuing, and unnecessarily brittle. Same exact idea as Dongli's v1[*], just a different approach to cleaning up the API for dealing with MSR filters. v2: Combine "check and get" into a single API instead of adding an out param. Dongli Zhang (2): KVM: VMX: fix comment to add LBR to passthrough MSRs KVM: VMX: return early if msr_bitmap is not supported Sean Christopherson (1): KVM: VMX: Combine "check" and "get" APIs for passthrough MSR lookups arch/x86/kvm/vmx/vmx.c | 68 ++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 39 deletions(-) base-commit: ec1e3d33557babed2c2c2c7da6e84293c2f56f58 -- 2.44.0.rc0.258.g7320e95886-goog