All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Max Filippov <jcmvbkbc@gmail.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	alsa-devel@alsa-project.org, Leon Romanovsky <leon@kernel.org>,
	Takashi Iwai <tiwai@suse.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>
Subject: Re: ALSA: intel8x0: div by zero in snd_intel8x0_update()
Date: Wed, 07 Jul 2021 20:14:13 +0200	[thread overview]
Message-ID: <s5hk0m26lfu.wl-tiwai@suse.de> (raw)
In-Reply-To: <CAMo8Bf+FF8Ofq=FwoZZXp9vKiMaUZNAm+W=OJmu2j2XN6kLb-Q@mail.gmail.com>

On Wed, 07 Jul 2021 19:50:07 +0200,
Max Filippov wrote:
> 
> On Wed, Jul 7, 2021 at 12:02 AM Takashi Iwai <tiwai@suse.de> wrote:
> > On Tue, 06 Jul 2021 19:50:08 +0200, Max Filippov wrote:
> > > linux v5.13 booting on qemu-system-xtensa virt board gets stuck inside
> > > snd_intel8x0_probe -> intel8x0_measure_ac97_clock with this patch.
> > > Prior to it it boots successfully for me.
> > > I'm curious if this issue has been reported yet.
> > >
> > > What I see is an IRQ flood, at some point snd_intel8x0_interrupt
> > > and timer ISR  are called in loop and execution never returns to
> > > the interrupted function intel8x0_measure_ac97_clock.
> > >
> > > Any idea what it could be?
> >
> > That's something odd with the VM.  As the chip itself has never shown
> > such a problem on real systems, maybe the best action would be to just
> > skip the clock measurement on VM.  The measurement itself is
> > unreliable on VM, so it makes more sense.
> >
> > That said, something like below would work?
> 
> It didn't change anything in my case. My further observation is that
> the snd_intel8x0_update is called before the ichdev->prepared
> is set to one and as a result IRQ is apparently never cleared.

So it's broken in anyway no matter whether
intel8x0_measure_ac97_clock() is called or not, right?
I'm afraid that something is wrong in VM, then.  The driver has been
working over decades on thousands of real different boards.

Skipping the clock measurement on VM would be still useful,
independent from your problem, though.


Takashi

