Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp522881lqo; Fri, 10 May 2024 07:06:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXCyq5865q0OTJIRWrXKS/HbiUwHCiijg9Ik9xLCDFelpOrNcwuPPCFaEgd6P12y6m1It6+L88/B17ShmRi043aMLS80HgqRaYas333BA== X-Google-Smtp-Source: AGHT+IFggDmfqlwKViIYiOBtOCIgH29H8gGC0RPwWO8Svi3JG8J/VCuXwAc/5IKbJooJUhQHZoDC X-Received: by 2002:a05:622a:134b:b0:43a:ff93:5cb0 with SMTP id d75a77b69052e-43dfdb2b690mr33258421cf.26.1715349988861; Fri, 10 May 2024 07:06:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715349988; cv=pass; d=google.com; s=arc-20160816; b=zXm9zfeMCqtDyodkfIABQ/X4SDIQ+L1Eb/Xy2CGrFZzxAnlIM472lHYz5uMxVwaepi eHYoc7udmCZblhFEubC5yw4DhIsZmBpWW9+Yow7sAcpfyiOo9gX2CrWgzA9vYbR/A2Hb yiCnePnvKuHMOGB1uIQW0koBK6HgIdaU9sMq0qLpKJaRP8AKfVkLN/VN+nTP2E4B7mjF 5Iu6dtXNfdLNOzhNxB4AAWFCFNcV36aC3rcsrCavowhTft8oqOXxdEuIFs4ycKwIazTq vkhctHQMe9aFoxJtO9un0KcXdWsBStHsTTe9kvGq9NldkTXSA3Z2gkquUOovnz/BX7yG uUpQ== 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 :dkim-signature; bh=lptgC6w3ChpNyW9MHIbYxZ3ZMMcjMFEznHEDQYbM8kE=; fh=cHI8rfMmkN2lGun4JuALKakmLIGxbMb024Ax5Atu+pw=; b=MP8Ut8jD7QReBs7HelUZap0/DbDaaS99UWytDaQ9jtIxJAPSK4+CEm34VV0z1O9SIr 0OzhlfwQikDrvFBxuYThAvQqZIVwG3vkangb6mstTNh/Gt5YbKt0RQa/7OJyCU3DSqyJ /JSTFOX4vOa1pDnRwlUFmB+GPkPQhBYttCWshbv6YXFE91cr0vrV4kkgFcHvBMvWUQZY 44GcE4UFMrLIuyga5DnTtiXYo7n2lZ6uySJ3ZPV08aVS/u8zyipB7PNRhv5pkKkGFdNZ RX6mZk1v/GriffS6eKj7iSnHtS9B6hSjj65xoT0qeVie6oO5bUsNhgP3Gwg1SU09dBM7 BXDQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=A3fIf0oN; 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-175858-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175858-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 d75a77b69052e-43df56d3d57si36415591cf.668.2024.05.10.07.06.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 07:06:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-175858-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=A3fIf0oN; 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-175858-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175858-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 946B01C208DC for ; Fri, 10 May 2024 14:06:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8787C171675; Fri, 10 May 2024 14:04:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="A3fIf0oN" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.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 44D27171658 for ; Fri, 10 May 2024 14:04:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715349898; cv=none; b=YMn46VkTdC7rWs/OnIzybeU9RrHANIK0QcAcXwa8IUxzv1cqYn+99wXNdc7Sf/l9n3HaiFq3YMvWg89XKgPrWMPfcr80VFeUFSS3qZH53YCxpyxTx/bBarT/gF25ijVeZF+65nYLAaZxiWVLDm+/mtoYgqspmvO0BJEvykLRqKg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715349898; c=relaxed/simple; bh=P9fTiCPU5LNu9fSMjxQ2/KpU8krH4ZDb8EvU1cBSgUU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=XEbZsxYdzqgZcR+ZEPtaUZBhU4Z3wrdiLhcBVcbLpB0aZvgMx3ADCi2/ee6P9N7bmAx7cwFLQcxvICupdNXLwG3Mjp9/SePkHC7wgQ9YqYChQpfuM9l5DBzKiql9BtrdVDTBUHAyYvCK9qvfAnpaBzHhKzvCDu1KTRCNA4bnlKY= 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=A3fIf0oN; arc=none smtp.client-ip=209.85.219.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-yb1-f202.google.com with SMTP id 3f1490d57ef6-dc6b26783b4so2725066276.0 for ; Fri, 10 May 2024 07:04:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715349896; x=1715954696; 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=lptgC6w3ChpNyW9MHIbYxZ3ZMMcjMFEznHEDQYbM8kE=; b=A3fIf0oN6qv0AVa7ThCaE6QffREU10x1ONbRmSIj9k69Y7ve3W+IAeJGEoYAiboZKv if7zAsRyO+mirbC1Sxr8SvD2CauyqZt75IYsh561La29RAMiIubC4zryGeM8MYwjAjnw T+6X/fBpaEZ1nmSb5etpoRnRIWy38UwhJubfFA9DygGE4bE15hkWRSkC+LLNOQm5Ji/r 8VwZNLicxIYxAhyNp02YqSWf0rUGWnsAAMBgLkncOXmLYvqPIaug6k4ks4po0Yz1Xgb1 YsVIYRyP9/4wIljwmJ/ph3gFild19sYoHYN3C5p9s1V8vRbJ2Jetzen4nVlRpIyg7UbP J65A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715349896; x=1715954696; 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=lptgC6w3ChpNyW9MHIbYxZ3ZMMcjMFEznHEDQYbM8kE=; b=gw1qrAKiX3MvaI80dxWSdqXGuW/iTXDvkaNhZkLyDReS7QzWC7Lk2xq9lMgu58KI9r ydC6SCnshBfFTTaRzNXXMqlwFMUxtGmNfSWh8Vdoaxi+Q8ErruAPGPhIt8kaivhCQUU9 V0qkbdT/lwr2p26is+yLTslOPbNCzmVofh3vrNoVsSqGDw2hsyOuak0ZcMFvB1dxPshF sOYIV11ESTxKc5FpNW+PerQQjZQxPIHPGrBkyTtR2NbqsOGrLVbLEEligZGZGeJJDQBT SDBgX4MqFsg8cvnU83lJhny7F2XXDInPtCLnr+Pa2tDRINEx9V37Z1NL+7+KEGAj1q6j Klpw== X-Forwarded-Encrypted: i=1; AJvYcCUlOf6upmFY8y0nthDKebdVzCX2NPJOsqovGAMmqCx6xSkCeTpoBGYEtOG0t/+IdOUHESX1cQh1R64G7Ct9H9bgbFHdSYy2FgiLKGQL X-Gm-Message-State: AOJu0YxSwxiZKrQAjwZU0y/wkUf48uYa4mtVKHbUZQg3sS86m8KqXLan 1WIVAQe6Eo9jtowPlJ1/fFdazhX2UgmWM8Ef0sGf7POEaJ5rWFe4aG5/n0ShpFokalTAj++nBCb Rqw== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6902:154a:b0:deb:88f5:fa0e with SMTP id 3f1490d57ef6-dee4f1ca69dmr195599276.5.1715349896323; Fri, 10 May 2024 07:04:56 -0700 (PDT) Date: Fri, 10 May 2024 07:04:54 -0700 In-Reply-To: <20240509235522.GA480079@ls.amr.corp.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <9bd868a287599eb2a854f6983f13b4500f47d2ae.1708933498.git.isaku.yamahata@intel.com> <5ba2b661-0db5-4b49-9489-4d3e72adf7d2@intel.com> <49b7402c-8895-4d53-ad00-07ce7863894d@intel.com> <20240509235522.GA480079@ls.amr.corp.intel.com> Message-ID: Subject: Re: [PATCH v19 037/130] KVM: TDX: Make KVM_CAP_MAX_VCPUS backend specific From: Sean Christopherson To: Isaku Yamahata Cc: Kai Huang , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "isaku.yamahata@gmail.com" , Paolo Bonzini , Erdem Aktas , Sagi Shahar , Bo2 Chen , Hang Yuan , Tina Zhang , isaku.yamahata@linux.intel.com Content-Type: text/plain; charset="us-ascii" On Thu, May 09, 2024, Isaku Yamahata wrote: > On Fri, May 10, 2024 at 11:19:44AM +1200, Kai Huang wrote: > > On 10/05/2024 10:52 am, Sean Christopherson wrote: > > > On Fri, May 10, 2024, Kai Huang wrote: > > > > On 10/05/2024 4:35 am, Sean Christopherson wrote: > > > > > KVM x86 limits KVM_MAX_VCPUS to 4096: > > > > > > > > > > config KVM_MAX_NR_VCPUS > > > > > int "Maximum number of vCPUs per KVM guest" > > > > > depends on KVM > > > > > range 1024 4096 > > > > > default 4096 if MAXSMP > > > > > default 1024 > > > > > help > > > > > > > > > > whereas the limitation from TDX is apprarently simply due to TD_PARAMS taking > > > > > a 16-bit unsigned value: > > > > > > > > > > #define TDX_MAX_VCPUS (~(u16)0) > > > > > > > > > > i.e. it will likely be _years_ before TDX's limitation matters, if it ever does. > > > > > And _if_ it becomes a problem, we don't necessarily need to have a different > > > > > _runtime_ limit for TDX, e.g. TDX support could be conditioned on KVM_MAX_NR_VCPUS > > > > > being <= 64k. > > > > > > > > Actually later versions of TDX module (starting from 1.5 AFAICT), the module > > > > has a metadata field to report the maximum vCPUs that the module can support > > > > for all TDX guests. > > > > > > My quick glance at the 1.5 source shows that the limit is still effectively > > > 0xffff, so again, who cares? Assert on 0xffff compile time, and on the reported > > > max at runtime and simply refuse to use a TDX module that has dropped the minimum > > > below 0xffff. > > > > I need to double check why this metadata field was added. My concern is in > > future module versions they may just low down the value. > > TD partitioning would reduce it much. That's still not a reason to plumb in what is effectively dead code. Either partitioning is opt-in, at which I suspect KVM will need yet more uAPI to express the limitations to userspace, or the TDX-module is potentially breaking existing use cases.