Skip to contentSkip to conversation

passthrough test fix and cleanup

PATCH Applied Kanchan Joshi 2 participants 4 messages Dec 6, 2022 1 message not in the archive io_uring

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20221206123005epcas5p474a1374f850c47f2c9af5ef8c8cc6509@epcas5p4.samsung.com

#1 lore raw

cover passthrough test fix and cleanup

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(-)
Signature · 1 line
2.25.1
#2 lore raw

PATCH 1/2 test/io_uring_passthrough: fix iopoll test

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

---
 test/io_uring_passthrough.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)
test/io_uring_passthrough.c +21 -3
index 9c71586..b58feae 100644
@@ -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 */
Signature · 1 line
2.25.1
#3 lore raw

PATCH 2/2 test/io_uring_passthrough: cleanup invalid submission test

In reply to Kanchan Joshi

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

---
 test/io_uring_passthrough.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
test/io_uring_passthrough.c +1 -2
index b58feae..7efdba1 100644
@@ -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) {
Signature · 1 line
2.25.1
maintainer Applied
#4 lore raw
In reply to Kanchan Joshi
Quoted 9 lines · Kanchan Joshi

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,

Signature · 1 line
Jens Axboe