From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936073AbcJEWGh (ORCPT ); Wed, 5 Oct 2016 18:06:37 -0400 Received: from p3plsmtps2ded03.prod.phx3.secureserver.net ([208.109.80.60]:34284 "EHLO p3plsmtps2ded03.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934112AbcJEWGd (ORCPT ); Wed, 5 Oct 2016 18:06:33 -0400 x-originating-ip: 72.167.245.219 From: kys@exchange.microsoft.com To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com, leann.ogasawara@canonical.com Cc: Long Li , "K. Y. Srinivasan" , Stable Subject: [PATCH V2 1/1] hv: do not lose pending heartbeat vmbus packets Date: Wed, 5 Oct 2016 16:57:46 -0700 Message-Id: <1475711866-25188-1-git-send-email-kys@exchange.microsoft.com> X-Mailer: git-send-email 1.7.4.1 Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfOs4uRXz2plUng8Aj1PHB0R/qK22yzQS5n3BNj9VV2q20RcezSjbSVxAGlp+DP70CtgS16nIzOYrl1TDyef/7vZ1rnOxpey0VSRhjwlapMMT3s5672Ge V7e0WWwV5mRf+SxNI8L7eSUoFppz264r8yeySLKXB5Jab+gsRr/x4pgUBkAVFvnHpmAOJMFQtwXmyEHR1+bq4qmPRdGCBViBBN0z6RDnbdZym2zH7g36JhcA w/qaagsCG4XlSCp6nLPazhQCCSwPqWI0tX9yNRgPY4CIpkjXcwaHsfrtsCbc9W/nDZ82TmSHXWZrwfx5opEpGk8tF/+93trawLFiz39QNBOeKSvY7Xbv0DiR BH7eAK4GaZsOnkdnGWYn+0bDw8YUcerurq/C3bzpTIa32dkBoh1Q4jhiwOVtZ3DJlefxZTteTr5M+OH6KtSNMbxkoHmg3eMvRvcrapILfaMW/EVa0xV7JRLR bRF+WFl4RgM80d4GOewC7vGGEVeVmoifpQ/jjB+fhsVJJk0C7OOZReFPJ+g= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Long Li The host keeps sending heartbeat packets independent of the guest responding to them. Even though we respond to the heartbeat messages at interrupt level, we can have situations where there maybe multiple heartbeat messages pending that have not been responded to. For instance this occurs when the VM is paused and the host continues to send the heartbeat messages. Address this issue by draining and responding to all the heartbeat messages that maybe pending. Signed-off-by: Long Li Signed-off-by: K. Y. Srinivasan CC: Stable --- V2: Submit the patch to stable as well - Joshua R. Poulson drivers/hv/hv_util.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c index 4aa3cb6..bcd0630 100644 --- a/drivers/hv/hv_util.c +++ b/drivers/hv/hv_util.c @@ -314,10 +314,14 @@ static void heartbeat_onchannelcallback(void *context) u8 *hbeat_txf_buf = util_heartbeat.recv_buffer; struct icmsg_negotiate *negop = NULL; - vmbus_recvpacket(channel, hbeat_txf_buf, - PAGE_SIZE, &recvlen, &requestid); + while (1) { + + vmbus_recvpacket(channel, hbeat_txf_buf, + PAGE_SIZE, &recvlen, &requestid); + + if (!recvlen) + break; - if (recvlen > 0) { icmsghdrp = (struct icmsg_hdr *)&hbeat_txf_buf[ sizeof(struct vmbuspipe_hdr)]; -- 1.7.4.1