mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Andreas Larsson" <andreas@gaisler.com>,
	"Sam Ravnborg" <sam@ravnborg.org>,
	"Maciej W. Rozycki" <macro@orcam.me.uk>,
	sparclinux@vger.kernel.org,
	"Randy Dunlap" <rdunlap@infradead.org>
Cc: "Miquel Raynal" <miquel.raynal@bootlin.com>,
	linux-parport@lists.infradead.org,
	"David S . Miller" <davem@davemloft.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/7] sparc32: Do not select ZONE_DMA
Date: Wed, 06 Mar 2024 15:45:28 +0100	[thread overview]
Message-ID: <75a4a08d-85c2-4a60-9cbd-90dd50f765a8@app.fastmail.com> (raw)
In-Reply-To: <bc33b608-e0b5-4dff-aa05-8513dce409b3@gaisler.com>

On Wed, Mar 6, 2024, at 15:19, Andreas Larsson wrote:
> On 2024-03-05 16:26, Arnd Bergmann wrote:
>> On Tue, Mar 5, 2024, at 16:06, Andreas Larsson wrote:
>>> On 2024-02-24 18:42, Sam Ravnborg via B4 Relay wrote:
>> 
>>>> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
>>>> index 734f23daecca..bdbde506c01e 100644
>>>> --- a/arch/sparc/Kconfig
>>>> +++ b/arch/sparc/Kconfig
>>>> @@ -62,7 +62,6 @@ config SPARC32
>>>>  	select HAVE_UID16
>>>>  	select LOCK_MM_AND_FIND_VMA
>>>>  	select OLD_SIGACTION
>>>> -	select ZONE_DMA
>>>
>>> This however makes a number of PCI drivers that depend on
>>> ZONE_DMA unselectable.
>> 
>> I think that is the correct thing to do then: the only
>> drivers that I see with this dependency are PCI sound cards
>> that apparently rely on DMA to the 16MB ISA range, which is
>> not provided by sparc.
>
> The ZONE_DMA dependency does not seem related to ISA per se. Commit
> 80ab8eae70e5 ("ALSA: Enable CONFIG_ZONE_DMA for smaller PCI DMA masks")
> that started to introduce it did were about ensuring 32-bit masks.
>
> Some of those sound card drivers sets a 24 bit mask, i.e. a 0-16MB
> range, but some among those sets a 28, and 30 bit DMA mask with
> dma_set_mask_and_coherent.

Ah right, I see it now.

> Testing, in a different driver, setting and
> allocating under a 30-bit DMA mask (or even a 28-bit DMA mask depending
> on where the physical memory resides) is possible before removing
> ZONE_DMA, but not after. 

I still don't see how that changes anything if
max_zone_pfn[ZONE_DMA] and max_zone_pfn[ZONE_NORMAL] are set
to the same value. Did you test this on a mainline kernel, or
do you have any patches on top that might have set up
the zones differently?

More specifically, what do you see in the boot log for the
size of each zone? 

> I am also a bit concerned if removing ZONE_DMA will let DMA be allocated
> in highmem and what that could lead to.

It's not supposed to make a difference, but this is a bit
more complex:

- Any kernel allocation (kmalloc etc) by definition comes from
  lowmem, regardless of GFP_DMA/GFP_KERNEL.

- user pages that get mapped using dma_map_sg() or dma_map_page()
  can be in highmem, but this should not depend on the presence
  of ZONE_DMA

- If you have devices that can only access a subset of the RAM
  and there is no IOMMU, you really need to use swiotlb to
  make it use bounce buffers, at least for the streaming
  (dma_map_*) API. A driver using only the coherent (dma_alloc_*)
  API should use ZONE_DMA if ZONE_NORMAL goes beyond the
  dma mask.

      Arnd

  reply	other threads:[~2024-03-06 14:45 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-24 17:42 [PATCH v2 0/7] sparc32: build fixes for all{yes,mod}config builds Sam Ravnborg via B4 Relay
2024-02-24 17:42 ` [PATCH v2 1/7] sparc32: Use generic cmpdi2/ucmpdi2 variants Sam Ravnborg via B4 Relay
2024-03-08 20:00   ` Andreas Larsson
2024-02-24 17:42 ` [PATCH v2 2/7] sparc32: Fix build with trapbase Sam Ravnborg via B4 Relay
2024-03-08 20:01   ` Andreas Larsson
2024-02-24 17:42 ` [PATCH v2 3/7] mtd: maps: sun_uflash: Declare uflash_devinit static Sam Ravnborg via B4 Relay
2024-02-26 10:23   ` Miquel Raynal
2024-03-08 20:02   ` Andreas Larsson
2024-02-24 17:42 ` [PATCH v2 4/7] sparc32: Do not select ZONE_DMA Sam Ravnborg via B4 Relay
2024-02-25  0:57   ` Maciej W. Rozycki
2024-02-25  7:08     ` Sam Ravnborg
2024-03-02 23:51   ` Randy Dunlap
2024-03-05 15:06   ` Andreas Larsson
2024-03-05 15:26     ` Arnd Bergmann
2024-03-06 14:19       ` Andreas Larsson
2024-03-06 14:45         ` Arnd Bergmann [this message]
2024-03-06 15:31           ` Andreas Larsson
2024-03-06 16:22             ` Arnd Bergmann
2024-03-06 18:19               ` Arnd Bergmann
2024-03-07 12:42                 ` Andreas Larsson
2024-03-07 13:06                   ` Arnd Bergmann
2024-03-06 15:04         ` Christoph Hellwig
2024-03-06 15:24           ` Arnd Bergmann
2024-02-24 17:42 ` [PATCH v2 5/7] sparc32: Do not select GENERIC_ISA_DMA Sam Ravnborg via B4 Relay
2024-03-08 20:03   ` Andreas Larsson
2024-03-09  9:04     ` Maciej W. Rozycki
2024-02-24 17:42 ` [PATCH v2 6/7] sparc32: Fix parport build with sparc32 Sam Ravnborg via B4 Relay
2024-03-02 23:52   ` Randy Dunlap
2024-03-08 20:04   ` Andreas Larsson
2024-03-09  9:06     ` Maciej W. Rozycki
2024-02-24 17:42 ` [PATCH v2 7/7] sparc32: Fix section mismatch in leon_pci_grpci Sam Ravnborg via B4 Relay
2024-03-02 23:54   ` Randy Dunlap
2024-03-05 15:06   ` Andreas Larsson
2024-03-07 18:20     ` Andreas Larsson
2024-03-07 20:16       ` Maciej W. Rozycki
2024-03-08  7:06         ` Andreas Larsson
2024-03-08 12:09           ` Maciej W. Rozycki
2024-03-08 22:08       ` Sam Ravnborg
2024-03-08 20:07   ` Andreas Larsson

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=75a4a08d-85c2-4a60-9cbd-90dd50f765a8@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=andreas@gaisler.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parport@lists.infradead.org \
    --cc=macro@orcam.me.uk \
    --cc=miquel.raynal@bootlin.com \
    --cc=rdunlap@infradead.org \
    --cc=sam@ravnborg.org \
    --cc=sparclinux@vger.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

all inboxes | Powered by JetHome®