From: "Petr Tesařík" <petr@tesarici.cz>
To: Petr Tesarik <petrtesarik@huaweicloud.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Russell King <linux@armlinux.org.uk>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)),
"H. Peter Anvin" <hpa@zytor.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Juergen Gross <jgross@suse.com>,
Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>,
Christoph Hellwig <hch@lst.de>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Robin Murphy <robin.murphy@arm.com>,
Petr Tesarik <petr.tesarik.ext@huawei.com>,
Jonathan Corbet <corbet@lwn.net>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Hans de Goede <hdegoede@redhat.com>, James Seo <james@equiv.tech>,
James Clark <james.clark@arm.com>,
Kees Cook <keescook@chromium.org>,
xen-devel@lists.xenproject.org (moderated list:XEN HYPERVISOR
ARM),
linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT),
linux-kernel@vger.kernel.org (open list),
linux-mips@vger.kernel.org (open list:MIPS),
iommu@lists.linux.dev (open list:XEN SWIOTLB SUBSYSTEM),
Roberto Sassu <roberto.sassu@huaweicloud.com>,
Kefeng Wang <wangkefeng.wang@huawei.com>
Subject: Re: [PATCH v4 3/8] swiotlb: separate memory pool data from other allocator data
Date: Thu, 13 Jul 2023 19:53:07 +0200 [thread overview]
Message-ID: <20230713195307.08d68b01@meshulam.tesarici.cz> (raw)
In-Reply-To: <e309b4a88ffb306c88a3b3cfe5e57483d73d20bc.1689261692.git.petr.tesarik.ext@huawei.com>
On Thu, 13 Jul 2023 17:23:14 +0200
Petr Tesarik <petrtesarik@huaweicloud.com> wrote:
> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
>
> Carve out memory pool specific fields from struct io_tlb_mem. The original
> struct now contains shared data for the whole allocator, while the new
> struct io_tlb_pool contains data that is specific to one memory pool of
> (potentially) many.
>
> Allocate both structures together for restricted DMA pools to keep the
> error cleanup path simple.
>
> Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
> ---
> include/linux/device.h | 2 +-
> include/linux/swiotlb.h | 47 +++++++----
> kernel/dma/swiotlb.c | 181 +++++++++++++++++++++++++---------------
> 3 files changed, 147 insertions(+), 83 deletions(-)
>
> diff --git a/include/linux/device.h b/include/linux/device.h
> index bbaeabd04b0d..d9754a68ba95 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -625,7 +625,7 @@ struct device_physical_location {
> * @dma_pools: Dma pools (if dma'ble device).
> * @dma_mem: Internal for coherent mem override.
> * @cma_area: Contiguous memory area for dma allocations
> - * @dma_io_tlb_mem: Pointer to the swiotlb pool used. Not for driver use.
> + * @dma_io_tlb_mem: Software IO TLB allocator. Not for driver use.
> * @archdata: For arch-specific additions.
> * @of_node: Associated device tree node.
> * @fwnode: Associated device node supplied by platform firmware.
> diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
> index 39313c3a791a..d669e11e2827 100644
> --- a/include/linux/swiotlb.h
> +++ b/include/linux/swiotlb.h
> @@ -62,8 +62,7 @@ dma_addr_t swiotlb_map(struct device *dev, phys_addr_t phys,
> #ifdef CONFIG_SWIOTLB
>
> /**
> - * struct io_tlb_mem - IO TLB Memory Pool Descriptor
> - *
> + * struct io_tlb_pool - IO TLB memory pool descriptor
> * @start: The start address of the swiotlb memory pool. Used to do a quick
> * range check to see if the memory was in fact allocated by this
> * API.
> @@ -73,15 +72,36 @@ dma_addr_t swiotlb_map(struct device *dev, phys_addr_t phys,
> * @vaddr: The vaddr of the swiotlb memory pool. The swiotlb memory pool
> * may be remapped in the memory encrypted case and store virtual
> * address for bounce buffer operation.
> - * @nslabs: The number of IO TLB blocks (in groups of 64) between @start and
> - * @end. For default swiotlb, this is command line adjustable via
> - * setup_io_tlb_npages.
> + * @nslabs: The number of IO TLB slots between @start and @end. For the
> + * default swiotlb, this can be adjusted with a boot parameter,
> + * see setup_io_tlb_npages().
> + * @used: The number of used IO TLB slots.
> + * @late_alloc: %true if allocated using the page allocator.
> + * @nareas: Number of areas in the pool.
> + * @area_nslabs: Number of slots in each area.
> + * @areas: Array of memory area descriptors.
> + * @slots: Array of slot descriptors.
> + */
> +struct io_tlb_pool {
> + phys_addr_t start;
> + phys_addr_t end;
> + void *vaddr;
> + unsigned long nslabs;
> + unsigned long used;
Oops. This member should not be re-introduced here after I removed it
with commit efa76afdde16...
I'm going to fix this in a v5, but I don't think it's critical enough
to make an immediate resend.
Petr T
next prev parent reply other threads:[~2023-07-13 17:53 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-13 15:23 [PATCH v4 0/8] Allow dynamic allocation of software IO TLB bounce buffers Petr Tesarik
2023-07-13 15:23 ` [PATCH v4 1/8] swiotlb: make io_tlb_default_mem local to swiotlb.c Petr Tesarik
2023-07-17 6:06 ` Philippe Mathieu-Daudé
2023-07-17 10:17 ` Petr Tesařík
2023-07-20 6:37 ` Christoph Hellwig
2023-07-20 7:54 ` Petr Tesařík
2023-07-13 15:23 ` [PATCH v4 2/8] swiotlb: add documentation and rename swiotlb_do_find_slots() Petr Tesarik
2023-07-20 6:38 ` Christoph Hellwig
2023-07-20 7:56 ` Petr Tesařík
2023-07-20 8:01 ` Christoph Hellwig
2023-07-20 8:14 ` Petr Tesařík
2023-07-13 15:23 ` [PATCH v4 3/8] swiotlb: separate memory pool data from other allocator data Petr Tesarik
2023-07-13 17:53 ` Petr Tesařík [this message]
2023-07-13 15:23 ` [PATCH v4 4/8] swiotlb: add a flag whether a SWIOTLB is allowed to grow Petr Tesarik
2023-07-13 15:23 ` [PATCH v4 5/8] swiotlb: if swiotlb is full, fall back to a transient memory pool Petr Tesarik
2023-07-13 15:23 ` [PATCH v4 6/8] swiotlb: determine potential physical address limit Petr Tesarik
2023-07-13 15:23 ` [PATCH v4 7/8] swiotlb: allocate a new memory pool when existing pools are full Petr Tesarik
2023-07-13 15:23 ` [PATCH v4 8/8] swiotlb: search the software IO TLB only if a device makes use of it Petr Tesarik
2023-07-20 6:47 ` Christoph Hellwig
2023-07-20 8:02 ` Petr Tesařík
2023-07-20 8:22 ` Christoph Hellwig
2023-07-20 6:52 ` [PATCH v4 0/8] Allow dynamic allocation of software IO TLB bounce buffers Christoph Hellwig
2023-07-20 8:13 ` Petr Tesařík
2023-07-20 8:23 ` Christoph Hellwig
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=20230713195307.08d68b01@meshulam.tesarici.cz \
--to=petr@tesarici.cz \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=hch@lst.de \
--cc=hdegoede@redhat.com \
--cc=hpa@zytor.com \
--cc=iommu@lists.linux.dev \
--cc=james.clark@arm.com \
--cc=james@equiv.tech \
--cc=jgross@suse.com \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=m.szyprowski@samsung.com \
--cc=mingo@redhat.com \
--cc=oleksandr_tyshchenko@epam.com \
--cc=petr.tesarik.ext@huawei.com \
--cc=petrtesarik@huaweicloud.com \
--cc=rafael@kernel.org \
--cc=roberto.sassu@huaweicloud.com \
--cc=robin.murphy@arm.com \
--cc=sstabellini@kernel.org \
--cc=tglx@linutronix.de \
--cc=tsbogend@alpha.franken.de \
--cc=wangkefeng.wang@huawei.com \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.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;
as well as URLs for NNTP newsgroup(s).