All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org,
	Vinod Koul <vinod.koul@intel.com>,
	Magnus Damm <magnus.damm@gmail.com>,
	linux-mmc@vger.kernel.org, alsa-devel@alsa-project.org,
	linux-serial@vger.kernel.org, Paul Mundt <lethal@linux-sh.org>
Subject: Re: [PATCH 1/7 v2] dmaengine: add a simple dma library
Date: Wed, 01 Feb 2012 11:47:35 +0900	[thread overview]
Message-ID: <4F28A7C7.8060500@renesas.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1202010145510.31226@axis700.grange>

Hi Guennadi-san,

2012/02/01 9:52, Guennadi Liakhovetski wrote:
> Hi Shimoda-san
> 
> On Tue, 31 Jan 2012, Shimoda, Yoshihiro wrote:
[ snip ]
>> I investigaed the issue. I found out the renesas_usbhs driver may
>> call tx_submit() in the callback()
> 
> Well, actually, this is not something, that shdma officially supports ATM. 
> Originally it was prohibited by the API, but later a correction has been 
> added to Documentation/dmaengine.txt, explicitly allowing this. So, good, 
> if this works for you, but watch out for possible issues.
>
>> of the dma-simple finally.
>> In this case, the value of power_up in the simple_tx_submit is 0,
>> the start_xfer() is not called. And then, even if the ld_queue is
>> not empty, the DMA doesn't start.
> 
> This is correct. As soon as all the transfers, currently queued in the 
> shdma driver, has been processed and completed, to restart DMA you need to 
> call dma_async_issue_pending().
> 
>> So, if I add codes like the following in the dma-simple.c,
>> the renesas_usbhs driver can work correctly without the driver changes.
>> If you think the code is good, would you merge it to your code?
>> ======= chan_irqt() =======
>> 	simple_chan_ld_cleanup(schan, false);
>>
>> +	spin_lock_irq(&schan->chan_lock);
>> +	/* Next desc */
>> +	simple_chan_xfer_ld_queue(schan);
>> +	spin_unlock_irq(&schan->chan_lock);
>>
>> 	return IRQ_HANDLED;
>> ==============
> 
> Therefore, no, this shouldn't be needed.

Thank you very much for your comment.
I understood it. I will investigate the renesas_usbhs driver more.

Best regards,
Yoshihiro Shimoda

