* [PATCH 3/7] Drivers: hv: vmbus: Fix a bug in hv_need_to_signal_on_read()
[not found] ` <1458780837-4367-1-git-send-email-kys@microsoft.com>
@ 2016-03-24 0:53 ` K. Y. Srinivasan
2016-03-31 23:59 ` Greg KH
2016-04-01 0:00 ` Greg KH
0 siblings, 2 replies; 5+ messages in thread
From: K. Y. Srinivasan @ 2016-03-24 0:53 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, olaf, apw, vkuznets, jasowang
Cc: K. Y. Srinivasan, stable
We need to issue a full memory barrier prior making a signalling decision.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Cc: stable@vger.kernel.org
---
drivers/hv/ring_buffer.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index 2919395..67dc245 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -104,6 +104,7 @@ static bool hv_need_to_signal_on_read(struct hv_ring_buffer_info *rbi)
u32 cur_write_sz;
u32 pending_sz;
+ mb();
pending_sz = READ_ONCE(rbi->ring_buffer->pending_send_sz);
/* If the other end is not blocked on write don't bother. */
if (pending_sz == 0)
--
1.7.4.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 3/7] Drivers: hv: vmbus: Fix a bug in hv_need_to_signal_on_read()
2016-03-24 0:53 ` [PATCH 3/7] Drivers: hv: vmbus: Fix a bug in hv_need_to_signal_on_read() K. Y. Srinivasan
@ 2016-03-31 23:59 ` Greg KH
2016-04-01 21:03 ` KY Srinivasan
2016-04-01 0:00 ` Greg KH
1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2016-03-31 23:59 UTC (permalink / raw)
To: K. Y. Srinivasan
Cc: linux-kernel, devel, olaf, apw, vkuznets, jasowang, stable
On Wed, Mar 23, 2016 at 05:53:53PM -0700, K. Y. Srinivasan wrote:
> We need to issue a full memory barrier prior making a signalling decision.
>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Cc: stable@vger.kernel.org
> ---
> drivers/hv/ring_buffer.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
why is this burried in a 7 patch series? Don't you want this in
4.6-final?
Please break this out into a separate patch, and redo this series.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/7] Drivers: hv: vmbus: Fix a bug in hv_need_to_signal_on_read()
2016-03-24 0:53 ` [PATCH 3/7] Drivers: hv: vmbus: Fix a bug in hv_need_to_signal_on_read() K. Y. Srinivasan
2016-03-31 23:59 ` Greg KH
@ 2016-04-01 0:00 ` Greg KH
2016-04-01 21:57 ` KY Srinivasan
1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2016-04-01 0:00 UTC (permalink / raw)
To: K. Y. Srinivasan
Cc: linux-kernel, devel, olaf, apw, vkuznets, jasowang, stable
On Wed, Mar 23, 2016 at 05:53:53PM -0700, K. Y. Srinivasan wrote:
> We need to issue a full memory barrier prior making a signalling decision.
>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Cc: stable@vger.kernel.org
> ---
> drivers/hv/ring_buffer.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
> index 2919395..67dc245 100644
> --- a/drivers/hv/ring_buffer.c
> +++ b/drivers/hv/ring_buffer.c
> @@ -104,6 +104,7 @@ static bool hv_need_to_signal_on_read(struct hv_ring_buffer_info *rbi)
> u32 cur_write_sz;
> u32 pending_sz;
>
> + mb();
And, are you sure this is correct? You better document the heck out of
this, why it's here, and what it is protecting. "raw" mb() calls are
really rare for good reason.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH 3/7] Drivers: hv: vmbus: Fix a bug in hv_need_to_signal_on_read()
2016-03-31 23:59 ` Greg KH
@ 2016-04-01 21:03 ` KY Srinivasan
0 siblings, 0 replies; 5+ messages in thread
From: KY Srinivasan @ 2016-04-01 21:03 UTC (permalink / raw)
To: Greg KH
Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com,
jasowang@redhat.com, stable@vger.kernel.org
> -----Original Message-----
> From: Greg KH [mailto:gregkh@linuxfoundation.org]
> Sent: Thursday, March 31, 2016 5:00 PM
> To: KY Srinivasan <kys@microsoft.com>
> Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> olaf@aepfle.de; apw@canonical.com; vkuznets@redhat.com;
> jasowang@redhat.com; stable@vger.kernel.org
> Subject: Re: [PATCH 3/7] Drivers: hv: vmbus: Fix a bug in
> hv_need_to_signal_on_read()
>
> On Wed, Mar 23, 2016 at 05:53:53PM -0700, K. Y. Srinivasan wrote:
> > We need to issue a full memory barrier prior making a signalling decision.
> >
> > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > Cc: stable@vger.kernel.org
> > ---
> > drivers/hv/ring_buffer.c | 1 +
> > 1 files changed, 1 insertions(+), 0 deletions(-)
>
> why is this burried in a 7 patch series? Don't you want this in
> 4.6-final?
>
> Please break this out into a separate patch, and redo this series.
Will do.
Thanks,
K. Y
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH 3/7] Drivers: hv: vmbus: Fix a bug in hv_need_to_signal_on_read()
2016-04-01 0:00 ` Greg KH
@ 2016-04-01 21:57 ` KY Srinivasan
0 siblings, 0 replies; 5+ messages in thread
From: KY Srinivasan @ 2016-04-01 21:57 UTC (permalink / raw)
To: Greg KH
Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com,
jasowang@redhat.com, stable@vger.kernel.org
> -----Original Message-----
> From: Greg KH [mailto:gregkh@linuxfoundation.org]
> Sent: Thursday, March 31, 2016 5:00 PM
> To: KY Srinivasan <kys@microsoft.com>
> Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> olaf@aepfle.de; apw@canonical.com; vkuznets@redhat.com;
> jasowang@redhat.com; stable@vger.kernel.org
> Subject: Re: [PATCH 3/7] Drivers: hv: vmbus: Fix a bug in
> hv_need_to_signal_on_read()
>
> On Wed, Mar 23, 2016 at 05:53:53PM -0700, K. Y. Srinivasan wrote:
> > We need to issue a full memory barrier prior making a signalling decision.
> >
> > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > Cc: stable@vger.kernel.org
> > ---
> > drivers/hv/ring_buffer.c | 1 +
> > 1 files changed, 1 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
> > index 2919395..67dc245 100644
> > --- a/drivers/hv/ring_buffer.c
> > +++ b/drivers/hv/ring_buffer.c
> > @@ -104,6 +104,7 @@ static bool hv_need_to_signal_on_read(struct
> hv_ring_buffer_info *rbi)
> > u32 cur_write_sz;
> > u32 pending_sz;
> >
> > + mb();
>
> And, are you sure this is correct? You better document the heck out of
> this, why it's here, and what it is protecting. "raw" mb() calls are
> really rare for good reason.
Yes; I am sure I need this barrier. This is a lockless ringbuffer code where
the reader updates the read index while the writer only updates the
write index and they each sample the index modified by the other end to
make decisions. Here is the reason for having this barrier:
"If the reading of the pend_sz (in the function hv_need_to_signal_on_read)
were to be reordered and read before we commit the new read index we could
have a problem. If the host were to set the pending_sz after we have sampled pending_sz
and go to sleep before we commit the read index, we could miss sending the interrupt."
I will add the necessary documentation here.
Regards,
K. Y
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-04-01 21:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1458780816-4328-1-git-send-email-kys@microsoft.com>
[not found] ` <1458780837-4367-1-git-send-email-kys@microsoft.com>
2016-03-24 0:53 ` [PATCH 3/7] Drivers: hv: vmbus: Fix a bug in hv_need_to_signal_on_read() K. Y. Srinivasan
2016-03-31 23:59 ` Greg KH
2016-04-01 21:03 ` KY Srinivasan
2016-04-01 0:00 ` Greg KH
2016-04-01 21:57 ` KY Srinivasan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox