From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 49886A0C4E; Tue, 2 Nov 2021 08:53:49 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BEFE74069F; Tue, 2 Nov 2021 08:53:48 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 587674068F for ; Tue, 2 Nov 2021 08:53:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635839626; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gsGXuJZ16ozoJwP0xQ3arHpwkOaPrINFFL2RqlKkUIg=; b=CsD8idj08PyNDO5DnV37TGadxAKFyCRhJN/tJEchrTPOMqoNXQHnJ/bvy8+M5NAVDhnalF z69+o+uTxDl2v8nze2AsuxRexG9KMuFJ0VZbw6r0GLPmNNJ4KY71B5e0oMWpyxwjFC9O0s BrmSYwcUEx8reY8ydwXOYtSfyY5aFkc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-321-k6ah46l5PJGhoImDE2_u7Q-1; Tue, 02 Nov 2021 03:53:43 -0400 X-MC-Unique: k6ah46l5PJGhoImDE2_u7Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 95C2980668E; Tue, 2 Nov 2021 07:53:42 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47B1B5C1BB; Tue, 2 Nov 2021 07:53:41 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: yux.jiang@intel.com, Harman Kalra Date: Tue, 2 Nov 2021 08:52:58 +0100 Message-Id: <20211102075259.3392-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-dev] [PATCH] eal: fix device hotplug 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" The device event interrupt handler was always freed. Bugzilla ID: 845 Fixes: c2bd9367e18f ("lib: remove direct access to interrupt handle") Signed-off-by: David Marchand --- lib/eal/linux/eal_dev.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c index 06820a3666..925cdba553 100644 --- a/lib/eal/linux/eal_dev.c +++ b/lib/eal/linux/eal_dev.c @@ -317,10 +317,12 @@ rte_dev_event_monitor_start(void) goto exit; } - if (rte_intr_type_set(intr_handle, RTE_INTR_HANDLE_DEV_EVENT)) + ret = rte_intr_type_set(intr_handle, RTE_INTR_HANDLE_DEV_EVENT); + if (ret) goto exit; - if (rte_intr_fd_set(intr_handle, -1)) + ret = rte_intr_fd_set(intr_handle, -1); + if (ret) goto exit; ret = dev_uev_socket_fd_create(); @@ -339,7 +341,10 @@ rte_dev_event_monitor_start(void) monitor_refcount++; exit: - rte_intr_instance_free(intr_handle); + if (ret) { + rte_intr_instance_free(intr_handle); + intr_handle = NULL; + } rte_rwlock_write_unlock(&monitor_lock); return ret; } @@ -370,6 +375,7 @@ rte_dev_event_monitor_stop(void) close(rte_intr_fd_get(intr_handle)); rte_intr_instance_free(intr_handle); + intr_handle = NULL; monitor_refcount--; -- 2.23.0