From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [Qemu-devel] [PATCH] ceph/rbd block driver for qemu-kvm (v4) Date: Fri, 08 Oct 2010 11:05:14 -0500 Message-ID: <4CAF413A.1000407@codemonkey.ws> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Sage Weil , Kevin Wolf , kvm@vger.kernel.org, qemu-devel@nongnu.org, ceph-devel@vger.kernel.org, Christian Brunner To: Yehuda Sadeh Weinraub Return-path: In-Reply-To: Sender: ceph-devel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org 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