public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Keith Busch <kbusch@meta.com>,
	csander@purestorage.com, io-uring <io-uring@vger.kernel.org>
Cc: Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCHv5 2/4] Add support IORING_SETUP_SQE_MIXED
Date: Tue, 21 Oct 2025 16:08:00 -0600	[thread overview]
Message-ID: <86b62f75-835e-4634-8b56-ab716d17569f@kernel.dk> (raw)
In-Reply-To: <20251021213329.784558-3-kbusch@meta.com>

(Adding right list)

On 10/21/25 3:33 PM, Keith Busch wrote:
> +/*
> + * Return a 128B sqe to fill. Applications must later call io_uring_submit()
> + * when it's ready to tell the kernel about it. The caller may call this
> + * function multiple times before calling io_uring_submit().
> + *
> + * Returns a vacant 128B sqe, or NULL if we're full. If the current tail is the
> + * last entry in the ring, this function will insert a nop + skip complete such
> + * that the 128b entry wraps back to the beginning of the queue for a
> + * contiguous big sq entry. It's up to the caller to use a 128b opcode in order
> + * for the kernel to know how to advance its sq head pointer.
> + */
> +IOURINGINLINE struct io_uring_sqe *io_uring_get_sqe128_mixed(struct io_uring *ring)
> +	LIBURING_NOEXCEPT
> +{

I would probably just name this io_uring_get_sqe128() and have it work
for both MIXED and SQE128. That would make for a cleaner API for the
application.

> +	struct io_uring_sq *sq = &ring->sq;
> +	unsigned head = io_uring_load_sq_head(ring), tail = sq->sqe_tail;
> +	struct io_uring_sqe *sqe;
> +
> +	if (!(ring->flags & IORING_SETUP_SQE_MIXED))
> +		return NULL;
> +
> +	if (((tail + 1) & sq->ring_mask) == 0) {
> +		if ((tail + 2) - head >= sq->ring_entries)
> +			return NULL;
> +
> +		sqe = _io_uring_get_sqe(ring);
> +		io_uring_prep_nop(sqe);
> +		sqe->flags |= IOSQE_CQE_SKIP_SUCCESS;
> +		tail = sq->sqe_tail;
> +	} else if ((tail + 1) - head >= sq->ring_entries) {
> +		return NULL;
> +	}
> +
> +	sqe = &sq->sqes[tail & sq->ring_mask];
> +	sq->sqe_tail = tail + 2;
> +	io_uring_initialize_sqe(sqe);
> +
> +	return sqe;
> +}

Spurious newline before turn, just group them.

-- 
Jens Axboe

       reply	other threads:[~2025-10-21 22:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20251021213329.784558-1-kbusch@meta.com>
     [not found] ` <20251021213329.784558-3-kbusch@meta.com>
2025-10-21 22:08   ` Jens Axboe [this message]
     [not found] ` <20251021213329.784558-5-kbusch@meta.com>
2025-10-21 22:09   ` [PATCHv5 4/4] Add mixed sqe test for uring commands Jens Axboe
2025-10-13 18:00 [PATCHv5 0/4] liburing: support for mix sized sqe's Keith Busch
2025-10-13 18:00 ` [PATCHv5 2/4] Add support IORING_SETUP_SQE_MIXED Keith Busch

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=86b62f75-835e-4634-8b56-ab716d17569f@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=csander@purestorage.com \
    --cc=io-uring@vger.kernel.org \
    --cc=kbusch@kernel.org \
    --cc=kbusch@meta.com \
    /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