]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Jun 2024 09:34:26 +0000 (11:34 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Jun 2024 09:34:26 +0000 (11:34 +0200)
added patches:
hv_utils-drain-the-timesync-packets-on-onchannelcallback.patch

queue-4.19/hv_utils-drain-the-timesync-packets-on-onchannelcallback.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/hv_utils-drain-the-timesync-packets-on-onchannelcallback.patch b/queue-4.19/hv_utils-drain-the-timesync-packets-on-onchannelcallback.patch
new file mode 100644 (file)
index 0000000..6c27375
--- /dev/null
@@ -0,0 +1,61 @@
+From b46b4a8a57c377b72a98c7930a9f6969d2d4784e Mon Sep 17 00:00:00 2001
+From: Vineeth Pillai <viremana@linux.microsoft.com>
+Date: Fri, 21 Aug 2020 15:28:49 +0000
+Subject: hv_utils: drain the timesync packets on onchannelcallback
+
+From: Vineeth Pillai <viremana@linux.microsoft.com>
+
+commit b46b4a8a57c377b72a98c7930a9f6969d2d4784e 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: Vineeth Pillai <viremana@linux.microsoft.com>
+Reviewed-by: Michael Kelley <mikelley@microsoft.com>
+Link: https://lore.kernel.org/r/20200821152849.99517-1-viremana@linux.microsoft.com
+Signed-off-by: Wei 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: Dexuan Cui <decui@microsoft.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/hv/hv_util.c |   19 ++++++++++++++++---
+ 1 file changed, 16 insertions(+), 3 deletions(-)
+
+--- a/drivers/hv/hv_util.c
++++ b/drivers/hv/hv_util.c
+@@ -294,10 +294,23 @@ static void timesync_onchannelcallback(v
+       struct ictimesync_ref_data *refdata;
+       u8 *time_txf_buf = util_timesynch.recv_buffer;
+-      vmbus_recvpacket(channel, time_txf_buf,
+-                       PAGE_SIZE, &recvlen, &requestid);
++      /*
++       * Drain the ring buffer and use the last packet to update
++       * host_ts
++       */
++      while (1) {
++              int ret = vmbus_recvpacket(channel, time_txf_buf,
++                                         PAGE_SIZE, &recvlen,
++                                         &requestid);
++              if (ret) {
++                      pr_warn_once("TimeSync IC pkt recv failed (Err: %d)\n",
++                                   ret);
++                      break;
++              }
++
++              if (!recvlen)
++                      break;
+-      if (recvlen > 0) {
+               icmsghdrp = (struct icmsg_hdr *)&time_txf_buf[
+                               sizeof(struct vmbuspipe_hdr)];
index b4e8cc791c2c67da4a269caadd4fb1967c119458..922f9d3a38bd3d8254f0edcb6772dc882c7abbf7 100644 (file)
@@ -61,3 +61,4 @@ intel_th-pci-add-sapphire-rapids-soc-support.patch
 intel_th-pci-add-meteor-lake-s-support.patch
 intel_th-pci-add-lunar-lake-support.patch
 nilfs2-fix-potential-kernel-bug-due-to-lack-of-writeback-flag-waiting.patch
+hv_utils-drain-the-timesync-packets-on-onchannelcallback.patch