All of lore.kernel.org
 help / color / mirror / Atom feed
From: f.fainelli@gmail.com (Florian Fainelli)
To: linux-arm-kernel@lists.infradead.org
Subject: DMA allocations from CMA and fatal_signal_pending check
Date: Tue, 28 Oct 2014 12:08:46 -0700	[thread overview]
Message-ID: <544FE9BE.6040503@gmail.com> (raw)

Hello,

While debugging why some dma_alloc_coherent() allocations where
returning NULL on our brcmstb platform, specifically with
drivers/net/ethernet/broadcom/bcmcsysport.c, I came across the
fatal_signal_pending() check in mm/page_alloc.c which is there.

This driver calls dma_alloc_coherent(, GFP_KERNEL) which ends up making
a coherent allocation from a CMA region on our platform. Since that
allocation is allowed to sleep, and because we are in bcm_syport_open(),
executed from process context, a pending signal makes
dma_alloc_coherent() return NULL.

There are two ways I could fix this:

- use a GFP_ATOMIC allocation, which would avoid this sensitivity to a
pending signal being fatal (we suffer from the same issue in
bcm_sysport_resume)

- move the DMA coherent allocation before bcm_sysport_open(), in the
driver's probe function, but if the network interface is never used, we
would be waisting precious DMA coherent memory for nothing (it is only 4
bytes times 32 but still

Now the general problem that I see with this fatal_signal_pending()
check is that any driver that calls dma_alloc_coherent() and which does
this in a process context (network drivers are frequently doing this in
their ndo_open callback) and also happens to get its allocation serviced
from CMA can now fail, instead of failing on really hard OOM conditions.
--
Florian

WARNING: multiple messages have this Message-ID (diff)
From: Florian Fainelli <f.fainelli@gmail.com>
To: linux-arm-kernel@lists.infradead.org,
	Brian Norris <computersforpeace@gmail.com>,
	Gregory Fong <gregory.0xf0@gmail.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	lauraa@codeaurora.org, gioh.kim@lge.com,
	aneesh.kumar@linux.vnet.ibm.com, iamjoonsoo.kim@lge.com,
	mina86@mina86.com, m.szyprowski@samsung.com,
	akpm@linux-foundation.org,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: DMA allocations from CMA and fatal_signal_pending check
Date: Tue, 28 Oct 2014 12:08:46 -0700	[thread overview]
Message-ID: <544FE9BE.6040503@gmail.com> (raw)

Hello,

While debugging why some dma_alloc_coherent() allocations where
returning NULL on our brcmstb platform, specifically with
drivers/net/ethernet/broadcom/bcmcsysport.c, I came across the
fatal_signal_pending() check in mm/page_alloc.c which is there.

This driver calls dma_alloc_coherent(, GFP_KERNEL) which ends up making
a coherent allocation from a CMA region on our platform. Since that
allocation is allowed to sleep, and because we are in bcm_syport_open(),
executed from process context, a pending signal makes
dma_alloc_coherent() return NULL.

There are two ways I could fix this:

- use a GFP_ATOMIC allocation, which would avoid this sensitivity to a
pending signal being fatal (we suffer from the same issue in
bcm_sysport_resume)

- move the DMA coherent allocation before bcm_sysport_open(), in the
driver's probe function, but if the network interface is never used, we
would be waisting precious DMA coherent memory for nothing (it is only 4
bytes times 32 but still

Now the general problem that I see with this fatal_signal_pending()
check is that any driver that calls dma_alloc_coherent() and which does
this in a process context (network drivers are frequently doing this in
their ndo_open callback) and also happens to get its allocation serviced
from CMA can now fail, instead of failing on really hard OOM conditions.
--
Florian

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Florian Fainelli <f.fainelli@gmail.com>
To: linux-arm-kernel@lists.infradead.org,
	Brian Norris <computersforpeace@gmail.com>,
	Gregory Fong <gregory.0xf0@gmail.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	lauraa@codeaurora.org, gioh.kim@lge.com,
	aneesh.kumar@linux.vnet.ibm.com, iamjoonsoo.kim@lge.com,
	mina86@mina86.com, m.szyprowski@samsung.com,
	akpm@linux-foundation.org,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: DMA allocations from CMA and fatal_signal_pending check
Date: Tue, 28 Oct 2014 12:08:46 -0700	[thread overview]
Message-ID: <544FE9BE.6040503@gmail.com> (raw)

Hello,

While debugging why some dma_alloc_coherent() allocations where
returning NULL on our brcmstb platform, specifically with
drivers/net/ethernet/broadcom/bcmcsysport.c, I came across the
fatal_signal_pending() check in mm/page_alloc.c which is there.

This driver calls dma_alloc_coherent(, GFP_KERNEL) which ends up making
a coherent allocation from a CMA region on our platform. Since that
allocation is allowed to sleep, and because we are in bcm_syport_open(),
executed from process context, a pending signal makes
dma_alloc_coherent() return NULL.

There are two ways I could fix this:

- use a GFP_ATOMIC allocation, which would avoid this sensitivity to a
pending signal being fatal (we suffer from the same issue in
bcm_sysport_resume)

- move the DMA coherent allocation before bcm_sysport_open(), in the
driver's probe function, but if the network interface is never used, we
would be waisting precious DMA coherent memory for nothing (it is only 4
bytes times 32 but still

Now the general problem that I see with this fatal_signal_pending()
check is that any driver that calls dma_alloc_coherent() and which does
this in a process context (network drivers are frequently doing this in
their ndo_open callback) and also happens to get its allocation serviced
from CMA can now fail, instead of failing on really hard OOM conditions.
--
Florian

             reply	other threads:[~2014-10-28 19:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-28 19:08 Florian Fainelli [this message]
2014-10-28 19:08 ` DMA allocations from CMA and fatal_signal_pending check Florian Fainelli
2014-10-28 19:08 ` Florian Fainelli
2014-10-31  8:28 ` Joonsoo Kim
2014-10-31  8:28   ` Joonsoo Kim
2014-10-31  8:28   ` Joonsoo Kim
2014-10-31 20:58   ` Florian Fainelli
2014-10-31 20:58     ` Florian Fainelli
2014-10-31 20:58     ` Florian Fainelli
2014-11-03 16:45     ` Michal Nazarewicz
2014-11-03 16:45       ` Michal Nazarewicz
2014-11-03 16:45       ` Michal Nazarewicz
2014-11-03 16:45       ` Michal Nazarewicz
2014-11-03 18:51       ` Florian Fainelli
2014-11-03 18:51         ` Florian Fainelli
2014-11-03 18:51         ` Florian Fainelli
2014-11-03 18:51         ` Florian Fainelli
2014-10-31 21:07   ` Maxime Bizon
2014-10-31 21:07     ` Maxime Bizon
2014-10-31 21:07     ` Maxime Bizon

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=544FE9BE.6040503@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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 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.