All of lore.kernel.org
 help / color / mirror / Atom feed
From: maxime.ripard@free-electrons.com (Maxime Ripard)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7] DMA: sun6i: Add driver for the Allwinner A31 DMA controller
Date: Wed, 21 May 2014 10:58:29 +0200	[thread overview]
Message-ID: <20140521085829.GP27329@lukather> (raw)
In-Reply-To: <20140521053105.GI21128@intel.com>

On Wed, May 21, 2014 at 11:01:05AM +0530, Vinod Koul wrote:
> On Tue, May 13, 2014 at 03:42:58PM +0200, Maxime Ripard wrote:
> > Hi Vinod,
> > 
> > On Wed, Apr 30, 2014 at 12:34:08PM +0530, Vinod Koul wrote:
> > > > +
> > > > +static int sun6i_dma_terminate_all(struct sun6i_vchan *vchan)
> > > > +{
> > > > +	struct sun6i_dma_dev *sdev = to_sun6i_dma_dev(vchan->vc.chan.device);
> > > > +	struct sun6i_pchan *pchan = vchan->phy;
> > > > +	unsigned long flags;
> > > > +	LIST_HEAD(head);
> > > > +
> > > > +	spin_lock(&sdev->lock);
> > > > +	list_del_init(&vchan->node);
> > > > +	spin_unlock(&sdev->lock);
> > > > +
> > > > +	spin_lock_irqsave(&vchan->vc.lock, flags);
> > > > +
> > > > +	vchan_get_all_descriptors(&vchan->vc, &head);
> > > > +
> > > > +	if (pchan) {
> > > > +		writel(DMA_CHAN_ENABLE_STOP, pchan->base + DMA_CHAN_ENABLE);
> > > > +		writel(DMA_CHAN_PAUSE_RESUME, pchan->base + DMA_CHAN_PAUSE);
> > > > +
> > > > +		vchan->phy = NULL;
> > > > +		pchan->vchan = NULL;
> > > > +		pchan->desc = NULL;
> > > > +		pchan->done = NULL;
> > > > +	}
> > > > +
> > > > +	spin_unlock_irqrestore(&vchan->vc.lock, flags);
> > > > +
> > > > +	vchan_dma_desc_free_list(&vchan->vc, &head);
> > > 
> > > shouldn't you kill the tasklet as well here?
> > 
> > Just to be clear, which tasklet? vchan's or the driver's?
> You need to take care of both. But I suspect if we ensure irq is not triggered
> and any pending ones are completed you can simply kill both of the tasklets
> happily. See the fixes merged in dmaengine last cycle (hint: patchlog shows what
> we need to do)

I still don't get why I should kill the driver tasklet in terminate_all.

The tasklet is common to all the channels, if you kill it, you'll
prevent it from scheduling while other channels might have had a need
for it to actually run.

About the commits themselves, I guess you talk about 9068b032 and
ccc7aad0. Both these commits only fix the remove path, not the
terminate_all one, and both these drivers are not doing anything
related to the tasklet in terminate_all.

> Btw just noticed, you *should* use dmaengine: as the subsytem name on the patch
> series...

Ok, I will.

Thanks,
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140521/e1823552/attachment.sig>

WARNING: multiple messages have this Message-ID (diff)
From: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Vinod Koul <vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Dan Williams
	<dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	kevin.z.m.zh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	sunny-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf@public.gmane.org,
	shuge-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf@public.gmane.org,
	zhuzhenhua-0TFLnhJekD6UEPyfVivIlAC/G2K4zDHf@public.gmane.org,
	andriy.shevchenko-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Subject: Re: [PATCH v7] DMA: sun6i: Add driver for the Allwinner A31 DMA controller
Date: Wed, 21 May 2014 10:58:29 +0200	[thread overview]
Message-ID: <20140521085829.GP27329@lukather> (raw)
In-Reply-To: <20140521053105.GI21128-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2345 bytes --]

