[PATCH 0/3] firewire: core: serialize topology building and bus manager work

Takashi Sakamoto posted 3 patches 2 weeks, 1 day ago
drivers/firewire/core-card.c     | 30 ++++++++----------------------
drivers/firewire/core-topology.c | 11 ++++++++++-
2 files changed, 18 insertions(+), 23 deletions(-)
[PATCH 0/3] firewire: core: serialize topology building and bus manager work
Posted by Takashi Sakamoto 2 weeks, 1 day ago
Hi,

Two functions, fw_core_handle_bus_reset() and bm_work(), acquire fw_card
spin lock, however each purpose is different.  The former function manages
to update some members of fw_card, and the latter function manages just to
access these members of fw_card. This reflects that the members are valid
during current bus generation once determined by the former function.

Current implementation schedules a work item for the latter function under
acquiring the spin lock in the former function. This could causes the
latter function to be stalled by spinning until the former function
finishes, depending on the timing to invoke the work item.

This patchset suppresses the stalling by serializing these two
functions. In former commits, the former function is invoked by IRQ
thread, thus sleep-able. The former function disables the work item
synchronously, then acquires the spin lock to update the members of
fw_card. After that, it releases the spin lock, then enable and schedule
the work item. The latter function is free from the spin lock.

Takashi Sakamoto (3):
  firewire: core: schedule bm_work item outside of spin lock
  firewire: core: disable bus management work temporarily during
    updating topology
  firewire: core: shrink critical section of fw_card spinlock in bm_work

 drivers/firewire/core-card.c     | 30 ++++++++----------------------
 drivers/firewire/core-topology.c | 11 ++++++++++-
 2 files changed, 18 insertions(+), 23 deletions(-)


base-commit: e0cda0dd12e08ecb8d26b8d78dc63e67e7069510
-- 
2.48.1
Re: [PATCH 0/3] firewire: core: serialize topology building and bus manager work
Posted by Takashi Sakamoto 2 weeks ago
On Wed, Sep 17, 2025 at 09:03:44AM +0900, Takashi Sakamoto wrote:
> Hi,
> 
> Two functions, fw_core_handle_bus_reset() and bm_work(), acquire fw_card
> spin lock, however each purpose is different.  The former function manages
> to update some members of fw_card, and the latter function manages just to
> access these members of fw_card. This reflects that the members are valid
> during current bus generation once determined by the former function.
> 
> Current implementation schedules a work item for the latter function under
> acquiring the spin lock in the former function. This could causes the
> latter function to be stalled by spinning until the former function
> finishes, depending on the timing to invoke the work item.
> 
> This patchset suppresses the stalling by serializing these two
> functions. In former commits, the former function is invoked by IRQ
> thread, thus sleep-able. The former function disables the work item
> synchronously, then acquires the spin lock to update the members of
> fw_card. After that, it releases the spin lock, then enable and schedule
> the work item. The latter function is free from the spin lock.
> 
> Takashi Sakamoto (3):
>   firewire: core: schedule bm_work item outside of spin lock
>   firewire: core: disable bus management work temporarily during
>     updating topology
>   firewire: core: shrink critical section of fw_card spinlock in bm_work
> 
>  drivers/firewire/core-card.c     | 30 ++++++++----------------------
>  drivers/firewire/core-topology.c | 11 ++++++++++-
>  2 files changed, 18 insertions(+), 23 deletions(-)

Applied to for-next branch.


Regards

Takashi Sakamoto