diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2024-09-23 12:55:27 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2024-09-23 12:55:27 -0700 |
commit | d7dfb07d4dacfc3d8fa553fe76f055724e2c7210 (patch) | |
tree | 93748e01de4518e4af8f540bd97f628bc5f96c91 /include | |
parent | 3a37872316c2e3288e09a1322221c83e5929768d (diff) | |
parent | f1cba5212e252243a539e079813bc96fbf53e241 (diff) |
Merge tag 'firewire-updates-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394
Pull firewire updates from Takashi Sakamoto:
"In the FireWire subsystem, tasklets have been used as the bottom half
of 1394 OHCi hardIRQ. In recent kernel updates, BH workqueues have
become available, and some developers have proposed replacing the
tasklet with a BH workqueue.
As a first step towards dropping tasklet use, the 1394 OHCI
isochronous context can use regular workqueues. In this context, the
batch of packets is processed in the specific queue, thus the timing
jitter caused by task scheduling is not so critical.
Additionally, DMA transmission can be scheduled per-packet basis,
therefore the context can be sleep between the operation of
transmissions. Furthermore, in-kernel protocol implementation involves
some CPU-bound tasks, which can sometimes consumes CPU time so long.
These characteristics suggest that normal workqueues are suitable,
through BH workqueues are not.
The replacement with a workqueue allows unit drivers to process the
content of packets in non-atomic context. It brings some reliefs to
some drivers in sound subsystem that spin-lock is not mandatory
anymore during isochronous packet processing.
Summary:
- Replace tasklet with workqueue for isochronous context
- Replace IDR with XArray
- Utilize guard macro where possible
- Print deprecation warning when enabling debug parameter of
firewire-ohci module
- Switch to nonatomic PCM operation"
* tag 'firewire-updates-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394: (55 commits)
firewire: core: rename cause flag of tracepoints event
firewire: core: update documentation of kernel APIs for flushing completions
firewire: core: add helper function to retire descriptors
Revert "firewire: core: move workqueue handler from 1394 OHCI driver to core function"
Revert "firewire: core: use mutex to coordinate concurrent calls to flush completions"
firewire: core: use mutex to coordinate concurrent calls to flush completions
firewire: core: move workqueue handler from 1394 OHCI driver to core function
firewire: core: fulfill documentation of fw_iso_context_flush_completions()
firewire: core: expose kernel API to schedule work item to process isochronous context
firewire: core: use WARN_ON_ONCE() to avoid superfluous dumps
ALSA: firewire: use nonatomic PCM operation
firewire: core: non-atomic memory allocation for isochronous event to user client
firewire: ohci: operate IT/IR events in sleepable work process instead of tasklet softIRQ
firewire: core: add local API to queue work item to workqueue specific to isochronous contexts
firewire: core: allocate workqueue to handle isochronous contexts in card
firewire: ohci: obsolete direct usage of printk_ratelimit()
firewire: ohci: deprecate debug parameter
firewire: core: update fw_device outside of device_find_child()
firewire: ohci: fix error path to detect initiated reset in TI TSB41BA3D phy
firewire: core/ohci: minor refactoring for computation of configuration ROM size
...
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/firewire.h | 22 | ||||
-rw-r--r-- | include/trace/events/firewire.h | 4 |
2 files changed, 24 insertions, 2 deletions
diff --git a/include/linux/firewire.h b/include/linux/firewire.h index 1cca14cf5652..b632eec3ab52 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h @@ -134,6 +134,8 @@ struct fw_card { __be32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4]; __be32 maint_utility_register; + + struct workqueue_struct *isoc_wq; }; static inline struct fw_card *fw_card_get(struct fw_card *card) @@ -509,6 +511,7 @@ union fw_iso_callback { struct fw_iso_context { struct fw_card *card; + struct work_struct work; int type; int channel; int speed; @@ -528,6 +531,25 @@ int fw_iso_context_queue(struct fw_iso_context *ctx, unsigned long payload); void fw_iso_context_queue_flush(struct fw_iso_context *ctx); int fw_iso_context_flush_completions(struct fw_iso_context *ctx); + +/** + * fw_iso_context_schedule_flush_completions() - schedule work item to process isochronous context. + * @ctx: the isochronous context + * + * Schedule a work item on workqueue to process the isochronous context. The registered callback + * function is called by the worker when a queued packet buffer with the interrupt flag is + * completed, either after transmission in the IT context or after being filled in the IR context. + * The callback function is also called when the header buffer in the context becomes full, If it + * is required to process the context in the current context, fw_iso_context_flush_completions() is + * available instead. + * + * Context: Any context. + */ +static inline void fw_iso_context_schedule_flush_completions(struct fw_iso_context *ctx) +{ + queue_work(ctx->card->isoc_wq, &ctx->work); +} + int fw_iso_context_start(struct fw_iso_context *ctx, int cycle, int sync, int tags); int fw_iso_context_stop(struct fw_iso_context *ctx); diff --git a/include/trace/events/firewire.h b/include/trace/events/firewire.h index b108176deb22..ad0e0cf82b9c 100644 --- a/include/trace/events/firewire.h +++ b/include/trace/events/firewire.h @@ -830,13 +830,13 @@ TRACE_EVENT_CONDITION(isoc_inbound_multiple_queue, #ifndef show_cause enum fw_iso_context_completions_cause { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH = 0, - FW_ISO_CONTEXT_COMPLETIONS_CAUSE_IRQ, + FW_ISO_CONTEXT_COMPLETIONS_CAUSE_INTERRUPT, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERFLOW, }; #define show_cause(cause) \ __print_symbolic(cause, \ { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH, "FLUSH" }, \ - { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_IRQ, "IRQ" }, \ + { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_INTERRUPT, "INTERRUPT" }, \ { FW_ISO_CONTEXT_COMPLETIONS_CAUSE_HEADER_OVERFLOW, "HEADER_OVERFLOW" } \ ) #endif |