On Wed, May 21, 2014 at 11:01:05AM +0530, Vinod Koul wrote:
> On Tue, May 13, 2014 at 03:42:58PM +0200, Maxime Ripard wrote:
> > Hi Vinod,
> > 
> > On Wed, Apr 30, 2014 at 12:34:08PM +0530, Vinod Koul wrote:
> > > > +
> > > > +static int sun6i_dma_terminate_all(struct sun6i_vchan *vchan)
> > > > +{
> > > > +	struct sun6i_dma_dev *sdev = to_sun6i_dma_dev(vchan->vc.chan.device);
> > > > +	struct sun6i_pchan *pchan = vchan->phy;
> > > > +	unsigned long flags;
> > > > +	LIST_HEAD(head);
> > > > +
> > > > +	spin_lock(&sdev->lock);
> > > > +	list_del_init(&vchan->node);
> > > > +	spin_unlock(&sdev->lock);
> > > > +
> > > > +	spin_lock_irqsave(&vchan->vc.lock, flags);
> > > > +
> > > > +	vchan_get_all_descriptors(&vchan->vc, &head);
> > > > +
> > > > +	if (pchan) {
> > > > +		writel(DMA_CHAN_ENABLE_STOP, pchan->base + DMA_CHAN_ENABLE);
> > > > +		writel(DMA_CHAN_PAUSE_RESUME, pchan->base + DMA_CHAN_PAUSE);
> > > > +
> > > > +		vchan->phy = NULL;
> > > > +		pchan->vchan = NULL;
> > > > +		pchan->desc = NULL;
> > > > +		pchan->done = NULL;
> > > > +	}
> > > > +
> > > > +	spin_unlock_irqrestore(&vchan->vc.lock, flags);
> > > > +
> > > > +	vchan_dma_desc_free_list(&vchan->vc, &head);
> > > 
> > > shouldn't you kill the tasklet as well here?
> > 
> > Just to be clear, which tasklet? vchan's or the driver's?
> You need to take care of both. But I suspect if we ensure irq is not triggered
> and any pending ones are completed you can simply kill both of the tasklets
> happily. See the fixes merged in dmaengine last cycle (hint: patchlog shows what
> we need to do)

I still don't get why I should kill the driver tasklet in terminate_all.

The tasklet is common to all the channels, if you kill it, you'll
prevent it from scheduling while other channels might have had a need
for it to actually run.

About the commits themselves, I guess you talk about 9068b032 and
ccc7aad0. Both these commits only fix the remove path, not the
terminate_all one, and both these drivers are not doing anything
related to the tasklet in terminate_all.

> Btw just noticed, you *should* use dmaengine: as the subsytem name on the patch
> series...

Ok, I will.

Thanks,
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
	linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-sunxi@googlegroups.com, kevin.z.m.zh@gmail.com,
	sunny@allwinnertech.com, shuge@allwinnertech.com,
	zhuzhenhua@allwinnertech.com, andriy.shevchenko@intel.com,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH v7] DMA: sun6i: Add driver for the Allwinner A31 DMA controller
Date: Wed, 21 May 2014 10:58:29 +0200	[thread overview]
Message-ID: <20140521085829.GP27329@lukather> (raw)
In-Reply-To: <20140521053105.GI21128@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2345 bytes --]

