[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZYv3BIeEgY8LnH7U@archie.me>
Date: Wed, 27 Dec 2023 17:05:56 +0700
From: Bagas Sanjaya <bagasdotme@...il.com>
To: Pasha Tatashin <pasha.tatashin@...een.com>, akpm@...ux-foundation.org,
alim.akhtar@...sung.com, alyssa@...enzweig.io,
asahi@...ts.linux.dev, baolu.lu@...ux.intel.com,
bhelgaas@...gle.com, cgroups@...r.kernel.org, corbet@....net,
david@...hat.com, dwmw2@...radead.org, hannes@...xchg.org,
heiko@...ech.de, iommu@...ts.linux.dev, jernej.skrabec@...il.com,
jonathanh@...dia.com, joro@...tes.org,
krzysztof.kozlowski@...aro.org, linux-doc@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, linux-rockchip@...ts.infradead.org,
linux-samsung-soc@...r.kernel.org, linux-sunxi@...ts.linux.dev,
linux-tegra@...r.kernel.org, lizefan.x@...edance.com,
marcan@...can.st, mhiramat@...nel.org, m.szyprowski@...sung.com,
paulmck@...nel.org, rdunlap@...radead.org, robin.murphy@....com,
samuel@...lland.org, suravee.suthikulpanit@....com,
sven@...npeter.dev, thierry.reding@...il.com, tj@...nel.org,
tomas.mudrunka@...il.com, vdumpa@...dia.com, wens@...e.org,
will@...nel.org, yu-cheng.yu@...el.com, rientjes@...gle.com
Cc: Josh Don <joshdon@...gle.com>, YouHong Li <liyouhong@...inos.cn>
Subject: Re: [PATCH v3 00/10] IOMMU memory observability
On Tue, Dec 26, 2023 at 08:01:55PM +0000, Pasha Tatashin wrote:
> ----------------------------------------------------------------------
> Changelog
> ----------------------------------------------------------------------
> v3:
> - Sync with v6.7-rc7
> - Addressed comments from David Rientjes: s/pages/page/, added unlikely() into
> the branches, expanded comment for iommu_free_pages_list().
> - Added Acked-bys: David Rientjes
>
> v2:
> - Added Reviewed-by Janne Grunau
> - Sync with 6.7.0-rc3, 3b47bc037bd44f142ac09848e8d3ecccc726be99
> - Separated form the series patches:
> vhost-vdpa: account iommu allocations
> https://lore.kernel.org/all/20231130200447.2319543-1-pasha.tatashin@soleen.com
> vfio: account iommu allocations
> https://lore.kernel.org/all/20231130200900.2320829-1-pasha.tatashin@soleen.com
> as suggested by Jason Gunthorpe
> - Fixed SPARC build issue detected by kernel test robot
> - Drop the following patches as they do account iommu page tables:
> iommu/dma: use page allocation function provided by iommu-pages.h
> iommu/fsl: use page allocation function provided by iommu-pages.h
> iommu/iommufd: use page allocation function provided by iommu-pages.h
> as suggested by Robin Murphy. These patches are not related to IOMMU
> page tables. We might need to do a separate work to support DMA
> observability.
> - Remove support iommu/io-pgtable-arm-v7s as the 2nd level pages are
> under a page size, thanks Robin Murphy for pointing this out.
>
> ----------------------------------------------------------------------
> Description
> ----------------------------------------------------------------------
> IOMMU subsystem may contain state that is in gigabytes. Majority of that
> state is iommu page tables. Yet, there is currently, no way to observe
> how much memory is actually used by the iommu subsystem.
>
> This patch series solves this problem by adding both observability to
> all pages that are allocated by IOMMU, and also accountability, so
> admins can limit the amount if via cgroups.
>
> The system-wide observability is using /proc/meminfo:
> SecPageTables: 438176 kB
>
> Contains IOMMU and KVM memory.
>
> Per-node observability:
> /sys/devices/system/node/nodeN/meminfo
> Node N SecPageTables: 422204 kB
>
> Contains IOMMU and KVM memory memory in the given NUMA node.
>
> Per-node IOMMU only observability:
> /sys/devices/system/node/nodeN/vmstat
> nr_iommu_pages 105555
>
> Contains number of pages IOMMU allocated in the given node.
>
> Accountability: using sec_pagetables cgroup-v2 memory.stat entry.
>
> With the change, iova_stress[1] stops as limit is reached:
>
> # ./iova_stress
> iova space: 0T free memory: 497G
> iova space: 1T free memory: 495G
> iova space: 2T free memory: 493G
> iova space: 3T free memory: 491G
>
> stops as limit is reached.
>
> This series encorporates suggestions that came from the discussion
> at LPC [2].
> ----------------------------------------------------------------------
> [1] https://github.com/soleen/iova_stress
> [2] https://lpc.events/event/17/contributions/1466
> ----------------------------------------------------------------------
> Previous versions
> v1: https://lore.kernel.org/all/20231128204938.1453583-1-pasha.tatashin@soleen.com
> v2: https://lore.kernel.org/linux-mm/20231130201504.2322355-1-pasha.tatashin@soleen.com
> ----------------------------------------------------------------------
>
First of all, Merry Christmas and Happy New Year for all!
And for this series, no observable regressions when booting the kernel with
the series applied.
Tested-by: Bagas Sanjaya <bagasdotme@...il.com>
--
An old man doll... just what I always wanted! - Clara
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists