linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com>,
	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>,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH/RFC] usb: fix renesas_usbhs to not schedule in atomic context
Date: Sun, 5 Feb 2012 16:54:00 +0200	[thread overview]
Message-ID: <20120205145358.GA13762@legolas.emea.dhcp.ti.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1202031623000.6211@axis700.grange>

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

Hi,

On Fri, Feb 03, 2012 at 04:43:20PM +0100, Guennadi Liakhovetski wrote:
> The current renesas_usbhs driver triggers
> 
> BUG: scheduling while atomic: ksoftirqd/0/3/0x00000102
> 
> with enabled CONFIG_DEBUG_ATOMIC_SLEEP, by submitting DMA transfers from 
> an atomic (tasklet) context, which is not supported by the shdma dmaengine 
> driver. Fix it by switching to a work. Also simplify some list 
> manipulations.

you are doing much more than what you say. Also, instead of using a
workqueue, have you considered using threaded_irqs ?

(I didn't go over the driver again to see if it makes sense to use
threaded_irqs in this case, but doesn't hurt asking)

> Shimoda-san, this is the problem, that you were observing. However, it 
> exists with the present version of shdma just as well as with the new one 
> - on top of the simple DMA library. I marked it an RFC because (1) I only 
> lightly tested it with the gadget device on mackerel with the mass storage 
> gadget, and (2) I am somewhat concerned about races. Currently the work 
> function runs with no locking and there are no usual cancel_work_sync() 
> points in the patch. However, it has also been like this before with the 
> tasklet implementation, which is not much better, and it looks like there 
> are no asynchronous operations on the same packets like timeouts. Only 
> asynchronous events, that I can think about are things like unloading the 
> driver or unplugging the cable, but these have been there before too. It 
> would become worse on SMP, I think. Comments welcome.
> 
> diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
> index 72339bd..4d739ec 100644
> --- a/drivers/usb/renesas_usbhs/fifo.c
> +++ b/drivers/usb/renesas_usbhs/fifo.c
> @@ -75,8 +75,7 @@ void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt,
>  		pipe->handler = &usbhsf_null_handler;
>  	}
>  
> -	list_del_init(&pkt->node);
> -	list_add_tail(&pkt->node, &pipe->list);
> +	list_move_tail(&pkt->node, &pipe->list);
>  
>  	/*
>  	 * each pkt must hold own handler.
> @@ -106,7 +105,7 @@ static struct usbhs_pkt *__usbhsf_pkt_get(struct usbhs_pipe *pipe)
>  	if (list_empty(&pipe->list))
>  		return NULL;
>  
> -	return list_entry(pipe->list.next, struct usbhs_pkt, node);
> +	return list_first_entry(&pipe->list, struct usbhs_pkt, node);

these two hunks are not part of $SUBJECT

-- 
balbi

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

  reply	other threads:[~2012-02-05 14:54 UTC|newest]

Thread overview: 33+ 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 ` [PATCH 1/7 v2] dmaengine: add a simple dma library Guennadi Liakhovetski
2012-01-26 17:34   ` [alsa-devel] " Sascha Hauer
2012-01-26 21:07     ` Guennadi Liakhovetski
2012-01-27  8:37   ` Shimoda, Yoshihiro
2012-01-27  8:48     ` Guennadi Liakhovetski
2012-01-31 11:03       ` Shimoda, Yoshihiro
2012-02-01  0:52         ` Guennadi Liakhovetski
2012-02-01  2:47           ` Shimoda, Yoshihiro
2012-02-02 22:19         ` Guennadi Liakhovetski
2012-02-03  8:47           ` Shimoda, Yoshihiro
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-05 14:54               ` Felipe Balbi [this message]
2012-02-06 10:11                 ` Guennadi Liakhovetski
2012-02-06 10:31                   ` Felipe Balbi
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  9:34     ` Guennadi Liakhovetski
2012-01-31  6:41       ` Vinod Koul
2012-01-31  8:59         ` Guennadi Liakhovetski
2012-02-01  5:38           ` Vinod Koul
2012-02-03 16:38             ` Guennadi Liakhovetski
2012-02-06  2:54   ` Vinod Koul
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 ` [PATCH 3/7 v2] mmc: sh_mmcif: remove unneeded struct sh_mmcif_dma, prepare for simple DMA 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 ` [PATCH 5/7 v2] serial: sh-sci: " Guennadi Liakhovetski
2012-01-26 14:56 ` [PATCH 6/7 v2] ASoC: SIU: " Guennadi Liakhovetski
2012-02-06  2:33   ` Vinod Koul
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

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=20120205145358.GA13762@legolas.emea.dhcp.ti.com \
    --to=balbi@ti.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=linux-usb@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=vinod.koul@intel.com \
    --cc=yoshihiro.shimoda.uh@renesas.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;
as well as URLs for NNTP newsgroup(s).