linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Russell King - ARM Linux admin <linux@armlinux.org.uk>,
	Peter Chen <hzpeterchen@gmail.com>
Cc: Michal Nazarewicz <mina86@mina86.com>,
	peter.chen@nxp.com, fugang.duan@nxp.com,
	linux-usb@vger.kernel.org, lkml <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org,
	Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: Why CMA allocater fails if there is a signal pending?
Date: Mon, 25 Mar 2019 09:44:17 -0700	[thread overview]
Message-ID: <7905eeb4-51ce-956b-31ed-33313bcfe7eb@gmail.com> (raw)
In-Reply-To: <20190325102633.v6hkvda6q7462wza@shell.armlinux.org.uk>

On 3/25/19 3:26 AM, Russell King - ARM Linux admin wrote:
> On Mon, Mar 25, 2019 at 04:37:09PM +0800, Peter Chen wrote:
>> Hi Michal & Marek,
>>
>> I meet an issue that the DMA (CMA used) allocation failed if there is a user
>> signal, Eg Ctrl+C, it causes the USB xHCI stack fails to resume due to
>> dma_alloc_coherent
>> failed. It can be easy to reproduce if the user press Ctrl+C at
>> suspend/resume test.
> 
> It has been possible in the past for cma_alloc() to take seconds or
> longer to allocate, depending on the size of the CMA area and the
> number of pinned GFP_MOVABLE pages within the CMA area.  Whether that
> is true of today's CMA or not, I don't know.
> 
> It's probably there to allow such a situation to be recoverable, but
> is not a good idea if we're expecting dma_alloc_*() not to fail in
> those scenarios.
> 

This is a known issue that was discussed here before:

http://lists.infradead.org/pipermail/linux-arm-kernel/2014-November/299265.html

one issue is that the process that is responsible for putting the system
asleep and is being resumed (which can be as simple as your shell doing
an 'echo "standby" > /sys/power/state' can be killed, and that
propagates throughout dpm_resume(). It is debatable whether the signal
should be ignored or not, probably not.

You can work around this by wrapping your echo to /sys/power/state with
a shell script that trap the signal and say, does an exit 1. AFAIR there
are many places where a dma_alloc_* allocation can fail, and not all
drivers are designed to recover correctly.
-- 
Florian


  reply	other threads:[~2019-03-25 16:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-25  8:37 Peter Chen
2019-03-25 10:26 ` Russell King - ARM Linux admin
2019-03-25 16:44   ` Florian Fainelli [this message]
2019-03-25 17:43     ` Russell King - ARM Linux admin
2019-03-26  2:21     ` Peter 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=7905eeb4-51ce-956b-31ed-33313bcfe7eb@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=fugang.duan@nxp.com \
    --cc=hzpeterchen@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=m.szyprowski@samsung.com \
    --cc=mina86@mina86.com \
    --cc=peter.chen@nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox