Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, Jaroslav Kysela <perex@perex.cz>
Subject: Re: [PATCH 2/3] ALSA: emu10k1: remove superfluous IRQ enable state saving
Date: Thu, 13 Jul 2023 10:15:21 +0200	[thread overview]
Message-ID: <ZK+ymU7ynF0eRy8R@ugly> (raw)
In-Reply-To: <875y6ogxt8.wl-tiwai@suse.de>

On Thu, Jul 13, 2023 at 07:55:31AM +0200, Takashi Iwai wrote:
>On Wed, 12 Jul 2023 16:57:49 +0200,
>Oswald Buddenhagen wrote:
>> 
>> The mixer, PCM prepare, MIDI, synth driver, and procfs callbacks are all
>> always invoked with IRQs enabled, so there is no point in saving the
>> state.
>> 
>> snd_emu1010_load_firmware_entry() is called from emu1010_firmware_work()
>> and snd_emu10k1_emu1010_init(); the latter from snd_emu10k1_create() and
>> snd_emu10k1_resume(), all of which have IRQs enabled.
>> 
>> The voice and memory functions are called from mixed contexts, so they
>> keep the state saving.
>> 
>> The low-level functions all keep the state saving, because it's not
>> feasible to keep track of what is called where.
>> 
>Wouldn't it make more sense if you replace it with a mutex?
>It'll become more obvious that it's only for non-IRQ context, too.
>
huh?
at least some of the ~six different locks touched by this patch 
absolutely _are_ used in irq context. this patch is concerned only about 
the specific call sites, where we know that local irqs are enabled, so 
we can unconditionally re-enable them rather than restoring the old 
state (the latter being a much more expensive operation). the code 
already contains precedents for this, and the complementary optimization 
of not disabling/restoring irqs where we know that they are already 
disabled.

the reg_lock would be convertible to a mixer_mutex in most mixer 
callbacks, but that is an orthogonal question, which is raised in the 
next commit.

regards

  reply	other threads:[~2023-07-13  8:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12 14:57 [PATCH 1/3] ALSA: emu10k1: fix return value of snd_emu1010_adc_pads_put() Oswald Buddenhagen
2023-07-12 14:57 ` [PATCH 2/3] ALSA: emu10k1: remove superfluous IRQ enable state saving Oswald Buddenhagen
2023-07-13  5:55   ` Takashi Iwai
2023-07-13  8:15     ` Oswald Buddenhagen [this message]
2023-07-13  8:27       ` Takashi Iwai
2023-07-13  8:30   ` Takashi Iwai
2023-07-12 14:57 ` [PATCH 3/3] ALSA: emu10k1: (re-)add mixer locking Oswald Buddenhagen
2023-07-13  8:33   ` Takashi Iwai
2023-07-13  9:07     ` Oswald Buddenhagen
2023-07-13  9:21       ` Takashi Iwai
2023-07-13 10:01         ` Oswald Buddenhagen
2023-07-13 10:24           ` Takashi Iwai
2023-07-13 10:54             ` Oswald Buddenhagen
2023-07-13 11:56               ` Takashi Iwai
2023-07-13  5:58 ` [PATCH 1/3] ALSA: emu10k1: fix return value of snd_emu1010_adc_pads_put() Takashi Iwai

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=ZK+ymU7ynF0eRy8R@ugly \
    --to=oswald.buddenhagen@gmx.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=perex@perex.cz \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox