mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Runyu Xiao <runyu.xiao@seu.edu.cn>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Clemens Ladisch <clemens@ladisch.de>,
	Jianhao Xu <jianhao.xu@seu.edu.cn>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: ymfpci: avoid changing control access under spinlock
Date: Mon, 28 Sep 2026 14:54:32 +0200	[thread overview]
Message-ID: <871pad5yev.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260927135301.777475-1-runyu.xiao@seu.edu.cn>

On Sun, 27 Sep 2026 15:53:01 +0200,
Runyu Xiao wrote:
> 
> The YMFPCI playback trigger changes a mixer control's access flags while
> holding reg_lock. Direct access changes are not serialized with the control
> core, and snd_ctl_activate_id() cannot be called under the spinlock because
> it may sleep.
> 
> Track the desired control state under reg_lock and update it from a work
> item. Use a generation counter to serialize prepare with a pending stop.
> Cancel the work before the PCM private data is released.
> 
> Assisted-by: LLM
> Fixes: 177a7cdbd1d8 ("[ALSA] ymfpci: fix volume handling of the 44.1 kHz slot")
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>

Although the intention is clear, this is just an overkill.  There is
no real race, and introducing the offloading work just for using
snd_ctl_activate_id() makes little sense for this old code.

If any, we should rather make snd_ctl_activate_id() to be callable
from the irq context, instead.  But this would need a redesign of the
control-led layer implementation -- that's the very reason of being
sleepable context.


thanks,

Takashi

      reply	other threads:[~2026-09-28 12:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-27 13:53 Runyu Xiao
2026-09-28 12:54 ` Takashi Iwai [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=871pad5yev.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=clemens@ladisch.de \
    --cc=jianhao.xu@seu.edu.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=runyu.xiao@seu.edu.cn \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®