All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Christoph Hellwig <hch@lst.de>,
	Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Cc: Jeremy Linton <jeremy.linton@arm.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	David Rientjes <rientjes@google.com>,
	linux-rpi-kernel@lists.infradead.org,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dma-pool: use single atomic pool for both DMA zones
Date: Wed, 8 Jul 2020 17:20:16 +0100	[thread overview]
Message-ID: <304053c7-9f88-8830-3287-2496a4cb48cd@arm.com> (raw)
In-Reply-To: <20200708153635.GB26743@lst.de>

On 2020-07-08 16:36, Christoph Hellwig wrote:
> On Wed, Jul 08, 2020 at 12:35:34PM +0200, Nicolas Saenz Julienne wrote:
>>> Which allows me to switch between ACPI/DT on the machine. In DT mode it
>>> works fine now,
>>
>> Nice, would that count as a Tested-by from you?
>>
>>> but with ACPI I continue to have failures unless I
>>> disable CMA via cma=0 on the kernel command line.
>>
>> Yes, I see why, in atomic_pool_expand() memory is allocated from CMA without
>> checking its correctness. That calls for a separate fix. I'll try to think of
>> something.
> 
> I think we need a dma_coherent_ok for the allocations from the
> pool and then fall back to the next better one to get started.  And
> yes, CMA is a bit of a mess, that generally needs better checks.

Yeah, another thought that came to mind later is that iommu-dma can use 
pages from any pool regardless of the device's DMA mask, so we could 
stand to be a lot less restrictive in that case too.

Perhaps it is better to just bite the bullet, keep the straightforward 
one-pool-per-zone setup, and implement the dma_coherent_ok() type 
fallback logic. More complexity for dma_alloc_from_pool(), but 
everything else stays nice and simple - lose the assumption that 
dev_to_pool() can work for this and and just let callers pass an 
allocation mask directly, and have dma_free_from_pool() simply check all 
available pools.

Robin.

WARNING: multiple messages have this Message-ID (diff)
From: Robin Murphy <robin.murphy@arm.com>
To: Christoph Hellwig <hch@lst.de>,
	Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Cc: linux-kernel@vger.kernel.org,
	Jeremy Linton <jeremy.linton@arm.com>,
	iommu@lists.linux-foundation.org,
	linux-rpi-kernel@lists.infradead.org,
	David Rientjes <rientjes@google.com>
Subject: Re: [PATCH] dma-pool: use single atomic pool for both DMA zones
Date: Wed, 8 Jul 2020 17:20:16 +0100	[thread overview]
Message-ID: <304053c7-9f88-8830-3287-2496a4cb48cd@arm.com> (raw)
In-Reply-To: <20200708153635.GB26743@lst.de>

On 2020-07-08 16:36, Christoph Hellwig wrote:
> On Wed, Jul 08, 2020 at 12:35:34PM +0200, Nicolas Saenz Julienne wrote:
>>> Which allows me to switch between ACPI/DT on the machine. In DT mode it
>>> works fine now,
>>
>> Nice, would that count as a Tested-by from you?
>>
>>> but with ACPI I continue to have failures unless I
>>> disable CMA via cma=0 on the kernel command line.
>>
>> Yes, I see why, in atomic_pool_expand() memory is allocated from CMA without
>> checking its correctness. That calls for a separate fix. I'll try to think of
>> something.
> 
> I think we need a dma_coherent_ok for the allocations from the
> pool and then fall back to the next better one to get started.  And
> yes, CMA is a bit of a mess, that generally needs better checks.

Yeah, another thought that came to mind later is that iommu-dma can use 
pages from any pool regardless of the device's DMA mask, so we could 
stand to be a lot less restrictive in that case too.

Perhaps it is better to just bite the bullet, keep the straightforward 
one-pool-per-zone setup, and implement the dma_coherent_ok() type 
fallback logic. More complexity for dma_alloc_from_pool(), but 
everything else stays nice and simple - lose the assumption that 
dev_to_pool() can work for this and and just let callers pass an 
allocation mask directly, and have dma_free_from_pool() simply check all 
available pools.

Robin.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2020-07-08 16:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07 12:28 [PATCH] dma-pool: use single atomic pool for both DMA zones Nicolas Saenz Julienne
2020-07-07 12:28 ` Nicolas Saenz Julienne
2020-07-07 22:08 ` Jeremy Linton
2020-07-07 22:08   ` Jeremy Linton
2020-07-08 10:35   ` Nicolas Saenz Julienne
2020-07-08 10:35     ` Nicolas Saenz Julienne
2020-07-08 15:11     ` Jeremy Linton
2020-07-08 15:11       ` Jeremy Linton
2020-07-08 15:36     ` Christoph Hellwig
2020-07-08 15:36       ` Christoph Hellwig
2020-07-08 16:20       ` Robin Murphy [this message]
2020-07-08 16:20         ` Robin Murphy
2020-07-08 15:35 ` Christoph Hellwig
2020-07-08 15:35   ` Christoph Hellwig
2020-07-08 16:00   ` Nicolas Saenz Julienne
2020-07-08 16:00     ` Nicolas Saenz Julienne
2020-07-08 16:10     ` Christoph Hellwig
2020-07-08 16:10       ` Christoph Hellwig
2020-07-09 21:49       ` David Rientjes
2020-07-09 21:49         ` David Rientjes via iommu
2020-07-10  8:19         ` Nicolas Saenz Julienne
2020-07-10  8:19           ` Nicolas Saenz Julienne
2020-07-08 23:16 ` Jeremy Linton
2020-07-08 23:16   ` Jeremy Linton

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=304053c7-9f88-8830-3287-2496a4cb48cd@arm.com \
    --to=robin.murphy@arm.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jeremy.linton@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=m.szyprowski@samsung.com \
    --cc=nsaenzjulienne@suse.de \
    --cc=rientjes@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 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.