[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87y147h07b.wl-tiwai@suse.de>
Date: Wed, 04 Sep 2024 18:07:20 +0200
From: Takashi Iwai <tiwai@...e.de>
To: Takashi Sakamoto <o-takashi@...amocchi.jp>
Cc: tiwai@...e.de,
linux-kernel@...r.kernel.org,
linux-sound@...r.kernel.org,
apais@...ux.microsoft.com,
edmund.raile@...tonmail.com,
linux-media@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH 2/5] firewire: core: add local API to queue work item to workqueue specific to isochronous contexts
On Wed, 04 Sep 2024 14:51:51 +0200,
Takashi Sakamoto wrote:
>
> In the previous commit, the workqueue is added per the instance of fw_card
> structure for isochronous contexts. The workqueue is designed to be used by
> the implementation of fw_card_driver structure underlying the fw_card.
>
> This commit adds some local APIs to be used by the implementation.
>
> Signed-off-by: Takashi Sakamoto <o-takashi@...amocchi.jp>
> ---
> drivers/firewire/core-iso.c | 30 ++++++++++++++++++++++++++++--
> drivers/firewire/core.h | 10 ++++++++++
> include/linux/firewire.h | 1 +
> 3 files changed, 39 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/firewire/core-iso.c b/drivers/firewire/core-iso.c
> index 101433b8bb51..af76fa1823f1 100644
> --- a/drivers/firewire/core-iso.c
> +++ b/drivers/firewire/core-iso.c
> @@ -211,21 +211,47 @@ EXPORT_SYMBOL(fw_iso_context_queue_flush);
>
> int fw_iso_context_flush_completions(struct fw_iso_context *ctx)
> {
> + int err;
> +
> trace_isoc_outbound_flush_completions(ctx);
> trace_isoc_inbound_single_flush_completions(ctx);
> trace_isoc_inbound_multiple_flush_completions(ctx);
>
> - return ctx->card->driver->flush_iso_completions(ctx);
> + might_sleep();
> +
> + // Avoid dead lock due to programming mistake.
> + if (WARN_ON(current_work() == &ctx->work))
> + return 0;
Maybe WARN_ON_ONCE() would be safer if it's supposed to be called
frequently. Otherwise it can spam too much.
Ditto for fw_iso_context_stop().
thanks,
Takashi
Powered by blists - more mailing lists