Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp12368rdb; Wed, 31 Jan 2024 21:45:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IEeUiheLIaD3NlzVV71DfXQi8TFqtKnuix8NO9BeI+2kRWjxdNerdny4guuMFNlZxeqqpzF X-Received: by 2002:a17:90b:2395:b0:294:6b8b:369a with SMTP id mr21-20020a17090b239500b002946b8b369amr3831433pjb.20.1706766312039; Wed, 31 Jan 2024 21:45:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706766312; cv=pass; d=google.com; s=arc-20160816; b=QlIuy+CMY/fRFHTsDri8smksfg67Wk0AuDMod3OqrIeZb3rknr1PdffNiRiS7beOfQ 6QtLehhr/5PESxp0E0u78VJ7+XT4qsaeoCnoWcZ2lh7cCLbDFocE2cDKFvzer/MKqrtS 8kc4xgvYGqvpgUjXYBfnZKJTRtiXnJi2lu2W3XWgibFXk5FAkcpIFTkABxLc9OZQNef/ uhn8ie1jaloO1tJLUFbCh8PyF0I8CApbID6W4090P+bWPGhvWKbApjiYpnDkQQ0l5ITI UOuXtHHeC4lydvAqA2jjGILsnDtXdbkXtoY1r50pEtJPPdlDOgltz6bJCydULb6lgufm QrKg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=fmok2g8b5tWvpbsX9cLmWQHlMF1xII4qzBeVlpsQ4mQ=; fh=airZ4EFArVEWSogmWqDtpZF93PDoeLyJmGX57elCmas=; b=eb6mZ4HCebj2wE4xn6yNSitJBj/uAZp4h8WRaj4xY5NnYjW2Me2ye/wBKTJajtgvV3 nlvK2kY3/lwBNfKlWnYgYqGqlXgosLf2ftoai9Co/leApRu6NgQpesPCfilrJhjz7mYL gIYI5umk4lDqhlqzJLsgO1xOFowCW11UNmjl2iNLoA/ToAych2+0W3P/GrHTFyfheFS+ NwZ/0E/1wlaDfo5cf0m4RjulAWLAJIxTmrDLZSCIpCDupeFyOrYJpDppLfHZKjmy90hW NnLsN0FW5O38HVg0wpR7obgRJE1ZDgN4rrxJSTlSl/nwVNOFk6KInp2aVdbn/viErHRm aEiA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=c0ulfMHV; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-47658-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47658-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=1; AJvYcCUdh7xVhtadfu4No+VJkNeGlBOqgKfZ4tvIMAa6RiMwEwdTqFp50HYXawcbd9NaXhEx5Erz9EhsMCHzkKUz2KfVniGPIOfHNTaggosgNg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p21-20020a17090b011500b00290b6513033si2888480pjz.153.2024.01.31.21.45.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 21:45:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47658-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=c0ulfMHV; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-47658-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47658-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F04CA2902DA for ; Thu, 1 Feb 2024 05:44:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C278612E5; Thu, 1 Feb 2024 05:44:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="c0ulfMHV" Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) (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 EF1C8612EE for ; Thu, 1 Feb 2024 05:44:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706766284; cv=none; b=T80JuZf5fkUtEqxBgtuidSpCAvmWs3edaLFGx0Gss5sfxctjEhMJyPNcBkZXIBzxnwOOoEDMCbRaWQ9Bp1OaivcDepSjM1N95YKEq4geDpKnfilTytoeEq4Fi3qRWgLCRQg9ySqIBRQFmrX35adxOIaxPFNndv8Xh+8sOK46bF0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706766284; c=relaxed/simple; bh=vEMPM/EH6Okz3t25IkSZi1WRRqu1MVzESQkdYhAZwy0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=CRfxcK62LHvncB+YjthrcJPm2zrSKew7jt4+47V88TY70gACeUz7hsqtQRAk9OEz/Y3zqrHAS6TnTGSH0xvHMHIsK+afjf/tAPjAiV2iTlA2iRrpAp0CRvH/8D0WJlAS8f8QXvaWAvF+vQXwNHIyFgw3ZmOQUmulmBkFMfUoVdc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=c0ulfMHV; arc=none smtp.client-ip=209.85.219.49 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=google.com Received: by mail-qv1-f49.google.com with SMTP id 6a1803df08f44-68c495ba558so3314116d6.3 for ; Wed, 31 Jan 2024 21:44:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706766282; x=1707371082; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=fmok2g8b5tWvpbsX9cLmWQHlMF1xII4qzBeVlpsQ4mQ=; b=c0ulfMHVBWZj79cvVe0naZvUO52Tb+Yv9+vRF/6YydinKpRNdPbH1L0DoavM+YaxlB IBPFlRdnj4YJOqaeNHSu6WjTF3YTQVz4PcgZm5iWI531sga2YqmbsXE+3m/mXrjf4bY2 U8cFaZ/oqQzSl+O5hYY069Ddj9MNG9oEXP8KNUKoBeD90NUxsW9m1S3fph7Upz6AIJj5 LwPjQAb4frvDNU6tlTtWxBBvd4pYkXId8kVDmH3KrsF0MJs69m3PirinqWrCpojOXlQZ H2aaUSOkMCnojU3l5WjROjh/4W9hU5zVpZlxikSqL0b6m/YgvTkQVx3+B7zGtW5+acK1 Jeiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706766282; x=1707371082; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fmok2g8b5tWvpbsX9cLmWQHlMF1xII4qzBeVlpsQ4mQ=; b=ABfOOX/6gJ9WSryi9VNmNDmvZenbW5xxJJzNNVCi+vLmF4vJzYcTfJHKpsypCU94dW 04dnKYxvMXRwm+L75XhosU48MuvUCCYs1OEdC7qMISJ99CqrpLq/9LjKwukOd00dM1xY QXBKzIC4XH/emz3/geqdwgpQsNIwnVajmvC8CgqsPv3uRTi6TdkW3Ibg5Qt94N7TsBoP rJNTXCmz8HQ04DGQ0N1lS/ccNsi927T+aTbZR9kZvpR3PIyQte855PJrElGmMSHZY9iE n6WsXzuxSXWNhXtX2AocqOCcy7y3pPQu/OZS2vbK85/PDSoxLlvG6GjJ4LIub6YWmFyr ushQ== X-Gm-Message-State: AOJu0YwqYRn4raL6mpaO64VzL+12zDs0Frz2iDulCk5BUJ1HnWhPuPzG jhYv451uXpf39HHiVgy5xSnvqjEVGFaKH/lSQdA2JGiuY8sDur6n7Y+Y8zw3mGES+aTK+XlTJKq DVfdbYdYxCW4VbFuMtjy+sMrk8kTf5F7X4hOP X-Received: by 2002:a05:6214:d87:b0:681:77d9:c405 with SMTP id e7-20020a0562140d8700b0068177d9c405mr3957939qve.33.1706766281534; Wed, 31 Jan 2024 21:44:41 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240112055251.36101-1-vannapurve@google.com> In-Reply-To: From: Vishal Annapurve Date: Thu, 1 Feb 2024 11:14:28 +0530 Message-ID: Subject: Re: [RFC V1 0/5] x86: CVMs: Align memory conversions to 2M granularity To: Dave Hansen Cc: x86@kernel.org, linux-kernel@vger.kernel.org, pbonzini@redhat.com, rientjes@google.com, seanjc@google.com, erdemaktas@google.com, ackerleytng@google.com, jxgao@google.com, sagis@google.com, oupton@google.com, peterx@redhat.com, vkuznets@redhat.com, dmatlack@google.com, pgonda@google.com, michael.roth@amd.com, kirill@shutemov.name, thomas.lendacky@amd.com, dave.hansen@linux.intel.com, linux-coco@lists.linux.dev, chao.p.peng@linux.intel.com, isaku.yamahata@gmail.com, andrew.jones@linux.dev, corbet@lwn.net, hch@lst.de, m.szyprowski@samsung.com, rostedt@goodmis.org, iommu@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jan 31, 2024 at 10:23=E2=80=AFPM Dave Hansen wrote: > > There's a bunch of code in the kernel for TDX and SEV guests. How much > of it uses the "CVM" nomenclature? Right, I see that "CoCo VMs" is a more accepted term in the kernel codebase so far, will update the references in the next version. > > What do you do when you need to dynamically scale up the SWIOTLB size > and can't allocate a 2M page? I guess you're saying here that you'd > rather run with a too-small 2M pool than a large-enough mixed 4k/2M pool. I am not yet certain how to ensure 2M page is always available/made available at runtime for CoCo VMs. Few options that I can think of: 1) Reserve additional memory for CMA allocations to satisfy runtime requests of 2M allocations. 2) Pre-reserve SWIOTLB to a safe value just like it's done today and not rely on dynamic scaling. Any suggestions are welcome. > > I also had a really hard time parsing through the problem statement and > solution here. I'd really suggest cleaning up the problem statement and > more clearly differentiating the host and guest sides in the description. Thanks for taking a look at this series. I will reword the description in the next version. The goal basically is to ensure private and shared memory regions are always huge page aligned.