From: Takashi Iwai <tiwai@suse.de>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>,
intel-gfx@lists.freedesktop.org, alsa-devel@alsa-project.org
Subject: Re: [PATCH 3/3] snd/hda: Protect concurrent display_power_status with a mutex
Date: Mon, 14 Jan 2019 18:46:57 +0100 [thread overview]
Message-ID: <s5hd0ozi12m.wl-tiwai@suse.de> (raw)
In-Reply-To: <20190114173753.472-3-chris@chris-wilson.co.uk>
On Mon, 14 Jan 2019 18:37:53 +0100,
Chris Wilson wrote:
>
> Just in case the audio linkage is swapped between components during the
> runtime pm sequence, we need to protect the rpm tracking with a mutex.
It's not clear to me how does this happens.
Could you elaborate a bit more the scenario?
thanks,
Takashi
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Takashi Iwai <tiwai@suse.de>
> Cc: Jani Nikula <jani.nikula@intel.com>
> ---
> include/sound/hdaudio.h | 1 +
> sound/hda/hdac_component.c | 7 +++++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h
> index 39761120ee76..497335b24e18 100644
> --- a/include/sound/hdaudio.h
> +++ b/include/sound/hdaudio.h
> @@ -368,6 +368,7 @@ struct hdac_bus {
> struct drm_audio_component *audio_component;
> unsigned long display_power_status;
> unsigned long display_power_active;
> + struct mutex display_power_lock;
>
> /* parameters required for enhanced capabilities */
> int num_streams;
> diff --git a/sound/hda/hdac_component.c b/sound/hda/hdac_component.c
> index 2702548b788a..ea76c1de2927 100644
> --- a/sound/hda/hdac_component.c
> +++ b/sound/hda/hdac_component.c
> @@ -77,6 +77,7 @@ void snd_hdac_display_power(struct hdac_bus *bus, unsigned int idx, bool enable)
> if (!acomp || !acomp->ops)
> return;
>
> + mutex_lock(&bus->display_power_lock);
> if (bus->display_power_status) {
> if (!bus->display_power_active) {
> unsigned long cookie = -1;
> @@ -98,6 +99,7 @@ void snd_hdac_display_power(struct hdac_bus *bus, unsigned int idx, bool enable)
> bus->display_power_active = 0;
> }
> }
> + mutex_unlock(&bus->display_power_lock);
> }
> EXPORT_SYMBOL_GPL(snd_hdac_display_power);
>
> @@ -290,6 +292,9 @@ int snd_hdac_acomp_init(struct hdac_bus *bus,
> GFP_KERNEL);
> if (!acomp)
> return -ENOMEM;
> +
> + mutex_init(&bus->display_power_lock);
> +
> acomp->audio_ops = aops;
> bus->audio_component = acomp;
> devres_add(dev, acomp);
> @@ -336,6 +341,8 @@ int snd_hdac_acomp_exit(struct hdac_bus *bus)
> bus->display_power_active = 0;
> bus->display_power_status = 0;
>
> + mutex_destroy(&bus->display_power_lock);
> +
> component_master_del(dev, &hdac_component_master_ops);
>
> bus->audio_component = NULL;
> --
> 2.20.1
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-01-14 17:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-14 17:37 [PATCH 1/3] drm/i915/audio: Track temporary rpm wakerefs Chris Wilson
2019-01-14 17:37 ` [PATCH 2/3] snd/hda: Track the display_power_status using a cookie Chris Wilson
2019-01-14 17:54 ` Takashi Iwai
2019-01-14 21:11 ` Chris Wilson
2019-01-14 17:37 ` [PATCH 3/3] snd/hda: Protect concurrent display_power_status with a mutex Chris Wilson
2019-01-14 17:46 ` Takashi Iwai [this message]
2019-01-14 17:51 ` Chris Wilson
2019-01-14 18:00 ` Takashi Iwai
2019-01-14 20:57 ` Chris Wilson
2019-01-14 21:18 ` Takashi Iwai
2019-01-14 18:07 ` [PATCH 1/3] drm/i915/audio: Track temporary rpm wakerefs John Harrison
2019-01-14 18:21 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] " Patchwork
2019-01-14 19:14 ` ✓ Fi.CI.BAT: success " Patchwork
2019-01-15 0:29 ` ✓ Fi.CI.IGT: " Patchwork
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=s5hd0ozi12m.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@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