于 2014/1/13 19:29, Kevin Wolf 写道:
Am 27.12.2013 um 05:17 hat Wenchao Xia geschrieben:
于 2013/12/13 21:22, Kevin Wolf 写道:
We can only have a single wait_serialising_requests() call per request
because otherwise we can run into deadlocks where requests are waiting
for each other.
do you mean:
mark_request_serialising(req)
...
wait_serialising_requests(req);
...
wait_serialising_requests(req);
will have deadlock?
Yes, it can deadlock (it doesn't have to, it depends on whether another
overlapping request is started concurrently). More precisely, the
problematic pattern is:
mark_request_serialising(req);
...
qemu_coroutine_yield(); /* Other requests may be issued now */
...
wait_serialising_requests(req);
What you mentioned above is a special case of this.
It seems when two overlapping request exist in the qeueue, and
both are waiting, problem happens. Thanks for explanation, I am fine
with this patch.
I thought it is already resolved by patch 15?
Maybe here is another deadlock reason?
The problematic pattern in patch 15 was:
mark_request_serialising(req);
... /* no yield here */
wait_serialising_requests(req);
As opposed to the originally used:
wait_serialising_requests(req);
... /* no yield here */
mark_request_serialising(req);
Kevin