public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ivan Orlov <ivan.orlov0322@gmail.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: tiwai@suse.com, perex@perex.cz, linux-sound@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ALSA: pcmtest: stop timer in the hw_free callback
Date: Wed, 6 Dec 2023 20:03:58 +0000	[thread overview]
Message-ID: <d2534c1b-b654-42a3-9edb-3041ed6bfe01@gmail.com> (raw)
In-Reply-To: <871qbz2rn9.wl-tiwai@suse.de>

On 12/6/23 16:59, Takashi Iwai wrote:
> On Wed, 06 Dec 2023 16:10:46 +0100,
> Ivan Orlov wrote:
>>
>> Stop timer in the 'hw_free' callback instead of the 'close' callback
>> since we want the timer to be stopped before the DMA buffer is released.
>> Otherwise, it could trigger a kernel panic in some circumstances, for
>> instance when the DMA buffer is already released but the timer callback
>> is still running.
> 
> You can't call timer_shutdown_sync() at hw_free.  The PCM stream is
> still there and you can re-setup via hw_params without closing.  But,
> after timer_shutdown_sync(), the timer instance must not be used any
> longer.
> 
> A more proper way would be to call timer_delete() (no sync) at trigger
> STOP, then call timer_delete_sync() at sync_stop op in addition.  This
> assures the immediate stop and the sync before changing to another PCM
> state.
> 
> timer_shutdown_sync() can be kept at the close op to be sure.
> 
> 
> thanks,
> 
> Takashi
> 

Hi Takashi,

Thanks a lot for the review, sounds reasonable, I'll make suggested 
changes and send the version 3 :)

--
Kind regards,
Ivan Orlov


      reply	other threads:[~2023-12-06 20:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06 15:10 [PATCH v2] ALSA: pcmtest: stop timer in the hw_free callback Ivan Orlov
2023-12-06 16:59 ` Takashi Iwai
2023-12-06 20:03   ` Ivan Orlov [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=d2534c1b-b654-42a3-9edb-3041ed6bfe01@gmail.com \
    --to=ivan.orlov0322@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --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