From patchwork Sun Mar 29 14:43:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerin Jacob Kollanukkaran X-Patchwork-Id: 67341 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 99B7AA0562; Sun, 29 Mar 2020 16:49:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7E3D61C0D2; Sun, 29 Mar 2020 16:45:00 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 7C8BF378E for ; Sun, 29 Mar 2020 16:44:59 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02TEe9MM012991; Sun, 29 Mar 2020 07:44:59 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=mON1t5kmJ5IMt6WCkW8I5yHBIU81z11fzPej8rgGIfI=; b=GQlQlxOJvicm9nZj0kcAmrURlPQkooR/DsoG4kZ+rdAF4O3Yqij6+6lfnKHSrVa4MvBQ F896ierWEKlxZuQ97+mtKTGZHez1YREgBF52QjDhRlEvx9zIlellzPemPxB7W9Db7kxX ODSgqZJq8aHV0w6DCR6Acbc8df57lzoOtfRyUAYCLsWNrRYJA2CLkRLc6+r97w0jRnP0 uAUMgO6lwbqLaUSQMv5cYpRc8+9RMzjw7zEhrW7NOSLUxatP1KVazOahjZovNM/EoPM6 NTU9PRWoZbK2y/wlFwdlIKMDr/RN5hfm3PQI5zLJ1+4J/uNxmuNRiCfzldcmps9W1nc3 kw== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 30263kb5kf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 29 Mar 2020 07:44:58 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 29 Mar 2020 07:44:56 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 29 Mar 2020 07:44:55 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sun, 29 Mar 2020 07:44:55 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id B08D53F703F; Sun, 29 Mar 2020 07:44:53 -0700 (PDT) From: To: Jerin Jacob , Sunil Kumar Kori , Bruce Richardson CC: , , , Date: Sun, 29 Mar 2020 20:13:31 +0530 Message-ID: <20200329144342.1543749-23-jerinj@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200329144342.1543749-1-jerinj@marvell.com> References: <20200325211603.240288-1-jerinj@marvell.com> <20200329144342.1543749-1-jerinj@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.645 definitions=2020-03-29_05:2020-03-27, 2020-03-29 signatures=0 Subject: [dpdk-dev] [PATCH v3 22/33] eal/trace: add interrupt tracepoints X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" From: Jerin Jacob Add the following interrupt related tracepoints. rte_trace_lib_eal_intr_callback_register; rte_trace_lib_eal_intr_callback_unregister; rte_trace_lib_eal_intr_enable; rte_trace_lib_eal_intr_disable; Signed-off-by: Jerin Jacob --- .../common/eal_common_trace_points.c | 13 +++ lib/librte_eal/common/include/rte_trace_eal.h | 34 ++++++++ lib/librte_eal/freebsd/eal/eal_interrupts.c | 52 ++++++++---- lib/librte_eal/linux/eal/eal_interrupts.c | 84 ++++++++++++------- lib/librte_eal/rte_eal_version.map | 4 + 5 files changed, 139 insertions(+), 48 deletions(-) diff --git a/lib/librte_eal/common/eal_common_trace_points.c b/lib/librte_eal/common/eal_common_trace_points.c index 2c0b72b5c..7f1a43519 100644 --- a/lib/librte_eal/common/eal_common_trace_points.c +++ b/lib/librte_eal/common/eal_common_trace_points.c @@ -38,6 +38,11 @@ RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_memzone_free); RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_thread_remote_launch); RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_thread_lcore_ready); +RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_intr_callback_register); +RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_intr_callback_unregister); +RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_intr_enable); +RTE_TRACE_POINT_DEFINE(rte_trace_lib_eal_intr_disable); + RTE_INIT(eal_trace_init) { RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_generic_void, @@ -99,4 +104,12 @@ RTE_INIT(eal_trace_init) RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_thread_lcore_ready, lib.eal.thread.lcore.ready, INFO); + RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_intr_callback_register, + lib.eal.intr.register, INFO); + RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_intr_callback_unregister, + lib.eal.intr.unregister, INFO); + RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_intr_enable, + lib.eal.intr.enable, INFO); + RTE_TRACE_POINT_REGISTER(rte_trace_lib_eal_intr_disable, + lib.eal.intr.disable, INFO); } diff --git a/lib/librte_eal/common/include/rte_trace_eal.h b/lib/librte_eal/common/include/rte_trace_eal.h index 8197e198a..7ab7b9659 100644 --- a/lib/librte_eal/common/include/rte_trace_eal.h +++ b/lib/librte_eal/common/include/rte_trace_eal.h @@ -16,6 +16,7 @@ extern "C" { #endif #include +#include #include /* Generic */ @@ -205,6 +206,39 @@ RTE_TRACE_POINT( rte_trace_ctf_u32(lcore_id); rte_trace_ctf_string(cpuset); ) +/* Interrupt */ +RTE_TRACE_POINT( + rte_trace_lib_eal_intr_callback_register, + RTE_TRACE_POINT_ARGS(const struct rte_intr_handle *handle, + rte_intr_callback_fn cb, void *cb_arg, int rc), + rte_trace_ctf_int(rc); rte_trace_ctf_int(handle->vfio_dev_fd); + rte_trace_ctf_int(handle->fd); rte_trace_ctf_int(handle->type); + rte_trace_ctf_u32(handle->max_intr); rte_trace_ctf_u32(handle->nb_efd); + rte_trace_ctf_ptr(cb); rte_trace_ctf_ptr(cb_arg); +) +RTE_TRACE_POINT( + rte_trace_lib_eal_intr_callback_unregister, + RTE_TRACE_POINT_ARGS(const struct rte_intr_handle *handle, + rte_intr_callback_fn cb, void *cb_arg, int rc), + rte_trace_ctf_int(rc); rte_trace_ctf_int(handle->vfio_dev_fd); + rte_trace_ctf_int(handle->fd); rte_trace_ctf_int(handle->type); + rte_trace_ctf_u32(handle->max_intr); rte_trace_ctf_u32(handle->nb_efd); + rte_trace_ctf_ptr(cb); rte_trace_ctf_ptr(cb_arg); +) +RTE_TRACE_POINT( + rte_trace_lib_eal_intr_enable, + RTE_TRACE_POINT_ARGS(const struct rte_intr_handle *handle, int rc), + rte_trace_ctf_int(rc); rte_trace_ctf_int(handle->vfio_dev_fd); + rte_trace_ctf_int(handle->fd); rte_trace_ctf_int(handle->type); + rte_trace_ctf_u32(handle->max_intr); rte_trace_ctf_u32(handle->nb_efd); +) +RTE_TRACE_POINT( + rte_trace_lib_eal_intr_disable, + RTE_TRACE_POINT_ARGS(const struct rte_intr_handle *handle, int rc), + rte_trace_ctf_int(rc); rte_trace_ctf_int(handle->vfio_dev_fd); + rte_trace_ctf_int(handle->fd); rte_trace_ctf_int(handle->type); + rte_trace_ctf_u32(handle->max_intr); rte_trace_ctf_u32(handle->nb_efd); +) #ifdef __cplusplus } diff --git a/lib/librte_eal/freebsd/eal/eal_interrupts.c b/lib/librte_eal/freebsd/eal/eal_interrupts.c index 7def3189b..71f3189ff 100644 --- a/lib/librte_eal/freebsd/eal/eal_interrupts.c +++ b/lib/librte_eal/freebsd/eal/eal_interrupts.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "eal_private.h" #include "eal_alarm_private.h" @@ -182,6 +183,7 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle, goto fail; } } + rte_trace_lib_eal_intr_callback_register(intr_handle, cb, cb_arg, ret); rte_spinlock_unlock(&intr_lock); return 0; @@ -196,6 +198,7 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle, } } free(callback); + rte_trace_lib_eal_intr_callback_register(intr_handle, cb, cb_arg, ret); rte_spinlock_unlock(&intr_lock); return ret; } @@ -335,6 +338,8 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle, } } out: + rte_trace_lib_eal_intr_callback_unregister(intr_handle, cb_fn, + cb_arg, ret); rte_spinlock_unlock(&intr_lock); return ret; @@ -343,55 +348,68 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle, int rte_intr_enable(const struct rte_intr_handle *intr_handle) { - if (intr_handle && intr_handle->type == RTE_INTR_HANDLE_VDEV) - return 0; + int rc = 0; - if (!intr_handle || intr_handle->fd < 0 || intr_handle->uio_cfg_fd < 0) - return -1; + if (intr_handle && intr_handle->type == RTE_INTR_HANDLE_VDEV) { + rc = 0; goto out; + } + + if (!intr_handle || intr_handle->fd < 0 || + intr_handle->uio_cfg_fd < 0) { + rc = -1; goto out; + } switch (intr_handle->type) { /* not used at this moment */ case RTE_INTR_HANDLE_ALARM: - return -1; + rc = -1; break; /* not used at this moment */ case RTE_INTR_HANDLE_DEV_EVENT: - return -1; + rc = -1; break; /* unknown handle type */ default: RTE_LOG(ERR, EAL, "Unknown handle type of fd %d\n", intr_handle->fd); - return -1; + rc = -1; break; } - return 0; +out: + rte_trace_lib_eal_intr_enable(intr_handle, rc); + return rc; } int rte_intr_disable(const struct rte_intr_handle *intr_handle) { - if (intr_handle && intr_handle->type == RTE_INTR_HANDLE_VDEV) - return 0; + int rc = 0; - if (!intr_handle || intr_handle->fd < 0 || intr_handle->uio_cfg_fd < 0) - return -1; + if (intr_handle && intr_handle->type == RTE_INTR_HANDLE_VDEV) { + rc = 0; goto out; + } + + if (!intr_handle || intr_handle->fd < 0 || + intr_handle->uio_cfg_fd < 0) { + rc = -1; goto out; + } switch (intr_handle->type) { /* not used at this moment */ case RTE_INTR_HANDLE_ALARM: - return -1; + rc = -1; break; /* not used at this moment */ case RTE_INTR_HANDLE_DEV_EVENT: - return -1; + rc = -1; break; /* unknown handle type */ default: RTE_LOG(ERR, EAL, "Unknown handle type of fd %d\n", intr_handle->fd); - return -1; + rc = -1; break; } - - return 0; +out: + rte_trace_lib_eal_intr_disable(intr_handle, rc); + return rc; } int diff --git a/lib/librte_eal/linux/eal/eal_interrupts.c b/lib/librte_eal/linux/eal/eal_interrupts.c index cb8e10709..20e9cb35e 100644 --- a/lib/librte_eal/linux/eal/eal_interrupts.c +++ b/lib/librte_eal/linux/eal/eal_interrupts.c @@ -34,6 +34,7 @@ #include #include #include +#include #include "eal_private.h" #include "eal_vfio.h" @@ -539,8 +540,9 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle, */ if (wake_thread) if (write(intr_pipe.writefd, "1", 1) < 0) - return -EPIPE; + ret = -EPIPE; + rte_trace_lib_eal_intr_callback_register(intr_handle, cb, cb_arg, ret); return ret; } @@ -656,63 +658,74 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle, ret = -EPIPE; } + rte_trace_lib_eal_intr_callback_unregister(intr_handle, cb_fn, + cb_arg, ret); return ret; } int rte_intr_enable(const struct rte_intr_handle *intr_handle) { - if (intr_handle && intr_handle->type == RTE_INTR_HANDLE_VDEV) - return 0; + int rc = 0; - if (!intr_handle || intr_handle->fd < 0 || intr_handle->uio_cfg_fd < 0) - return -1; + if (intr_handle && intr_handle->type == RTE_INTR_HANDLE_VDEV) { + rc = 0; goto out; + } + + if (!intr_handle || intr_handle->fd < 0 || + intr_handle->uio_cfg_fd < 0) { + rc = -1; goto out; + } switch (intr_handle->type){ /* write to the uio fd to enable the interrupt */ case RTE_INTR_HANDLE_UIO: if (uio_intr_enable(intr_handle)) - return -1; + rc = -1; break; case RTE_INTR_HANDLE_UIO_INTX: if (uio_intx_intr_enable(intr_handle)) - return -1; + rc = -1; break; /* not used at this moment */ case RTE_INTR_HANDLE_ALARM: - return -1; + rc = -1; + break; #ifdef VFIO_PRESENT case RTE_INTR_HANDLE_VFIO_MSIX: if (vfio_enable_msix(intr_handle)) - return -1; + rc = -1; break; case RTE_INTR_HANDLE_VFIO_MSI: if (vfio_enable_msi(intr_handle)) - return -1; + rc = -1; break; case RTE_INTR_HANDLE_VFIO_LEGACY: if (vfio_enable_intx(intr_handle)) - return -1; + rc = -1; break; #ifdef HAVE_VFIO_DEV_REQ_INTERFACE case RTE_INTR_HANDLE_VFIO_REQ: if (vfio_enable_req(intr_handle)) - return -1; + rc = -1; break; #endif #endif /* not used at this moment */ case RTE_INTR_HANDLE_DEV_EVENT: - return -1; + rc = -1; + break; /* unknown handle type */ default: RTE_LOG(ERR, EAL, "Unknown handle type of fd %d\n", intr_handle->fd); - return -1; + rc = -1; + break; } - - return 0; +out: + rte_trace_lib_eal_intr_enable(intr_handle, rc); + return rc; } /** @@ -778,57 +791,66 @@ rte_intr_ack(const struct rte_intr_handle *intr_handle) int rte_intr_disable(const struct rte_intr_handle *intr_handle) { - if (intr_handle && intr_handle->type == RTE_INTR_HANDLE_VDEV) - return 0; + int rc = 0; - if (!intr_handle || intr_handle->fd < 0 || intr_handle->uio_cfg_fd < 0) - return -1; + if (intr_handle && intr_handle->type == RTE_INTR_HANDLE_VDEV) { + rc = 0; goto out; + } + + if (!intr_handle || intr_handle->fd < 0 || + intr_handle->uio_cfg_fd < 0) { + rc = -1; goto out; + } switch (intr_handle->type){ /* write to the uio fd to disable the interrupt */ case RTE_INTR_HANDLE_UIO: if (uio_intr_disable(intr_handle)) - return -1; + rc = -1; break; case RTE_INTR_HANDLE_UIO_INTX: if (uio_intx_intr_disable(intr_handle)) - return -1; + rc = -1; break; /* not used at this moment */ case RTE_INTR_HANDLE_ALARM: - return -1; + rc = -1; + break; #ifdef VFIO_PRESENT case RTE_INTR_HANDLE_VFIO_MSIX: if (vfio_disable_msix(intr_handle)) - return -1; + rc = -1; break; case RTE_INTR_HANDLE_VFIO_MSI: if (vfio_disable_msi(intr_handle)) - return -1; + rc = -1; break; case RTE_INTR_HANDLE_VFIO_LEGACY: if (vfio_disable_intx(intr_handle)) - return -1; + rc = -1; break; #ifdef HAVE_VFIO_DEV_REQ_INTERFACE case RTE_INTR_HANDLE_VFIO_REQ: if (vfio_disable_req(intr_handle)) - return -1; + rc = -1; break; #endif #endif /* not used at this moment */ case RTE_INTR_HANDLE_DEV_EVENT: - return -1; + rc = -1; + break; /* unknown handle type */ default: RTE_LOG(ERR, EAL, "Unknown handle type of fd %d\n", intr_handle->fd); - return -1; + rc = -1; + break; } - - return 0; +out: + rte_trace_lib_eal_intr_disable(intr_handle, rc); + return rc; } static int diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index afaf16689..2ea9dcf99 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -393,4 +393,8 @@ EXPERIMENTAL { __rte_trace_lib_eal_memzone_free; __rte_trace_lib_eal_thread_remote_launch; __rte_trace_lib_eal_thread_lcore_ready; + __rte_trace_lib_eal_intr_callback_register; + __rte_trace_lib_eal_intr_callback_unregister; + __rte_trace_lib_eal_intr_enable; + __rte_trace_lib_eal_intr_disable; };