From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: "K. Y. Srinivasan" <kys@microsoft.com>,
Long Li <longli@exchange.microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>,
devel@linuxdriverproject.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hv: do not lose pending heartbeat vmbus packets
Date: Thu, 29 Sep 2016 11:22:02 +0200 [thread overview]
Message-ID: <87lgyb3vt1.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <1473737481-21939-1-git-send-email-longli@exchange.microsoft.com> (Long Li's message of "Mon, 12 Sep 2016 20:31:21 -0700")
Long Li <longli@exchange.microsoft.com> writes:
> From: Long Li <longli@microsoft.com>
>
> The host keeps sending heartbeat packets independent of guest responding to them. In some situations, there might be multiple heartbeat packets pending in the ring buffer. Don't lose them, read them all.
>
> Signed-off-by: Long Li <longli@microsoft.com>
Long, K. Y.,
it seems this patch didn't make it to char-misc tree and it looks like
an important fix. A couple of nitpicks below,
> ---
> drivers/hv/hv_util.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
> index d5acaa2..9dc6372 100644
> --- a/drivers/hv/hv_util.c
> +++ b/drivers/hv/hv_util.c
> @@ -283,10 +283,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);
We should check vmbus_recvpacket() return value as
well. E.g. hv_ringbuffer_read() may return -EAGAIN in case we didn't
receive the whole packet (and we do this check in other drivers, see
storvsc_on_channel_callback() for example).
> +
> + if (!recvlen)
so this should be 'if (ret || !recvlen)'
> + break;
>
> - if (recvlen > 0) {
> icmsghdrp = (struct icmsg_hdr *)&hbeat_txf_buf[
> sizeof(struct vmbuspipe_hdr)];
--
Vitaly
next prev parent reply other threads:[~2016-09-29 9:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-13 3:31 [PATCH] hv: do not lose pending heartbeat vmbus packets Long Li
2016-09-19 17:15 ` Haiyang Zhang
2016-09-29 9:22 ` Vitaly Kuznetsov [this message]
2016-09-30 18:31 ` Long Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lgyb3vt1.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=devel@linuxdriverproject.org \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longli@exchange.microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox