All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH liburing 0/2] passthrough test fix and cleanup
       [not found] <CGME20221206123005epcas5p474a1374f850c47f2c9af5ef8c8cc6509@epcas5p4.samsung.com>
@ 2022-12-06 12:18 ` Kanchan Joshi
       [not found]   ` <CGME20221206123009epcas5p4d65eca3320f9845e190fc425a06799a6@epcas5p4.samsung.com>
                     ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kanchan Joshi @ 2022-12-06 12:18 UTC (permalink / raw)
  To: axboe; +Cc: io-uring, Kanchan Joshi

Hi Jens,

This series does a fix in test/io_uring_passthrough.c and a minor
cleanup too.
Please take a look.

Kanchan Joshi (2):
  test/io_uring_passthrough: fix iopoll test
  test/io_uring_passthrough: cleanup invalid submission test

 test/io_uring_passthrough.c | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

-- 
2.25.1


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

* [PATCH liburing 1/2] test/io_uring_passthrough: fix iopoll test
       [not found]   ` <CGME20221206123009epcas5p4d65eca3320f9845e190fc425a06799a6@epcas5p4.samsung.com>
@ 2022-12-06 12:18     ` Kanchan Joshi
  0 siblings, 0 replies; 4+ messages in thread
From: Kanchan Joshi @ 2022-12-06 12:18 UTC (permalink / raw)
  To: axboe; +Cc: io-uring, Kanchan Joshi

iopoll test is broken as it does not initialize the command/sqe properly
before submission.
Add the necessary initialization to set this right.

Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
---
 test/io_uring_passthrough.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/test/io_uring_passthrough.c b/test/io_uring_passthrough.c
index 9c71586..b58feae 100644
--- a/test/io_uring_passthrough.c
+++ b/test/io_uring_passthrough.c
@@ -350,6 +350,8 @@ static int test_io_uring_submit_enters(const char *file)
 	int fd, i, ret, ring_flags, open_flags;
 	unsigned head;
 	struct io_uring_cqe *cqe;
+	struct nvme_uring_cmd *cmd;
+	struct io_uring_sqe *sqe;
 
 	ring_flags = IORING_SETUP_IOPOLL;
 	ring_flags |= IORING_SETUP_SQE128;
@@ -369,12 +371,28 @@ static int test_io_uring_submit_enters(const char *file)
 	}
 
 	for (i = 0; i < BUFFERS; i++) {
-		struct io_uring_sqe *sqe;
 		off_t offset = BS * (rand() % BUFFERS);
+		__u64 slba;
+		__u32 nlb;
 
 		sqe = io_uring_get_sqe(&ring);
-		io_uring_prep_writev(sqe, fd, &vecs[i], 1, offset);
-		sqe->user_data = 1;
+		io_uring_prep_readv(sqe, fd, &vecs[i], 1, offset);
+		sqe->user_data = i;
+		sqe->opcode = IORING_OP_URING_CMD;
+		sqe->cmd_op = NVME_URING_CMD_IO;
+		cmd = (struct nvme_uring_cmd *)sqe->cmd;
+		memset(cmd, 0, sizeof(struct nvme_uring_cmd));
+
+		slba = offset >> lba_shift;
+		nlb = (BS >> lba_shift) - 1;
+
+		cmd->opcode = nvme_cmd_read;
+		cmd->cdw10 = slba & 0xffffffff;
+		cmd->cdw11 = slba >> 32;
+		cmd->cdw12 = nlb;
+		cmd->addr = (__u64)(uintptr_t)&vecs[i];
+		cmd->data_len = 1;
+		cmd->nsid = nsid;
 	}
 
 	/* submit manually to avoid adding IORING_ENTER_GETEVENTS */
-- 
2.25.1


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

* [PATCH liburing 2/2] test/io_uring_passthrough: cleanup invalid submission test
       [not found]   ` <CGME20221206123012epcas5p33de3600bbc6effa8e2a08f748cb0eee4@epcas5p3.samsung.com>
@ 2022-12-06 12:18     ` Kanchan Joshi
  0 siblings, 0 replies; 4+ messages in thread
From: Kanchan Joshi @ 2022-12-06 12:18 UTC (permalink / raw)
  To: axboe; +Cc: io-uring, Kanchan Joshi

Just do away with setting IOPOLL as this is not necessary for the test.

Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
---
 test/io_uring_passthrough.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/test/io_uring_passthrough.c b/test/io_uring_passthrough.c
index b58feae..7efdba1 100644
--- a/test/io_uring_passthrough.c
+++ b/test/io_uring_passthrough.c
@@ -286,8 +286,7 @@ static int test_invalid_passthru_submit(const char *file)
 	struct io_uring_sqe *sqe;
 	struct nvme_uring_cmd *cmd;
 
-	ring_flags = IORING_SETUP_IOPOLL | IORING_SETUP_SQE128;
-	ring_flags |= IORING_SETUP_CQE32;
+	ring_flags = IORING_SETUP_CQE32 | IORING_SETUP_SQE128;
 
 	ret = t_create_ring(1, &ring, ring_flags);
 	if (ret != T_SETUP_OK) {
-- 
2.25.1


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

* Re: [PATCH liburing 0/2] passthrough test fix and cleanup
  2022-12-06 12:18 ` [PATCH liburing 0/2] passthrough test fix and cleanup Kanchan Joshi
       [not found]   ` <CGME20221206123009epcas5p4d65eca3320f9845e190fc425a06799a6@epcas5p4.samsung.com>
       [not found]   ` <CGME20221206123012epcas5p33de3600bbc6effa8e2a08f748cb0eee4@epcas5p3.samsung.com>
@ 2022-12-06 17:19   ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2022-12-06 17:19 UTC (permalink / raw)
  To: Kanchan Joshi; +Cc: io-uring


On Tue, 06 Dec 2022 17:48:29 +0530, Kanchan Joshi wrote:
> This series does a fix in test/io_uring_passthrough.c and a minor
> cleanup too.
> Please take a look.
> 
> Kanchan Joshi (2):
>   test/io_uring_passthrough: fix iopoll test
>   test/io_uring_passthrough: cleanup invalid submission test
> 
> [...]

Applied, thanks!

[1/2] test/io_uring_passthrough: fix iopoll test
      commit: 6e86d14a0a88e41c442a4a9c37effc55ac00d2ff
[2/2] test/io_uring_passthrough: cleanup invalid submission test
      commit: 29ec9d9fd3262034e4dce32cb75c0faaad158d1c

Best regards,
-- 
Jens Axboe



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

end of thread, other threads:[~2022-12-06 17:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20221206123005epcas5p474a1374f850c47f2c9af5ef8c8cc6509@epcas5p4.samsung.com>
2022-12-06 12:18 ` [PATCH liburing 0/2] passthrough test fix and cleanup Kanchan Joshi
     [not found]   ` <CGME20221206123009epcas5p4d65eca3320f9845e190fc425a06799a6@epcas5p4.samsung.com>
2022-12-06 12:18     ` [PATCH liburing 1/2] test/io_uring_passthrough: fix iopoll test Kanchan Joshi
     [not found]   ` <CGME20221206123012epcas5p33de3600bbc6effa8e2a08f748cb0eee4@epcas5p3.samsung.com>
2022-12-06 12:18     ` [PATCH liburing 2/2] test/io_uring_passthrough: cleanup invalid submission test Kanchan Joshi
2022-12-06 17:19   ` [PATCH liburing 0/2] passthrough test fix and cleanup Jens Axboe

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.