On Tue, May 12, 2020 at 08:28:39AM -0400, Jag Raman wrote: > > On May 12, 2020, at 6:21 AM, Stefan Hajnoczi wrote: > > On Wed, Apr 22, 2020 at 09:13:47PM -0700, elena.ufimtseva@oracle.com wrote: > >> +uint64_t wait_for_remote(int efd) > >> +{ > >> + struct pollfd pfd = { .fd = efd, .events = POLLIN }; > >> + uint64_t val; > >> + int ret; > >> + > >> + ret = poll(&pfd, 1, 1000); > > > > This 1 second blocking operation is not allowed in an event loop since > > it will stall any other event loop activity. If locks are held then > > other threads may also be stalled. > > > > It's likely that this will need to change as part of the QEMU event loop > > integration. Caller code can be kept mostly unchanged if you use > > coroutines. > > In case the remote process has hung or terminated, the 1 second timeout > ensures that the IO operation does not block for too long. Timeouts are fine. They just need to be integrated into the event loop instead of blocking it. That way other processing can continue while waiting for the remote device process to respond or time out. Stefan