From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, Clemens Ladisch <clemens@ladisch.de>
Subject: Re: [PATCH 10/11] ALSA: firewire: Replace tasklet with work
Date: Sun, 6 Sep 2020 17:26:28 +0900 [thread overview]
Message-ID: <20200906082628.GA74660@workstation> (raw)
In-Reply-To: <20200903104131.21097-11-tiwai@suse.de>
Hi,
On Thu, Sep 03, 2020 at 12:41:30PM +0200, Takashi Iwai wrote:
> The tasklet is an old API that should be deprecated, usually can be
> converted to another decent API. In FireWire driver, a tasklet is
> still used for offloading the AMDTP PCM stream handling. It can be
> achieved gracefully with a work queued, too.
>
> This patch replaces the tasklet usage in firewire-lib driver with a
> simple work. The conversion is fairly straightforward but for the
> in_interrupt() checks that are replaced with the check using the
> current_work().
>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
> sound/firewire/amdtp-stream-trace.h | 2 +-
> sound/firewire/amdtp-stream.c | 25 +++++++++++++------------
> sound/firewire/amdtp-stream.h | 2 +-
> 3 files changed, 15 insertions(+), 14 deletions(-)
After testing this patch, I agree with the usage of
'(current_work() == &s->period_work)' as an alternative of 'in_interrupt()'.
However, the usage is not appropriate for tracepoints event in the case.
> diff --git a/sound/firewire/amdtp-stream-trace.h b/sound/firewire/amdtp-stream-trace.h
> index 26e7cb555d3c..5386d548cada 100644
> --- a/sound/firewire/amdtp-stream-trace.h
> +++ b/sound/firewire/amdtp-stream-trace.h
> @@ -49,7 +49,7 @@ TRACE_EVENT(amdtp_packet,
> __entry->data_blocks = data_blocks;
> __entry->data_block_counter = data_block_counter,
> __entry->packet_index = s->packet_index;
> - __entry->irq = !!in_interrupt();
> + __entry->irq = (current_work() == &s->period_work);
> __entry->index = index;
> ),
> TP_printk(
The tracepoints event is probed in two contexts:
* softirq for isochronous context to process hardware events of 1394 OHCI.
* user task of ALSA PCM applications.
However, it's not probed in the workqueue task since the case is already
avoided carefully in below patch:
> @@ -1184,7 +1185,7 @@ unsigned long amdtp_domain_stream_pcm_pointer(struct amdtp_domain *d,
>
> if (irq_target && amdtp_stream_running(irq_target)) {
> // This function is called in software IRQ context of
> - // period_tasklet or process context.
> + // period_work or process context.
> //
> // When the software IRQ context was scheduled by software IRQ
> // context of IT contexts, queued packets were already handled.
> @@ -1195,9 +1196,9 @@ unsigned long amdtp_domain_stream_pcm_pointer(struct amdtp_domain *d,
> // immediately to keep better granularity of PCM pointer.
> //
> // Later, the process context will sometimes schedules software
> - // IRQ context of the period_tasklet. Then, no need to flush the
> + // IRQ context of the period_work. Then, no need to flush the
> // queue by the same reason as described in the above
> - if (!in_interrupt()) {
> + if (current_work() != &s->period_work) {
> // Queued packet should be processed without any kernel
> // preemption to keep latency against bus cycle.
> preempt_disable();
as long as testing, I can see no logs for the trancepoints event with the 'irq' field is 1.
I would like you to leave 'amdtp-stream-trace.h' as is by dropping the above change since
the irq field should record whether the context is softirq or user task.
Thanks
Takashi Sakamoto
next prev parent reply other threads:[~2020-09-06 8:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-03 10:41 [PATCH 00/11] ALSA: Kill tasklet usage Takashi Iwai
2020-09-03 10:41 ` [PATCH 01/11] ALSA: pcsp: Replace tasklet with work Takashi Iwai
2020-09-03 10:41 ` [PATCH 02/11] ALSA: timer: " Takashi Iwai
2020-09-03 10:41 ` [PATCH 03/11] ALSA: usb-audio: " Takashi Iwai
2020-09-03 10:41 ` [PATCH 04/11] ALSA: ua101: " Takashi Iwai
2020-09-03 10:41 ` [PATCH 05/11] ALSA: aloop: " Takashi Iwai
2020-09-03 10:41 ` [PATCH 06/11] ALSA: hdsp: " Takashi Iwai
2020-09-03 10:41 ` [PATCH 07/11] ALSA: hdspm: " Takashi Iwai
2020-09-03 10:41 ` [PATCH 08/11] ALSA: riptide: Replace tasklet with threaded irq Takashi Iwai
2020-09-03 10:41 ` [PATCH 09/11] ALSA: asihpi: " Takashi Iwai
2020-09-03 10:41 ` [PATCH 10/11] ALSA: firewire: Replace tasklet with work Takashi Iwai
2020-09-06 8:26 ` Takashi Sakamoto [this message]
2020-09-07 8:34 ` Takashi Iwai
2020-09-03 10:41 ` [PATCH 11/11] ALSA: mixart: Correct comment wrt obsoleted tasklet usage 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=20200906082628.GA74660@workstation \
--to=o-takashi@sakamocchi.jp \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--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.