Re: [PATCH net v2] hvsock: fix epollout hang from race condition
From: David Miller <davem@davemloft.net>
Date: 2019-06-19 01:42:51
Also in:
linux-hyperv, lkml
From: David Miller <davem@davemloft.net>
Date: 2019-06-19 01:42:51
Also in:
linux-hyperv, lkml
From: Sunil Muthuswamy <redacted> 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 empty. 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: vsock_stream_sendmsg()->hv_stream_has_space() Earlier hv_stream_has_space was setting/clearing the pending size on every call. Signed-off-by: Sunil Muthuswamy <redacted> Reviewed-by: Dexuan Cui <decui@microsoft.com> --- - Resubmitting the patch after taking care of some spurious warnings.
Applied and queued up for -stable.