From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) (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 65B16345EA1 for ; Wed, 22 Jul 2026 22:09:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.198 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784758175; cv=none; b=Crd8z2QCpXTi4JT8Qes1pitNS0BISwL4w2jut8sz/3LDEHRFy+wPh3+xQoPIH23PK4zjGTxnUC3eawF2nUAHjp7i+/l04ldtk2ouFw+HURlJsvyklA5BoRWKpkbzeyopDBNtyco+5Tlif1+Ov07n8xqqYCP9qETynetoeT4/yFA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784758175; c=relaxed/simple; bh=BvrcAeGYxP6POw2jbXtWTig813bTQmdrgS1FdeG+l1o=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=SKJvJfuOa/nvx+v1CjweAgUt1zX6Hewy3Jgb3NPlTP6i2nLAfcGbKMKG/dTKXoBblwKgAOLJ08GIYLXsnqXDaRNIfgLmY+X76bXFgxQV9C6FFekvBIXQbasCxR3oSDfghy45YFD/UffVIAWBrI9TMd9Qbk1vOe7QH4ws6njGHV4= 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=T751kGfg; arc=none smtp.client-ip=209.85.210.198 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="T751kGfg" Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-8488ac68185so24408370b3a.2 for ; Wed, 22 Jul 2026 15:09:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1784758174; x=1785362974; darn=vger.kernel.org; h=content-transfer-encoding:content-type:cc:to:from:subject :message-id:references:mime-version:in-reply-to:date:from:to:cc :subject:date:message-id:reply-to:content-type; bh=fAykqS9DtvWGSj58lKIuZXh9sJItsA/beqvkn+rWVtE=; b=T751kGfgIqfkjnQuzRQfRn2cAdSQuQAfY0yrpYBGdL8DJZmGK2C/NXrMkVijbdoGB6 n2vL9XzfwH7BWrXYTOHm/0hbaN7kUnZY00WMFdpyATMyeM74QsbCA1765NkS9awcaU4b JbfhmryJuH7DViCvUHOnp8ATJK3l2kNjPWZxsjM5FDzF1PuQgaL9GbkILH/VxE5ux7CF zsfVsUEvUsCo9Hft/b9ClICzhLu8lK32gsgbjGAyeR0z11UVNArgUzg330beTfMr5A1T 74EkXcvYKbdI5MHfn28rdm4QOX0U+YfooGBdCpyDkCEYi1CEsp7K0SDknunNI7PFfIKd TwGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784758174; x=1785362974; h=content-transfer-encoding:content-type: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 :content-type; bh=fAykqS9DtvWGSj58lKIuZXh9sJItsA/beqvkn+rWVtE=; b=tZrzje/hOpr9G6IDUDqBVD7qtZ+UNSEscrDJZ/5oBtIxxMNPwEB+mV7Y7oGCDkR5Rd ncDy1LfrTQW3l0wvBY91Q1nE2q6tKKXKoM4+mVQY8TgBC7VnZQV8+xSJ6e2r2yS7xtRM QXkFSCDsEyctobzzN7qw96Gf5hOH72lnQqSgCwrHhBQ2u7xT8QwjcaNUy8bvszqzDJkD ecM22IsXx5yDh3PwaeaDw5ljARDZQ0E3oOWzTHp7eGHvmTEsB5DUat05/TFjT+ewYG5e X4Yw/X9yt7IMlPlbOTvnfhosjDkudXSoxEIL7p/3BcHDu3SvPMxhxmSFDZSCiczL3e3s m/OA== X-Forwarded-Encrypted: i=1; AHgh+Rqccae/l1XoZ1mGNcETaYdJXuNGDHRvFs/0914MG5l7OiMwn2D5yKvMkYa9MwdK0iyUP/81mCA6s3Qq8ws=@vger.kernel.org X-Gm-Message-State: AOJu0Yy9BtLWi9XPe8TAdxJCH3NTroyPyo+acVieJfibYz78CiOG5gVt uS2e9KvqofTo2lvjP6qAKaYYvt9T9LWkxn0tzNNYcQ+Gtuw1zU+TiWFvoGANlqecoloYA12IvMn 947rYWw== X-Received: from pfbfj32.prod.google.com ([2002:a05:6a00:3a20:b0:848:56a2:f6a9]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:ccf:b0:842:614e:cc94 with SMTP id d2e1a72fcca58-84e2b8ab35amr818120b3a.26.1784758173554; Wed, 22 Jul 2026 15:09:33 -0700 (PDT) Date: Wed, 22 Jul 2026 15:09:32 -0700 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260616004155.1435766-1-yosry@kernel.org> <20260616004155.1435766-3-yosry@kernel.org> Message-ID: Subject: Re: [RFC PATCH v2 02/25] KVM: SVM: Passthrough the number of supported ASIDs From: Sean Christopherson To: Jim Mattson Cc: Yosry Ahmed , Paolo Bonzini , Maxim Levitsky , Vitaly Kuznetsov , Tom Lendacky , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Tue, Jul 14, 2026, Jim Mattson wrote: > On Tue, Jul 14, 2026 at 4:41=E2=80=AFPM Sean Christopherson wrote: >=20 > > What complications? Advertise the lowest common feature set for the po= ol, just > > like userspace has to do for literally every other feature. >=20 > The problem with passing through the number of host ASIDs to the guest > is what to do when the combined host plus guest usage exceeds the > number of available ASIDs, particularly when FlushByASID is not > available. But that doesn't have anything to do with the number of ASIDs that KVM enum= erates to L1. As of this series, the number ASIDs KVM will consume in hardware is= a property of the total number of vCPUs in the system (one ASID per vCPU, plu= s one more for nested usage). E.g. if KVM advertises 10000 ASIDs to L1, all 1000= 0 (10001, if ASID=3D0 counts?) of the those ASIDs will map to svm->nested.asi= d02. Of course, that completely undermines my statement about suboptimal perform= ance: And potentially suboptimal for performance. There might be a legitimate = reason why a CPU generation advertises X instead of Y. My bogus assertion about performance notwithstanding, I still think adverti= sing what hardware supports is the simple, sane approach. Because at the end of= the day it's just that: advertising. Userspace can do whatever it wants, inclu= ding peeking at raw CPUID. E.g. if we want to pull a stupid and emulate the beh= avior of ignoring "unsupported" ASIDs, then we'd need to do that based on userspa= ce's defined CPUID model, not KVM's advertised support.