qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH RESEND v6 12/36] multi-process: add functions to synchronize


From: Stefan Hajnoczi
Subject: Re: [PATCH RESEND v6 12/36] multi-process: add functions to synchronize proxy and remote endpoints
Date: Wed, 13 May 2020 09:43:13 +0100

On Tue, May 12, 2020 at 08:28:39AM -0400, Jag Raman wrote:
> > On May 12, 2020, at 6:21 AM, Stefan Hajnoczi <address@hidden> wrote:
> > On Wed, Apr 22, 2020 at 09:13:47PM -0700, address@hidden 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

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]