firewire: core: schedule bm_work item outside of spin lock
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Wed, 17 Sep 2025 00:03:45 +0000 (09:03 +0900)
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>
Wed, 17 Sep 2025 00:07:03 +0000 (09:07 +0900)
Before (re)building topology tree, fw_core_handle_bus_reset() schedules
a work item under acquiring fw_card spin lock. The work item invokes
bm_work() which acquires the spin lock at first, then can be stalled to
wait until the building tree finishes. This is inconvenient.

This commit moves the timing to schedule the work item after releasing
the spin lock.

Link: https://lore.kernel.org/r/20250917000347.52369-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
drivers/firewire/core-topology.c

index 8fa0772..2f73bcd 100644 (file)
@@ -479,7 +479,6 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation,
                card->reset_jiffies = get_jiffies_64();
                card->bm_node_id  = 0xffff;
                card->bm_abdicate = bm_abdicate;
-               fw_schedule_bm_work(card, 0);
 
                local_node = build_tree(card, self_ids, self_id_count, generation);
 
@@ -496,6 +495,8 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation,
                }
        }
 
+       fw_schedule_bm_work(card, 0);
+
        // Just used by transaction layer.
        scoped_guard(spinlock, &card->topology_map.lock) {
                update_topology_map(card->topology_map.buffer, sizeof(card->topology_map.buffer),