From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758609AbcCVJ4J (ORCPT ); Tue, 22 Mar 2016 05:56:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36195 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758521AbcCVJ4A (ORCPT ); Tue, 22 Mar 2016 05:56:00 -0400 From: Vitaly Kuznetsov To: KY Srinivasan 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() References: <1458350038-32624-1-git-send-email-kys@microsoft.com> <1458350065-32666-1-git-send-email-kys@microsoft.com> <1458350065-32666-3-git-send-email-kys@microsoft.com> <87shzk1bwq.fsf@vitty.brq.redhat.com> Date: Tue, 22 Mar 2016 10:55:56 +0100 In-Reply-To: (KY Srinivasan's message of "Tue, 22 Mar 2016 00:04:03 +0000") Message-ID: <87zitq7s5v.fsf@vitty.brq.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org KY Srinivasan writes: >> -----Original Message----- >> From: Vitaly Kuznetsov [mailto:vkuznets@redhat.com] >> Sent: Monday, March 21, 2016 1:19 AM >> To: KY Srinivasan >> 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" 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 ... -- Vitaly