> As a small improvement, we don't need aio_co_enter() in job_start(),
> we can simplify it with qemu_coroutine_enter(). If the aio_context
> where it is running is wrong, job_do_yield_locked() will automatically
> reschedule the coroutine where it belongs, once the first
> job_pause_point is triggered in job_co_entry.
> 

> @@ -1145,7 +1161,7 @@ void job_start(Job *job)
>          job->paused = false;
>          job_state_transition_locked(job, JOB_STATUS_RUNNING);
>      }
> -    aio_co_enter(job->aio_context, job->co);
> +    qemu_coroutine_enter(job->co);

This is actually wrong. If the job is not under drain, job_pause_point
in job_co_enter is not going to yield() job->co, so it won't change the
aiocontext automatically, running part if not all of job->driver->run()
in the wrong AioContext.

I will drop it in v5.

Emanuele


Reply via email to