* Re: [Bug 46011] Capture of sound from USB connected audio card (UGM96) doesn't work in 3.5.1 - kernel bug generated: scheduling while atomic [not found] ` <s5htxw4xwt7.wl%tiwai@suse.de> @ 2012-08-16 10:28 ` Daniel Mack 2012-08-16 11:26 ` Clemens Ladisch 0 siblings, 1 reply; 3+ messages in thread From: Daniel Mack @ 2012-08-16 10:28 UTC (permalink / raw) To: Clemens Ladisch; +Cc: Takashi Iwai, alsa-devel On 15.08.2012 12:40, Takashi Iwai wrote: >>> Could you try the patch below? Clemens, the patch below fixes a "sleeping while atomic" bug in the USB audio driver, but it raises a new "not enough bandwidth" issue, which might even be unreleated. I currently don't see the root cause here, but I might be blind. Do you have any idea? Thanks, Daniel > --- > From: Takashi Iwai <tiwai@suse.de> > Subject: [PATCH] ALSA: usb-audio: Fix scheduling-while-atomic bug in PCM > capture stream > > A PCM capture stream on usb-audio causes a scheduling-while-atomic > BUG, as reported in the bugzilla entry below. It's because > snd_usb_endpoint_start() is called at first at trigger START for a > capture stream, and this function contains the left-over EP > deactivation codes. The problem doesn't happen for a playback stream > because the function is called at PCM prepare time, which can sleep. > > This patch fixes the BUG by moving the EP deactivation code into the > PCM prepare callback. > > Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=46011 > Cc: <stable@vger.kernel.org> [v3.5+] > Signed-off-by: Takashi Iwai <tiwai@suse.de> > --- > sound/usb/endpoint.c | 4 ---- > sound/usb/pcm.c | 3 +++ > 2 files changed, 3 insertions(+), 4 deletions(-) > > diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c > index 0f647d2..c411812 100644 > --- a/sound/usb/endpoint.c > +++ b/sound/usb/endpoint.c > @@ -821,10 +821,6 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep) > if (++ep->use_count != 1) > return 0; > > - /* just to be sure */ > - deactivate_urbs(ep, 0, 1); > - wait_clear_urbs(ep); > - > ep->active_mask = 0; > ep->unlink_mask = 0; > ep->phase = 0; > diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c > index a1298f3..62ec808 100644 > --- a/sound/usb/pcm.c > +++ b/sound/usb/pcm.c > @@ -544,6 +544,9 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) > subs->last_frame_number = 0; > runtime->delay = 0; > > + /* clear the pending deactivation on the target EPs */ > + deactivate_endpoints(subs); > + > /* for playback, submit the URBs now; otherwise, the first hwptr_done > * updates for all URBs would happen at the same time when starting */ > if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Bug 46011] Capture of sound from USB connected audio card (UGM96) doesn't work in 3.5.1 - kernel bug generated: scheduling while atomic 2012-08-16 10:28 ` [Bug 46011] Capture of sound from USB connected audio card (UGM96) doesn't work in 3.5.1 - kernel bug generated: scheduling while atomic Daniel Mack @ 2012-08-16 11:26 ` Clemens Ladisch 2012-08-17 6:17 ` Takashi Iwai 0 siblings, 1 reply; 3+ messages in thread From: Clemens Ladisch @ 2012-08-16 11:26 UTC (permalink / raw) To: Daniel Mack; +Cc: Takashi Iwai, alsa-devel Daniel Mack wrote: > Clemens, the patch below fixes a "sleeping while atomic" bug in the USB > audio driver, but it raises a new "not enough bandwidth" issue, which > might even be unreleated. > >> +++ b/sound/usb/pcm.c >> @@ -544,6 +544,9 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) >> >> + /* clear the pending deactivation on the target EPs */ >> + deactivate_endpoints(subs); The HC drivers calculate bandwidth for a stream when the first URB is submitted or the last one is completed. (xHCI does this when the altsetting is changed; IIRC there are plans to have other HCDs do the same.) This patch doesn't change the relative order of URB submissions and cancellations. The descriptions in bug 46011 indicates that we're running into the not-completely-fixed EHCI scheduling bugs. Regards, Clemens ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Bug 46011] Capture of sound from USB connected audio card (UGM96) doesn't work in 3.5.1 - kernel bug generated: scheduling while atomic 2012-08-16 11:26 ` Clemens Ladisch @ 2012-08-17 6:17 ` Takashi Iwai 0 siblings, 0 replies; 3+ messages in thread From: Takashi Iwai @ 2012-08-17 6:17 UTC (permalink / raw) To: Clemens Ladisch; +Cc: alsa-devel, Daniel Mack At Thu, 16 Aug 2012 13:26:48 +0200, Clemens Ladisch wrote: > > Daniel Mack wrote: > > Clemens, the patch below fixes a "sleeping while atomic" bug in the USB > > audio driver, but it raises a new "not enough bandwidth" issue, which > > might even be unreleated. > > > >> +++ b/sound/usb/pcm.c > >> @@ -544,6 +544,9 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) > >> > >> + /* clear the pending deactivation on the target EPs */ > >> + deactivate_endpoints(subs); > > The HC drivers calculate bandwidth for a stream when the first URB is > submitted or the last one is completed. (xHCI does this when the > altsetting is changed; IIRC there are plans to have other HCDs do the > same.) > > This patch doesn't change the relative order of URB submissions and > cancellations. The descriptions in bug 46011 indicates that we're > running into the not-completely-fixed EHCI scheduling bugs. Yes, this reminds me of a known issue... In anyway, the fix for the bad EP deactivation was already merged to sound git tree and will be included in the next pull request for 3.6-rc3. Takashi ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-08-17 5:47 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <bug-46011-47592@https.bugzilla.kernel.org/> [not found] ` <20120815103121.D4D5211FC6C@bugzilla.kernel.org> [not found] ` <502B7B5B.1030808@gmail.com> [not found] ` <s5htxw4xwt7.wl%tiwai@suse.de> 2012-08-16 10:28 ` [Bug 46011] Capture of sound from USB connected audio card (UGM96) doesn't work in 3.5.1 - kernel bug generated: scheduling while atomic Daniel Mack 2012-08-16 11:26 ` Clemens Ladisch 2012-08-17 6:17 ` Takashi Iwai
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).