All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: hch@lst.de, robin.murphy@arm.com, vdumpa@nvidia.com,
	linux@armlinux.org.uk, catalin.marinas@arm.com,
	will.deacon@arm.com, joro@8bytes.org, m.szyprowski@samsung.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
	tony@atomide.com
Subject: Re: [PATCH v2 RFC/RFT 1/5] ARM: dma-mapping: Add fallback normal page allocations
Date: Wed, 24 Apr 2019 17:06:38 +0200	[thread overview]
Message-ID: <20190424150638.GA22191@lst.de> (raw)
In-Reply-To: <20190326230131.16275-2-nicoleotsuka@gmail.com>

On Tue, Mar 26, 2019 at 04:01:27PM -0700, Nicolin Chen wrote:
>  	page = dma_alloc_from_contiguous(dev, count, order, gfp & __GFP_NOWARN);
> +	if (!page)
> +		page = alloc_pages(gfp, order);

We have this fallback in most callers already.  And with me adding
it to the dma-iommu code in one series, and you to arm here I think
we really need to take a step back and think of a better way
to handle this, and the general mess that dma_alloc_from_contiguous.

So what about:

 (1) change the dma_alloc_from_contiguous prototype to be:

struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp);

     that is: calculate order and count internally, pass the full gfp_t
     and mask it internally, and drop the pointless from in the name.
     I'd also use the oppurtunity to forbid a NULL dev argument and
     opencode those uses.
 
 (2) handle the alloc_pages fallback internally.  Note that we should
     use alloc_pages_node as we do in dma-direct.

> +			if (!dma_release_from_contiguous(dev, page, count))
> +				__free_pages(page, get_order(size));

Same for dma_release_from_contiguous - drop the _from, pass the
actual size, and handle the free_pages fallback.

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: tony@atomide.com, catalin.marinas@arm.com, will.deacon@arm.com,
	linux@armlinux.org.uk, iommu@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, robin.murphy@arm.com, hch@lst.de,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 RFC/RFT 1/5] ARM: dma-mapping: Add fallback normal page allocations
Date: Wed, 24 Apr 2019 17:06:38 +0200	[thread overview]
Message-ID: <20190424150638.GA22191@lst.de> (raw)
Message-ID: <20190424150638.co2Zxx1E1yPoejiRENyPjD7E-XEbAj8tfeARNGA4IJw@z> (raw)
In-Reply-To: <20190326230131.16275-2-nicoleotsuka@gmail.com>

On Tue, Mar 26, 2019 at 04:01:27PM -0700, Nicolin Chen wrote:
>  	page = dma_alloc_from_contiguous(dev, count, order, gfp & __GFP_NOWARN);
> +	if (!page)
> +		page = alloc_pages(gfp, order);

We have this fallback in most callers already.  And with me adding
it to the dma-iommu code in one series, and you to arm here I think
we really need to take a step back and think of a better way
to handle this, and the general mess that dma_alloc_from_contiguous.

So what about:

 (1) change the dma_alloc_from_contiguous prototype to be:

struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp);

     that is: calculate order and count internally, pass the full gfp_t
     and mask it internally, and drop the pointless from in the name.
     I'd also use the oppurtunity to forbid a NULL dev argument and
     opencode those uses.
 
 (2) handle the alloc_pages fallback internally.  Note that we should
     use alloc_pages_node as we do in dma-direct.

> +			if (!dma_release_from_contiguous(dev, page, count))
> +				__free_pages(page, get_order(size));

Same for dma_release_from_contiguous - drop the _from, pass the
actual size, and handle the free_pages fallback.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: tony@atomide.com, catalin.marinas@arm.com, joro@8bytes.org,
	will.deacon@arm.com, linux@armlinux.org.uk,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
	robin.murphy@arm.com, hch@lst.de,
	linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com
Subject: Re: [PATCH v2 RFC/RFT 1/5] ARM: dma-mapping: Add fallback normal page allocations
Date: Wed, 24 Apr 2019 17:06:38 +0200	[thread overview]
Message-ID: <20190424150638.GA22191@lst.de> (raw)
In-Reply-To: <20190326230131.16275-2-nicoleotsuka@gmail.com>

On Tue, Mar 26, 2019 at 04:01:27PM -0700, Nicolin Chen wrote:
>  	page = dma_alloc_from_contiguous(dev, count, order, gfp & __GFP_NOWARN);
> +	if (!page)
> +		page = alloc_pages(gfp, order);

We have this fallback in most callers already.  And with me adding
it to the dma-iommu code in one series, and you to arm here I think
we really need to take a step back and think of a better way
to handle this, and the general mess that dma_alloc_from_contiguous.

