public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: io-uring@vger.kernel.org, asml.silence@gmail.com,
	naup96721@gmail.com, stable@vger.kernel.org
Subject: Re: [PATCH 1/2] io_uring: ensure ctx->rings is stable for task work flags manipulation
Date: Wed, 11 Mar 2026 09:06:36 -0600	[thread overview]
Message-ID: <abGE_CLo4vW_-Tkh@kbusch-mbp> (raw)
In-Reply-To: <20260311131336.197028-2-axboe@kernel.dk>

On Wed, Mar 11, 2026 at 07:11:55AM -0600, Jens Axboe wrote:
> +/*
> + * Sets IORING_SQ_TASKRUN in the sq_flags shared with userspace, using the
> + * RCU protected rings pointer to be safe against concurrent ring resizing.
> + * Must be called inside an RCU read-side critical section.

You can make the rcu requirement explicit in the code with:

	ASSERT(rcu_read_lock_held());

And debug kernels will catch misuse, too.

> + */
> +static void io_ctx_mark_taskrun(struct io_ring_ctx *ctx)
> +{
> +	if (ctx->flags & IORING_SETUP_TASKRUN_FLAG) {
> +		struct io_rings *rings = rcu_dereference(ctx->rings_rcu);
> +
> +		atomic_or(IORING_SQ_TASKRUN, &rings->sq_flags);
> +	}
> +}

  reply	other threads:[~2026-03-11 15:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11 13:11 [PATCHSET v2] Fix DEFER_TASKRUN ring resize flag manipulation Jens Axboe
2026-03-11 13:11 ` [PATCH 1/2] io_uring: ensure ctx->rings is stable for task work flags manipulation Jens Axboe
2026-03-11 15:06   ` Keith Busch [this message]
2026-03-11 15:12     ` Jens Axboe
2026-03-11 13:11 ` [PATCH 2/2] io_uring/eventfd: use ctx->rings_rcu for flags checking Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2026-03-10 14:45 [PATCHSET 0/2] Fix DEFER_TASKRUN ring resize flag manipulation Jens Axboe
2026-03-10 14:45 ` [PATCH 1/2] io_uring: ensure ctx->rings is stable for task work flags manipulation Jens Axboe
2026-03-11 11:13   ` Pavel Begunkov
2026-03-11 13:05     ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=abGE_CLo4vW_-Tkh@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=naup96721@gmail.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox