Skip to content
Commit 1af0a35e authored by Vineeth Pillai's avatar Vineeth Pillai Committed by Greg Kroah-Hartman
Browse files

hv_utils: drain the timesync packets on onchannelcallback

commit b46b4a8a

 upstream.

There could be instances where a system stall prevents the timesync
packets to be consumed. And this might lead to more than one packet
pending in the ring buffer. Current code empties one packet per callback
and it might be a stale one. So drain all the packets from ring buffer
on each callback.

Signed-off-by: default avatarVineeth Pillai <viremana@linux.microsoft.com>
Reviewed-by: default avatarMichael Kelley <mikelley@microsoft.com>
Link: https://lore.kernel.org/r/20200821152849.99517-1-viremana@linux.microsoft.com
Signed-off-by: default avatarWei Liu <wei.liu@kernel.org>
[ The upstream commit uses HV_HYP_PAGE_SIZE, which is not defined in 4.19.y.
  Fixed this manually for 4.19.y by using PAGE_SIZE instead.

  If there are multiple messages in the host-to-guest ringbuffer of the TimeSync
  device, 4.19.y only handles 1 message, and later the host puts new messages
  into the ringbuffer without signaling the guest because the ringbuffer is not
  empty, causing a "hung" ringbuffer. Backported the mainline fix for this issue. ]
Signed-off-by: default avatarDexuan Cui <decui@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 95f6f81e
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment