public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH 1/1] io_uring: silence false positive warnings
@ 2025-01-07 14:11 Pavel Begunkov
  2025-01-07 14:31 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2025-01-07 14:11 UTC (permalink / raw)
  To: io-uring; +Cc: asml.silence, syzbot+1bcb75613069ad4957fc

If we kill a ring and then immediately exit the task, we'll get
cancellattion running by the task and a kthread in io_ring_exit_work.
For DEFER_TASKRUN, we do want to limit it to only one entity executing
it, however it's currently not an issue as it's protected by uring_lock.

Silence lockdep assertions for now, we'll return to it later.

Reported-by: [email protected]
Signed-off-by: Pavel Begunkov <[email protected]>
---
 io_uring/io_uring.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h
index 032758b28d78..f65e3f3ede51 100644
--- a/io_uring/io_uring.h
+++ b/io_uring/io_uring.h
@@ -127,6 +127,9 @@ static inline void io_lockdep_assert_cq_locked(struct io_ring_ctx *ctx)
 #if defined(CONFIG_PROVE_LOCKING)
 	lockdep_assert(in_task());
 
+	if (ctx->flags & IORING_SETUP_DEFER_TASKRUN)
+		lockdep_assert_held(&ctx->uring_lock);
+
 	if (ctx->flags & IORING_SETUP_IOPOLL) {
 		lockdep_assert_held(&ctx->uring_lock);
 	} else if (!ctx->task_complete) {
@@ -138,9 +141,7 @@ static inline void io_lockdep_assert_cq_locked(struct io_ring_ctx *ctx)
 		 * Not from an SQE, as those cannot be submitted, but via
 		 * updating tagged resources.
 		 */
-		if (percpu_ref_is_dying(&ctx->refs))
-			lockdep_assert(current_work());
-		else
+		if (!percpu_ref_is_dying(&ctx->refs))
 			lockdep_assert(current == ctx->submitter_task);
 	}
 #endif
-- 
2.47.1


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

* Re: [PATCH 1/1] io_uring: silence false positive warnings
  2025-01-07 14:11 [PATCH 1/1] io_uring: silence false positive warnings Pavel Begunkov
@ 2025-01-07 14:31 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2025-01-07 14:31 UTC (permalink / raw)
  To: io-uring, Pavel Begunkov; +Cc: syzbot+1bcb75613069ad4957fc


On Tue, 07 Jan 2025 14:11:32 +0000, Pavel Begunkov wrote:
> If we kill a ring and then immediately exit the task, we'll get
> cancellattion running by the task and a kthread in io_ring_exit_work.
> For DEFER_TASKRUN, we do want to limit it to only one entity executing
> it, however it's currently not an issue as it's protected by uring_lock.
> 
> Silence lockdep assertions for now, we'll return to it later.
> 
> [...]

Applied, thanks!

[1/1] io_uring: silence false positive warnings
      commit: 60495b08cf7a6920035c5172a22655ca2001270b

Best regards,
-- 
Jens Axboe




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

end of thread, other threads:[~2025-01-07 14:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-07 14:11 [PATCH 1/1] io_uring: silence false positive warnings Pavel Begunkov
2025-01-07 14:31 ` Jens Axboe

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