mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] firewire: core: misc fixes
@ 2026-10-19 12:25 Takashi Sakamoto
  2026-10-19 12:25 ` [PATCH 1/2] firewire: core: adjust context_unsafe() usage for lockdep checks Takashi Sakamoto
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Takashi Sakamoto @ 2026-10-19 12:25 UTC (permalink / raw)
  To: linux1394-devel; +Cc: linux-kernel

Hi,

This series fixes a few bugs introduced by recent changes.

Takashi Sakamoto (2):
  firewire: core: adjust context_unsafe() usage for lockdep checks
  firewire: core: replace drain_workqueue() with flush_workqueue()

 drivers/firewire/core-card.c        | 4 ++--
 drivers/firewire/core-transaction.c | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)


base-commit: 9a513d9f68461294a6a615986becf619b9549f37
-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] firewire: core: adjust context_unsafe() usage for lockdep checks
  2026-10-19 12:25 [PATCH 0/2] firewire: core: misc fixes Takashi Sakamoto
@ 2026-10-19 12:25 ` Takashi Sakamoto
  2026-10-19 12:25 ` [PATCH 2/2] firewire: core: replace drain_workqueue() with flush_workqueue() Takashi Sakamoto
  2026-10-20  1:47 ` [PATCH 0/2] firewire: core: misc fixes Takashi Sakamoto
  2 siblings, 0 replies; 4+ messages in thread
From: Takashi Sakamoto @ 2026-10-19 12:25 UTC (permalink / raw)
  To: linux1394-devel; +Cc: linux-kernel

schedule_error_callback() requires a lock to be held by the caller.
However, __fw_send_request() calls the function without holding any lock
when retrieving the transaction label fails, as no lock is needed in
this case. context_safe() is used to suppress the precondition check in
compiler-based context analysis, but it does not affect lockdep checks.
As a result, lockdep reports a violation of the precondition.

Acquire the lock before calling the function instead of using
context_unsafe().

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 drivers/firewire/core-transaction.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index e24fb6b97770..0ebe70a4d440 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -438,7 +438,8 @@ __must_not_hold(&card->transactions.lock)
 		tstamp = cycle_time_to_ohci_tstamp(curr_cycle_time);
 
 		t->packet.timestamp = tstamp;
-		context_unsafe(schedule_error_callback(card, t, RCODE_SEND_ERROR, tstamp));
+		scoped_guard(spinlock_irqsave, &card->transactions.lock)
+			schedule_error_callback(card, t, RCODE_SEND_ERROR, tstamp);
 
 		return;
 	}
-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] firewire: core: replace drain_workqueue() with flush_workqueue()
  2026-10-19 12:25 [PATCH 0/2] firewire: core: misc fixes Takashi Sakamoto
  2026-10-19 12:25 ` [PATCH 1/2] firewire: core: adjust context_unsafe() usage for lockdep checks Takashi Sakamoto
@ 2026-10-19 12:25 ` Takashi Sakamoto
  2026-10-20  1:47 ` [PATCH 0/2] firewire: core: misc fixes Takashi Sakamoto
  2 siblings, 0 replies; 4+ messages in thread
From: Takashi Sakamoto @ 2026-10-19 12:25 UTC (permalink / raw)
  To: linux1394-devel; +Cc: linux-kernel

drain_workqueue() allows only chained work to be queued while draining.
This is inconvenient because work can be queued from contexts other than
work items already executing on the workqueue.

Use flush_workqueue() instead to allow work to be queued from any
context.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 drivers/firewire/core-card.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c
index b4d40dc7720f..b35e8901cc4b 100644
--- a/drivers/firewire/core-card.c
+++ b/drivers/firewire/core-card.c
@@ -841,8 +841,8 @@ void fw_core_remove_card(struct fw_card *card)
 	// Ensure the entire contents of the driver are visible to other CPUs.
 	smp_store_release(&card->driver, &closer.driver);
 
-	drain_workqueue(card->isoc_wq);
-	drain_workqueue(card->async_wq);
+	flush_workqueue(card->isoc_wq);
+	flush_workqueue(card->async_wq);
 	card->driver->disable(card);
 
 	scoped_guard(spinlock_irqsave, &card->transactions.lock)
-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] firewire: core: misc fixes
  2026-10-19 12:25 [PATCH 0/2] firewire: core: misc fixes Takashi Sakamoto
  2026-10-19 12:25 ` [PATCH 1/2] firewire: core: adjust context_unsafe() usage for lockdep checks Takashi Sakamoto
  2026-10-19 12:25 ` [PATCH 2/2] firewire: core: replace drain_workqueue() with flush_workqueue() Takashi Sakamoto
@ 2026-10-20  1:47 ` Takashi Sakamoto
  2 siblings, 0 replies; 4+ messages in thread
From: Takashi Sakamoto @ 2026-10-20  1:47 UTC (permalink / raw)
  To: linux1394-devel; +Cc: linux-kernel

On Mon, Oct 19, 2026 at 09:25:53PM +0900, Takashi Sakamoto wrote:
> Hi,
> 
> This series fixes a few bugs introduced by recent changes.
> 
> Takashi Sakamoto (2):
>   firewire: core: adjust context_unsafe() usage for lockdep checks
>   firewire: core: replace drain_workqueue() with flush_workqueue()
> 
>  drivers/firewire/core-card.c        | 4 ++--
>  drivers/firewire/core-transaction.c | 3 ++-
>  2 files changed, 4 insertions(+), 3 deletions(-)

Applied to for-next branch.


Regards

Takashi Sakamoto

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-20  1:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-19 12:25 [PATCH 0/2] firewire: core: misc fixes Takashi Sakamoto
2026-10-19 12:25 ` [PATCH 1/2] firewire: core: adjust context_unsafe() usage for lockdep checks Takashi Sakamoto
2026-10-19 12:25 ` [PATCH 2/2] firewire: core: replace drain_workqueue() with flush_workqueue() Takashi Sakamoto
2026-10-20  1:47 ` [PATCH 0/2] firewire: core: misc fixes Takashi Sakamoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®