public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Michael Kelley <mhkelley@outlook.com>
Cc: "mikelley@microsoft.com" <mikelley@microsoft.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devel@linuxdriverproject.org" <devel@linuxdriverproject.org>,
	"olaf@aepfle.de" <olaf@aepfle.de>,
	"apw@canonical.com" <apw@canonical.com>,
	"vkuznets@redhat.com" <vkuznets@redhat.com>,
	"jasowang@redhat.com" <jasowang@redhat.com>,
	"leann.ogasawara@canonical.com" <leann.ogasawara@canonical.com>,
	"marcelo.cerri@canonical.com" <marcelo.cerri@canonical.com>,
	"sthemmin@microsoft.com" <sthemmin@microsoft.com>,
	"kys@microsoft.com" <kys@microsoft.com>
Subject: Re: [PATCH char-misc 1/1] Drivers: hv: vmbus: Fix ring buffer signaling
Date: Tue, 13 Feb 2018 09:34:39 -0800	[thread overview]
Message-ID: <20180213093439.3698cb5e@xeon-e3> (raw)
In-Reply-To: <SN6PR1901MB204572CAD3159EB07D6F1043CBF10@SN6PR1901MB2045.namprd19.prod.outlook.com>


>  	if (rbi->ring_buffer->feature_bits.feat_pending_send_sz) {
>  		u32 pending_sz = READ_ONCE(rbi->ring_buffer->pending_send_sz);
>  
>  		/*
> +		 * Ensure the read of write_index in hv_get_bytes_to_write()
> +		 * happens after the read of pending_send_sz.
> +		 */
> +		virt_rmb();
> +		curr_write_sz = hv_get_bytes_to_write(rbi);
> +
> +		/*
>  		 * If there was space before we began iteration,
>  		 * then host was not blocked. Also handles case where
>  		 * pending_sz is zero then host has nothing pending
>  		 * and does not need to be signaled.
>  		 */
> -		if (orig_write_sz > pending_sz)
> +		if (curr_write_sz - delta > pending_sz)
>  			return;
>  
>  		/* If pending write will not fit, don't give false hope. */
> -		if (hv_get_bytes_to_write(rbi) < pending_sz)
> +		if (curr_write_sz <= pending_sz)
>  			return;
> +
> +		vmbus_setevent(channel);
>  	}
>  
> -	vmbus_setevent(channel);
>  }

I think this won't work on older versions of Windows where feat_pending_sz
is never set.  On those versions vmbus_setevent needs to always be called.

  parent reply	other threads:[~2018-02-13 17:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-10 20:48 [PATCH char-misc 1/1] Drivers: hv: vmbus: Fix ring buffer signaling Michael Kelley
2018-02-11 23:50 ` Stephen Hemminger
2018-02-12  1:14 ` KY Srinivasan
2018-02-12  5:13   ` Michael Kelley (EOSG)
2018-02-13 17:34 ` Stephen Hemminger [this message]
2018-02-14  2:12   ` Michael Kelley (EOSG)
2018-02-14 18:12 ` Stephen Hemminger

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=20180213093439.3698cb5e@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=apw@canonical.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jasowang@redhat.com \
    --cc=kys@microsoft.com \
    --cc=leann.ogasawara@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.cerri@canonical.com \
    --cc=mhkelley@outlook.com \
    --cc=mikelley@microsoft.com \
    --cc=olaf@aepfle.de \
    --cc=sthemmin@microsoft.com \
    --cc=vkuznets@redhat.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