alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Liam Girdwood <lrg@ti.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 2/3] ASoC: dapm - Use card mutex for DAPM ops instead of codec mutex.
Date: Sun, 4 Mar 2012 14:09:40 +0000	[thread overview]
Message-ID: <20120304140939.GH3083@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1330711872-27436-2-git-send-email-lrg@ti.com>


[-- Attachment #1.1: Type: text/plain, Size: 1946 bytes --]

On Fri, Mar 02, 2012 at 06:11:11PM +0000, Liam Girdwood wrote:

Thanks for looking at this stuff, it's needed attention for a long time
but it's never been a practical problem and it's always depressed me too
much every time I've thought about looking at it myself.

> This patch updates the DAPM operations that use the codec mutex to
> now use the card mutex PCM subclass for all DAPM ops.

Hrm, this makes "PCM" look misnamed...  should we have a DAPM context,
or perhaps even just a separate lock for DAPM?  If we can have a
separate lock that'd be good, it's usually much simpler (at least for
me) to reason about multiple locks interacting than nesting on the same
lock but it's not always reasonable to split the locks, like with the
PCM stuff calling back into itself.

It looks like we're also missing a lock in snd_soc_dapm_sync() here, we
need to lock that as well as the updaters otherwise we might change the
lists underneath the DAPM run which doesn't work so well.  I might've
missed that, though (and currently we're not exactly 100% on taking that
lock when we should).  That's why snd_soc_jack_report() has the CODEC
mutex for example.

We'll also need to make sure the locking for the register I/O is sorted,
it's OK for the devices using regmap as that locks for us but currently
anything using the ASoC level cache relies on the CODEC mutex being held
for register I/O.  This isn't quite so risky as it was when we had the
advanced caches since the data structure is just a plain array but
writes may still go AWOL and that'd be a nightmare to debug.  I'm
worrying that right now something is relying on the fact that DAPM takes
the CODEC mutex to protect it.  But probably it's OK to fix that up
separately I think, we've got plenty of problems there and either
killing all the ASoC level caches or adding a new lock at the cache
level seem like the way to go both of which are basically orthogonal to
what's going on here.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2012-03-04 14:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-02 18:11 [PATCH 1/3] ASoC: core - Add card mutex locking subclasses Liam Girdwood
2012-03-02 18:11 ` [PATCH 2/3] ASoC: dapm - Use card mutex for DAPM ops instead of codec mutex Liam Girdwood
2012-03-04 14:09   ` Mark Brown [this message]
2012-03-05 14:48     ` Liam Girdwood
2012-03-05 15:26       ` Mark Brown
2012-03-05 15:55         ` Liam Girdwood
2012-03-05 16:45           ` Mark Brown
2012-03-05 17:05             ` Liam Girdwood
2012-03-05 20:34               ` Mark Brown
2012-03-02 18:11 ` [PATCH 3/3] ASoC: dapm - lock mixer & mux update power with card mutex Liam Girdwood

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=20120304140939.GH3083@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=lrg@ti.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;
as well as URLs for NNTP newsgroup(s).