> Perhaps because intel8x0_measure_ac97_clock is called from the
> snd_intel8x0_probe, well before the snd_intel8x0_pcm_prepare
> that sets ichdev->prepared is called.
> 
> > thanks,
> >
> > Takashi
> >
> > ---
> > diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
> > index 2d1bfbcba933..b75f832d7777 100644
> > --- a/sound/pci/intel8x0.c
> > +++ b/sound/pci/intel8x0.c
> > @@ -2199,6 +2199,9 @@ static int snd_intel8x0_mixer(struct intel8x0 *chip, int ac97_clock,
> >         pbus->private_free = snd_intel8x0_mixer_free_ac97_bus;
> >         if (ac97_clock >= 8000 && ac97_clock <= 48000)
> >                 pbus->clock = ac97_clock;
> > +       else if (chip->inside_vm)
> > +               pbus->clock = 48000;
> > +
> >         /* FIXME: my test board doesn't work well with VRA... */
> >         if (chip->device_type == DEVICE_ALI)
> >                 pbus->no_vra = 1;
> 
> -- 
> Thanks.
> -- Max
> 

WARNING: multiple messages have this Message-ID (diff)
From: Takashi Iwai <tiwai@suse.de>
To: Max Filippov <jcmvbkbc@gmail.com>
Cc: alsa-devel@alsa-project.org, Leon Romanovsky <leon@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	Takashi Iwai <tiwai@suse.com>,
	Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: Re: ALSA: intel8x0: div by zero in snd_intel8x0_update()
Date: Wed, 07 Jul 2021 20:14:13 +0200	[thread overview]
Message-ID: <s5hk0m26lfu.wl-tiwai@suse.de> (raw)
In-Reply-To: <CAMo8Bf+FF8Ofq=FwoZZXp9vKiMaUZNAm+W=OJmu2j2XN6kLb-Q@mail.gmail.com>

On Wed, 07 Jul 2021 19:50:07 +0200,
Max Filippov wrote:
> 
> On Wed, Jul 7, 2021 at 12:02 AM Takashi Iwai <tiwai@suse.de> wrote:
> > On Tue, 06 Jul 2021 19:50:08 +0200, Max Filippov wrote:
> > > linux v5.13 booting on qemu-system-xtensa virt board gets stuck inside
> > > snd_intel8x0_probe -> intel8x0_measure_ac97_clock with this patch.
> > > Prior to it it boots successfully for me.
> > > I'm curious if this issue has been reported yet.
> > >
> > > What I see is an IRQ flood, at some point snd_intel8x0_interrupt
> > > and timer ISR  are called in loop and execution never returns to
> > > the interrupted function intel8x0_measure_ac97_clock.
> > >
> > > Any idea what it could be?
> >
> > That's something odd with the VM.  As the chip itself has never shown
> > such a problem on real systems, maybe the best action would be to just
> > skip the clock measurement on VM.  The measurement itself is
> > unreliable on VM, so it makes more sense.
> >
> > That said, something like below would work?
> 
> It didn't change anything in my case. My further observation is that
> the snd_intel8x0_update is called before the ichdev->prepared
> is set to one and as a result IRQ is apparently never cleared.

So it's broken in anyway no matter whether
intel8x0_measure_ac97_clock() is called or not, right?
I'm afraid that something is wrong in VM, then.  The driver has been
working over decades on thousands of real different boards.

Skipping the clock measurement on VM would be still useful,
independent from your problem, though.


Takashi

> Perhaps because intel8x0_measure_ac97_clock is called from the
> snd_intel8x0_probe, well before the snd_intel8x0_pcm_prepare
> that sets ichdev->prepared is called.
> 
> > thanks,
> >
> > Takashi
> >
> > ---
> > diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
> > index 2d1bfbcba933..b75f832d7777 100644
> > --- a/sound/pci/intel8x0.c
> > +++ b/sound/pci/intel8x0.c
> > @@ -2199,6 +2199,9 @@ static int snd_intel8x0_mixer(struct intel8x0 *chip, int ac97_clock,
> >         pbus->private_free = snd_intel8x0_mixer_free_ac97_bus;
> >         if (ac97_clock >= 8000 && ac97_clock <= 48000)
> >                 pbus->clock = ac97_clock;
> > +       else if (chip->inside_vm)
> > +               pbus->clock = 48000;
> > +
> >         /* FIXME: my test board doesn't work well with VRA... */
> >         if (chip->device_type == DEVICE_ALI)
> >                 pbus->no_vra = 1;
> 
> -- 
> Thanks.
> -- Max
> 

  reply	other threads:[~2021-07-07 18:14 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14  8:17 ALSA: intel8x0: div by zero in snd_intel8x0_update() Sergey Senozhatsky
2021-05-14  8:17 ` Sergey Senozhatsky
2021-05-14 11:05 ` Takashi Iwai
2021-05-14 11:05   ` Takashi Iwai
2021-05-14 11:16   ` Sergey Senozhatsky
2021-05-14 11:16     ` Sergey Senozhatsky
2021-05-16  8:30     ` Sergey Senozhatsky
2021-05-16  8:30       ` Sergey Senozhatsky
2021-05-16  8:31       ` Sergey Senozhatsky
2021-05-16  8:31         ` Sergey Senozhatsky
2021-05-16  9:49         ` Takashi Iwai
2021-05-16  9:49           ` Takashi Iwai
2021-05-16 10:59           ` Sergey Senozhatsky
2021-05-16 10:59             ` Sergey Senozhatsky
2021-05-16 11:23           ` Sergey Senozhatsky
2021-05-16 11:23             ` Sergey Senozhatsky
2021-05-16 12:07             ` Takashi Iwai
2021-05-16 12:07               ` Takashi Iwai
2021-05-16 12:55               ` Sergey Senozhatsky
2021-05-16 12:55                 ` Sergey Senozhatsky
2021-07-06 17:50           ` Max Filippov
2021-07-06 17:50             ` Max Filippov
2021-07-07  7:02             ` Takashi Iwai
2021-07-07  7:02               ` Takashi Iwai
2021-07-07 17:50               ` Max Filippov
2021-07-07 17:50                 ` Max Filippov
2021-07-07 18:14                 ` Takashi Iwai [this message]
2021-07-07 18:14                   ` Takashi Iwai
2021-07-07 20:33                   ` Max Filippov
2021-07-07 20:33                     ` Max Filippov
2021-07-08  7:13                     ` Takashi Iwai
2021-07-08  7:13                       ` Takashi Iwai
2021-07-08  8:41                       ` Max Filippov
2021-07-08  8:41                         ` Max Filippov
2021-07-08  9:00                         ` Takashi Iwai
2021-07-08  9:00                           ` Takashi Iwai
2021-07-08 10:12                           ` Sergey Senozhatsky
2021-07-08 10:12                             ` Sergey Senozhatsky

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=s5hk0m26lfu.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=gustavoars@kernel.org \
    --cc=jcmvbkbc@gmail.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=tiwai@suse.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.