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 DE6EAA0C43; Sat, 23 Oct 2021 01:34:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3E1E541144; Sat, 23 Oct 2021 01:33:58 +0200 (CEST) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by mails.dpdk.org (Postfix) with ESMTP id B7C8B40150 for ; Sat, 23 Oct 2021 01:33:56 +0200 (CEST) Received: by mail-lf1-f44.google.com with SMTP id br29so2673183lfb.7 for ; Fri, 22 Oct 2021 16:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rzNkB8cSjbd8fJN/yeY+TVwDO3ovWgZ+AenkjusPs0s=; b=cU9dsq6m2LV9rYRWdWSHTZh/3VENQRQJFNP4OW4+6sOn+yKY1QGucBUn+A+9IIOwNi QMpMTvOQywbgw8Zq3BxMER1fahzu57pT0caxeXzw05nwlD+grnu/ZYIdoDEnpvESbFxX GbwXlUrtrhbFo2+HQX0lAqKS7Kt1KnVB48iaM+JRoMViQqOufnit9ysrF8HVn21Ea/wI f/Q2Q/YakOY5afBJPKsa+RPPj8sBEO5wnrUe1sfjrRZf91DKTfpzzEyCBlHkK6nStd4F HmKwzliKn2PH3NhdP/5HpKo4jYDiFFBc4BC+BJpnnUwBUrYmJ3jcC+Y2pUrwhsN2f0Ac cYYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rzNkB8cSjbd8fJN/yeY+TVwDO3ovWgZ+AenkjusPs0s=; b=gymtuRCLBR5fkjRR71az36MzRhKgoSDCE2GZhdgM62ixkYEI9RYAtS9qHNjoLSE24P we5C6XUMNFAm1ui75Fzsl5QujXEf/nQjO0R2p+UWwhdKpWXHymwLtJXmb4vqV+rR2shi E32pUFo88iPOr6jGFjINCo5VR9Vtyr9ln/jaReEDECD4N2CN6vceDkfKjCdIhy7HW5Ga /9a/baJTFs0InypEPwmv9oAGjsjhm1XN5EzaUsB4uamoli/fi6v3MTSuCRKBjYEmu7BG ob5Rcdsr6mPs7bXtIDBKYmtJOwegrLI1ywhOVkzVroM/WX1GdZSkvWNjHnZ+gpH0sxAH kj/A== X-Gm-Message-State: AOAM5321u0a2OzUAb89/I+5Gm4g3MWfUzbEcuaJu30Zpw3H+8/KjN7wp d8fEVZg5e1EkAmgDkliK9B8= X-Google-Smtp-Source: ABdhPJzRbj760Jgl2tMkDxQHkNATo8SZj00D2RN15LhaHhS5h7GR2VhcvvnixtP0QCRcqmg9JPpZyg== X-Received: by 2002:a05:6512:3d88:: with SMTP id k8mr2593112lfv.114.1634945636408; Fri, 22 Oct 2021 16:33:56 -0700 (PDT) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id r26sm857899lfm.237.2021.10.22.16.33.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 16:33:56 -0700 (PDT) Date: Sat, 23 Oct 2021 02:33:55 +0300 From: Dmitry Kozlyuk To: Harman Kalra Cc: , Bruce Richardson , , , Message-ID: <20211023023355.24e64770@sovereign> In-Reply-To: <20211022204934.132186-7-hkalra@marvell.com> References: <20210826145726.102081-1-hkalra@marvell.com> <20211022204934.132186-1-hkalra@marvell.com> <20211022204934.132186-7-hkalra@marvell.com> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v5 6/6] eal/alarm: introduce alarm fini routine 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" 2021-10-23 02:19 (UTC+0530), Harman Kalra: > Implementing alarm cleanup routine, where the memory allocated > for interrupt instance can be freed. > > Signed-off-by: Harman Kalra > --- > lib/eal/common/eal_private.h | 11 +++++++++++ > lib/eal/freebsd/eal.c | 1 + > lib/eal/freebsd/eal_alarm.c | 7 +++++++ > lib/eal/linux/eal.c | 1 + > lib/eal/linux/eal_alarm.c | 7 +++++++ > 5 files changed, 27 insertions(+) > > diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h > index 86dab1f057..7fb9bc1324 100644 > --- a/lib/eal/common/eal_private.h > +++ b/lib/eal/common/eal_private.h > @@ -163,6 +163,17 @@ int rte_eal_intr_init(void); > */ > int rte_eal_alarm_init(void); > > +/** > + * Init alarm mechanism. This is to allow a callback be called after > + * specific time. > + * > + * This function is private to EAL. > + * > + * @return > + * 0 on success, negative on error > + */ > +void rte_eal_alarm_fini(void); > + The description should say the opposite. > /** > * Function is to check if the kernel module(like, vfio, vfio_iommu_type1, > * etc.) loaded. > diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c > index 56a60f13e9..535ea687ca 100644 > --- a/lib/eal/freebsd/eal.c > +++ b/lib/eal/freebsd/eal.c > @@ -977,6 +977,7 @@ rte_eal_cleanup(void) > rte_eal_memory_detach(); > rte_trace_save(); > eal_trace_fini(); > + rte_eal_alarm_fini(); Alarms are initialized after tracing, so they should be finalized after. > eal_cleanup_config(internal_conf); > return 0; > } > diff --git a/lib/eal/freebsd/eal_alarm.c b/lib/eal/freebsd/eal_alarm.c > index 1f2ea58175..cf706f609f 100644 > --- a/lib/eal/freebsd/eal_alarm.c > +++ b/lib/eal/freebsd/eal_alarm.c > @@ -46,6 +46,13 @@ static rte_spinlock_t alarm_list_lk = RTE_SPINLOCK_INITIALIZER; > static struct rte_intr_handle *intr_handle; > static void eal_alarm_callback(void *arg); > > +void > +rte_eal_alarm_fini(void) > +{ > + if (intr_handle) > + rte_intr_instance_free(intr_handle); > +} > + > int > rte_eal_alarm_init(void) > { > diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c > index 0d0fc66668..806158f297 100644 > --- a/lib/eal/linux/eal.c > +++ b/lib/eal/linux/eal.c > @@ -1370,6 +1370,7 @@ rte_eal_cleanup(void) > rte_eal_memory_detach(); > rte_trace_save(); > eal_trace_fini(); > + rte_eal_alarm_fini(); Likewise. > eal_cleanup_config(internal_conf); > return 0; > } > diff --git a/lib/eal/linux/eal_alarm.c b/lib/eal/linux/eal_alarm.c > index 3d4307686c..c3a3c943a8 100644 > --- a/lib/eal/linux/eal_alarm.c > +++ b/lib/eal/linux/eal_alarm.c > @@ -58,6 +58,13 @@ static struct rte_intr_handle *intr_handle; > static int handler_registered = 0; > static void eal_alarm_callback(void *arg); > > +void > +rte_eal_alarm_fini(void) > +{ > + if (intr_handle) > + rte_intr_instance_free(intr_handle); > +} > + > int > rte_eal_alarm_init(void) > { That being fixed, Acked-by: Dmitry Kozlyuk