Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65F1EC07E95 for ; Fri, 16 Jul 2021 13:24:08 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id E47B261026 for ; Fri, 16 Jul 2021 13:24:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E47B261026 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 44EED4067B; Fri, 16 Jul 2021 15:24:07 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id D28A840151 for ; Fri, 16 Jul 2021 15:24:05 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10046"; a="210718525" X-IronPort-AV: E=Sophos;i="5.84,245,1620716400"; d="scan'208";a="210718525" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2021 06:24:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,245,1620716400"; d="scan'208";a="496728410" Received: from npg_dpdk_virtio_jiayuhu_07.sh.intel.com ([10.67.119.25]) by FMSMGA003.fm.intel.com with ESMTP; 16 Jul 2021 06:24:03 -0700 From: Jiayu Hu To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, chenbo.xia@intel.com, Jiayu Hu Date: Fri, 16 Jul 2021 15:51:26 -0400 Message-Id: <1626465089-17052-1-git-send-email-jiayu.hu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1626162383-89674-2-git-send-email-jiayu.hu@intel.com> References: <1626162383-89674-2-git-send-email-jiayu.hu@intel.com> Subject: [dpdk-dev] [PATCH v5 0/3] provide thread unsafe async registration functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Lock protection is needed during the vhost notifies the application of device readiness, so the first patch adds lock protection. In addition, the second patch reworks async feature structure to improve readability. After performing locking, existed async vhost registration functions will cause deadlock, as they acquire lock too. The last patch provides thread unsafe registration functions to support calling within vhost callback functions. v5: * improve coding style * update commit log, doc and comments * remove useless field async_inorder * change async_threshold from uint16_t to uint32_t v4: * remove brace {} in single statement block v3: * rename and use enum to define async device features * change padding fields to 8 bytes v2: * rework async feature structure * fix typo in commit log Jiayu Hu (3): vhost: fix lock on device readiness notification vhost: rework async configuration structure vhost: add thread unsafe async registeration functions doc/guides/prog_guide/vhost_lib.rst | 35 ++++++-- examples/vhost/main.c | 8 +- lib/vhost/rte_vhost_async.h | 86 ++++++++++++++----- lib/vhost/version.map | 4 + lib/vhost/vhost.c | 162 ++++++++++++++++++++++++++---------- lib/vhost/vhost.h | 3 +- lib/vhost/vhost_user.c | 5 +- 7 files changed, 219 insertions(+), 84 deletions(-) -- 2.7.4