Commit 78186df4 authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Jim Harris
Browse files

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: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ia98f491eb52be0156954372461e05c198c070e3b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15946


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
parent fb67fa54
Loading
Loading
Loading
Loading
+4 −10
Original line number Diff line number Diff line
@@ -1239,11 +1239,7 @@ accel_process_sequence(struct spdk_accel_sequence *seq)
	seq->in_process_sequence = true;

	task = TAILQ_FIRST(&seq->tasks);
	if (task == NULL) {
		/* We've processed all tasks */
		accel_sequence_complete(seq);
		return;
	}
	assert(task != NULL);

	do {
		state = seq->state;
@@ -1290,8 +1286,9 @@ accel_process_sequence(struct spdk_accel_sequence *seq)
			}
			break;
		case ACCEL_SEQUENCE_STATE_COMPLETE_TASK:
			/* Update the task pointer here, in case a task was completed by a module
			 * from submit_tasks() */
			TAILQ_REMOVE(&seq->tasks, task, seq_link);
			TAILQ_INSERT_TAIL(&seq->completed, task, seq_link);
			/* Check if there are any remaining tasks */
			task = TAILQ_FIRST(&seq->tasks);
			if (task == NULL) {
				/* 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);
	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)) {
		SPDK_ERRLOG("Failed to execute %s operation, sequence: %p\n",
			    g_opcode_strings[task->op_code], seq);