From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=52857 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8YXb-0001Hq-Fe for qemu-devel@nongnu.org; Wed, 20 Oct 2010 09:17:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P8YXa-0002tD-D3 for qemu-devel@nongnu.org; Wed, 20 Oct 2010 09:17:15 -0400 Received: from mail-qw0-f45.google.com ([209.85.216.45]:52673) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P8YXa-0002t9-As for qemu-devel@nongnu.org; Wed, 20 Oct 2010 09:17:14 -0400 Received: by qwh5 with SMTP id 5so2441815qwh.4 for ; Wed, 20 Oct 2010 06:17:14 -0700 (PDT) Message-ID: <4CBEEBC2.1010007@codemonkey.ws> Date: Wed, 20 Oct 2010 08:16:50 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 2/3] Make paio subsystem use threadlets References: <20101019173946.16514.62027.stgit@localhost6.localdomain6> <20101019174320.16514.92329.stgit@localhost6.localdomain6> 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: Stefan Hajnoczi Cc: Arun R Bharadwaj , qemu-devel@nongnu.org On 10/20/2010 04:30 AM, Stefan Hajnoczi wrote: > >> } else if (acb->ret == -EINPROGRESS) { >> active = 1; >> } >> - mutex_unlock(&lock); >> >> if (active) { >> /* fail safe: if the aio could not be canceled, we wait for >> > while (qemu_paio_error(acb) == EINPROGRESS) > ; > > Tight loop with no memory barrier reading a memory location that is > updated by another thread. We shouldn't communicate between threads > without barriers. > We shouldn't use a tight loop period. A condition should be used if signalling is needed. And we shouldn't rely on atomic assignments to communicate between threads. Just use a mutex and avoid being fancier than we need to be. Regards, Anthony Liguori > Stefan > >