> Thanks
> Guennadi
> 
>>
>> Best regards,
>> Yoshihiro Shimoda
>>
>>> Thanks
>>> Guennadi
>>>
>>>> For reference, if I changed the threaded IRQ to tasklet,
>>>> the 2 environment worked correctly:
>>>> ==============
>>>> diff --git a/drivers/dma/dma-simple.c b/drivers/dma/dma-simple.c
>>>> index 49d8f7d..65a5170 100644
>>>> --- a/drivers/dma/dma-simple.c
>>>> +++ b/drivers/dma/dma-simple.c
>>>> @@ -715,16 +715,18 @@ static irqreturn_t chan_irq(int irq, void *dev)
>>>>
>>>>  	spin_lock(&schan->chan_lock);
>>>>
>>>> -	ret = ops->chan_irq(schan, irq) ? IRQ_WAKE_THREAD : IRQ_NONE;
>>>> +	ret = ops->chan_irq(schan, irq) ? IRQ_HANDLED : IRQ_NONE;
>>>> +	if (ret == IRQ_HANDLED)
>>>> +		tasklet_schedule(&schan->tasklet);
>>>>
>>>>  	spin_unlock(&schan->chan_lock);
>>>>
>>>>  	return ret;
>>>>  }
>>>>
>>>> -static irqreturn_t chan_irqt(int irq, void *dev)
>>>> +static void chan_irqt(unsigned long dev)
>>>>  {
>>>> -	struct dma_simple_chan *schan = dev;
>>>> +	struct dma_simple_chan *schan = (struct dma_simple_chan *)dev;
>>>>  	const struct dma_simple_ops *ops =
>>>>  		to_simple_dev(schan->dma_chan.device)->ops;
>>>>  	struct dma_simple_desc *sdesc;
>>>> @@ -744,15 +746,13 @@ static irqreturn_t chan_irqt(int irq, void *dev)
>>>>  	spin_unlock_irq(&schan->chan_lock);
>>>>
>>>>  	simple_chan_ld_cleanup(schan, false);
>>>> -
>>>> -	return IRQ_HANDLED;
>>>>  }
>>>>
>>>>  int dma_simple_request_irq(struct dma_simple_chan *schan, int irq,
>>>>  			   unsigned long flags, const char *name)
>>>>  {
>>>> -	int ret = request_threaded_irq(irq, chan_irq, chan_irqt,
>>>> -				       flags, name, schan);
>>>> +	int ret = request_irq(irq, chan_irq, flags, name, schan);
>>>> +	tasklet_init(&schan->tasklet, chan_irqt, (unsigned long)schan);
>>>>
>>>>  	schan->irq = ret < 0 ? ret : irq;
>>>>
>>>> diff --git a/include/linux/dma-simple.h b/include/linux/dma-simple.h
>>>> index 5336674..beb1489 100644
>>>> --- a/include/linux/dma-simple.h
>>>> +++ b/include/linux/dma-simple.h
>>>> @@ -68,6 +68,7 @@ struct dma_simple_chan {
>>>>  	int id;				/* Raw id of this channel */
>>>>  	int irq;			/* Channel IRQ */
>>>>  	enum dma_simple_pm_state pm_state;
>>>> +	struct tasklet_struct tasklet;
>>>>  };
>>>>
>>>>  /**
>>>> ==============
>>>>
>>>> Best regards,
>>>> Yoshihiro Shimoda
>>>>
>>>
>>> ---
>>> Guennadi Liakhovetski, Ph.D.
>>> Freelance Open-Source Software Developer
>>> http://www.open-technology.de/
>>>
>>
>>
>> -- 
>> Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
>> EC No.
>>
> 
> ---
> Guennadi Liakhovetski, Ph.D.
> Freelance Open-Source Software Developer
> http://www.open-technology.de/
> 


-- 
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
EC No.

WARNING: multiple messages have this Message-ID (diff)
From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org,
	Vinod Koul <vinod.koul@intel.com>,
	Magnus Damm <magnus.damm@gmail.com>,
	linux-mmc@vger.kernel.org, alsa-devel@alsa-project.org,
	linux-serial@vger.kernel.org, Paul Mundt <lethal@linux-sh.org>
Subject: Re: [PATCH 1/7 v2] dmaengine: add a simple dma library
Date: Wed, 01 Feb 2012 02:47:35 +0000	[thread overview]
Message-ID: <4F28A7C7.8060500@renesas.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1202010145510.31226@axis700.grange>

Hi Guennadi-san,

2012/02/01 9:52, Guennadi Liakhovetski wrote:
> Hi Shimoda-san
> 
> On Tue, 31 Jan 2012, Shimoda, Yoshihiro wrote:
[ snip ]
>> I investigaed the issue. I found out the renesas_usbhs driver may
>> call tx_submit() in the callback()
> 
> Well, actually, this is not something, that shdma officially supports ATM. 
> Originally it was prohibited by the API, but later a correction has been 
> added to Documentation/dmaengine.txt, explicitly allowing this. So, good, 
> if this works for you, but watch out for possible issues.
>
>> of the dma-simple finally.
>> In this case, the value of power_up in the simple_tx_submit is 0,
>> the start_xfer() is not called. And then, even if the ld_queue is
>> not empty, the DMA doesn't start.
> 
> This is correct. As soon as all the transfers, currently queued in the 
> shdma driver, has been processed and completed, to restart DMA you need to 
> call dma_async_issue_pending().
> 
>> So, if I add codes like the following in the dma-simple.c,
>> the renesas_usbhs driver can work correctly without the driver changes.
>> If you think the code is good, would you merge it to your code?
>> ==== chan_irqt() ===>> 	simple_chan_ld_cleanup(schan, false);
>>
>> +	spin_lock_irq(&schan->chan_lock);
>> +	/* Next desc */
>> +	simple_chan_xfer_ld_queue(schan);
>> +	spin_unlock_irq(&schan->chan_lock);
>>
>> 	return IRQ_HANDLED;
>> =======
> 
> Therefore, no, this shouldn't be needed.

Thank you very much for your comment.
I understood it. I will investigate the renesas_usbhs driver more.

Best regards,
Yoshihiro Shimoda

> Thanks
> Guennadi
> 
>>
>> Best regards,
>> Yoshihiro Shimoda
>>
>>> Thanks
>>> Guennadi
>>>
>>>> For reference, if I changed the threaded IRQ to tasklet,
>>>> the 2 environment worked correctly:
>>>> =======
>>>> diff --git a/drivers/dma/dma-simple.c b/drivers/dma/dma-simple.c
>>>> index 49d8f7d..65a5170 100644
>>>> --- a/drivers/dma/dma-simple.c
>>>> +++ b/drivers/dma/dma-simple.c
>>>> @@ -715,16 +715,18 @@ static irqreturn_t chan_irq(int irq, void *dev)
>>>>
>>>>  	spin_lock(&schan->chan_lock);
>>>>
>>>> -	ret = ops->chan_irq(schan, irq) ? IRQ_WAKE_THREAD : IRQ_NONE;
>>>> +	ret = ops->chan_irq(schan, irq) ? IRQ_HANDLED : IRQ_NONE;
>>>> +	if (ret = IRQ_HANDLED)
>>>> +		tasklet_schedule(&schan->tasklet);
>>>>
>>>>  	spin_unlock(&schan->chan_lock);
>>>>
>>>>  	return ret;
>>>>  }
>>>>
>>>> -static irqreturn_t chan_irqt(int irq, void *dev)
>>>> +static void chan_irqt(unsigned long dev)
>>>>  {
>>>> -	struct dma_simple_chan *schan = dev;
>>>> +	struct dma_simple_chan *schan = (struct dma_simple_chan *)dev;
>>>>  	const struct dma_simple_ops *ops >>>>  		to_simple_dev(schan->dma_chan.device)->ops;
>>>>  	struct dma_simple_desc *sdesc;
>>>> @@ -744,15 +746,13 @@ static irqreturn_t chan_irqt(int irq, void *dev)
>>>>  	spin_unlock_irq(&schan->chan_lock);
>>>>
>>>>  	simple_chan_ld_cleanup(schan, false);
>>>> -
>>>> -	return IRQ_HANDLED;
>>>>  }
>>>>
>>>>  int dma_simple_request_irq(struct dma_simple_chan *schan, int irq,
>>>>  			   unsigned long flags, const char *name)
>>>>  {
>>>> -	int ret = request_threaded_irq(irq, chan_irq, chan_irqt,
>>>> -				       flags, name, schan);
>>>> +	int ret = request_irq(irq, chan_irq, flags, name, schan);
>>>> +	tasklet_init(&schan->tasklet, chan_irqt, (unsigned long)schan);
>>>>
>>>>  	schan->irq = ret < 0 ? ret : irq;
>>>>
>>>> diff --git a/include/linux/dma-simple.h b/include/linux/dma-simple.h
>>>> index 5336674..beb1489 100644
>>>> --- a/include/linux/dma-simple.h
>>>> +++ b/include/linux/dma-simple.h
>>>> @@ -68,6 +68,7 @@ struct dma_simple_chan {
>>>>  	int id;				/* Raw id of this channel */
>>>>  	int irq;			/* Channel IRQ */
>>>>  	enum dma_simple_pm_state pm_state;
>>>> +	struct tasklet_struct tasklet;
>>>>  };
>>>>
>>>>  /**
>>>> =======
>>>>
>>>> Best regards,
>>>> Yoshihiro Shimoda
>>>>
>>>
>>> ---
>>> Guennadi Liakhovetski, Ph.D.
>>> Freelance Open-Source Software Developer
>>> http://www.open-technology.de/
>>>
>>
>>
>> -- 
>> Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
>> EC No.
>>
> 
> ---
> Guennadi Liakhovetski, Ph.D.
> Freelance Open-Source Software Developer
> http://www.open-technology.de/
> 


-- 
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
EC No.

  reply	other threads:[~2012-02-01  2:47 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-26 14:56 [PATCH 0/7 v2] extract a simple dmaengine library from shdma.c Guennadi Liakhovetski
2012-01-26 14:56 ` Guennadi Liakhovetski
2012-01-26 14:56 ` Guennadi Liakhovetski
2012-01-26 14:56 ` [PATCH 1/7 v2] dmaengine: add a simple dma library Guennadi Liakhovetski
2012-01-26 14:56   ` Guennadi Liakhovetski
2012-01-26 14:56   ` Guennadi Liakhovetski
2012-01-26 17:34   ` Sascha Hauer
2012-01-26 17:34     ` [alsa-devel] " Sascha Hauer
2012-01-26 17:34     ` Sascha Hauer
2012-01-26 21:07     ` Guennadi Liakhovetski
2012-01-26 21:07       ` Guennadi Liakhovetski
2012-01-27  8:37   ` Shimoda, Yoshihiro
2012-01-27  8:37     ` Shimoda, Yoshihiro
2012-01-27  8:48     ` Guennadi Liakhovetski
2012-01-27  8:48       ` Guennadi Liakhovetski
2012-01-31 11:03       ` Shimoda, Yoshihiro
2012-01-31 11:03         ` Shimoda, Yoshihiro
2012-02-01  0:52         ` Guennadi Liakhovetski
2012-02-01  0:52           ` Guennadi Liakhovetski
2012-02-01  2:47           ` Shimoda, Yoshihiro [this message]
2012-02-01  2:47             ` Shimoda, Yoshihiro
2012-02-02 22:19         ` Guennadi Liakhovetski
2012-02-02 22:19           ` Guennadi Liakhovetski
2012-02-03  8:47           ` Shimoda, Yoshihiro
2012-02-03  8:47             ` Shimoda, Yoshihiro
2012-02-03 10:21             ` Guennadi Liakhovetski
2012-02-03 10:21               ` Guennadi Liakhovetski
2012-02-03 15:43             ` [PATCH/RFC] usb: fix renesas_usbhs to not schedule in atomic context Guennadi Liakhovetski
2012-02-03 15:43               ` Guennadi Liakhovetski
2012-02-05 14:54               ` Felipe Balbi
2012-02-05 14:54                 ` Felipe Balbi
2012-02-06 10:11                 ` Guennadi Liakhovetski
2012-02-06 10:11                   ` Guennadi Liakhovetski
2012-02-06 10:31                   ` Felipe Balbi
2012-02-06 10:31                     ` Felipe Balbi
2012-02-06 10:31                     ` Felipe Balbi
2012-02-06  8:52               ` Shimoda, Yoshihiro
2012-02-06  8:52                 ` Shimoda, Yoshihiro
2012-02-06  8:52                 ` Shimoda, Yoshihiro
2012-01-30  8:32   ` [PATCH 1/7 v2] dmaengine: add a simple dma library Vinod Koul
2012-01-30  8:44     ` Vinod Koul
2012-01-30  9:34     ` Guennadi Liakhovetski
2012-01-30  9:34       ` Guennadi Liakhovetski
2012-01-31  6:41       ` Vinod Koul
2012-01-31  6:53         ` Vinod Koul
2012-01-31  8:59         ` Guennadi Liakhovetski
2012-01-31  8:59           ` Guennadi Liakhovetski
2012-02-01  5:38           ` Vinod Koul
2012-02-01  5:50             ` Vinod Koul
2012-02-03 16:38             ` Guennadi Liakhovetski
2012-02-03 16:38               ` Guennadi Liakhovetski
2012-02-06  2:54   ` Vinod Koul
2012-02-06  2:56     ` Vinod Koul
2012-02-06  9:53     ` Guennadi Liakhovetski
2012-02-06  9:53       ` Guennadi Liakhovetski
2012-02-06  9:53       ` Guennadi Liakhovetski
2012-01-26 14:56 ` [PATCH 2/7 v2] dma: shdma: prepare for simple DMA conversion Guennadi Liakhovetski
2012-01-26 14:56   ` Guennadi Liakhovetski
2012-01-26 14:56 ` [PATCH 3/7 v2] mmc: sh_mmcif: remove unneeded struct sh_mmcif_dma, prepare for simple DMA Guennadi Liakhovetski
2012-01-26 14:56   ` Guennadi Liakhovetski
2012-01-26 14:56 ` [PATCH 4/7 v2] mmc: sh_mobile_sdhi: prepare for conversion to " Guennadi Liakhovetski
2012-01-26 14:56   ` Guennadi Liakhovetski
2012-01-26 14:56 ` [PATCH 5/7 v2] serial: sh-sci: " Guennadi Liakhovetski
2012-01-26 14:56   ` Guennadi Liakhovetski
2012-01-26 14:56 ` [PATCH 6/7 v2] ASoC: SIU: " Guennadi Liakhovetski
2012-01-26 14:56   ` Guennadi Liakhovetski
2012-01-26 14:56   ` Guennadi Liakhovetski
2012-02-06  2:33   ` Vinod Koul
2012-02-06  2:45     ` Vinod Koul
2012-02-06  9:11     ` Guennadi Liakhovetski
2012-02-06  9:11       ` Guennadi Liakhovetski
2012-01-26 14:56 ` [PATCH 7/7 v2] dma: shdma: convert to the simple DMA library Guennadi Liakhovetski
2012-01-26 14:56   ` Guennadi Liakhovetski

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=4F28A7C7.8060500@renesas.com \
    --to=yoshihiro.shimoda.uh@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=g.liakhovetski@gmx.de \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=vinod.koul@intel.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.