All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: Don't resubmit pending URBs at MIDI error recovery
@ 2014-12-06 17:10 Takashi Iwai
  2014-12-06 19:54 ` Clemens Ladisch
  0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2014-12-06 17:10 UTC (permalink / raw)
  To: alsa-devel; +Cc: Clemens Ladisch

In snd_usbmidi_error_timer(), the driver tries to resubmit MIDI input
URBs to reactivate the MIDI stream, but this causes the error when
some of URBs are still pending like:

 WARNING: CPU: 0 PID: 0 at ../drivers/usb/core/urb.c:339 usb_submit_urb+0x5f/0x70()
 URB ef705c40 submitted while active
 CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.16.6-2-desktop #1
 Hardware name: FOXCONN TPS01/TPS01, BIOS 080015  03/23/2010
  c0984bfa f4009ed4 c078deaf f4009ee4 c024c884 c09a135c f4009f00 00000000
  c0984bfa 00000153 c061ac4f c061ac4f 00000009 00000001 ef705c40 e854d1c0
  f4009eec c024c8d3 00000009 f4009ee4 c09a135c f4009f00 f4009f04 c061ac4f
 Call Trace:
  [<c0205df6>] try_stack_unwind+0x156/0x170
  [<c020482a>] dump_trace+0x5a/0x1b0
  [<c0205e56>] show_trace_log_lvl+0x46/0x50
  [<c02049d1>] show_stack_log_lvl+0x51/0xe0
  [<c0205eb7>] show_stack+0x27/0x50
  [<c078deaf>] dump_stack+0x45/0x65
  [<c024c884>] warn_slowpath_common+0x84/0xa0
  [<c024c8d3>] warn_slowpath_fmt+0x33/0x40
  [<c061ac4f>] usb_submit_urb+0x5f/0x70
  [<f7974104>] snd_usbmidi_submit_urb+0x14/0x60 [snd_usbmidi_lib]
  [<f797483a>] snd_usbmidi_error_timer+0x6a/0xa0 [snd_usbmidi_lib]
  [<c02570c0>] call_timer_fn+0x30/0x130
  [<c0257442>] run_timer_softirq+0x1c2/0x260
  [<c0251493>] __do_softirq+0xc3/0x270
  [<c0204732>] do_softirq_own_stack+0x22/0x30
  [<c025186d>] irq_exit+0x8d/0xa0
  [<c0795228>] smp_apic_timer_interrupt+0x38/0x50
  [<c0794a3c>] apic_timer_interrupt+0x34/0x3c
  [<c0673d9e>] cpuidle_enter_state+0x3e/0xd0
  [<c028bb8d>] cpu_idle_loop+0x29d/0x3e0
  [<c028bd23>] cpu_startup_entry+0x53/0x60
  [<c0bfac1e>] start_kernel+0x415/0x41a

For avoiding these errors, check the pending URBs and skip
resubmitting such ones.

Reported-and-tested-by: Stefan Seyfried <stefan.seyfried@googlemail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/midi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index d3d49525a16b..5bfb695547f8 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -365,6 +365,8 @@ static void snd_usbmidi_error_timer(unsigned long data)
 		if (in && in->error_resubmit) {
 			in->error_resubmit = 0;
 			for (j = 0; j < INPUT_URBS; ++j) {
+				if (atomic_read(&in->urbs[j]->use_count))
+					continue;
 				in->urbs[j]->dev = umidi->dev;
 				snd_usbmidi_submit_urb(in->urbs[j], GFP_ATOMIC);
 			}
-- 
2.2.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ALSA: usb-audio: Don't resubmit pending URBs at MIDI error recovery
  2014-12-06 17:10 [PATCH] ALSA: usb-audio: Don't resubmit pending URBs at MIDI error recovery Takashi Iwai
@ 2014-12-06 19:54 ` Clemens Ladisch
  2014-12-06 20:45   ` Takashi Iwai
  0 siblings, 1 reply; 3+ messages in thread
From: Clemens Ladisch @ 2014-12-06 19:54 UTC (permalink / raw)
  To: Takashi Iwai, alsa-devel

Takashi Iwai wrote:
> In snd_usbmidi_error_timer(), the driver tries to resubmit MIDI input
> URBs to reactivate the MIDI stream, but this causes the error when
> some of URBs are still pending

I wonder what kept the other URBs alive.

> For avoiding these errors, check the pending URBs and skip
> resubmitting such ones.
>
> Reported-and-tested-by: Stefan Seyfried <stefan.seyfried@googlemail.com>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>

Anyway,
Acked-by: Clemens Ladisch <clemens@ladisch.de>

> ---
>  sound/usb/midi.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/sound/usb/midi.c b/sound/usb/midi.c
> index d3d49525a16b..5bfb695547f8 100644
> --- a/sound/usb/midi.c
> +++ b/sound/usb/midi.c
> @@ -365,6 +365,8 @@ static void snd_usbmidi_error_timer(unsigned long data)
>  		if (in && in->error_resubmit) {
>  			in->error_resubmit = 0;
>  			for (j = 0; j < INPUT_URBS; ++j) {
> +				if (atomic_read(&in->urbs[j]->use_count))
> +					continue;
>  				in->urbs[j]->dev = umidi->dev;
>  				snd_usbmidi_submit_urb(in->urbs[j], GFP_ATOMIC);
>  			}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ALSA: usb-audio: Don't resubmit pending URBs at MIDI error recovery
  2014-12-06 19:54 ` Clemens Ladisch
@ 2014-12-06 20:45   ` Takashi Iwai
  0 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2014-12-06 20:45 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel

At Sat, 06 Dec 2014 20:54:48 +0100,
Clemens Ladisch wrote:
> 
> Takashi Iwai wrote:
> > In snd_usbmidi_error_timer(), the driver tries to resubmit MIDI input
> > URBs to reactivate the MIDI stream, but this causes the error when
> > some of URBs are still pending
> 
> I wonder what kept the other URBs alive.

I'm not quite sure, but maybe it's controller-specific issues.
FWIW, the reporter used R-Pi.

> > For avoiding these errors, check the pending URBs and skip
> > resubmitting such ones.
> >
> > Reported-and-tested-by: Stefan Seyfried <stefan.seyfried@googlemail.com>
> > Cc: <stable@vger.kernel.org>
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> 
> Anyway,
> Acked-by: Clemens Ladisch <clemens@ladisch.de>

Queued now.


thanks,

Takashi

> > ---
> >  sound/usb/midi.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/sound/usb/midi.c b/sound/usb/midi.c
> > index d3d49525a16b..5bfb695547f8 100644
> > --- a/sound/usb/midi.c
> > +++ b/sound/usb/midi.c
> > @@ -365,6 +365,8 @@ static void snd_usbmidi_error_timer(unsigned long data)
> >  		if (in && in->error_resubmit) {
> >  			in->error_resubmit = 0;
> >  			for (j = 0; j < INPUT_URBS; ++j) {
> > +				if (atomic_read(&in->urbs[j]->use_count))
> > +					continue;
> >  				in->urbs[j]->dev = umidi->dev;
> >  				snd_usbmidi_submit_urb(in->urbs[j], GFP_ATOMIC);
> >  			}
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-06 20:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-06 17:10 [PATCH] ALSA: usb-audio: Don't resubmit pending URBs at MIDI error recovery Takashi Iwai
2014-12-06 19:54 ` Clemens Ladisch
2014-12-06 20:45   ` Takashi Iwai

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.