From: Takashi Iwai <tiwai@suse.de>
To: Giuliano Pochini <pochini@shiny.it>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: [PATCH] Kernel crash
Date: Wed, 15 Sep 2004 12:24:03 +0200 [thread overview]
Message-ID: <s5h4qlzx22k.wl@alsa2.suse.de> (raw)
In-Reply-To: <20040913220729.466531ce.pochini@shiny.it>
At Mon, 13 Sep 2004 22:07:29 +0200,
Giuliano Pochini wrote:
>
> On Mon, 13 Sep 2004 17:00:21 +0200
> Takashi Iwai <tiwai@suse.de> wrote:
>
> > > I added some code in the hw_free callback to avoid the crash and some debug
> > > lines in pcm_native.c and I got this trace:
> > >
> > > pcm_trigger start
> > > [...]
> > > pcm_native.c:1241: snd_pcm_playback_drain (state=RUNNING)
> > > pcm_native.c:1294: snd_pcm_playback_drain not empty
> > > pcm_native.c:1204: snd_pcm_change_state(DRAINING)
> > > pcm_native.c:1457: snd_pcm_capture_drop (state=DRAINING)
> > > pcm_native.c:1204: snd_pcm_change_state(SETUP)
> > >
> > > This changes the state of both substreams to SETUP, so
> > > snd_pcm_playback/capture_drain/drop() functions will not call _stop()
> > > anymore.
> > >
> > > pcm_native.c:1359: snd_pcm_playback_drop (state=SETUP)
> > > pcm_hw_free(play) <--- BUG!
> > > pcm_close
> > > pcm_native.c:snd_pcm_capture_drop (state=SETUP)
> > > pcm_hw_free(capt)
> > > pcm_close
> >
> > I see.
> >
> > > I developed this patch, but I'm not sure it's ok. The first part probably is
> > > not required but it seems more correct IMHO.
> >
> > The first one should be ok.
> > I'm also not 100% sure about the second one after the short glance.
> >
> > The problem is that we have no DMA running state in runtime struct.
> > DMA is supposed to be running in DRAINING state for playback, while
> > it's to be stopped in DRAINING capture.
>
> I guessed the DMA is going on in RUNNING and DRAINING states only. Actually
> I just noticed that my patch is wrong: in PREPARED state DMA is off and
> snd_pcm_stop() should not be called if state is SNDRV_PCM_STATE_XRUN because
> snd_pcm_xrun() already stopped it.
>
> (compiled and tested ok)
I believe the second part is not needed. DRAINING in capture implies
that the DMA is already stopped (like XRUN).
If the second part really fixes the problem, the bug is in somewhere
else.
Takashi
>
>
> --- pcm_native.c_orig Sat Sep 11 15:29:51 2004
> +++ pcm_native.c Mon Sep 13 21:51:05 2004
> @@ -1280,7 +1280,8 @@
> break;
> }
>
> - if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) {
> + if (runtime->status->state == SNDRV_PCM_STATE_RUNNING ||
> + runtime->status->state == SNDRV_PCM_STATE_DRAINING) {
> if (snd_pcm_playback_empty(substream)) {
> snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP);
> goto _end;
> @@ -1464,9 +1465,14 @@
> if (res < 0)
> goto _end;
> /* Fall through */
> - case SNDRV_PCM_STATE_PREPARED:
> case SNDRV_PCM_STATE_DRAINING:
> + if (snd_pcm_update_hw_ptr(substream) >= 0) {
> + snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP);
> + break;
> + }
> + /* Fall through */
> case SNDRV_PCM_STATE_XRUN:
> + case SNDRV_PCM_STATE_PREPARED:
> snd_pcm_change_state(substream, SNDRV_PCM_STATE_SETUP);
> break;
> default:
>
>
>
> --
> Giuliano.
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
> Project Admins to receive an Apple iPod Mini FREE for your judgement on
> who ports your project to Linux PPC the best. Sponsored by IBM.
> Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/alsa-devel
>
-------------------------------------------------------
This SF.Net email is sponsored by: thawte's Crypto Challenge Vl
Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam
Camcorder. More prizes in the weekly Lunch Hour Challenge.
Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m
next prev parent reply other threads:[~2004-09-15 10:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-05 18:51 Kernel crash Giuliano Pochini
2004-09-06 15:16 ` Takashi Iwai
2004-09-07 7:55 ` Giuliano Pochini
2004-09-11 19:02 ` [PATCH] " Giuliano Pochini
2004-09-13 15:00 ` Takashi Iwai
2004-09-13 20:07 ` Giuliano Pochini
2004-09-15 10:24 ` Takashi Iwai [this message]
2004-09-15 17:50 ` Giuliano Pochini
2004-09-15 18:01 ` Takashi Iwai
2004-09-16 11:16 ` Takashi Iwai
2004-09-16 19:56 ` Giuliano Pochini
2004-09-17 6:54 ` Jaroslav Kysela
2004-09-17 10:22 ` Takashi Iwai
2004-09-17 10:32 ` Takashi Iwai
2004-09-22 8:08 ` Jaroslav Kysela
2004-09-22 10:08 ` Takashi Iwai
2004-09-22 14:12 ` Giuliano Pochini
2004-09-23 7:43 ` Jaroslav Kysela
2004-09-24 13:30 ` Takashi Iwai
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=s5h4qlzx22k.wl@alsa2.suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@lists.sourceforge.net \
--cc=pochini@shiny.it \
/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.