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: 1161211 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id AFDE8DFB7C for ; Thu, 5 Jul 2012 15:17:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933135Ab2GEPRB (ORCPT ); Thu, 5 Jul 2012 11:17:01 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:52063 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932530Ab2GEPRA (ORCPT ); Thu, 5 Jul 2012 11:17:00 -0400 Received: by mail-pb0-f46.google.com with SMTP id rp8so12925038pbb.19 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 Cc: avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org, anthony.perard@citrix.com, jan.kiszka@siemens.com, mst@redhat.com, stefano.stabellini@eu.citrix.com Subject: [PATCH uq/master 2/9] event_notifier: remove event_notifier_test 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> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.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