Re: [PATCH net v2] hvsock: fix epollout hang from race condition
From: David Miller
Date: Tue Jun 18 2019 - 21:47:55 EST
From: Sunil Muthuswamy <sunilmut@xxxxxxxxxxxxx>
Date: Mon, 17 Jun 2019 19:26:25 +0000
> Currently, hvsock can enter into a state where epoll_wait on EPOLLOUT will
> not return even when the hvsock socket is writable, under some race
> condition. This can happen under the following sequence:
> Now, the EPOLLOUT will never return even if the socket write buffer is
> The fix is to set the pending size to the default size and never change it.
> This way the host will always notify the guest whenever the writable space
> is bigger than the pending size. The host is already optimized to *only*
> notify the guest when the pending size threshold boundary is crossed and
> not everytime.
> This change also reduces the cpu usage somewhat since hv_stream_has_space()
> is in the hotpath of send:
> Earlier hv_stream_has_space was setting/clearing the pending size on every
> Signed-off-by: Sunil Muthuswamy <sunilmut@xxxxxxxxxxxxx>
> Reviewed-by: Dexuan Cui <decui@xxxxxxxxxxxxx>
> - Resubmitting the patch after taking care of some spurious warnings.
Applied and queued up for -stable.