From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NxiFH-00042l-JU for qemu-devel@nongnu.org; Fri, 02 Apr 2010 10:53:15 -0400 Received: from [140.186.70.92] (port=43708 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NxiFE-00042R-RC for qemu-devel@nongnu.org; Fri, 02 Apr 2010 10:53:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NxiFD-0003Gw-D5 for qemu-devel@nongnu.org; Fri, 02 Apr 2010 10:53:12 -0400 Received: from ey-out-1920.google.com ([74.125.78.148]:16091) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NxiFD-0003Gm-7N for qemu-devel@nongnu.org; Fri, 02 Apr 2010 10:53:11 -0400 Received: by ey-out-1920.google.com with SMTP id 4so435979eyg.14 for ; Fri, 02 Apr 2010 07:53:10 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4BB604D3.8060704@redhat.com> Date: Fri, 02 Apr 2010 16:53:07 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <42665c8da55a0be2287ed67a8350fe6e3e2a1ab8.1268823114.git.mst@redhat.com> In-Reply-To: <42665c8da55a0be2287ed67a8350fe6e3e2a1ab8.1268823114.git.mst@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCHv6 03/11] notifier: event notifier implementation List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: amit.shah@redhat.com, Juan Quintela , qemu-devel@nongnu.org, kraxel@redhat.com On 03/17/2010 12:07 PM, Michael S. Tsirkin wrote: > +{ > +#ifdef CONFIG_EVENTFD > + int fd = eventfd(!!active, EFD_NONBLOCK | EFD_CLOEXEC); > + uint64_t value; > + int r = read(e->fd,&value, sizeof(value)); > + if (r == sizeof(value)) { > + /* restore previous value. */ > + int s = write(e->fd,&value, sizeof(value)); > + /* never blocks because we use EFD_SEMAPHORE. No, we don't... Also, it seems like this function as it is written now requires blocking operation of the eventfd, otherwise it would not be atomic when another thread calls event_notifier_test_and_clear. Which makes everything more complicated. But after all is unused, maybe it should be zapped? Paolo