On Wed, May 21, 2014 at 11:01:05AM +0530, Vinod Koul wrote:
> On Tue, May 13, 2014 at 03:42:58PM +0200, Maxime Ripard wrote:
> > Hi Vinod,
> > 
> > On Wed, Apr 30, 2014 at 12:34:08PM +0530, Vinod Koul wrote:
> > > > +
> > > > +static int sun6i_dma_terminate_all(struct sun6i_vchan *vchan)
> > > > +{
> > > > +	struct sun6i_dma_dev *sdev = to_sun6i_dma_dev(vchan->vc.chan.device);
> > > > +	struct sun6i_pchan *pchan = vchan->phy;
> > > > +	unsigned long flags;
> > > > +	LIST_HEAD(head);
> > > > +
> > > > +	spin_lock(&sdev->lock);
> > > > +	list_del_init(&vchan->node);
> > > > +	spin_unlock(&sdev->lock);
> > > > +
> > > > +	spin_lock_irqsave(&vchan->vc.lock, flags);
> > > > +
> > > > +	vchan_get_all_descriptors(&vchan->vc, &head);
> > > > +
> > > > +	if (pchan) {
> > > > +		writel(DMA_CHAN_ENABLE_STOP, pchan->base + DMA_CHAN_ENABLE);
> > > > +		writel(DMA_CHAN_PAUSE_RESUME, pchan->base + DMA_CHAN_PAUSE);
> > > > +
> > > > +		vchan->phy = NULL;
> > > > +		pchan->vchan = NULL;
> > > > +		pchan->desc = NULL;
> > > > +		pchan->done = NULL;
> > > > +	}
> > > > +
> > > > +	spin_unlock_irqrestore(&vchan->vc.lock, flags);
> > > > +
> > > > +	vchan_dma_desc_free_list(&vchan->vc, &head);
> > > 
> > > shouldn't you kill the tasklet as well here?
> > 
> > Just to be clear, which tasklet? vchan's or the driver's?
> You need to take care of both. But I suspect if we ensure irq is not triggered
> and any pending ones are completed you can simply kill both of the tasklets
> happily. See the fixes merged in dmaengine last cycle (hint: patchlog shows what
> we need to do)

I still don't get why I should kill the driver tasklet in terminate_all.

The tasklet is common to all the channels, if you kill it, you'll
prevent it from scheduling while other channels might have had a need
for it to actually run.

About the commits themselves, I guess you talk about 9068b032 and
ccc7aad0. Both these commits only fix the remove path, not the
terminate_all one, and both these drivers are not doing anything
related to the tasklet in terminate_all.

> Btw just noticed, you *should* use dmaengine: as the subsytem name on the patch
> series...

Ok, I will.

Thanks,
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2014-05-21  8:58 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-24 14:22 [PATCH v7] Add support for the Allwinner A31 DMA Controller Maxime Ripard
2014-04-24 14:22 ` Maxime Ripard
2014-04-24 14:22 ` Maxime Ripard
2014-04-24 14:22 ` [PATCH v7] DMA: sun6i: Add driver for the Allwinner A31 DMA controller Maxime Ripard
2014-04-24 14:22   ` Maxime Ripard
2014-04-24 14:22   ` Maxime Ripard
2014-04-30  7:04   ` Vinod Koul
2014-04-30  7:04     ` Vinod Koul
2014-04-30  7:04     ` Vinod Koul
2014-04-30 21:53     ` Maxime Ripard
2014-04-30 21:53       ` Maxime Ripard
2014-04-30 21:53       ` Maxime Ripard
2014-05-02 16:34       ` Vinod Koul
2014-05-02 16:34         ` Vinod Koul
2014-05-02 16:34         ` Vinod Koul
2014-05-08  3:19         ` Maxime Ripard
2014-05-08  3:19           ` Maxime Ripard
2014-05-08  3:19           ` Maxime Ripard
2014-05-21  5:29           ` Vinod Koul
2014-05-21  5:29             ` Vinod Koul
2014-05-21  5:29             ` Vinod Koul
2014-05-13 13:42     ` Maxime Ripard
2014-05-13 13:42       ` Maxime Ripard
2014-05-13 13:42       ` Maxime Ripard
2014-05-21  5:31       ` Vinod Koul
2014-05-21  5:31         ` Vinod Koul
2014-05-21  5:31         ` Vinod Koul
2014-05-21  8:58         ` Maxime Ripard [this message]
2014-05-21  8:58           ` Maxime Ripard
2014-05-21  8:58           ` Maxime Ripard
2014-05-21 11:02           ` Vinod Koul
2014-05-21 11:02             ` Vinod Koul
2014-05-21 11:02             ` Vinod Koul
2014-05-20 12:40   ` [linux-sunxi] " Emilio López
2014-05-20 12:40     ` Emilio López
2014-05-20 12:40     ` Emilio López
2014-05-20 12:52     ` [linux-sunxi] " Shevchenko, Andriy
2014-05-20 12:52       ` Shevchenko, Andriy
2014-05-20 12:52       ` Shevchenko, Andriy

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=20140521085829.GP27329@lukather \
    --to=maxime.ripard@free-electrons.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.