From: Robin Murphy <robin.murphy@arm.com>
To: Stefan Wahren <wahrenst@gmx.net>, Arnd Bergmann <arnd@arndb.de>,
Russell King <linux@armlinux.org.uk>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
Lukas Wunner <lukas@wunner.de>, Christoph Hellwig <hch@lst.de>,
Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
linux-arm-kernel@lists.infradead.org, stefan.wahren@i2se.com
Subject: Re: [PATCH] ARM: mm: Fix ARCH_LOW_ADDRESS_LIMIT when CONFIG_ZONE_DMA
Date: Wed, 6 Sep 2023 12:38:21 +0100 [thread overview]
Message-ID: <70a38749-e2b6-4d97-e6c5-c51267e3793e@arm.com> (raw)
In-Reply-To: <b132f5ae-f25b-e83e-1c36-5f2c498a431a@gmx.net>
On 2023-09-06 11:31, Stefan Wahren wrote:
> Hi,
>
> Am 03.06.23 um 15:58 schrieb Lukas Wunner:
>> On Sat, Jun 03, 2023 at 02:59:53PM +0200, Arnd Bergmann wrote:
>>> On Sat, Jun 3, 2023, at 14:38, Russell King (Oracle) wrote:
>>>> On Sat, Jun 03, 2023 at 02:33:49PM +0200, Arnd Bergmann wrote:
>>>>> Changing the low address limit by itself makes the swiotlb work
>>>>> correctly, but for performance we also want to avoid having to
>>>>> use the swiotlb at all when dealing with the zero page.
>>>>
>>>> How often is the zero page used for DMA _to_ a device (it should never
>>>> be used for DMA _from_ a device.) ? It doesn't sound that useful to me,
>>>> since it can only be used for writing zeros.
>>>
>>> It's possible that this doesn't happen all that much at all, the
>>> bcm2835-dma driver is the only one that has a specific optimization
>>> for this case, introduced in commit bf75703d0912d ("dmaengine:
>>> bcm2835: Avoid accessing memory when copying zeroes").
>>>
>>> If the ZERO page can only be mapped through swiotlb, that
>>> optimization is clearly counterproductive because it requires
>>> making a copy of the zero page but doesn't actually skip
>>> any transfers.
>>>
>>> I don't really understand what the spi driver is doing here,
>>> but I can see that it still contains the code that originally
>>> started the discussion about the change to the DMA driver,
>>> so I assume it's still used that way.
>>
>> SPI is a bidirectional bus, i.e. you receive as many bytes as you write.
>>
>> When you're receiving an Ethernet frame from an SPI-attached network
>> chip,
>> you need to clock out bytes in order to clock in the Ethernet frame.
>> The content of those bytes you clock out doesn't matter. They can be
>> zeroes or anything else.
>>
>> The Raspberry Pi's BCM2835 DMA controller is capable of synthesizing
>> zeroes
>> and writing them to the SPI controller's FIFO. This reduces traffic
>> on the
>> memory bus because you don't need to copy data from memory to the FIFO.
>>
>> Unfortunately only a subset of the DMA channels has that capability.
>> If the SPI controller happens to get only one of the inferior "lite"
>> channels, it needs to fall back to copying data from memory. To avoid
>> having to map a page for that, it simply reuses the zero page.
>>
>> Hope that sheds some light on what the driver is doing there.
>
> i'm bit a lost in this old discussion. Arnd sent a Reviewed-By to the
> patch.
>
> Shall i send this to RMK's patch system?
I think so - I don't remember how we got into the SPI thing, but that
looks somewhat bogus and broken, and doesn't matter to the correctness
of this patch in itself.
Thanks,
Robin.
>
> Or is the patch not sufficient enough?
>
>>
>> Thanks,
>>
>> Lukas
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2023-09-06 11:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-03 9:06 [PATCH] ARM: mm: Fix ARCH_LOW_ADDRESS_LIMIT when CONFIG_ZONE_DMA Stefan Wahren
2023-06-03 12:33 ` Arnd Bergmann
2023-06-03 12:38 ` Russell King (Oracle)
2023-06-03 12:59 ` Arnd Bergmann
2023-06-03 13:52 ` Russell King (Oracle)
[not found] ` <20230603135820.GA13150@wunner.de>
2023-09-06 10:31 ` Stefan Wahren
2023-09-06 11:38 ` Robin Murphy [this message]
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=70a38749-e2b6-4d97-e6c5-c51267e3793e@arm.com \
--to=robin.murphy@arm.com \
--cc=arnd@arndb.de \
--cc=f.fainelli@gmail.com \
--cc=hch@lst.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=lukas@wunner.de \
--cc=nsaenzjulienne@suse.de \
--cc=stefan.wahren@i2se.com \
--cc=wahrenst@gmx.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.