Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp190069lqo; Tue, 7 May 2024 17:21:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVo8K+z/ObsUONonwgfyT0RrYURCAywEJHJ4AGH0r765cdTwEd3LD3XFraUx85djMP0AGzmjtqN2WvvgTxV3aAv/XSMqXQ5/LrZvIoL5w== X-Google-Smtp-Source: AGHT+IH0n8c8h1rB6AtoelZ5iyGPdGxCTomUf35Pd1xlmnuMK3ut6F84TKRe2NSE7KIV9QqmrRAi X-Received: by 2002:a50:935b:0:b0:572:f6e9:7724 with SMTP id 4fb4d7f45d1cf-5731d9cd3a3mr772160a12.3.1715127674994; Tue, 07 May 2024 17:21:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715127674; cv=pass; d=google.com; s=arc-20160816; b=howUaycfkOrgYjQxejCTk1cR4XaNo1PAnPiKWNv2IdJrmXfO8X2g5NoT3hopG5d91i oGi9uYmTA0B4PyGrrmWHbbjxd06kiZvj5ttBI4sEHAsWPay/HotkWq0oTmALq5krCa0X 0EedDQXiiHYwrqAgGw++BrFXNV3BEA3DryODRZMzwg9NaOcGdevrsOMRbcd/jAg/Wj9q zLFM0IycV0LAPlI42NerxayDsnFc0iYmfNnUj/zQJcvbpr2DSie7NPo2lbHZKhJSxFq2 cVECTypFdZAgksN7QcgAejPimEh2EkH+py4oX0ygb5udNVXs4k2kwoR0b51sHy3SBm21 W86A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :in-reply-to:date:dkim-signature; bh=c5zLDljjdB2rK7nQXYwlp9FD4GIUWDXqjmQ12YQdFX8=; fh=9uZpYF9AqGJLiXstmOuZ2OkNc/SCj1hxpt598pph6/M=; b=jd70sxJp8AtJvA+ljgo53KTCz0O5T+u+BIJcy2NUaLIM3+e6BB64Y+hrgIWqu7E/wH /Kp+K1TmJYPoYxvRHmyHPuBCl02xOQgfpNUClJbR01ZftGbuphfWQV4byFwwDWyV0Vft cpGa5Kfz3ydg4fSnbNkXEs5TjmOPngTa7JljB1s6vE4FdhzTERBc7eWb1/vn4/mZ4VJD qHKK7EP+WbpIg2ftEHbyc5a3GqhBVD3+0Cf+oVDvy3EcHpSUeMBOa6CzgxLUXUHxq9Uq 2XDrCVvSfBEOymb7X/BpU6M4fi7bBipppJYFwuGb+XC9bRRpDF6TnWWgZiO9ftEAcYuN ygrw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=dsHSVYnl; 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-172555-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172555-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d8-20020aa7ce08000000b00572af345b6asi6407783edv.43.2024.05.07.17.21.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 17:21:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172555-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=dsHSVYnl; 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-172555-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172555-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 am.mirrors.kernel.org (Postfix) with ESMTPS id B82311F2563E for ; Wed, 8 May 2024 00:21:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D037663E; Wed, 8 May 2024 00:21:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="dsHSVYnl" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.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 A2A3D364 for ; Wed, 8 May 2024 00:21:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715127666; cv=none; b=eH00IKmNldjj1DC0ceVm/DfhErLPw++q0ZQwsv72W3I6/1hOdbSed2YKyWafrJJ/rFsMn7x6+CcofgvYt+bsyVZFON9Df+Yv0XqFnfA2LE/snFZ0kBygr1rzJzl5T1qiGxTljSe1yQ8FyqlmTViHxFIy72frPu6HM6cRl9yj5Zg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715127666; c=relaxed/simple; bh=6QNGrVnw6PUGIQqkgtVttbRiZ7WaoPYzwoKhGNB5rZw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=BpUCo1aOpPpWH6GJZdM+BoolJLe1dPEeqkAybFQIoBxlGUmYv9tff85IXrB3ALg1r5Y+aEAQcKTWi9SyClu8cya9usSjz5UNh9ZZPmEofyo7/1gjI/5VfHPaBBFeZhxmBXM21TCkLUNpvDRyr7GbTJY/e+ElZL3NuHG18rYIDkY= 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=dsHSVYnl; arc=none smtp.client-ip=209.85.128.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-yw1-f202.google.com with SMTP id 00721157ae682-61e0c296333so4594237b3.1 for ; Tue, 07 May 2024 17:21:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715127664; x=1715732464; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=c5zLDljjdB2rK7nQXYwlp9FD4GIUWDXqjmQ12YQdFX8=; b=dsHSVYnlzJMoTOZqOSvwLo1PNmikCUCyxVrfBiDXmZ9v5bBEsxsKBmG0L+wsSb/UWs XjqMXCPy9zTgGCypQFs0ak4NZzs1j2HxIPnt0AbCT60S/gXnOLtEB/oNey36i2vp9d3+ 1ySYf/+sXBxpido/FtRsrQNaN+g2On4hsCV8Ubt168h0tWGTYqNQs5kek2S+x24wAwks AUyDbRLoWpYOXEsRFfKAIT7mSoxSbUR3RYjKRHRLKCtRTNDFjY6ZrPgVUhNi/Z34+Nxc UFloXntx0LGc8JfCjexhK3M/7MnGhpwD8eWUlw8ijfCIJEMB2BXIgzu2MqRu/12bIS8/ VKCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715127664; x=1715732464; h=content-transfer-encoding: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=c5zLDljjdB2rK7nQXYwlp9FD4GIUWDXqjmQ12YQdFX8=; b=IMCAdYIj8NwgrsY6GzflKVDv3Zah4MDZ/RHGrv3Ke9w5WHp9V9s8zTmC7Yp8K4Il5P X3ddlcH7RFqtRs172NGDLhGUty3eC1Fv6EfgdeaAUbwX43Bc6cf0pjr14vl8iHQVxZLK oFiWvri7YlmLX0gQ9wyENoqBXpkMPxjjUiUTBVHo8MO4gkP6Rvezqlo9A+nN2soJwsp1 XT2RrSAAHMi+h3q+tPrPsh+IqJKkIYFxziMYWnbXcmbFtVpqqvRB6JeS/UUYh2W8wlMl i7lx6qP34/EPP5ysadRlupSq5Tg9Hu3/gaqV60gdkzFbc81nvwkRIqtFzxMYDaHqZXZh QHdQ== X-Forwarded-Encrypted: i=1; AJvYcCX1SYwMXvlY43dukOWhj/QC0r8F4/ZD6GvvsOV3vG/Oddx3lbTbHlc5SGMhC/4g6Zbl62QmQpbtfhCvTBI3fStqUQ63QtmTkzFtfbp/ X-Gm-Message-State: AOJu0YyW6LaytAIo1QVCPVSgbTPh7cWE1bL4FHpg9L57R5sgLj1bAAod y17gd5xYZvq4oaMrE1+qrS10AOMYMWC2SgZszSNGWyVIkLOuICHDEISQwLTrFlovDLSk0Q5YZE0 Syw== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a0d:d80e:0:b0:611:6f24:62b1 with SMTP id 00721157ae682-62085a32ba6mr3654617b3.1.1715127663759; Tue, 07 May 2024 17:21:03 -0700 (PDT) Date: Tue, 7 May 2024 17:21:02 -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: <20240404121327.3107131-1-pbonzini@redhat.com> <20240404121327.3107131-8-pbonzini@redhat.com> <43d1ade0461868016165e964e2bc97f280aee9d4.camel@intel.com> Message-ID: Subject: Re: [PATCH v5 07/17] KVM: x86: add fields to struct kvm_arch for CoCo features From: Sean Christopherson To: Rick P Edgecombe Cc: "kvm@vger.kernel.org" , "pbonzini@redhat.com" , "linux-kernel@vger.kernel.org" , Yan Y Zhao , "michael.roth@amd.com" , Isaku Yamahata Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Tue, May 07, 2024, Rick P Edgecombe wrote: > On Mon, 2024-04-08 at 18:21 -0700, Sean Christopherson wrote: > > > - Give other name for this check like zap_from_leafs (or better name?= ) > > > =C2=A0=C2=A0 The implementation is same to kvm_gfn_shared_mask() with= comment. > > > =C2=A0=C2=A0 - Or we can add a boolean variable to struct kvm > >=20 > > If we _don't_ hardcode the behavior, a per-memslot flag or a per-VM > > capability (and thus boolean) is likely the way to go.=C2=A0 My off-the= -cuff > > vote is probably for a per-memslot flag. >=20 > Hi Sean, >=20 > Can you elaborate on the reason for a per-memslot flag? We are discussing= this > design point internally, and also the intersection with the previous atte= mpts to > do something similar with a per-vm flag[0]. >=20 > I'm wondering if the intention is to try to make a memslot flag, so it ca= n be > expanded for the normal VM usage. Sure, I'll go with that answer. Like I said, off-the-cuff. There's no concrete motiviation, it's more that _if_ we're going to expose = a knob to userspace, then I'd prefer to make it as precise as possible to minimize= the changes of KVM ending up back in ABI hell again. > Because the discussion on the original attempts, it seems safer to keep t= his > behavior more limited (TDX only) for now. And for TDX's usage a struct k= vm > bool fits best because all memslots need to be set to zap_leafs_only =3D = true, > anyway. No they don't. They might be set that way in practice for QEMU, but it's n= ot strictly required. E.g. nothing would prevent a VMM from exposing a shared= -only memslot to a guest. The memslots that burned KVM the first time around wer= e related to VFIO devices, and I wouldn't put it past someone to be crazy eno= ugh to expose an passhtrough an untrusted device to a TDX guest. > It's simpler for userspace, and less possible situations to worry about f= or KVM. >=20 > [0] https://lore.kernel.org/kvm/20200703025047.13987-1-sean.j.christopher= son@intel.com/