Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4197781rdh; Tue, 28 Nov 2023 15:00:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+uyJnRDpn3woensCkSKP0fL6tbAzKNMiMB/7UlTSwetfUdqiyfJ4llkxnzW41BIM9U9pm X-Received: by 2002:a05:6a20:d04d:b0:189:fd93:c969 with SMTP id hv13-20020a056a20d04d00b00189fd93c969mr21872516pzb.26.1701212421598; Tue, 28 Nov 2023 15:00:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701212421; cv=none; d=google.com; s=arc-20160816; b=TyF6BSo+oaznJbSgK5qQNvBNcQxgCoU4z8UCxfJY69wW/QAmHpixTsWazvEgPEYYPE /V01MnUva2c9yJlqeZKsHWsvlPhZRo76oKBR8lHK7rioHg0ZS7dFI8KrPvMMKzRSID4A 9S9auEk7oKGKvNFulXfUvw59jbmsbpXntvA/MnEXPP7iWjQwVnajgVZ3KuZ3BdwW+N8G qNgXkbNlfnuAYY+FGrXBK3WL+LIbQXIDCdmfaHgtv1+ZlJ8YDuuObN35QQYs4C6HPpBj 8GzNKfVdmwcXEwlOtkHETRci8DgyMkYVcMZvy/9y3SpzZHM+5Yc/0G4UE45pamYkxFKg K4Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=DhqiAMM9A/yRyCQawi+I63bKhMIj4+UcxEPs56barcQ=; fh=UNPcC/DB6oXUkxgC39dYwwu3avY88U+TuvKXlKnynGg=; b=Z1dov41obxhjpLZi93L+3AeLGaJLWDqdUk3MZDOoRIsTn7pvrcIPwXbgyvKCxEjiW7 WcCbcWjpjsxSHuGmI23Z4su56Zc1yKPHryi4EYXDPwpSIJ/gIo4Ek1HFjt8DNrvmAqqM 7QlvG4IpGSiazDCglqPEH3RUGn+0lc4A6se2NqtPZb95eXLy0TJcnQAAneYCykEF3gpF /2gpdijiGgf92DQ0/SfcGSqA3wVqVli5joaWPZLnkbKaPyF/z8qfg6+8+6+WKYLDs8da xVqdzWH9Uop/V0IEog6XJDTECpie+lAoPM3LmEpQr0FhkpqGDPy1pcn/kBhIVzTTTNnc /WSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id d35-20020a631d63000000b005c2422cb335si13508838pgm.680.2023.11.28.14.59.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 15:00:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 92AF28068896; Tue, 28 Nov 2023 14:59:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229930AbjK1W7i (ORCPT + 99 others); Tue, 28 Nov 2023 17:59:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbjK1W7h (ORCPT ); Tue, 28 Nov 2023 17:59:37 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DEDA283; Tue, 28 Nov 2023 14:59:43 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D85752F4; Tue, 28 Nov 2023 15:00:30 -0800 (PST) Received: from [10.57.71.132] (unknown [10.57.71.132]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C33433F6C4; Tue, 28 Nov 2023 14:59:35 -0800 (PST) Message-ID: <79c397ee-b71b-470e-9184-401b4b96a0d2@arm.com> Date: Tue, 28 Nov 2023 22:59:33 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 06/16] iommu/dma: use page allocation function provided by iommu-pages.h Content-Language: en-GB To: Pasha Tatashin Cc: akpm@linux-foundation.org, alex.williamson@redhat.com, alim.akhtar@samsung.com, alyssa@rosenzweig.io, asahi@lists.linux.dev, baolu.lu@linux.intel.com, bhelgaas@google.com, cgroups@vger.kernel.org, corbet@lwn.net, david@redhat.com, dwmw2@infradead.org, hannes@cmpxchg.org, heiko@sntech.de, iommu@lists.linux.dev, jasowang@redhat.com, jernej.skrabec@gmail.com, jgg@ziepe.ca, jonathanh@nvidia.com, joro@8bytes.org, kevin.tian@intel.com, krzysztof.kozlowski@linaro.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, lizefan.x@bytedance.com, marcan@marcan.st, mhiramat@kernel.org, mst@redhat.com, m.szyprowski@samsung.com, netdev@vger.kernel.org, paulmck@kernel.org, rdunlap@infradead.org, samuel@sholland.org, suravee.suthikulpanit@amd.com, sven@svenpeter.dev, thierry.reding@gmail.com, tj@kernel.org, tomas.mudrunka@gmail.com, vdumpa@nvidia.com, virtualization@lists.linux.dev, wens@csie.org, will@kernel.org, yu-cheng.yu@intel.com References: <20231128204938.1453583-1-pasha.tatashin@soleen.com> <20231128204938.1453583-7-pasha.tatashin@soleen.com> From: Robin Murphy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 28 Nov 2023 14:59:53 -0800 (PST) On 2023-11-28 10:50 pm, Pasha Tatashin wrote: > On Tue, Nov 28, 2023 at 5:34 PM Robin Murphy wrote: >> >> On 2023-11-28 8:49 pm, Pasha Tatashin wrote: >>> Convert iommu/dma-iommu.c to use the new page allocation functions >>> provided in iommu-pages.h. >> >> These have nothing to do with IOMMU pagetables, they are DMA buffers and >> they belong to whoever called the corresponding dma_alloc_* function. > > Hi Robin, > > This is true, however, we want to account and observe the pages > allocated by IOMMU subsystem for DMA buffers, as they are essentially > unmovable locked pages. Should we separate IOMMU memory from KVM > memory all together and add another field to /proc/meminfo, something > like "iommu -> iommu pagetable and dma memory", or do we want to > export DMA memory separately from IOMMU page tables? These are not allocated by "the IOMMU subsystem", they are allocated by the DMA API. Even if you want to claim that a driver pinning memory via iommu_dma_ops is somehow different from the same driver pinning the same amount of memory via dma-direct when iommu.passthrough=1, it's still nonsense because you're failing to account the pages which iommu_dma_ops gets from CMA, dma_common_alloc_pages(), dynamic SWIOTLB, the various pools, and so on. Thanks, Robin. > Since, I included DMA memory, I specifically removed mentioning of > IOMMU page tables in the most of places, and only report it as IOMMU > memory. However, since it is still bundled together with SecPageTables > it can be confusing. > > Pasha