Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1362797

RE: [PATCH 3/5] Drivers: hv: vmbus: Fix a bug in hv_need_to_signal_on_read()

From KY Srinivasan <kys@microsoft.com>
Newsgroups linux.kernel
Subject RE: [PATCH 3/5] Drivers: hv: vmbus: Fix a bug in hv_need_to_signal_on_read()
Date 2016-03-22 16:00 +0100
Message-ID <rfvWN-5W8-1@gated-at.bofh.it> (permalink)
References (1 earlier) <rec9Q-3HN-5@gated-at.bofh.it> <rec9R-3HN-23@gated-at.bofh.it> <rf3e9-2Ra-7@gated-at.bofh.it> <rfi3w-4L0-9@gated-at.bofh.it> <rfrgt-2yM-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



> -----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.

Regards,

K. Y
> 
> --
>   Vitaly

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] Drivers: hv: vmbus  "K. Y. Srinivasan" <kys@microsoft.com> - 2016-03-19 00:40 +0100
  [PATCH 4/5] Drivers: hv: vmbus: Use the new virt_xx barrier code "K. Y. Srinivasan" <kys@microsoft.com> - 2016-03-19 00:40 +0100
  [PATCH 1/5] Drivers: hv: vmbus: Introduce functions for estimating room in the ring buffer "K. Y. Srinivasan" <kys@microsoft.com> - 2016-03-19 00:40 +0100
    [PATCH 3/5] Drivers: hv: vmbus: Fix a bug in hv_need_to_signal_on_read() "K. Y. Srinivasan" <kys@microsoft.com> - 2016-03-19 00:40 +0100
      Re: [PATCH 3/5] Drivers: hv: vmbus: Fix a bug in hv_need_to_signal_on_read() Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-03-21 09:20 +0100
        RE: [PATCH 3/5] Drivers: hv: vmbus: Fix a bug in  hv_need_to_signal_on_read() KY Srinivasan <kys@microsoft.com> - 2016-03-22 01:10 +0100
          Re: [PATCH 3/5] Drivers: hv: vmbus: Fix a bug in hv_need_to_signal_on_read() Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-03-22 11:00 +0100
            RE: [PATCH 3/5] Drivers: hv: vmbus: Fix a bug in  hv_need_to_signal_on_read() KY Srinivasan <kys@microsoft.com> - 2016-03-22 16:00 +0100
            RE: [PATCH 3/5] Drivers: hv: vmbus: Fix a bug in  hv_need_to_signal_on_read() KY Srinivasan <kys@microsoft.com> - 2016-03-22 18:20 +0100
    [PATCH 5/5] Drivers: hv: vmbus: Implement copy-free read APIs "K. Y. Srinivasan" <kys@microsoft.com> - 2016-03-19 00:40 +0100
      Re: [PATCH 5/5] Drivers: hv: vmbus: Implement copy-free read APIs Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-03-21 09:30 +0100
        RE: [PATCH 5/5] Drivers: hv: vmbus: Implement copy-free read APIs KY Srinivasan <kys@microsoft.com> - 2016-03-22 00:50 +0100
  RE: [PATCH 0/5] Drivers: hv: vmbus  KY Srinivasan <kys@microsoft.com> - 2016-03-23 20:50 +0100

csiph-web