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 7DE74A0C45; Tue, 19 Oct 2021 01:37:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6EEB2410F4; Tue, 19 Oct 2021 01:37:09 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id C385740E5A for ; Tue, 19 Oct 2021 01:37:04 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19IK0KLX000860; Mon, 18 Oct 2021 16:37:04 -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=pfpt0220; bh=qj3wFFsEkgSuI0KzuHzFZR3qStbgmeVkgDvaxQPx+6E=; b=MxTHXbwMrdF6bpmy/hlFQaJeoop7Occh/73I5CPLD1Z1gMopOZkr8CcP4T7WlUcUg9MD vl9ppbq16BjI50SnFStFoZcGd5zkS3wmBEKDvH1j2X4tib6PsS/71veVC2YFv5o7eW0K LhvMo7tq4cNIN4H1cP+pmmbOa+i1Kxo9jLSw92oDhH3m6csIR5dk60CGc3yxPzQBfLw6 8lr/mDE5weYCMUlFBEJfSshji0ueDQF9Pn16rCmT/SwjB4e4INKvYObwNt7U2JC7X66h DuQZbKGlk4dFqVjY8ANfnFs21DQry9tkYLe4GgcgZdQzPbMU5ZB/XYSmqUotHY55arRw QA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 3bsfk48n1d-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 16:37:04 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 18 Oct 2021 16:37:02 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Mon, 18 Oct 2021 16:37:02 -0700 Received: from BG-LT7430.marvell.com (BG-LT7430.marvell.com [10.28.177.176]) by maili.marvell.com (Postfix) with ESMTP id 9BB783F7043; Mon, 18 Oct 2021 16:37:00 -0700 (PDT) From: To: , Erik Gabriel Carrillo CC: , Pavan Nikhilesh Date: Tue, 19 Oct 2021 05:06:06 +0530 Message-ID: <20211018233610.5694-11-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211018233610.5694-1-pbhagavatula@marvell.com> References: <20211015190221.2160-1-pbhagavatula@marvell.com> <20211018233610.5694-1-pbhagavatula@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: 3w0g5uwzBU9faD1rrnx7nOHFZhgWh4oE X-Proofpoint-GUID: 3w0g5uwzBU9faD1rrnx7nOHFZhgWh4oE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_07,2021-10-18_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH v5 11/14] eventdev: move timer adapters memory to hugepage 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" From: Pavan Nikhilesh Move memory used by timer adapters to hugepage. Allocate memory on the first adapter create or lookup to address both primary and secondary process usecases. This will prevent TLB misses if any and aligns to memory structure of other subsystems. Signed-off-by: Pavan Nikhilesh --- doc/guides/rel_notes/release_21_11.rst | 2 ++ lib/eventdev/rte_event_timer_adapter.c | 36 ++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst index 6442c79977..9694b32002 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -226,6 +226,8 @@ API Changes the crypto/security operation. This field will be used to communicate events such as soft expiry with IPsec in lookaside mode. +* eventdev: Move memory used by timer adapters to hugepage. This will prevent + TLB misses if any and aligns to memory structure of other subsystems. ABI Changes ----------- diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c index ae55407042..894f532ef0 100644 --- a/lib/eventdev/rte_event_timer_adapter.c +++ b/lib/eventdev/rte_event_timer_adapter.c @@ -33,7 +33,7 @@ RTE_LOG_REGISTER_SUFFIX(evtim_logtype, adapter.timer, NOTICE); RTE_LOG_REGISTER_SUFFIX(evtim_buffer_logtype, adapter.timer, NOTICE); RTE_LOG_REGISTER_SUFFIX(evtim_svc_logtype, adapter.timer.svc, NOTICE); -static struct rte_event_timer_adapter adapters[RTE_EVENT_TIMER_ADAPTER_NUM_MAX]; +static struct rte_event_timer_adapter *adapters; static const struct event_timer_adapter_ops swtim_ops; @@ -138,6 +138,17 @@ rte_event_timer_adapter_create_ext( int n, ret; struct rte_eventdev *dev; + if (adapters == NULL) { + adapters = rte_zmalloc("Eventdev", + sizeof(struct rte_event_timer_adapter) * + RTE_EVENT_TIMER_ADAPTER_NUM_MAX, + RTE_CACHE_LINE_SIZE); + if (adapters == NULL) { + rte_errno = ENOMEM; + return NULL; + } + } + if (conf == NULL) { rte_errno = EINVAL; return NULL; @@ -312,6 +323,17 @@ rte_event_timer_adapter_lookup(uint16_t adapter_id) int ret; struct rte_eventdev *dev; + if (adapters == NULL) { + adapters = rte_zmalloc("Eventdev", + sizeof(struct rte_event_timer_adapter) * + RTE_EVENT_TIMER_ADAPTER_NUM_MAX, + RTE_CACHE_LINE_SIZE); + if (adapters == NULL) { + rte_errno = ENOMEM; + return NULL; + } + } + if (adapters[adapter_id].allocated) return &adapters[adapter_id]; /* Adapter is already loaded */ @@ -358,7 +380,7 @@ rte_event_timer_adapter_lookup(uint16_t adapter_id) int rte_event_timer_adapter_free(struct rte_event_timer_adapter *adapter) { - int ret; + int i, ret; ADAPTER_VALID_OR_ERR_RET(adapter, -EINVAL); FUNC_PTR_OR_ERR_RET(adapter->ops->uninit, -EINVAL); @@ -382,6 +404,16 @@ rte_event_timer_adapter_free(struct rte_event_timer_adapter *adapter) adapter->data = NULL; adapter->allocated = 0; + ret = 0; + for (i = 0; i < RTE_EVENT_TIMER_ADAPTER_NUM_MAX; i++) + if (adapters[i].allocated) + ret = adapter[i].allocated; + + if (!ret) { + rte_free(adapters); + adapters = NULL; + } + rte_eventdev_trace_timer_adapter_free(adapter); return 0; } -- 2.17.1