Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4203527rdh; Tue, 28 Nov 2023 15:09:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLS4gtnD+LenUiCFhWtOB09hLvgxDQ2gWLGP9TdYzgYq+2NI9QDlyTCMnQhRK+hWbeLTKZ X-Received: by 2002:a17:90a:c718:b0:27d:1972:136c with SMTP id o24-20020a17090ac71800b0027d1972136cmr19427952pjt.38.1701212942130; Tue, 28 Nov 2023 15:09:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701212942; cv=none; d=google.com; s=arc-20160816; b=j/29+Mhtd/xvXEkuyjc9LbOfAh+1YSnZfj2ETwxj+FVEtGOmG7Sdk5F3/H5DVGgU1l NuZ8WW/kpB/AGejRW+U1mEvHv1LglpswYqLgyeLl6AEHasSDcHX/eXkpmpnSuJC6sPvd H8FrNDLv9bi0RlfauU1YZO/JR9xOft3UYv0HWZ6FhkACky79W6vuWM9Njc+WzH9WqM1y LAjjMtJIra9t7aQ9q8Udi4AsrXm3ByUP94+RIxY4s+YkVAwZQZpAbofapQVIbyHnSS1E oKVHGPtY9tHqi8JghQ4oRpkFCeVYGp1fvz8mt2C+G3ttTAbaBDbaNbBxhpv2VnlLD5EV hFjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ZwfH1boRaqUSm7vYG/zdQBuuZhpN21nmfcJNTWlLUDE=; fh=KrOdxIG8yo4eQUue+6iUQpXhhA25gH2Ad8XZy9Mnro0=; b=es9/GTTnzTwumRv8yAssWke3hScNv0pWL4sB3qYLja03nUal0y19nHl3YIiF0A0v1K cWF2lJNkQQfgVrGti9/xABaq+tZdFpqBPClKyk9WoVvmzseX4SVC6HeFSyYYPiseCze8 RxiB3Gd+ZIhKHAubLJxJkOxBeFRfM8WYvH6ehi6X6b8xvvz1BJdU7B1wZemuqpZAX0QI ZN4Kj0EpPdUxo53tl6rJuDrquUrYbUrhKTIn0Txw48+sNMcUKxCoK9OVWvWCvUy746Rb QRXtg8NzodwkZXjrmicP2weE6ETvCgdBTEJKqstZrjcFiCtwLhWf3T184oib9PEtAEc7 l3BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=L2M2Qprf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id nk4-20020a17090b194400b002859aaee807si25788pjb.33.2023.11.28.15.09.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 15:09:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=L2M2Qprf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 9D09780A68BD; Tue, 28 Nov 2023 15:08:59 -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 S1346453AbjK1XIo (ORCPT + 99 others); Tue, 28 Nov 2023 18:08:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229543AbjK1XIn (ORCPT ); Tue, 28 Nov 2023 18:08:43 -0500 Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E54218E for ; Tue, 28 Nov 2023 15:08:49 -0800 (PST) Received: by mail-qt1-x832.google.com with SMTP id d75a77b69052e-423a459d616so20797071cf.1 for ; Tue, 28 Nov 2023 15:08:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1701212928; x=1701817728; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ZwfH1boRaqUSm7vYG/zdQBuuZhpN21nmfcJNTWlLUDE=; b=L2M2Qprf4E13EmuQfMCiF96aDL6KRUKn30A8AJ9b64X816aPXJAY9oxw7B1ln8iZHi 48FDR+YptH8ftAV2+eOX/vl7Oe5bDpdaafnB96VWxqu5tkeNY7SunuexF2cs/fzyj/PF 52SOZGEcxMRPEPkYoIZQOTGi2wnFe8v/w1oF10w6RQwekK+EzxkxlYt0qcfzwiJQts+H 2tMU1YUY+TjpQSYKZH1l+OlSp3m7dzueKnbvTL7NXjfpV4JEEkxClWrtUUf4jcXVj6jt e7sejvPKLZx1EPf+lDFFwqdwpKQonrOaiVG5Lue0KJdEEO6Oz2qRGuU1t6eH92/gwk6X Cj3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701212928; x=1701817728; h=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=ZwfH1boRaqUSm7vYG/zdQBuuZhpN21nmfcJNTWlLUDE=; b=SqHfyjh4/5psighQCKIXB6HOlIWe45msYj6GpfM5Dof/yVsFAYPWOh/U8K4KCkkbMV l6nZBqrnnyRy7cCsKNa67LK7u9h7LAFyyQlJT/SE+E5sDzjiCXwJSngk9IhWcNITAYu/ AektMw77d3F2cA34xDMchFQTJ2ICAwKpVJ83x1u0UVYnckdUt2h/y4G1NtesPrbpfCxs s0fBG4+OkMa+hjlrzDlSeSWHYjfMz27PwrpM2AVwxJqLNnd8qUughx4uiYTYLiJ+2Z0u cBlXB0411qm7LEHRfP5cOjU1oYst46BKloXqCmVCuPWcwspefmSyphwsI63Kklv0muhx y4aw== X-Gm-Message-State: AOJu0YxOArV9Q/wFsHG5+G3O97hfVzsv9h3gd7wXISmtdFL6W+SWh/zf dGuYB4dVHIu1Z/29akK3DJEGFalCbQMPDjkMgcEWng== X-Received: by 2002:a05:622a:d2:b0:423:7f91:3a17 with SMTP id p18-20020a05622a00d200b004237f913a17mr22124861qtw.21.1701212928489; Tue, 28 Nov 2023 15:08:48 -0800 (PST) MIME-Version: 1.0 References: <20231128204938.1453583-1-pasha.tatashin@soleen.com> <20231128204938.1453583-7-pasha.tatashin@soleen.com> <79c397ee-b71b-470e-9184-401b4b96a0d2@arm.com> In-Reply-To: <79c397ee-b71b-470e-9184-401b4b96a0d2@arm.com> From: Pasha Tatashin Date: Tue, 28 Nov 2023 18:08:11 -0500 Message-ID: Subject: Re: [PATCH 06/16] iommu/dma: use page allocation function provided by iommu-pages.h To: Robin Murphy 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 15:08:59 -0800 (PST) > > 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. I see, IOMMU variants are used only for discontiguous allocations, and the common ones are defined outside of driver/iommu. Alright, I can remove all the changes for all no-page table related IOMMU allocations. Pasha