From patchwork Thu Jul 5 15:16:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 169208 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 976492C020E for ; Fri, 6 Jul 2012 01:17:41 +1000 (EST) Received: from localhost ([::1]:53381 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SmnoJ-0001ui-8p for incoming@patchwork.ozlabs.org; Thu, 05 Jul 2012 11:17:39 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Smnns-0001Jz-VP for qemu-devel@nongnu.org; Thu, 05 Jul 2012 11:17:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Smnni-0001x1-2G for qemu-devel@nongnu.org; Thu, 05 Jul 2012 11:17:12 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:36068) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Smnnh-0001wK-Pd for qemu-devel@nongnu.org; Thu, 05 Jul 2012 11:17:01 -0400 Received: by pbbro12 with SMTP id ro12so14161944pbb.4 for ; Thu, 05 Jul 2012 08:16:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=QLWLUGMa2CNbrlKg+x2LHyCSaBY/b1hjnVLLEeGq+Og=; b=Du4QVUCM1972SOOix365RMgysdEgsZvR5rLVWP4bMQzbnMEl3CS3G9l1IhG/1NykaS nIovPVplQnjd1hm4nWjfSNgGN4WF35avhrQGB76UVF3N8bdimdNKYMcCcbjRag8Fb15I PolPezFbRVTn/f7NIekxze60phUuMr7+HwBKOInUXTJQLRQU7DlG0aPFJmauIfCyKd9j 64vngcJ5NGTf9Qdc9/bfnN1Uib7PtsPEggitljCjXJnc865ns6AIQxguTR7SGyF9yb9s 6wBhVhLtDU4rXpuSgm3xIG4JOKJ4nHzVVFie81i3UB5hxNdUweiCjRSZFO8bjdRtBiyK qkDw== Received: by 10.68.130.169 with SMTP id of9mr20114896pbb.82.1341501419812; Thu, 05 Jul 2012 08:16:59 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-189-113.ip51.fastwebnet.it. [93.34.189.113]) by mx.google.com with ESMTPS id jv6sm19931888pbc.40.2012.07.05.08.16.55 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 05 Jul 2012 08:16:58 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 5 Jul 2012 17:16:23 +0200 Message-Id: <1341501390-797-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.10.2 In-Reply-To: <1341501390-797-1-git-send-email-pbonzini@redhat.com> References: <1341501390-797-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: kvm@vger.kernel.org, mst@redhat.com, jan.kiszka@siemens.com, mtosatti@redhat.com, avi@redhat.com, anthony.perard@citrix.com, stefano.stabellini@eu.citrix.com Subject: [Qemu-devel] [PATCH uq/master 2/9] event_notifier: remove event_notifier_test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This is broken; since the eventfd is used in nonblocking mode there is a race between reading and writing. Signed-off-by: Paolo Bonzini --- event_notifier.c | 15 --------------- event_notifier.h | 1 - 2 files changed, 16 deletions(-) diff --git a/event_notifier.c b/event_notifier.c index 2b210f4..c339bfe 100644 --- a/event_notifier.c +++ b/event_notifier.c @@ -51,18 +51,3 @@ int event_notifier_test_and_clear(EventNotifier *e) int r = read(e->fd, &value, sizeof(value)); return r == sizeof(value); } - -int event_notifier_test(EventNotifier *e) -{ - 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. - * If we didn't we'd get EAGAIN on overflow - * and we'd have to write code to ignore it. */ - assert(s == sizeof(value)); - } - return r == sizeof(value); -} diff --git a/event_notifier.h b/event_notifier.h index efca852..9b2edf4 100644 --- a/event_notifier.h +++ b/event_notifier.h @@ -24,6 +24,5 @@ void event_notifier_cleanup(EventNotifier *); int event_notifier_get_fd(EventNotifier *); int event_notifier_set(EventNotifier *); int event_notifier_test_and_clear(EventNotifier *); -int event_notifier_test(EventNotifier *); #endif