On Tue, Jul 08, 2014 at 11:45:10PM +0800, Ming Lei wrote: > In the enqueue path, we can't complete request, otherwise > "Co-routine re-entered recursively" may be caused, so this > patch fixes the issue with below ideas:
Thi probably happens when the caller is in coroutine context and its completion function invokes qemu_coroutine_enter() on itself. The solution is to invoke completions from a BH (other places in the block layer do this too). > - for -EAGAIN, retry the submission in an introduced event handler I agree with Paolo that a BH is appropriate. > - for part of completion, just update the io queue, since it is > moving on after all If we do this then we need to guarantee that io_submit() will be called at some point soon. Otherwise requests could get stuck if the guest doesn't submit any more I/O requests to push the queue. Please split this into separate patches. You're trying to do too much. Overall, I would prefer it if we avoid the extra complexity of deferring io_submit() on EAGAIN and partial submission. Do you understand why the kernel is producing this behavior? Can we set the right capacity in io_setup() so it doesn't happen? > + if (enqueue) > + return ret; Please set up a git hook to run checkpatch.pl. It will alert you when you violate QEMU coding style: http://blog.vmsplice.net/2011/03/how-to-automatically-run-checkpatchpl.html I already mentioned coding style in previous patches, using a git hook will avoid it happening again.
pgppubcpZnIhH.pgp
Description: PGP signature