From: Mike Lothian <mike@fireburn.co.uk>
To: Petr Tesarik <petrtesarik@huaweicloud.com>
Cc: Jonathan Corbet <corbet@lwn.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Christoph Hellwig <hch@lst.de>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Robin Murphy <robin.murphy@arm.com>, Borislav Petkov <bp@suse.de>,
"Paul E. McKenney" <paulmck@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Zhen Lei <thunder.leizhen@huawei.com>,
Randy Dunlap <rdunlap@infradead.org>,
Damien Le Moal <damien.lemoal@opensource.wdc.com>,
Kim Phillips <kim.phillips@amd.com>,
"Steven Rostedt (Google)" <rostedt@goodmis.org>,
Muchun Song <muchun.song@linux.dev>, Ondrej Zary <linux@zary.sk>,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
Petr Tesarik <petr.tesarik.ext@huawei.com>,
Hans de Goede <hdegoede@redhat.com>,
Dan Williams <dan.j.williams@intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Kees Cook <keescook@chromium.org>,
Thomas Gleixner <tglx@linutronix.de>,
Won Chung <wonchung@google.com>,
"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
"open list:DRM DRIVERS" <dri-devel@lists.freedesktop.org>,
"open list:DMA MAPPING HELPERS" <iommu@lists.linux.dev>,
petr@tesarici.cz, Kefeng Wang <wangkefeng.wang@huawei.com>,
Roberto Sassu <roberto.sassu@huawei.com>
Subject: Re: [PATCH v2 0/7] Allow dynamic allocation of software IO TLB bounce buffers
Date: Fri, 28 Apr 2023 09:53:38 +0100 [thread overview]
Message-ID: <CAHbf0-HwQhFsYW8cp0t9660877b9tTxZBego7VSfx0ayAwKePQ@mail.gmail.com> (raw)
In-Reply-To: <cover.1681898595.git.petr.tesarik.ext@huawei.com>
On Wed, 19 Apr 2023 at 11:05, Petr Tesarik <petrtesarik@huaweicloud.com> wrote:
>
> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
>
> The goal of my work is to provide more flexibility in the sizing of
> SWIOTLB.
>
> The software IO TLB was designed with these assumptions:
>
> 1. It would not be used much, especially on 64-bit systems.
> 2. A small fixed memory area (64 MiB by default) is sufficient to
> handle the few cases which require a bounce buffer.
> 3. 64 MiB is little enough that it has no impact on the rest of the
> system.
>
> First, if SEV is active, all DMA must be done through shared
> unencrypted pages, and SWIOTLB is used to make this happen without
> changing device drivers. The software IO TLB size is increased to
> 6% of total memory in sev_setup_arch(), but that is more of an
> approximation. The actual requirements may vary depending on the
> amount of I/O and which drivers are used. These factors may not be
> know at boot time, i.e. when SWIOTLB is allocated.
>
> Second, other colleagues have noticed that they can reliably get
> rid of occasional OOM kills on an Arm embedded device by reducing
> the SWIOTLB size. This can be achieved with a kernel parameter, but
> determining the right value puts additional burden on pre-release
> testing, which could be avoided if SWIOTLB is allocated small and
> grows only when necessary.
>
> Changes from v1-devel-v7:
> - Add comments to acquire/release barriers
> - Fix whitespace issues reported by checkpatch.pl
>
> Changes from v1-devel-v6:
> - Provide long description of functions
> - Fix kernel-doc (Returns: to Return:)
> - Rename __lookup_dyn_slot() to lookup_dyn_slot_locked()
>
> Changes from RFC:
> - Track dynamic buffers per device instead of per swiotlb
> - Use a linked list instead of a maple tree
> - Move initialization of swiotlb fields of struct device to a
> helper function
> - Rename __lookup_dyn_slot() to lookup_dyn_slot_locked()
> - Introduce per-device flag if dynamic buffers are in use
> - Add one more user of DMA_ATTR_MAY_SLEEP
> - Add kernel-doc comments for new (and some old) code
> - Properly escape '*' in dma-attributes.rst
>
> Petr Tesarik (7):
> swiotlb: Use a helper to initialize swiotlb fields in struct device
> swiotlb: Move code around in preparation for dynamic bounce buffers
> dma-mapping: introduce the DMA_ATTR_MAY_SLEEP attribute
> swiotlb: Dynamically allocated bounce buffers
> swiotlb: Add a boot option to enable dynamic bounce buffers
> drm: Use DMA_ATTR_MAY_SLEEP from process context
> swiotlb: per-device flag if there are dynamically allocated buffers
>
> .../admin-guide/kernel-parameters.txt | 6 +-
> Documentation/core-api/dma-attributes.rst | 10 +
> drivers/base/core.c | 4 +-
> drivers/gpu/drm/drm_gem_shmem_helper.c | 2 +-
> drivers/gpu/drm/drm_prime.c | 2 +-
> include/linux/device.h | 12 +
> include/linux/dma-mapping.h | 6 +
> include/linux/swiotlb.h | 54 ++-
> kernel/dma/swiotlb.c | 382 ++++++++++++++++--
> 9 files changed, 443 insertions(+), 35 deletions(-)
>
> --
> 2.25.1
>
Hi
Is this a potential fix for
https://bugzilla.kernel.org/show_bug.cgi?id=217310 where I'm manually
setting bigger buffers to keep my wifi working?
Thanks
Mike
next prev parent reply other threads:[~2023-04-28 8:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-19 10:03 [PATCH v2 0/7] Allow dynamic allocation of software IO TLB bounce buffers Petr Tesarik
2023-04-19 10:03 ` [PATCH v2 1/7] swiotlb: Use a helper to initialize swiotlb fields in struct device Petr Tesarik
2023-04-19 10:03 ` [PATCH v2 2/7] swiotlb: Move code around in preparation for dynamic bounce buffers Petr Tesarik
2023-04-19 10:03 ` [PATCH v2 3/7] dma-mapping: introduce the DMA_ATTR_MAY_SLEEP attribute Petr Tesarik
2023-04-19 10:03 ` [PATCH v2 4/7] swiotlb: Dynamically allocated bounce buffers Petr Tesarik
2023-04-19 10:03 ` [PATCH v2 5/7] swiotlb: Add a boot option to enable dynamic " Petr Tesarik
2023-04-19 10:03 ` [PATCH v2 6/7] drm: Use DMA_ATTR_MAY_SLEEP from process context Petr Tesarik
2023-04-19 10:03 ` [PATCH v2 7/7] swiotlb: per-device flag if there are dynamically allocated buffers Petr Tesarik
2023-04-26 12:15 ` [PATCH v2 0/7] Allow dynamic allocation of software IO TLB bounce buffers Petr Tesařík
2023-04-26 12:26 ` Greg Kroah-Hartman
2023-04-26 12:44 ` Petr Tesařík
2023-04-26 12:53 ` Greg Kroah-Hartman
2023-04-26 13:16 ` Petr Tesařík
2023-05-09 7:16 ` Petr Tesařík
2023-05-09 7:32 ` Greg Kroah-Hartman
2023-07-10 22:23 ` Mike Lothian
2023-04-28 8:53 ` Mike Lothian [this message]
2023-04-28 9:07 ` Petr Tesařík
2023-05-01 10:29 ` Mike Lothian
2023-05-02 12:15 ` Petr Tesarik
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=CAHbf0-HwQhFsYW8cp0t9660877b9tTxZBego7VSfx0ayAwKePQ@mail.gmail.com \
--to=mike@fireburn.co.uk \
--cc=Jason@zx2c4.com \
--cc=airlied@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bp@suse.de \
--cc=catalin.marinas@arm.com \
--cc=corbet@lwn.net \
--cc=damien.lemoal@opensource.wdc.com \
--cc=dan.j.williams@intel.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=hch@lst.de \
--cc=hdegoede@redhat.com \
--cc=iommu@lists.linux.dev \
--cc=keescook@chromium.org \
--cc=kim.phillips@amd.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@zary.sk \
--cc=m.szyprowski@samsung.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=muchun.song@linux.dev \
--cc=paulmck@kernel.org \
--cc=petr.tesarik.ext@huawei.com \
--cc=petr@tesarici.cz \
--cc=petrtesarik@huaweicloud.com \
--cc=rafael@kernel.org \
--cc=rdunlap@infradead.org \
--cc=roberto.sassu@huawei.com \
--cc=robin.murphy@arm.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=thunder.leizhen@huawei.com \
--cc=tzimmermann@suse.de \
--cc=wangkefeng.wang@huawei.com \
--cc=will@kernel.org \
--cc=wonchung@google.com \
/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).