Re: [PATCH] PCI: endpoint: Migrate to Genalloc framework for outbound window memory allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 18, 2024 at 12:08:43PM -0500, Bjorn Helgaas wrote:
> On Sun, Mar 17, 2024 at 11:39:17AM +0530, Manivannan Sadhasivam wrote:
> > As proposed during the last year 'PCI Endpoint Subsystem Open Items
> > Discussion' of Linux Plumbers conference [1], let's migrate to Genalloc
> > framework for managing the endpoint outbound window memory allocation.
> > 
> > PCI Endpoint subsystem is using a custom memory allocator in pci-epc-mem
> > driver from the start for managing the memory required to map the host
> > address space (outbound) in endpoint. Even though it works well, it
> > completely defeats the purpose of the 'Genalloc framework', a general
> > purpose memory allocator framework created to avoid various custom memory
> > allocators in the kernel.
> 
> Nice idea.  I wonder if something like this could be done for PCI BAR
> assignment, i.e., the stuff in setup-bus.c.  There are a lot of
> constraints there, so maybe it wouldn't be practical.
> 

I took a quick look at it and I share the same view.

> > The migration to Genalloc framework is done is such a way that the existing
> > API semantics are preserved. So that the callers of the EPC mem APIs do not
> > need any modification (apart from the pcie-designware-epc driver that
> > queries page size).
> > 
> > Internally, the EPC mem driver now uses Genalloc framework's
> > 'gen_pool_first_fit_order_align' algorithm that aligns the allocated memory
> > based on the requested size as like the previous allocator. And the
> > page size passed during pci_epc_mem_init() API is used as the minimum order
> > for the memory allocations.
> 
> /as like the previous allocator/as the previous allocator did/
> 
> > During the migration, 'struct pci_epc_mem' is removed as it is seems
> > redundant and the existing 'struct pci_epc_mem_window' in 'struct pci_epc'
> > is now used to hold the address windows of the endpoint controller.
> 
> s/as it is seems/as it seems/
> 
> If this is not a logically required part of the conversion, could the
> pci_epc_mem removal be a separate patch?
> 

genalloc migration essentially makes the 'struct pci_epc_mem' unused. So I
thought it makes sense to remove it in the same patch. But I do not have a
stronger opinion to not split it.

So, I can split it in next version.

> The docs refer to it as "genalloc", i.e., not capitalized:
> https://docs.kernel.org/core-api/genalloc.html
> 

Ok. Will change it.

- Mani

-- 
மணிவண்ணன் சதாசிவம்




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux