From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=49083 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P4Fqg-0002uz-TD for qemu-devel@nongnu.org; Fri, 08 Oct 2010 12:31:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P4FRd-0002K1-Ru for qemu-devel@nongnu.org; Fri, 08 Oct 2010 12:05:18 -0400 Received: from mail-qy0-f180.google.com ([209.85.216.180]:55191) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P4FRd-0002Jc-O8 for qemu-devel@nongnu.org; Fri, 08 Oct 2010 12:05:17 -0400 Received: by qyk1 with SMTP id 1so1042537qyk.4 for ; Fri, 08 Oct 2010 09:05:17 -0700 (PDT) Message-ID: <4CAF413A.1000407@codemonkey.ws> Date: Fri, 08 Oct 2010 11:05:14 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] ceph/rbd block driver for qemu-kvm (v4) References: <20100802194631.GA4923@chb-desktop> <20100803201407.GD1475@chb-desktop> <4CADD567.9010606@codemonkey.ws> <4CAE13BA.70707@codemonkey.ws> <4CAE24C5.8030007@codemonkey.ws> <4CAE35C5.2010809@codemonkey.ws> <4CAE41BD.2070508@codemonkey.ws> <4CAF255A.1030103@codemonkey.ws> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yehuda Sadeh Weinraub Cc: Kevin Wolf , kvm@vger.kernel.org, qemu-devel@nongnu.org, Sage Weil , ceph-devel@vger.kernel.org, Christian Brunner On 10/08/2010 10:50 AM, Yehuda Sadeh Weinraub wrote: > Oh, that makes it more clean. Considering that we did it for kvm, and > looking at the kvm qemu_bh_schedule() implementation, it does look > thread safe (there might be an issue though with canceling the bh > though, haven't looked at it, not really relevant). It's definitely not thread safe. Even though you can set the flag atomically (not guaranteed, but assume you can), we rely on the fact that we can check for pending BHs before entering sleep without having to worry about new BHs being scheduled in between the sleep and the check. If you schedule a BH in a thread then you open yourself up to the race. Regards, Anthony Liguori