DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jianfeng Tan <jianfeng.tan@intel.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, anatoly.burakov@intel.com,
	Jianfeng Tan <jianfeng.tan@intel.com>
Subject: [dpdk-dev] [RFC 3/8] eal/linux: use glibc malloc in alarm
Date: Thu, 19 Apr 2018 15:03:31 +0000	[thread overview]
Message-ID: <1524150216-3407-4-git-send-email-jianfeng.tan@intel.com> (raw)
In-Reply-To: <1524150216-3407-1-git-send-email-jianfeng.tan@intel.com>

We will reply on alarm API for async IPC request as following patch
indicates. rte_malloc could require async IPC request.

To avoid such chicken or the egg causality dilemma, we change to
use glibc malloc in alarm implimentation.

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
 lib/librte_eal/linuxapp/eal/eal_alarm.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_alarm.c b/lib/librte_eal/linuxapp/eal/eal_alarm.c
index c115e82..391d2a6 100644
--- a/lib/librte_eal/linuxapp/eal/eal_alarm.c
+++ b/lib/librte_eal/linuxapp/eal/eal_alarm.c
@@ -19,7 +19,6 @@
 #include <rte_launch.h>
 #include <rte_lcore.h>
 #include <rte_errno.h>
-#include <rte_malloc.h>
 #include <rte_spinlock.h>
 #include <eal_private.h>
 
@@ -91,7 +90,7 @@ eal_alarm_callback(void *arg __rte_unused)
 		rte_spinlock_lock(&alarm_list_lk);
 
 		LIST_REMOVE(ap, next);
-		rte_free(ap);
+		free(ap);
 	}
 
 	if (!LIST_EMPTY(&alarm_list)) {
@@ -122,7 +121,7 @@ rte_eal_alarm_set(uint64_t us, rte_eal_alarm_callback cb_fn, void *cb_arg)
 	if (us < 1 || us > (UINT64_MAX - US_PER_S) || cb_fn == NULL)
 		return -EINVAL;
 
-	new_alarm = rte_zmalloc(NULL, sizeof(*new_alarm), 0);
+	new_alarm = calloc(1, sizeof(*new_alarm));
 	if (new_alarm == NULL)
 		return -ENOMEM;
 
@@ -196,7 +195,7 @@ rte_eal_alarm_cancel(rte_eal_alarm_callback cb_fn, void *cb_arg)
 
 			if (ap->executing == 0) {
 				LIST_REMOVE(ap, next);
-				rte_free(ap);
+				free(ap);
 				count++;
 			} else {
 				/* If calling from other context, mark that alarm is executing
@@ -220,7 +219,7 @@ rte_eal_alarm_cancel(rte_eal_alarm_callback cb_fn, void *cb_arg)
 
 				if (ap->executing == 0) {
 					LIST_REMOVE(ap, next);
-					rte_free(ap);
+					free(ap);
 					count++;
 					ap = ap_prev;
 				} else if (pthread_equal(ap->executing_id, pthread_self()) == 0)
-- 
2.7.4

  parent reply	other threads:[~2018-04-19 15:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-19 15:03 [dpdk-dev] [RFC 0/8] remove IPC threads Jianfeng Tan
2018-04-19 15:03 ` [dpdk-dev] [RFC 1/8] ipc: clearn up code Jianfeng Tan
2018-04-19 15:03 ` [dpdk-dev] [RFC 2/8] ipc: fix timeout not properly handled in async Jianfeng Tan
2018-04-19 15:03 ` Jianfeng Tan [this message]
2018-04-19 15:03 ` [dpdk-dev] [RFC 4/8] ipc: remove IPC thread for async request Jianfeng Tan
2018-04-20  9:03   ` Burakov, Anatoly
2018-04-19 15:03 ` [dpdk-dev] [RFC 5/8] eal/linux: use glibc malloc in interrupt handling Jianfeng Tan
2018-04-19 15:03 ` [dpdk-dev] [RFC 6/8] eal: bring forward init of " Jianfeng Tan
2018-04-19 15:03 ` [dpdk-dev] [RFC 7/8] eal: add IPC type for interrupt thread Jianfeng Tan
2018-04-19 15:03 ` [dpdk-dev] [RFC 8/8] ipc: remove IPC thread for message read Jianfeng Tan
2018-04-19 15:22 ` [dpdk-dev] [RFC 0/8] remove IPC threads Thomas Monjalon
2018-05-31 10:12 ` [dpdk-dev] [RFC v2 0/6] Remove " Anatoly Burakov
2018-05-31 10:12 ` [dpdk-dev] [RFC v2 1/6] eal/linux: use glibc malloc in alarm Anatoly Burakov
2018-05-31 10:12 ` [dpdk-dev] [RFC v2 2/6] ipc: remove IPC thread for async requests Anatoly Burakov
2018-05-31 10:12 ` [dpdk-dev] [RFC v2 3/6] eal/linux: use glibc malloc in interrupt handling Anatoly Burakov
2018-05-31 10:12 ` [dpdk-dev] [RFC v2 4/6] eal: bring forward init of " Anatoly Burakov
2018-05-31 10:12 ` [dpdk-dev] [RFC v2 5/6] eal: add IPC type for interrupt thread Anatoly Burakov
2018-05-31 10:12 ` [dpdk-dev] [RFC v2 6/6] ipc: remove main IPC thread Anatoly Burakov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1524150216-3407-4-git-send-email-jianfeng.tan@intel.com \
    --to=jianfeng.tan@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).