accel: put completed tasks on the completed queue in process_sequence

The first task on a sequence's task queue is the one that we're
currently executing.  By moving the place where we remove it from that
queue and place it on the completed queue to process_sequence(), we'll
be able to perform some extra steps (e.g. memory domain push) after a
task has been completed.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ia98f491eb52be0156954372461e05c198c070e3b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15946
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
Konrad Sztyber 2022-12-12 15:41:00 +01:00 committed by Jim Harris
parent fb67fa548f
commit 78186df493

View File

@ -1239,11 +1239,7 @@ accel_process_sequence(struct spdk_accel_sequence *seq)
seq->in_process_sequence = true; seq->in_process_sequence = true;
task = TAILQ_FIRST(&seq->tasks); task = TAILQ_FIRST(&seq->tasks);
if (task == NULL) { assert(task != NULL);
/* We've processed all tasks */
accel_sequence_complete(seq);
return;
}
do { do {
state = seq->state; state = seq->state;
@ -1290,8 +1286,9 @@ accel_process_sequence(struct spdk_accel_sequence *seq)
} }
break; break;
case ACCEL_SEQUENCE_STATE_COMPLETE_TASK: case ACCEL_SEQUENCE_STATE_COMPLETE_TASK:
/* Update the task pointer here, in case a task was completed by a module TAILQ_REMOVE(&seq->tasks, task, seq_link);
* from submit_tasks() */ TAILQ_INSERT_TAIL(&seq->completed, task, seq_link);
/* Check if there are any remaining tasks */
task = TAILQ_FIRST(&seq->tasks); task = TAILQ_FIRST(&seq->tasks);
if (task == NULL) { if (task == NULL) {
/* Immediately return here to make sure we don't touch the sequence /* Immediately return here to make sure we don't touch the sequence
@ -1337,9 +1334,6 @@ accel_sequence_task_cb(void *cb_arg, int status)
assert(seq->state == ACCEL_SEQUENCE_STATE_AWAIT_TASK); assert(seq->state == ACCEL_SEQUENCE_STATE_AWAIT_TASK);
accel_sequence_set_state(seq, ACCEL_SEQUENCE_STATE_COMPLETE_TASK); accel_sequence_set_state(seq, ACCEL_SEQUENCE_STATE_COMPLETE_TASK);
TAILQ_REMOVE(&seq->tasks, task, seq_link);
TAILQ_INSERT_TAIL(&seq->completed, task, seq_link);
if (spdk_unlikely(status != 0)) { if (spdk_unlikely(status != 0)) {
SPDK_ERRLOG("Failed to execute %s operation, sequence: %p\n", SPDK_ERRLOG("Failed to execute %s operation, sequence: %p\n",
g_opcode_strings[task->op_code], seq); g_opcode_strings[task->op_code], seq);