From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45CF7C05027 for ; Mon, 6 Feb 2023 03:50:37 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6283E41611; Mon, 6 Feb 2023 04:50:36 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id B52AD40A7D for ; Mon, 6 Feb 2023 04:50:34 +0100 (CET) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4P9C2f48STzfYnV; Mon, 6 Feb 2023 11:50:18 +0800 (CST) Received: from [10.67.100.224] (10.67.100.224) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 6 Feb 2023 11:50:33 +0800 Subject: Re: [PATCH v8 1/5] eal: add lcore info in telemetry To: Robin Jarry , CC: =?UTF-8?Q?Morten_Br=c3=b8rup?= , Kevin Laatz References: <20221123102612.1688865-1-rjarry@redhat.com> <20230202134329.539625-1-rjarry@redhat.com> <20230202134329.539625-2-rjarry@redhat.com> From: fengchengwen Message-ID: <72396994-5403-99f9-20a8-9c785dfb2b89@huawei.com> Date: Mon, 6 Feb 2023 11:50:33 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20230202134329.539625-2-rjarry@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.100.224] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected 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 Hi Robin, On 2023/2/2 21:43, Robin Jarry wrote: > Report the same information than rte_lcore_dump() in the telemetry > API into /eal/lcore/list and /eal/lcore/info,ID. > > Example: > > --> /eal/lcore/info,3 > { > "/eal/lcore/info": { > "lcore_id": 3, > "socket": 0, > "role": "RTE", > "cpuset": [ > 3 > ] > } > } > ... > + > +static int > +handle_lcore_info(const char *cmd __rte_unused, const char *params, struct rte_tel_data *d) > +{ > + struct lcore_telemetry_info info = { .d = d }; > + unsigned long lcore_id; > + char *endptr; > + > + if (params == NULL) > + return -EINVAL; > + errno = 0; > + lcore_id = strtoul(params, &endptr, 10); > + if (errno) > + return -errno; > + if (*params == '\0' || *endptr != '\0' || lcore_id >= RTE_MAX_LCORE) > + return -EINVAL; > + > + info.lcore_id = lcore_id; > + > + return rte_lcore_iterate(lcore_telemetry_info_cb, &info); lcore_iterate will iterate and find the lcore. How about add one new API e.g. rte_lcore_cb(xxx) ? > +} > + > +RTE_INIT(lcore_telemetry) > +{ > + rte_telemetry_register_cmd( > + "/eal/lcore/list", handle_lcore_list, > + "List of lcore ids. Takes no parameters"); > + rte_telemetry_register_cmd( > + "/eal/lcore/info", handle_lcore_info, > + "Returns lcore info. Parameters: int lcore_id"); > +} > +#endif /* !RTE_EXEC_ENV_WINDOWS */ >