All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH V2 3/3] selftests: ublk: add ublk zero copy test
Date: Wed, 26 Feb 2025 10:41:43 -0700	[thread overview]
Message-ID: <Z79SV8gD1hah9PVD@kbusch-mbp> (raw)
In-Reply-To: <20250226155841.2489284-4-ming.lei@redhat.com>

On Wed, Feb 26, 2025 at 11:58:38PM +0800, Ming Lei wrote:
> +	struct io_uring_sqe *reg;
> +	struct io_uring_sqe *rw;
> +	struct io_uring_sqe *ureg;
> +
> +	if (!zc) {
> +		rw = ublk_queue_alloc_sqe(q);
> +		if (!rw)
> +			return -ENOMEM;
> +
> +		io_uring_prep_rw(op, rw, 1 /*fds[1]*/,
> +				(void *)iod->addr,
> +				iod->nr_sectors << 9,
> +				iod->start_sector << 9);
> +		io_uring_sqe_set_flags(rw, IOSQE_FIXED_FILE);
> +		q->io_inflight++;
> +		/* bit63 marks us as tgt io */
> +		rw->user_data = build_user_data(tag, op, UBLK_IO_TGT_NORMAL, 1);
> +		return 0;
> +	}
> +
> +	ublk_queue_alloc_sqe3(q, &reg, &rw, &ureg);
> +
> +	io_uring_prep_buf_register(reg, 0, tag, q->q_id, tag);
> +	reg->user_data = build_user_data(tag, 0xfe, 1, 1);
> +	reg->flags |= IOSQE_CQE_SKIP_SUCCESS;
> +	reg->flags |= IOSQE_IO_LINK;
> +
> +	io_uring_prep_rw(op, rw, 1 /*fds[1]*/, 0,
> +		iod->nr_sectors << 9,
> +		iod->start_sector << 9);
> +	rw->buf_index = tag;
> +	rw->flags |= IOSQE_FIXED_FILE;
> +	rw->flags |= IOSQE_IO_LINK;
> +	rw->user_data = build_user_data(tag, op, UBLK_IO_TGT_ZC_OP, 1);
> +	q->io_inflight++;
> +
> +	io_uring_prep_buf_unregister(ureg, 0, tag, q->q_id, tag);
> +	ureg->user_data = build_user_data(tag, 0xff, UBLK_IO_TGT_ZC_BUF, 1);

You don't have anything handling the unregister command's completion so
I think you want the IOSQE_CQE_SKIP_SUCCESS flag on it otherwise you get
an unexpected CQE for it.

  reply	other threads:[~2025-02-26 17:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 15:58 [PATCH V2 0/3] selftests: add ublk selftests Ming Lei
2025-02-26 15:58 ` [PATCH V2 1/3] selftests: ublk: add kernel selftests for ublk Ming Lei
2025-02-26 15:58 ` [PATCH V2 2/3] selftests: ublk: add file backed ublk Ming Lei
2025-02-26 15:58 ` [PATCH V2 3/3] selftests: ublk: add ublk zero copy test Ming Lei
2025-02-26 17:41   ` Keith Busch [this message]
2025-02-27  0:25     ` Ming Lei

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=Z79SV8gD1hah9PVD@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=ming.lei@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.