public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: "Jingoo Han" <jingoohan1@gmail.com>,
	"Gustavo Pimentel" <gustavo.pimentel@synopsys.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: endpoint: Migrate to Genalloc framework for outbound window memory allocation
Date: Mon, 18 Mar 2024 12:08:43 -0500	[thread overview]
Message-ID: <20240318170843.GA1187538@bhelgaas> (raw)
In-Reply-To: <20240317-pci-ep-genalloc-v1-1-70fe52a3b9be@linaro.org>

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.

> 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?

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

Thanks for working on this.

Bjorn

  reply	other threads:[~2024-03-18 17:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-17  6:09 [PATCH] PCI: endpoint: Migrate to Genalloc framework for outbound window memory allocation Manivannan Sadhasivam
2024-03-18 17:08 ` Bjorn Helgaas [this message]
2024-03-19 14:35   ` Manivannan Sadhasivam
2024-03-19 15:50 ` Frank Li
2024-03-19 16:16   ` Frank Li
2024-03-19 16:28   ` Manivannan Sadhasivam
2024-03-19 17:01     ` Frank Li
2024-03-20  6:10       ` Manivannan Sadhasivam
2024-03-20 14:26         ` Frank Li
2024-03-20  9:56 ` Kishon Vijay Abraham I
2024-03-20 11:29   ` Manivannan Sadhasivam
2024-04-14 13:00     ` Manivannan Sadhasivam
2024-04-18  4:44       ` Kishon Vijay Abraham I
2024-04-18  5:24         ` Manivannan Sadhasivam
2024-04-24 14:23           ` Kishon Vijay Abraham I

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240318170843.GA1187538@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=gustavo.pimentel@synopsys.com \
    --cc=jingoohan1@gmail.com \
    --cc=kishon@kernel.org \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox