public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Bard Liao <yung-chuan.liao@linux.intel.com>
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	pierre-louis.bossart@linux.intel.com, bard.liao@intel.com
Subject: Re: [PATCH] soundwire: intel: don't save hw_params for use in prepare
Date: Wed, 12 Apr 2023 15:33:12 +0530	[thread overview]
Message-ID: <ZDaB4Nea32pNWpeN@matsya> (raw)
In-Reply-To: <20230321022642.1426611-1-yung-chuan.liao@linux.intel.com>

On 21-03-23, 10:26, Bard Liao wrote:
> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> 
> The existing code copies the hw_params pointer and reuses it later in
> .prepare, specifically to re-initialize the ALH DMA channel
> information that's lost in suspend-resume cycles.
> 
> This is not needed, we can directly access the information from the
> substream/rtd - as done for the HDAudio DAIs in
> sound/soc/sof/intel/hda-dai.c
> 
> In addition, using the saved pointer causes the suspend-resume test
> cases to fail on specific platforms, depending on which version of GCC
> is used. Péter Ujfalusi and I have spent long hours to root-cause this
> problem that was reported by the Intel CI first with 6.2-rc1 and again
> v6.3-rc1. In the latter case we were lucky that the problem was 100%
> reproducible on local test devices, and found out that adding a
> dev_dbg() or adding a call to usleep_range() just before accessing the
> saved pointer "fixed" the issue. With errors appearing just by
> changing the compiler version or minor changes in the code generated,
> clearly we have a memory management Heisenbug.
> 
> The root-cause seems to be that the hw_params pointer is not
> persistent. The soc-pcm code allocates the hw_params structure on the
> stack, and passes it to the BE dailink hw_params and DAIs
> hw_params. Saving such a pointer and reusing it later during the
> .prepare stage cannot possibly work reliably, it's broken-by-design
> since v5.10. It's astonishing that the problem was not seen earlier.
> 
> This simple fix will have to be back-ported to -stable, due to changes
> to avoid the use of the get/set_dmadata routines this patch will only
> apply on kernels older than v6.1.

Applied, thanks

-- 
~Vinod

      reply	other threads:[~2023-04-12 10:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21  2:26 [PATCH] soundwire: intel: don't save hw_params for use in prepare Bard Liao
2023-04-12 10:03 ` Vinod Koul [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=ZDaB4Nea32pNWpeN@matsya \
    --to=vkoul@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=bard.liao@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=yung-chuan.liao@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox