All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kai Vehmanen <kvehmanen@nosignal.fi>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org,
	pierre-louis.bossart@linux.intel.com,
	Kai Vehmanen <kai.vehmanen@linux.intel.com>
Subject: Re: [RFC PATCH] ALSA: hda/hdmi: fix race in handling acomp ELD notification at resume
Date: Thu, 8 Apr 2021 13:49:15 +0300 (EEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.2104081341410.1629@ecabase.localdomain> (raw)
In-Reply-To: <s5hft0189bi.wl-tiwai@suse.de>

Hi,

On Thu, 8 Apr 2021, Takashi Iwai wrote:
> OK, that's a messy problem, indeed.  It's partly because of ASoC
> referred resume that is completely independent from the rest resume
> via HD-audio bus.  More badly, this can't be managed via the device
> link because the resume callback itself has been processed.
>
> And, IIUC, another part of the problem is that i915 notifies the HPD
> *after* the resume completion, right?  Then indeed it can be racy.

yes, exactly.

>> Seems quite odd indeed, but I've now got reports of systems where this is
>> hit, and unfortunately it's very systematic on these systems. By adding
>> some arbitrary delay to soc_resume_deferred(), I could easily hit this
>> myself as well on the systems I have at hand.
>
> Another possible fix would be to check dev->power.power_state instead
> of the global card state.  This is set in each PM callback in
> hda_codec.c to indicate the current PM state of the codec.  Something
> like below.  Let me know if this works, too.

Thanks, this works in my setup and is much cleaner. I think this is also 
more robust. I realized that with snd_power_get_state() check, there is a 
theoretical race still possible if notify comes before 
soc_resume_deferred() gets scheduled (i.e. delay is not within 
soc_resume_deferred() but in getting it scheduled to begin with). This 
would seem really unlikely, but it's a possible race nevertheless.

I'll update the patch to use dev->power.power_state, ask people with 
affected systems to double check, and I'll send a V2.

Br, Kai

      reply	other threads:[~2021-04-08 10:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07 15:47 [RFC PATCH] ALSA: hda/hdmi: fix race in handling acomp ELD notification at resume Kai Vehmanen
2021-04-07 16:10 ` Takashi Iwai
2021-04-07 16:40   ` Kai Vehmanen
2021-04-08  8:33     ` Takashi Iwai
2021-04-08 10:49       ` Kai Vehmanen [this message]

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=alpine.DEB.2.21.2104081341410.1629@ecabase.localdomain \
    --to=kvehmanen@nosignal.fi \
    --cc=alsa-devel@alsa-project.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.de \
    /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.