So what about:

 (1) change the dma_alloc_from_contiguous prototype to be:

struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp);

     that is: calculate order and count internally, pass the full gfp_t
     and mask it internally, and drop the pointless from in the name.
     I'd also use the oppurtunity to forbid a NULL dev argument and
     opencode those uses.
 
 (2) handle the alloc_pages fallback internally.  Note that we should
     use alloc_pages_node as we do in dma-direct.

> +			if (!dma_release_from_contiguous(dev, page, count))
> +				__free_pages(page, get_order(size));

Same for dma_release_from_contiguous - drop the _from, pass the
actual size, and handle the free_pages fallback.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-04-24 15:06 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-26 23:01 [PATCH v2 RFC/RFT 0/5] Save single pages from CMA area Nicolin Chen
2019-03-26 23:01 ` Nicolin Chen
     [not found] ` <20190326230131.16275-1-nicoleotsuka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-03-26 23:01   ` [PATCH v2 RFC/RFT 1/5] ARM: dma-mapping: Add fallback normal page allocations Nicolin Chen
2019-03-26 23:01     ` Nicolin Chen
2019-03-26 23:01     ` Nicolin Chen
2019-04-24 15:06     ` Christoph Hellwig [this message]
2019-04-24 15:06       ` Christoph Hellwig
2019-04-24 15:06       ` Christoph Hellwig
     [not found]       ` <20190424150638.GA22191-jcswGhMUV9g@public.gmane.org>
2019-04-24 15:08         ` Christoph Hellwig
2019-04-24 15:08           ` Christoph Hellwig
2019-04-24 15:08           ` Christoph Hellwig
2019-04-24 15:08           ` Christoph Hellwig
2019-04-24 18:33       ` Nicolin Chen
2019-04-24 18:33         ` Nicolin Chen
2019-04-24 18:33         ` Nicolin Chen
2019-04-24 19:26         ` Christoph Hellwig
2019-04-24 19:26           ` Christoph Hellwig
2019-04-24 19:26           ` Christoph Hellwig
2019-04-24 19:38           ` Nicolin Chen
2019-04-24 19:38             ` Nicolin Chen
2019-04-24 19:38             ` Nicolin Chen
2019-04-30 15:24           ` Catalin Marinas
2019-04-30 15:24             ` Catalin Marinas
2019-04-30 15:24             ` Catalin Marinas
2019-05-02 13:26             ` Christoph Hellwig
2019-05-02 13:26               ` Christoph Hellwig
2019-05-02 13:26               ` Christoph Hellwig
2019-05-02 13:26               ` Christoph Hellwig
2019-04-26 20:21       ` Nicolin Chen
2019-04-26 20:21         ` Nicolin Chen
2019-04-26 20:21         ` Nicolin Chen
2019-04-26 20:25         ` Christoph Hellwig
2019-04-26 20:25           ` Christoph Hellwig
2019-04-26 20:25           ` Christoph Hellwig
2019-03-26 23:01   ` [PATCH v2 RFC/RFT 2/5] dma-remap: Run alloc_pages() on failure Nicolin Chen
2019-03-26 23:01     ` Nicolin Chen
2019-03-26 23:01     ` Nicolin Chen
2019-03-26 23:01 ` [PATCH v2 RFC/RFT 3/5] iommu: amd_iommu: Add fallback normal page allocations Nicolin Chen
2019-03-26 23:01   ` Nicolin Chen
2019-03-26 23:01 ` [PATCH v2 RFC/RFT 4/5] arm64: dma-mapping: " Nicolin Chen
2019-03-26 23:01   ` Nicolin Chen
2019-03-26 23:01 ` [PATCH v2 RFC/RFT 5/5] dma-contiguous: Do not allocate a single page from CMA area Nicolin Chen
2019-03-26 23:01   ` Nicolin Chen
2019-03-27  8:08 ` [PATCH v2 RFC/RFT 0/5] Save single pages " Christoph Hellwig
2019-03-27  8:08   ` Christoph Hellwig
2019-03-27 18:42   ` Nicolin Chen
2019-03-27 18:42     ` Nicolin Chen

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=20190424150638.GA22191@lst.de \
    --to=hch@lst.de \
    --cc=catalin.marinas@arm.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=m.szyprowski@samsung.com \
    --cc=nicoleotsuka@gmail.com \
    --cc=robin.murphy@arm.com \
    --cc=tony@atomide.com \
    --cc=vdumpa@nvidia.com \
    --cc=will.deacon@arm.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.