Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp620473rdh; Wed, 14 Feb 2024 06:58:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVDxZPOMNuBh97DdC4XCqvPqKxFy9/SLJerv74oQovuaXs/XNOQd7pndEds4kqbhDI9yMQPNYGss0lAI2Bdi7a1oZeLknEpYPYURASWtw== X-Google-Smtp-Source: AGHT+IGdBzYiPXwBEvaQ2sUisFZprBSpol+T0rAUjZM3mvWhLYXQRVPvA8/l+DIPYHxsht8Cfp5+ X-Received: by 2002:a05:6358:5389:b0:178:a7de:2e17 with SMTP id z9-20020a056358538900b00178a7de2e17mr3039335rwe.7.1707922704159; Wed, 14 Feb 2024 06:58:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707922704; cv=pass; d=google.com; s=arc-20160816; b=QQB18Cd+gxPKQZDEB5OoM+1joJX/Ym8CwTTL4q21flB+omPJCQCE9G41d7EIn2cC8Y 1esddvqlYPS3deeTedeN6B92rKSecr3IRHN9hESIT0hB4LYKjgMpsjFnQD9AubJSx7XQ pBTKxnxfGs+x2C6HfaG2V8FJ+TS1x59JOepWj4zD9PSd98Po5quJKmEKOLC6nV8OSXr9 avhO0hISKUDr2J8Ay0m8ylmDwBTHUUQpBMQRPjFUfry39e9yrCtYpga7TxmeVZyqIRMQ FGrGs9O9v7PWFc4bKFluXp+V+3EnnM5XuWxCOES3ymMFAN8ybFwetusb3J/ULriG/eM2 Babg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature:dkim-signature; bh=epVZw1x9FVt2elh8jYLSX6PiqT6PpjnxqNeFSeq1Zwo=; fh=OAOJHAd1Ua7C73Umm7J6pRtckbHNfkxg68KJysBAdS0=; b=s90LkvHFoKHSKKxz7ODOZ/TiySxerVr1QHyHgOl3ANxYOnS8pwgiz4yxjJF93F9Zn4 Ezdrsf6i8VndCfGyn7uwmTanyFa821h+8UVvvmZ/29hqmBIyG+tD7PFPOiK64ASpX3B+ b/ob0+nIcDgnatPa5zxE247dmRNDjpDdkYq3nGRyuEA6CLPOFbn89GHVfEF1DRbT6uqo 2YMnihK8j0mFkjfeoSHriprj3XcfsLqqavI4coRUk/4EaC0VQd+TQzCCjFJlX125dhDr GqSaQj64UcGxWlXC7fgX0vf6vG1fNB0Bqj7pX6+EiAFycjl5w/QH1KC/9qtXKPsFc/wr yYYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@shutemov.name header.s=fm2 header.b=gyQBbXH2; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=TWECDkEP; arc=pass (i=1 spf=pass spfdomain=shutemov.name dkim=pass dkdomain=shutemov.name dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-65363-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65363-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCXOzoUml5HThQ9rIQxnFylZf+AqkbezhNmPndS2/AdrMJ9Qniuv724jPMboG6+m/CyH0HHQvTeZTk+gVwcKyED5B43kHiXxVSNvM7DSng== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id cf8-20020a056a02084800b005cd783d410csi3859510pgb.610.2024.02.14.06.58.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 06:58:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65363-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@shutemov.name header.s=fm2 header.b=gyQBbXH2; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=TWECDkEP; arc=pass (i=1 spf=pass spfdomain=shutemov.name dkim=pass dkdomain=shutemov.name dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-65363-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65363-linux.lists.archive=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 1BDA9B20E00 for ; Wed, 14 Feb 2024 14:50:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 047B35B1F4; Wed, 14 Feb 2024 14:50:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=shutemov.name header.i=@shutemov.name header.b="gyQBbXH2"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="TWECDkEP" Received: from wfhigh8-smtp.messagingengine.com (wfhigh8-smtp.messagingengine.com [64.147.123.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 014A25579B for ; Wed, 14 Feb 2024 14:49:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.159 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707922201; cv=none; b=AYV3UYURgQdPCqiCx77kFtpatbZCoUvJljxiNDX5P5MOURe/svrtRsCRUZJmBJK9RoB2OF0xXfq+nzxDOS6m51DTUJpa0agbGHOQsxXvaSHF3wjVdwV5N1XjfbydoHFHUrr54Oexl5DFAH+mbrnMY/HQfen9bw1ajod23+F1dSc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707922201; c=relaxed/simple; bh=B1yFHfeHqpqZavgAJ56fxZmHRfqRxaiP53AMO42YAk8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=a0qOCV1FTndOYCCD5gDYv2YGD9WrHImAFeJMhubnsbSDcM9zbb8IH1ZgUDrctv5rWFpjolRXhg7AO9ljcpTxwp48mFJDZ1JJPlB8AslQ89FJ/uFYxsnoftlOZkZ/rnmx2SsZxphbtq5Cqg7KTLa3VsAEb4117s4WTnWcg8jmjLU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name; spf=pass smtp.mailfrom=shutemov.name; dkim=pass (2048-bit key) header.d=shutemov.name header.i=@shutemov.name header.b=gyQBbXH2; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=TWECDkEP; arc=none smtp.client-ip=64.147.123.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shutemov.name Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailfhigh.west.internal (Postfix) with ESMTP id 5ECD2180007C; Wed, 14 Feb 2024 09:49:56 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Wed, 14 Feb 2024 09:49:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1707922195; x= 1708008595; bh=epVZw1x9FVt2elh8jYLSX6PiqT6PpjnxqNeFSeq1Zwo=; b=g yQBbXH2Nd0+K8dm+BcBfX5h1iijUIOSpznBIPpqcSiWFGBi4uy+ekQkVEtz4utnl RC8WyKwJOIUYe5ltvS5CAV+nY0oL7R6qmfPLy89cXJDUfEcV6QuVgXY6HOBcoTPE IQuz8RItCSO8eg6jjCJnd8bgwu7h45n25lgd7Z3a0PHioW7afFmpMQdlr+rD2xEz MPUyK8Y/nzYX7ovkxetOJuRLvdBfO5ImGrS4gFLl08+oXTfEk6Rlm2GCLHS5ezJR B8LCU0r4c2Q+Kpolz6HDeASuRuILF687s2ny91S+eXAr10vzUppyIYhZ9TaUXxIu KUhOEnig/MnY4J5ySkMcg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1707922195; x=1708008595; bh=epVZw1x9FVt2elh8jYLSX6PiqT6P pjnxqNeFSeq1Zwo=; b=TWECDkEPyM+sYaRC5S/kgrLIwNlmMN5vk78TViGP+uG9 sV19jQS/pZDH4VVyghDBnXnQeLbpl1oHNGtkc3b/KaF9+eOyZw8LVVBdHg8HarEe fxc9m704DTG9dzstJOSIgSC0v8gBAAUYNpTIDGOqvmxJLzJDtxyd8MhUVA84+6Dq VUJNWPDOJSCI7cUVBgvFHDPYb5A127XlJLexkbUWAddoJ4Z1KTdrogLR55ErvDia +rk09aBQcQMq815rtwAMzyqDPMcaU99rsptGwady+fZc67+o5+OF2IBcl9iXNqnL fydkw+UZqln/W0ihd9dwmd65wNdWU1wpL1lZbAJyeA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudejgdejtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehttdfstddttddvnecuhfhrohhmpedfmfhirhhi lhhlucetrdcuufhhuhhtvghmohhvfdcuoehkihhrihhllhesshhhuhhtvghmohhvrdhnrg hmvgeqnecuggftrfgrthhtvghrnhepffdvveeuteduhffhffevlefhteefveevkeelveej udduvedvuddvleetudevhfeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepkhhirhhilhhlsehshhhuthgvmhhovhdrnhgrmhgv X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 14 Feb 2024 09:49:46 -0500 (EST) Date: Wed, 14 Feb 2024 16:49:43 +0200 From: "Kirill A. Shutemov" To: Vishal Annapurve Cc: x86@kernel.org, linux-kernel@vger.kernel.org, pbonzini@redhat.com, rientjes@google.com, bgardon@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, 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, bp@suse.de, rostedt@goodmis.org, iommu@lists.linux.dev Subject: Re: [RFC V1 1/5] swiotlb: Support allocating DMA memory from SWIOTLB Message-ID: References: <20240112055251.36101-1-vannapurve@google.com> <20240112055251.36101-2-vannapurve@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240112055251.36101-2-vannapurve@google.com> On Fri, Jan 12, 2024 at 05:52:47AM +0000, Vishal Annapurve wrote: > Modify SWIOTLB framework to allocate DMA memory always from SWIOTLB. > > CVMs use SWIOTLB buffers for bouncing memory when using dma_map_* APIs > to setup memory for IO operations. SWIOTLB buffers are marked as shared > once during early boot. > > Buffers allocated using dma_alloc_* APIs are allocated from kernel memory > and then converted to shared during each API invocation. This patch ensures > that such buffers are also allocated from already shared SWIOTLB > regions. This allows enforcing alignment requirements on regions marked > as shared. But does it work in practice? Some devices (like GPUs) require a lot of DMA memory. So with this approach we would need to have huge SWIOTLB buffer that is unused in most VMs. -- Kiryl Shutsemau / Kirill A. Shutemov