Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756011AbcCNUHM (ORCPT ); Mon, 14 Mar 2016 16:07:12 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:34481 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753187AbcCNUHJ (ORCPT ); Mon, 14 Mar 2016 16:07:09 -0400 Subject: Re: [PATCHv2] vsock: Fix blocking ops call in prepare_to_wait To: David Miller , imbrenda@linux.vnet.ibm.com References: <1454611845-5358-1-git-send-email-labbott@fedoraproject.org> <20160213.055940.1894427692019983187.davem@davemloft.net> <1457699963-27694-1-git-send-email-imbrenda@linux.vnet.ibm.com> <20160314.152403.1490973796884839758.davem@davemloft.net> Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, labbott@fedoraproject.org From: Laura Abbott Message-ID: <56E719EA.7040208@redhat.com> Date: Mon, 14 Mar 2016 13:07:06 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160314.152403.1490973796884839758.davem@davemloft.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1654 Lines: 36 On 03/14/2016 12:24 PM, David Miller wrote: > From: Claudio Imbrenda > Date: Fri, 11 Mar 2016 13:39:23 +0100 > >> I think I found a problem with the patch submitted by Laura Abbott >> ( https://lkml.org/lkml/2016/2/4/711 ): we might miss wakeups. >> Since the condition is not checked between the prepare_to_wait and the >> schedule(), if a wakeup happens after the condition is checked but before >> the sleep happens, and we miss it. ( A description of the problem can be >> found here: http://www.makelinux.net/ldd3/chp-6-sect-2 ). >> >> My solution (see patch below) is to shrink the area influenced by >> prepare_to_wait, but keeping the fragile section around the condition, and >> keep the rest of the code in "normal" running state. This way the sleep is >> correct and the other functions don't need to worry. The only caveat here >> is that the function(s) called to verify the conditions are really not >> allowed to sleep, so if you need synchronization in the backend of e.g. >> vsock_stream_has_space(), you should use spinlocks and not mutexes. >> >> In case we want to be able to sleep while waiting for conditions, we can >> consider this instead: https://lwn.net/Articles/628628/ . >> >> >> I stumbled on this problem while working on fixing the upcoming virtio >> backend for vsock, below is the patch I had prepared, with the original >> message. > > Can someone please look at this? Who maintains this code anyways? > Nobody was listed in MAINTAINERS. I tried cc-ing some of the e-mail addresses of the original authors (vmware?) when sending the original patch and they all bounced. Thanks, Laura