From patchwork Fri Jul 15 13:12:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatoly Burakov X-Patchwork-Id: 113985 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9431DA0032; Fri, 15 Jul 2022 15:13:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 583FF40696; Fri, 15 Jul 2022 15:13:22 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id CBF7240696 for ; Fri, 15 Jul 2022 15:13:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657890799; x=1689426799; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=h77i2d7CtD3Vs/vdrLhOOL0sTuGrEcf8SUYINxmxwlE=; b=NF3a5QAwfg3BGYnzh9nf0+jP5cIRQZPlTFZ+hlbCPH+Gr7ZRe5xQ/go5 vm9AYdDZsWhD7+a1IHDRq3MXpxkrtL9vI3kqtJd66sgXR8iPLayhSlBRg DvM2hepv/1Fp6G1Kc6fqBtVTz2h70VCULpS68nYQA+e4dcANDsTwm8KpS i6mpJM+9yDGNrMksuVbIjuvpRFs5CQG0kkZqx6k6mAuta+o3AhkpXkGAJ Ze4k7ArfS7/4TZxakp7nNuadzbcMTH1iJ9UzPyLorovq6JQAt6GT89HTM NzJmQV4VBDj/kMA0Vb0n6T9C3cJyoIsEW9VmIUM1r6/4QoUeuTYNXq+1J A==; X-IronPort-AV: E=McAfee;i="6400,9594,10408"; a="347467266" X-IronPort-AV: E=Sophos;i="5.92,274,1650956400"; d="scan'208";a="347467266" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2022 06:13:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,274,1650956400"; d="scan'208";a="685956357" Received: from silpixa00401191.ir.intel.com ([10.55.128.75]) by FMSMGA003.fm.intel.com with ESMTP; 15 Jul 2022 06:13:00 -0700 From: Anatoly Burakov To: dev@dpdk.org Subject: [20.11 PATCH v1 2/2] eal: add cpuset lcore telemetry entries Date: Fri, 15 Jul 2022 13:12:54 +0000 Message-Id: <3f66bf233f9f1ef28c93ca22fa0972491b36c3e8.1657890738.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 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 Expose per-lcore cpuset information to telemetry. Signed-off-by: Anatoly Burakov --- .../common/eal_common_lcore_telemetry.c | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/lib/librte_eal/common/eal_common_lcore_telemetry.c b/lib/librte_eal/common/eal_common_lcore_telemetry.c index 5e4ea15ff5..39fffe2b93 100644 --- a/lib/librte_eal/common/eal_common_lcore_telemetry.c +++ b/lib/librte_eal/common/eal_common_lcore_telemetry.c @@ -19,6 +19,8 @@ int __rte_lcore_telemetry_enabled; #ifdef RTE_LCORE_BUSYNESS +#include "eal_private.h" + struct lcore_telemetry { int busyness; /**< Calculated busyness (gets set/returned by the API) */ @@ -235,6 +237,48 @@ lcore_handle_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; +} + RTE_INIT(lcore_init_telemetry) { __rte_lcore_telemetry_enabled = true; @@ -249,6 +293,9 @@ RTE_INIT(lcore_init_telemetry) rte_telemetry_register_cmd("/eal/lcore/busyness_disable", lcore_busyness_disable, "disable lcore busyness measurement"); + + rte_telemetry_register_cmd("/eal/lcore/cpuset", lcore_handle_cpuset, + "list physical core affinity for each lcore"); } #else