Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1247568rdb; Fri, 2 Feb 2024 21:20:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IEe9SWnk31YEyYu6kz7332GmvX7Dmg93zW8IrSJk/Jr3iARk+TNEMoRVq9Ze0eh3wZfEW0N X-Received: by 2002:a17:906:2688:b0:a31:1178:8e6d with SMTP id t8-20020a170906268800b00a3111788e6dmr3034270ejc.70.1706937606949; Fri, 02 Feb 2024 21:20:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706937606; cv=pass; d=google.com; s=arc-20160816; b=Qxs75zT5fONOZuU0oa7KozZOohkwvcjWodgJ5ot88C28DLa0TyoqTG20NHbs8loAgO BnFSwYprZg4npiCYt3BjrHrsqf7I4eNt2sFQXuJRy5JFTb6T8H1WMRH1i6onGW97b7Bb n5XFhQx1iM968LSe9Ou2dZLMXdH9zP7OOXNh+hYsAOiqE40UyMVKh7oy8x6MwoRn9hA1 I+WLe5t/f3Lchx7KBMBgx2ZBOSFTa+VsR/yvz5IpqyLPcfFlPDPNJhdXDcJa3c7O1kle +kuh6gi2gsOBOSpPj6CWn1V3iYQxjwn1ABoxvqIjRytNPqOY82iVLT7vylAqRddLon2K 881w== 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=hxZUisTRnkCHmoXtIIiIE5AFQkxg9hNXueoX4FT1IyU=; fh=xPQ7vgBE6hchiGjzuwG/e4BgaNTNSjKc60ufNAh2dBg=; b=MYlK7fNmATfzfDBymAub4VJVcoCXx2uRQl1LXnRLeMh85Drc5UWuf6yYMUtn6T7LBL kURcp5nzIunKGVtnRT5jDGtf5MBCh7WxS4/0EYIEbudbbRoCzVfqeKqf5ZJhfuwIHFBp PPdbJfi1SQz6HSx3JuMnIjaJDOlyFiszmwuP1xjDbbjyWuNYzUMHtMNdsmA7uWFelDaQ 68laZEeyutfQDC33jAUE5r5JpU0Sps01cR0ty0No41YUVnd460n4cqz71uRK8Hse36EM CQsTVp8TMCb328jMm2Inx/tSTPlMp+Qn77cIF22NWx7Zr+1mQXRA2+k7YvQUQrzjIXX0 912g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=l62OrDZK; 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-50934-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50934-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; AJvYcCVa+y/elJJ1Tba1IW0AqYjrOnP9/PpN2UDXFkoVpFa9Y5y+P5GVgO5q0npdSQS57MIBvAFXP8WyLzuXfGUWGrQLwWj1OEx9rgGqVNmq0w== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id v10-20020a170906488a00b00a35abe27c6asi1436226ejq.549.2024.02.02.21.20.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 21:20:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50934-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=l62OrDZK; 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-50934-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50934-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 5E76F1F27F7C for ; Sat, 3 Feb 2024 05:20:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 81AA810A2B; Sat, 3 Feb 2024 05:19:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="l62OrDZK" Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) (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 2DC9D10A1C for ; Sat, 3 Feb 2024 05:19:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706937594; cv=none; b=Gf3Gt1K2KhVREjf87v/o1TXKGQkCUoJoEv8VroJjwGn5waanjieX/HH38STn4mdjTcYhV0SL+rqdCNto9QLLKcdTN71exglGWeOk3yq0mA4hOfScRtgEnseNnpzMwXUR4mbiaPP4r8WYpl22R2wNGpVcehVJnz7doYSl1wtUtMI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706937594; c=relaxed/simple; bh=aV3RAoxJAIIl/L41qxXGSFWaFYi0w5bCiFnptXPK/IE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=NGi4lGlYEaEMhSLNGWuD8ab6JD6GdCZ/qqK7gjBxOBP/qmnMlw2D/whXAJVqjVxL8pZp7aH/dD1NWG5gfbj+tEbi7OHSQk85zfS0yxmz6txo1Cj8G6HC8wARXAfkcRzVWbLSlNyr7F11BAHmM6J+C786Y4WtiODzjJECauDso/o= 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=l62OrDZK; arc=none smtp.client-ip=209.85.219.43 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-f43.google.com with SMTP id 6a1803df08f44-68c7f482f8eso9468606d6.3 for ; Fri, 02 Feb 2024 21:19:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706937592; x=1707542392; 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=hxZUisTRnkCHmoXtIIiIE5AFQkxg9hNXueoX4FT1IyU=; b=l62OrDZK9YxbcV8Jlk+51HjizekLGOT8xMDBYsyY+w6YMV1YEE8UC5FvOEOpb2qnKS jmt5Z0o/nQPyPKwHDjyUReV79b/hxWpR2b4QKd644+v2QqIN9LLTsrr1Up/f5cI6S9R5 M7g9+u9An+wnmEs5/U46Ebqb5szZrUS7ukYvVxMMtN/nMSnEfnERQwmENy7oz0ChSa0U oYDC498w2tUaCQA0NXXKgzH2P/1U/tQFcpji+ViehH8DTuWdM2LaBEIV3YK6vLRxx7je NRGSKGYna8eOuGXFZ+ofBL0rsdRPS8iIDaP41Bfjy3yI7eqDtFqm5VmXK8tYq5cqD9Jf 4ONA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706937592; x=1707542392; 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=hxZUisTRnkCHmoXtIIiIE5AFQkxg9hNXueoX4FT1IyU=; b=r/4Jw3QAxXxQ3WM6rbUioaHSpWAXiSLKZPf8attNkzS+mrNTPsJNlqTZsB/vIpkgag +rehFUILVBtg3bWXOw/vo8ygTXwbsDzm681ntfbzW/RM/jqoGn/bknQDUoLBdO2vIy3N pl9A2sUG7/c9iyptCzetpfYjCGHG1sOvt19oh2nhhDVcZL7YK2zfTfCFq+KaS3ugWlFW 27jvAHPzYKH6w5ssWGhkcTIoDaQMVs8f9/175235f7xy9JoavLNSjNX7Vh01cDBmexh9 EKw1dPUezQAU5scdLALzPVT14q+uXDXfBlfXeTQFtdHhxHdlvOYeRJvlkGK5bjeBztWi Et+w== X-Gm-Message-State: AOJu0YyZ4tAfnaAFyP0JTphBi1y9GUE4/yvIWYbSi7yk+PoiTk+2xM6t bq9/LWPJJR+vz6qfDA+M4n7c2/VrebmJoUbLIe9fT5pZoSqWD8P4BcOe7fVSS84fkq+UYY5IoWM 7ATpEMy9dH6B7gqvP2GXE7lN9y0vo+f6aGBJz X-Received: by 2002:a0c:aa1a:0:b0:685:edc7:62c0 with SMTP id d26-20020a0caa1a000000b00685edc762c0mr285138qvb.30.1706937591794; Fri, 02 Feb 2024 21:19:51 -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> <20240112055251.36101-6-vannapurve@google.com> <6709a57c-48a0-4ddd-b64e-a1e34ae2b763@intel.com> <1d9d3372-825a-417a-8811-ffa501c83936@linux.microsoft.com> <3313c886-e964-48c3-8277-b47cb1955de9@linux.microsoft.com> <746d2448-3adc-467b-a39c-5585f33bd740@intel.com> In-Reply-To: <746d2448-3adc-467b-a39c-5585f33bd740@intel.com> From: Vishal Annapurve Date: Sat, 3 Feb 2024 10:49:38 +0530 Message-ID: Subject: Re: [RFC V1 5/5] x86: CVMs: Ensure that memory conversions happen at 2M alignment To: Dave Hansen Cc: Jeremi Piotrowski , 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 Fri, Feb 2, 2024 at 10:06=E2=80=AFPM Dave Hansen = wrote: > > On 2/2/24 08:22, Vishal Annapurve wrote: > >> If you must - focus on getting swiotlb conversions to happen at the de= sired > >> granularity but don't try to force every single conversion to be >4K. > > If any conversion within a guest happens at 4K granularity, then this > > will effectively cause non-hugepage aligned EPT/NPT entries. This > > series is trying to get all private and shared memory regions to be > > hugepage aligned to address the problem statement. > > Yeah, but the series is trying to do that by being awfully myopic at > this stage and without being _declared_ to be so myopic. > Agreed. I was being overly optimistic when I mentioned following in the cover message: "** This series leaves out some of the conversion sites which might not be 2M aligned but should be easy to fix once the approach is finalized. **" > Take a look at all of the set_memory_decrypted() calls. How many of > them even operate on the part of the guest address space rooted in the > memfd where splits matter? They're not doing conversions. They're just > setting up shared mappings in the page tables of gunk that was never > private in the first place. Thinking it over again, yeah the conversions that are happening outside SWIOTLB should be impacting significantly less memory ranges. As Jeremi and you are suggesting, it would be a big step forward if memory conversions happening for just DMA requests are aligned to hugepage sizes.