From patchwork Tue Jun 30 09:20:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huawei Xie X-Patchwork-Id: 5968 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 79B3FC454; Tue, 30 Jun 2015 11:21:19 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id ED192C438 for ; Tue, 30 Jun 2015 11:21:13 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 30 Jun 2015 02:21:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,376,1432623600"; d="scan'208";a="597319125" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 30 Jun 2015 02:21:12 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t5U9LAEc030335; Tue, 30 Jun 2015 17:21:10 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t5U9L7B4003614; Tue, 30 Jun 2015 17:21:09 +0800 Received: (from hxie5@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t5U9L7UJ003610; Tue, 30 Jun 2015 17:21:07 +0800 From: Huawei Xie To: dev@dpdk.org Date: Tue, 30 Jun 2015 17:20:50 +0800 Message-Id: <1435656050-3539-5-git-send-email-huawei.xie@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1435656050-3539-1-git-send-email-huawei.xie@intel.com> References: <1434649260-26317-2-git-send-email-huawei.xie@intel.com> <1435656050-3539-1-git-send-email-huawei.xie@intel.com> Subject: [dpdk-dev] [PATCH v4 4/4] vhost: add comment for potential unwanted callback on listenfds X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" add comment for potential unwanted callback on listenfds v4 changes: add comment for potential unwanted callback on listenfds Signed-off-by: Huawei Xie Acked-by: Changchun Ouyang --- lib/librte_vhost/vhost_user/fd_man.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/librte_vhost/vhost_user/fd_man.c b/lib/librte_vhost/vhost_user/fd_man.c index bd30f8d..d68b270 100644 --- a/lib/librte_vhost/vhost_user/fd_man.c +++ b/lib/librte_vhost/vhost_user/fd_man.c @@ -242,6 +242,13 @@ fdset_event_dispatch(struct fdset *pfdset) pthread_mutex_unlock(&pfdset->fd_mutex); + /* + * When select is blocked, other threads might unregister + * listenfds from and register new listenfds into fdset. + * When select returns, the entries for listenfds in the fdset + * might have been updated. It is ok if there is unwanted call + * for new listenfds. + */ ret = select(maxfds + 1, &rfds, &wfds, NULL, &tv); if (ret <= 0) continue;