From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Takashi Iwai <tiwai@suse.de>
Cc: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org,
apais@linux.microsoft.com, edmund.raile@protonmail.com,
linux-media@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH 2/5] firewire: core: add local API to queue work item to workqueue specific to isochronous contexts
Date: Thu, 5 Sep 2024 17:07:11 +0900 [thread overview]
Message-ID: <20240905080711.GA486563@workstation.local> (raw)
In-Reply-To: <87y147h07b.wl-tiwai@suse.de>
Hi,
On Wed, Sep 04, 2024 at 06:07:20PM +0200, Takashi Iwai wrote:
> 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@sakamocchi.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 for your suggestion. Indeed, the kernel API would be called so
frequently, and the *_ONCE macro would be safer. I'll post another patch
for it, since posting updated series of changes to all of receivers is a
bit cumbersome to me...
Thanks
Takashi Sakamoto
next prev parent reply other threads:[~2024-09-05 8:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 12:51 [PATCH 0/5] firewire: use sleepable workqueue to handle 1394 OHCI IT/IR context events Takashi Sakamoto
2024-09-04 12:51 ` [PATCH 1/5] firewire: core: allocate workqueue to handle isochronous contexts in card Takashi Sakamoto
2024-09-04 12:51 ` [PATCH 2/5] firewire: core: add local API to queue work item to workqueue specific to isochronous contexts Takashi Sakamoto
2024-09-04 16:07 ` Takashi Iwai
2024-09-05 8:07 ` Takashi Sakamoto [this message]
2024-09-04 12:51 ` [PATCH 3/5] firewire: ohci: operate IT/IR events in sleepable work process instead of tasklet softIRQ Takashi Sakamoto
2024-09-04 12:51 ` [PATCH 4/5] firewire: core: non-atomic memory allocation for isochronous event to user client Takashi Sakamoto
2024-09-04 12:51 ` [PATCH 5/5] ALSA: firewire: use nonatomic PCM operation Takashi Sakamoto
2024-09-04 16:07 ` Takashi Iwai
2024-09-05 8:08 ` Takashi Sakamoto
2024-09-05 8:33 ` [PATCH 0/5] firewire: use sleepable workqueue to handle 1394 OHCI IT/IR context events Takashi Sakamoto
2024-09-12 21:44 ` firewire: use sleepable workqueue to handle 1394 OHCI IT/IR context events: test 2 Edmund Raile
2024-09-13 9:38 ` Takashi Sakamoto
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=20240905080711.GA486563@workstation.local \
--to=o-takashi@sakamocchi.jp \
--cc=apais@linux.microsoft.com \
--cc=edmund.raile@protonmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.