From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id AE713A034F; Tue, 12 May 2020 17:31:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 735361BFB3; Tue, 12 May 2020 17:31:04 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id D509C1BF98 for ; Tue, 12 May 2020 17:31:01 +0200 (CEST) IronPort-SDR: M20w6EyT/pVXv7X70tpIOEPmz8TiaodVNWCVdbYNAhwFoGxhgHdO4QP7Te75XL3Mk2EBizwFTR EC1rlQYRLRuQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2020 08:31:01 -0700 IronPort-SDR: PJ5tRL5Jp3h3NRdiBVKv9mvuq7E3SYbBgD8+AaeMNXQASbU6ZFnIt9VDoXsCtA9pr/7HrlT3ot Upe934yy4XNQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,384,1583222400"; d="scan'208";a="409336924" Received: from silpixa00399953.ir.intel.com (HELO silpixa00399953.ger.corp.intel.com) ([10.237.222.53]) by orsmga004.jf.intel.com with ESMTP; 12 May 2020 08:30:59 -0700 From: Ciara Power To: bruce.richardson@intel.com Cc: dev@dpdk.org, Ciara Power Date: Tue, 12 May 2020 16:28:58 +0100 Message-Id: <20200512152902.70211-2-ciara.power@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200512152902.70211-1-ciara.power@intel.com> References: <20200512152902.70211-1-ciara.power@intel.com> Subject: [dpdk-dev] [PATCH 1/5] telemetry: keep telemetry threads separate from data plane 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" The threads for listening on the telemetry sockets are control threads and should be separated from those on the data plane. Since telemetry cannot use the rte_ctrl_thread_create() API, as it does not depend on EAL, we pass the ctrl thread cpu_set to telemetry init and use it directly to ensure that telemetry cannot interfere with the data plane threads. Signed-off-by: Ciara Power --- lib/librte_eal/freebsd/eal.c | 3 ++- lib/librte_eal/linux/eal.c | 3 ++- lib/librte_telemetry/rte_telemetry.h | 3 ++- lib/librte_telemetry/telemetry.c | 13 ++++++++----- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c index f681bc7a22..14b52168e2 100644 --- a/lib/librte_eal/freebsd/eal.c +++ b/lib/librte_eal/freebsd/eal.c @@ -958,7 +958,8 @@ rte_eal_init(int argc, char **argv) if (!internal_config.no_telemetry) { const char *error_str; if (rte_telemetry_init(rte_eal_get_runtime_dir(), - &error_str) != 0) { + &internal_config.ctrl_cpuset, &error_str) + != 0) { rte_eal_init_alert(error_str); return -1; } diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c index 6123bb7c46..9620d25444 100644 --- a/lib/librte_eal/linux/eal.c +++ b/lib/librte_eal/linux/eal.c @@ -1296,7 +1296,8 @@ rte_eal_init(int argc, char **argv) if (!internal_config.no_telemetry) { const char *error_str; if (rte_telemetry_init(rte_eal_get_runtime_dir(), - &error_str) != 0) { + &internal_config.ctrl_cpuset, &error_str) + != 0) { rte_eal_init_alert(error_str); return -1; } diff --git a/lib/librte_telemetry/rte_telemetry.h b/lib/librte_telemetry/rte_telemetry.h index 1965affba3..2c3c96cf73 100644 --- a/lib/librte_telemetry/rte_telemetry.h +++ b/lib/librte_telemetry/rte_telemetry.h @@ -250,6 +250,7 @@ rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help); */ __rte_experimental int -rte_telemetry_init(const char *runtime_dir, const char **err_str); +rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset, + const char **err_str); #endif diff --git a/lib/librte_telemetry/telemetry.c b/lib/librte_telemetry/telemetry.c index 56a2fed3f5..7b6f8a79e4 100644 --- a/lib/librte_telemetry/telemetry.c +++ b/lib/librte_telemetry/telemetry.c @@ -341,7 +341,7 @@ create_socket(char *path) } static int -telemetry_legacy_init(const char *runtime_dir) +telemetry_legacy_init(const char *runtime_dir, rte_cpuset_t *cpuset) { pthread_t t_old; @@ -363,12 +363,13 @@ telemetry_legacy_init(const char *runtime_dir) if (v1_socket.sock < 0) return -1; pthread_create(&t_old, NULL, socket_listener, &v1_socket); + pthread_setaffinity_np(t_old, sizeof(*cpuset), cpuset); return 0; } static int -telemetry_v2_init(const char *runtime_dir) +telemetry_v2_init(const char *runtime_dir, rte_cpuset_t *cpuset) { pthread_t t_new; @@ -390,20 +391,22 @@ telemetry_v2_init(const char *runtime_dir) if (v2_socket.sock < 0) return -1; pthread_create(&t_new, NULL, socket_listener, &v2_socket); + pthread_setaffinity_np(t_new, sizeof(*cpuset), cpuset); atexit(unlink_sockets); return 0; } int32_t -rte_telemetry_init(const char *runtime_dir, const char **err_str) +rte_telemetry_init(const char *runtime_dir, rte_cpuset_t *cpuset, + const char **err_str) { - if (telemetry_v2_init(runtime_dir) != 0) { + if (telemetry_v2_init(runtime_dir, cpuset) != 0) { *err_str = telemetry_log_error; printf("Error initialising telemetry - %s\n", *err_str); return -1; } - if (telemetry_legacy_init(runtime_dir) != 0) { + if (telemetry_legacy_init(runtime_dir, cpuset) != 0) { *err_str = telemetry_log_error; printf("No telemetry legacy support - %s\n", *err_str); } -- 2.17.1