From: Dan Williams <dan.j.williams@intel.com>
To: Ilya Yanok <yanok@emcraft.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"'Vladimir K'" <vlad@emcraft.com>, Wolfgang Denk <wd@denx.de>
Subject: Re: [RFC] CONFIG_NET_DMA can hang the system if DMA engine driver uses tasklets
Date: Thu, 07 Oct 2010 16:33:09 -0700 [thread overview]
Message-ID: <4CAE58B5.1030901@intel.com> (raw)
In-Reply-To: <4CAE5445.4020106@emcraft.com>
On 10/7/2010 4:14 PM, Ilya Yanok wrote:
[..]
> We can see that the network stack calls dma_memcpy_to_iovec() function
> from the softirq context and it never returns in case of DMA driver runs
> out of descriptors and thus blocks the tasklet from being executed. We
> have a deadlock.
>
> Dan, I'd like to ask your opinion, do you think this is a problem of
> CONFIG_NET_DMA feature implementation or should the DMA engine drivers
> be aware of it? How should we fix it?
>
> I can imagine the following possible solutions:
> 1. Add a possibility to return a failure to the dma_memcpy_to_iovec()
> function (and reschedule it from the upper level) to give tasklets a
> chance to be executed.
> 2. Place a restriction on the DMA drivers that descriptors should be
> freed from the hard-irq context, not soft-irq and fix the existing drivers.
> 3. Try to free the descriptors not only from tasklet but also from the
> place they get requested.
This is what ioatdma and iop-adma do i.e. process descriptor reclaim
from the allocation failure path. For example in ioat2_check_space_lock():
/* progress reclaim in the allocation failure case we may be
* called under bh_disabled so we need to trigger the timer
* event directly
*/
if (jiffies > chan->timer.expires && timer_pending(&chan->timer)) {
struct ioatdma_device *device = chan->device;
mod_timer(&chan->timer, jiffies + COMPLETION_TIMEOUT);
device->timer_fn((unsigned long) &chan->common);
}
The assumption is that a free descriptor is always a short time delay.
> Maybe somebody has a better solution.
Not really, but extending dmatest with a test for this expectation would
help make this more clear but it would need a config option that injects
descriptor allocation failures.
--
Dan
next prev parent reply other threads:[~2010-10-07 23:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-07 23:14 [RFC] CONFIG_NET_DMA can hang the system if DMA engine driver uses tasklets Ilya Yanok
2010-10-07 23:33 ` Dan Williams [this message]
2010-10-07 23:49 ` Ilya Yanok
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=4CAE58B5.1030901@intel.com \
--to=dan.j.williams@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vlad@emcraft.com \
--cc=wd@denx.de \
--cc=yanok@emcraft.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