Revert "sock/uring: use batched manner to get the cqes."
This reverts commit 79215d80c1
.
Reason: Find the bugs while using batched. For example, if
we fetch 3 CQEs, A, B, C and put it in a cqes[] array.
Then we leverage io uring cqe seen to handle, Then we handle the
CQE A, then invokes the call back related with A. In A's call back,
it may also call the reap function (sock_uring_group_reap),
then the CQEs will be handled again. Thus the CQEs B and C can be already
handled. Then we will handle B or C again, then it triggers the error.
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I67ece3b24e677b88d66d08722b00539693b42e1e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2543
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
821824888b
commit
59e44bcbb3
@ -884,18 +884,23 @@ static int
|
||||
sock_uring_group_reap(struct spdk_uring_sock_group_impl *group, int max, int max_read_events,
|
||||
struct spdk_sock **socks)
|
||||
{
|
||||
int count, i, completed_cqe_num;
|
||||
struct io_uring_cqe *cqes[SPDK_SOCK_GROUP_QUEUE_DEPTH];
|
||||
int i, count, ret;
|
||||
struct io_uring_cqe *cqe;
|
||||
struct spdk_uring_sock *sock, *tmp;
|
||||
struct spdk_uring_task *task;
|
||||
int status;
|
||||
|
||||
max = spdk_min(max, SPDK_SOCK_GROUP_QUEUE_DEPTH);
|
||||
completed_cqe_num = io_uring_peek_batch_cqe(&group->uring, cqes, max);
|
||||
for (i = 0; i < completed_cqe_num; i++) {
|
||||
assert(cqes[i] != NULL);
|
||||
for (i = 0; i < max; i++) {
|
||||
ret = io_uring_peek_cqe(&group->uring, &cqe);
|
||||
if (ret != 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
task = (struct spdk_uring_task *)cqes[i]->user_data;
|
||||
if (cqe == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
task = (struct spdk_uring_task *)cqe->user_data;
|
||||
assert(task != NULL);
|
||||
sock = task->sock;
|
||||
assert(sock != NULL);
|
||||
@ -903,8 +908,8 @@ sock_uring_group_reap(struct spdk_uring_sock_group_impl *group, int max, int max
|
||||
assert(sock->group == group);
|
||||
sock->group->io_inflight--;
|
||||
sock->group->io_avail++;
|
||||
status = cqes[i]->res;
|
||||
io_uring_cqe_seen(&group->uring, cqes[i]);
|
||||
status = cqe->res;
|
||||
io_uring_cqe_seen(&group->uring, cqe);
|
||||
|
||||
task->status = SPDK_URING_SOCK_TASK_NOT_IN_USE;
|
||||
|
||||
|
@ -48,8 +48,6 @@ DEFINE_STUB(__io_uring_get_cqe, int, (struct io_uring *ring, struct io_uring_cqe
|
||||
DEFINE_STUB(io_uring_submit, int, (struct io_uring *ring), 0);
|
||||
DEFINE_STUB(io_uring_get_sqe, struct io_uring_sqe *, (struct io_uring *ring), 0);
|
||||
DEFINE_STUB(io_uring_queue_init, int, (unsigned entries, struct io_uring *ring, unsigned flags), 0);
|
||||
DEFINE_STUB(io_uring_peek_batch_cqe, unsigned, (struct io_uring *ring, struct io_uring_cqe **cqes,
|
||||
unsigned count), 0);
|
||||
DEFINE_STUB_V(io_uring_queue_exit, (struct io_uring *ring));
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user