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 9F860A0032; Wed, 14 Sep 2022 11:26:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 08BB842B6C; Wed, 14 Sep 2022 11:26:28 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 77E8540151 for ; Wed, 14 Sep 2022 11:26:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663147585; x=1694683585; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=a5TOHRyM7kiYanLRoAXeydND7E87eM1Y+cADkGnpOwo=; b=VJQqqKFblTzZ/+jRsiCv5FUiciARQFwBb1qx0i+GZq6kWosyJCtjmLLF MaC/9ylf1tLzZMwaqDjGS3auEJSIuTydk+TRNSLs2Zjq/kO8XTNbVI9ST qx8r0J8Qy1wntOJmMlgiDARnBALoQxhqnHqmPJwvRXCrBrAHU04vHpV7/ MCU5H89l+5z7VIQfe1gkd3+sPI5HOKiTc/o1Sn3hRVOIXQoxsRh4KPijr KgruZbfx1/AkgdjO19fu9WTLChNgrzSDvhkXbit1mzrT5iMmBTOm3IpnM x3DpldcMiyMi9T+lkKHNDFtnty+zBGVFr9ginq0fc/TkBDnAEuZxdsDFe A==; X-IronPort-AV: E=McAfee;i="6500,9779,10469"; a="384675037" X-IronPort-AV: E=Sophos;i="5.93,315,1654585200"; d="scan'208";a="384675037" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2022 02:26:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,315,1654585200"; d="scan'208";a="612446506" Received: from silpixa00401122.ir.intel.com ([10.237.213.42]) by orsmga007.jf.intel.com with ESMTP; 14 Sep 2022 02:26:22 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: anatoly.burakov@intel.com Subject: [PATCH v7 2/4] eal: add cpuset lcore telemetry entries Date: Wed, 14 Sep 2022 10:29:27 +0100 Message-Id: <20220914092929.1159773-3-kevin.laatz@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220914092929.1159773-1-kevin.laatz@intel.com> References: <24c49429394294cfbf0d9c506b205029bac77c8b.1657890378.git.anatoly.burakov@intel.com> <20220914092929.1159773-1-kevin.laatz@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Anatoly Burakov Expose per-lcore cpuset information to telemetry. Signed-off-by: Anatoly Burakov --- .../common/eal_common_lcore_poll_telemetry.c | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/lib/eal/common/eal_common_lcore_poll_telemetry.c b/lib/eal/common/eal_common_lcore_poll_telemetry.c index d97996e85f..a19d6ccb95 100644 --- a/lib/eal/common/eal_common_lcore_poll_telemetry.c +++ b/lib/eal/common/eal_common_lcore_poll_telemetry.c @@ -19,6 +19,8 @@ rte_atomic32_t __rte_lcore_poll_telemetry_enabled; #ifdef RTE_LCORE_POLL_BUSYNESS +#include "eal_private.h" + struct lcore_poll_telemetry { int poll_busyness; /**< Calculated poll busyness (gets set/returned by the API) */ @@ -247,6 +249,48 @@ lcore_handle_poll_busyness(const char *cmd __rte_unused, return 0; } +static int +lcore_handle_cpuset(const char *cmd __rte_unused, + const char *params __rte_unused, + struct rte_tel_data *d) +{ + char corenum[64]; + int i; + + rte_tel_data_start_dict(d); + + RTE_LCORE_FOREACH(i) { + const struct lcore_config *cfg = &lcore_config[i]; + const rte_cpuset_t *cpuset = &cfg->cpuset; + struct rte_tel_data *ld; + unsigned int cpu; + + if (!rte_lcore_is_enabled(i)) + continue; + + /* create an array of integers */ + ld = rte_tel_data_alloc(); + if (ld == NULL) + return -ENOMEM; + rte_tel_data_start_array(ld, RTE_TEL_INT_VAL); + + /* add cpu ID's from cpuset to the array */ + for (cpu = 0; cpu < CPU_SETSIZE; cpu++) { + if (!CPU_ISSET(cpu, cpuset)) + continue; + rte_tel_data_add_array_int(ld, cpu); + } + + /* add array to the per-lcore container */ + snprintf(corenum, sizeof(corenum), "%d", i); + + /* tell telemetry library to free this array automatically */ + rte_tel_data_add_dict_container(d, corenum, ld, 0); + } + + return 0; +} + void eal_lcore_poll_telemetry_free(void) { @@ -273,6 +317,9 @@ RTE_INIT(lcore_init_poll_telemetry) rte_telemetry_register_cmd("/eal/lcore/poll_busyness_disable", lcore_poll_busyness_disable, "disable lcore poll busyness measurement"); + rte_telemetry_register_cmd("/eal/lcore/cpuset", lcore_handle_cpuset, + "list physical core affinity for each lcore"); + rte_atomic32_set(&__rte_lcore_poll_telemetry_enabled, true); } -- 2.31.1