[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGtprH8LOgvtO_rjFzASbp240P=yBvODCBU22sN_+uhdumueiQ@mail.gmail.com>
Date: Tue, 5 Mar 2024 09:19:00 -0800
From: Vishal Annapurve <vannapurve@...gle.com>
To: Alexander Graf <graf@...zon.com>
Cc: "Kirill A. Shutemov" <kirill@...temov.name>, x86@...nel.org, linux-kernel@...r.kernel.org,
pbonzini@...hat.com, rientjes@...gle.com, seanjc@...gle.com,
erdemaktas@...gle.com, ackerleytng@...gle.com, jxgao@...gle.com,
sagis@...gle.com, oupton@...gle.com, peterx@...hat.com, vkuznets@...hat.com,
dmatlack@...gle.com, pgonda@...gle.com, michael.roth@....com,
thomas.lendacky@....com, dave.hansen@...ux.intel.com,
linux-coco@...ts.linux.dev, chao.p.peng@...ux.intel.com,
isaku.yamahata@...il.com, andrew.jones@...ux.dev, corbet@....net, hch@....de,
m.szyprowski@...sung.com, rostedt@...dmis.org, iommu@...ts.linux.dev
Subject: Re: [RFC V1 1/5] swiotlb: Support allocating DMA memory from SWIOTLB
On Thu, Feb 15, 2024 at 3:14 PM Alexander Graf <graf@...zon.com> wrote:
> > ...
> > The issue with aligning the pool areas to hugepages is that hugepage
> > allocation at runtime is not guaranteed. Guaranteeing the hugepage
> > allocation might need calculating the upper bound in advance, which
> > defeats the purpose of enabling dynamic SWIOTLB. I am open to
> > suggestions here.
>
>
> You could allocate a max bound at boot using CMA and then only fill into
> the CMA area when SWIOTLB size requirements increase? The CMA region
> will allow movable allocations as long as you don't require the CMA space.
Thanks Alex for the inputs, I wanted to understand CMA better before
responding here.
I am trying to get the following requirements satisfied:
1) SWIOTLB pools are aligned to hugepage sizes.
2) SWIOTLB pool areas can be scaled up dynamically on demand to avoid
pre-allocating large memory ranges.
Using CMA to back SWIOTLB pools for CoCo VMs as per this suggestion would need:
1) Pre-configuring CMA areas with a certain amount at boot either with,
- command line argument to the kernel (tedious to specify with
different memory shapes) or
- kernel init time hook called by architecture specific code to
setup CMA areas according to the amount of memory available (Possibly
a percentage of memory as done for SWIOTLB configuration)
2) SWIOTLB pool dynamic allocation logic can first scan for CMA areas
to find the hugepage aligned ranges, and if not found, can fall back
to allocate the ranges using buddy allocator (which should ideally
happen after depleting the CMA area).
3) SWIOTLB pool regions would need to be allocatable from >4G ranges as well.
Setting up a suitable percentage of memory for CMA area in case of
CoCo VMs will allow larger SWIOTLB pool area additions, this should
help alleviate Michael Kelley's concern about spin lock contention due
to smaller pool areas. This will need some analysis of shared memory
usage with current devices in use with CoCo VMs, especially GPUs which
might need large amounts of shared memory.
>
>
> Alex
Powered by blists - more mailing lists