lkml.org 
[lkml]   [2016]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH 3/5] Drivers: hv: vmbus: Fix a bug in hv_need_to_signal_on_read()
Date


> -----Original Message-----
> From: KY Srinivasan
> Sent: Tuesday, March 22, 2016 7:37 AM
> To: 'Vitaly Kuznetsov' <vkuznets@redhat.com>
> Cc: gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org;
> devel@linuxdriverproject.org; olaf@aepfle.de; apw@canonical.com;
> jasowang@redhat.com; stable@vger.kernel.org
> Subject: RE: [PATCH 3/5] Drivers: hv: vmbus: Fix a bug in
> hv_need_to_signal_on_read()
>
>
>
> > -----Original Message-----
> > From: Vitaly Kuznetsov [mailto:vkuznets@redhat.com]
> > Sent: Tuesday, March 22, 2016 2:56 AM
> > To: KY Srinivasan <kys@microsoft.com>
> > Cc: gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org;
> > devel@linuxdriverproject.org; olaf@aepfle.de; apw@canonical.com;
> > jasowang@redhat.com; stable@vger.kernel.org
> > Subject: Re: [PATCH 3/5] Drivers: hv: vmbus: Fix a bug in
> > hv_need_to_signal_on_read()
> >
> > KY Srinivasan <kys@microsoft.com> writes:
> >
> > >> -----Original Message-----
> > >> From: Vitaly Kuznetsov [mailto:vkuznets@redhat.com]
> > >> Sent: Monday, March 21, 2016 1:19 AM
> > >> To: KY Srinivasan <kys@microsoft.com>
> > >> Cc: gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org;
> > >> devel@linuxdriverproject.org; olaf@aepfle.de; apw@canonical.com;
> > >> jasowang@redhat.com; stable@vger.kernel.org
> > >> Subject: Re: [PATCH 3/5] Drivers: hv: vmbus: Fix a bug in
> > >> hv_need_to_signal_on_read()
> > >>
> > >> "K. Y. Srinivasan" <kys@microsoft.com> writes:
> > >>
> > >> > We need to issue a full memory barrier prior making a signalling
> > >> > decision.
> > >>
> > >> Any reason this should be mb()? This is pretty strong and will probably
> > >> lead to performace regression ... and, btw, we have another mb() in
> > >> hv_ringbuffer_read().
> > >>
> > >> Could you please describe the scenarion you're trying to protect against
> > >> so we could search for a better solution?
> > >
> > > 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 these are two reads we can add a lightweight barrier just preventing
> > compiler from reordering (e.g. smp_rmb()), right?
> >
> > > 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.
> >
> > so write and then we read and we need to prevent reordering... not sure
> > how to get rid on mb() then ...
>
> The other memory barrier in the function (prior to writing the read index)
> has been there forever and I am not sure why that needs to be a full barrier.
> I feel a read barrier should suffice.

I may also look at restructuring these APIs to not always check for signaling.
I will experiment with that scheme to minimize the barrier calls.

K. Y

\
 
 \ /
  Last update: 2016-03-22 18:41    [W:0.060 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site