From patchwork Wed Feb 10 23:09:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 78596 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1AN9gDl006142 for ; Wed, 10 Feb 2010 23:09:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755863Ab0BJXJf (ORCPT ); Wed, 10 Feb 2010 18:09:35 -0500 Received: from mail-fx0-f220.google.com ([209.85.220.220]:39277 "EHLO mail-fx0-f220.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755851Ab0BJXJa (ORCPT ); Wed, 10 Feb 2010 18:09:30 -0500 Received: by mail-fx0-f220.google.com with SMTP id 20so603555fxm.21 for ; Wed, 10 Feb 2010 15:09:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:from:to:cc:subject :date:message-id:x-mailer:in-reply-to:references; bh=0BT+0x7WQVSI4+WPE1aMKdpmajipf71xE0a4KGD8tCA=; b=OX+nRk/U7mPDSMGM1hs61K5A8ov1+u1cGD2ZrXjh+xMkyAc+fppqFgsEgFlRrA8ied F1pJ1rFOBgXoiF10nTmwz22YjFLgGcW4OLZ6FwIVK7Sg91UJikEoXGZ7hv9toHQ3NUM1 TkjSTH21D6yLLbeJxdrIEZIwMM1V4oXzaaCi0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; b=mERJ+Z5yPqE9sTnB+rnsP5Iftrmq0FxhLqdPE/8Qq0GYZJW3NFyoo0pcKEo4mIMWXn m/ICoZKtbibhRlWcamTvJGm/m12iGgC92Xq9/R7EX+Az9kXAIZDXtZtXjEe22mbhkfzG VaLvnruEGmyIlunheoatE0DlNaeyDa8yDN68g= Received: by 10.223.17.92 with SMTP id r28mr452897faa.91.1265843368700; Wed, 10 Feb 2010 15:09:28 -0800 (PST) Received: from localhost.localdomain ([85.93.118.17]) by mx.google.com with ESMTPS id 18sm2839148fks.34.2010.02.10.15.09.27 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 10 Feb 2010 15:09:28 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org Subject: [PATCH 2/4] qemu-kvm: morph io_thread_wakeup into qemu.git's qemu_event_read Date: Thu, 11 Feb 2010 00:09:14 +0100 Message-Id: <1265843356-25765-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.6.6 In-Reply-To: <1265843356-25765-1-git-send-email-pbonzini@redhat.com> References: <1265843356-25765-1-git-send-email-pbonzini@redhat.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 10 Feb 2010 23:09:43 +0000 (UTC) diff --git a/qemu-kvm.c b/qemu-kvm.c index 669a784..50e1303 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -2049,19 +2049,13 @@ static void sigfd_handler(void *opaque) static void io_thread_wakeup(void *opaque) { int fd = (unsigned long) opaque; - char buffer[4096]; - - /* Drain the pipe/(eventfd) */ - while (1) { - ssize_t len; + ssize_t len; + char buffer[512]; + /* Drain the notify pipe. For eventfd, only 8 bytes will be read. */ + do { len = read(fd, buffer, sizeof(buffer)); - if (len == -1 && errno == EINTR) - continue; - - if (len <= 0) - break; - } + } while ((len == -1 && errno == EINTR) || len == sizeof(buffer)); } int kvm_main_loop(void)