From patchwork Tue Sep 6 16:13:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 115985 X-Patchwork-Delegate: david.marchand@redhat.com 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 471DDA0542; Tue, 6 Sep 2022 18:17:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A6B0F42802; Tue, 6 Sep 2022 18:16:39 +0200 (CEST) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10086.outbound.protection.outlook.com [40.107.1.86]) by mails.dpdk.org (Postfix) with ESMTP id 75AB1427F6 for ; Tue, 6 Sep 2022 18:16:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P5z9rlUrfmJ8Ki/tsZhmz2mRpaIPNG+1CL4SKIlWrzFMNpzupWLZp6dSSFw6T2kJAwD43yWfVFu+r4cFAmCK62exS89Sit9ZV3paT2Mw5BM349qbqHbEq5G7y0Y2vC3FtBsI+UbdRNUNybAvwMYLvCVxkEdPF88P+l2nqARzAfCdRVfeehU8PEsMhkOpR0pdzLoFcubBl3a0opasTAAd2FGJCuxIctBxc3ZDql9bI1amziMdwMSvWReKJf8wTGIGlzxrtp+OiF76AtpObLyNTpfghWIz7vUBt0vz4pqMUjqnlxJ67xPCV9dnJlIs3aWXvUOW0n+9uiuf0s5FIL2jmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=//BhbDRrntohIw7MqBub0bYndNGR7WBhzavy+EzyzcM=; b=VFB8iEP1Ggxe4ByWLnhIgjDtvHcyTzi6YC3FM2iGPvg9lsZQt+0OUaWWE0qPRPLeX8u+esNz6E51K7a85U39DqoOJ2ForPu4Ww0xCMPuckNJ5HdzUQtQ0AJLRiJPKzEe8apkET4S7XK7Z5O8uDLpUKI5W8aVh1K8sxIdD54E6VeJ6ACdzRCMu2QXJ+nHHiAnXrJ12lehODWsy1YZr6rHqUHwi9cH/GNMN87NeQW9v2FMQ1Dwrjfuca+nciBswKEyZQ7+8ja2GQNdrEqrx06Y4IOxx8EqSyrE4LIGy3B9QtOEYx4cwDIhOMSctrotMrY8XD0BwDFl72LBlE/E+fX+Hg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=//BhbDRrntohIw7MqBub0bYndNGR7WBhzavy+EzyzcM=; b=RF4YVATAxsx810apRJeNEyy6+qBVXPWHW1nTpVTJhHa/d9WIwwU4JuV5PEtTj6UYCdlpiF5SrJEyvhK/xnRqpioW5BYmdrRcI1WLhh/Y6rwhJT/aZoPmUP7sRzDrP2Ak3T78HVbYLZgF5Xt8c2OzqfOXEpjJpwcpQNhdoPe+WmA= Received: from OS6P279CA0107.NORP279.PROD.OUTLOOK.COM (2603:10a6:e10:3c::17) by AS8PR07MB8154.eurprd07.prod.outlook.com (2603:10a6:20b:375::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.12; Tue, 6 Sep 2022 16:16:36 +0000 Received: from HE1EUR02FT070.eop-EUR02.prod.protection.outlook.com (2603:10a6:e10:3c:cafe::1a) by OS6P279CA0107.outlook.office365.com (2603:10a6:e10:3c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.11 via Frontend Transport; Tue, 6 Sep 2022 16:16:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; pr=C Received: from oa.msg.ericsson.com (192.176.1.74) by HE1EUR02FT070.mail.protection.outlook.com (10.152.11.44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.5588.10 via Frontend Transport; Tue, 6 Sep 2022 16:16:35 +0000 Received: from ESESSMB504.ericsson.se (153.88.183.165) by ESESSMR501.ericsson.se (153.88.183.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Tue, 6 Sep 2022 18:16:27 +0200 Received: from ESESBMB501.ericsson.se (153.88.183.168) by ESESSMB504.ericsson.se (153.88.183.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Tue, 6 Sep 2022 18:16:27 +0200 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.184) with Microsoft SMTP Server id 15.1.2375.31 via Frontend Transport; Tue, 6 Sep 2022 18:16:27 +0200 Received: from localhost.localdomain (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id 62A0F380061; Tue, 6 Sep 2022 18:16:27 +0200 (CEST) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: Van@dpdk.org, Haaren@dpdk.org, Harry CC: , Honnappa Nagarahalli , =?utf-8?q?Morten_Br=C3=B8rup?= , nd , =?utf-8?q?Mattias_R=C3=B6nnblom?= Subject: [PATCH 1/6] service: reduce statistics overhead for parallel services Date: Tue, 6 Sep 2022 18:13:47 +0200 Message-ID: <20220906161352.296110-1-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220708125645.3141464-2-harry.van.haaren@intel.com> References: <20220708125645.3141464-2-harry.van.haaren@intel.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0dbdb4ac-dc69-49e0-a854-08da90232b82 X-MS-TrafficTypeDiagnostic: AS8PR07MB8154:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EK8ttasoVYkx5UB3RVffY+9cTMu455JjUQ7pEALXS3zqL+sLOCf3dPm1Qf4iT0J5FJb/xdw2DTKragjDXAtHzLtYrLXC8SkBMEGolqIepJgKKWK7QV+tAblnDNRm7u79VYE4EqsDRVHjoOCG+m4kFEYFB97biDm6gVsnAB3+3hwbtHZYq3PADM0PyIze/0Ko7QLNpXypcYot/Z8otsK19vl/LGCIhF7FIk114iPNmnuXROZdFRUSbGHQ1GpKwhoYG4dJxlRg0q/LmWvbj5/lKrvT15W4913c3ZF4mm6K0q6vYoPgrnZYnun67TtU/LWPeZUUv84EdoXYaUKYXIAniQDzm466KPIQd0fnBvQnzrthJVTOrw1p7aCCsbLOGTfSPMj+uXsM25TBJ10zzoUpvWuO7PG4dKnCUjlEK8FuuAuR9K/W68zfy3j8zIwlYXyy3SKTLAROnYNMUBKd3NpaGwcyCoFOKSn5h6Ohdc61qmgCTcVr0MYtniE2rJbhtBH++B62VCynMIWfWTeqTXt8mvQCQU1YF+Ji//8i6yE6Z40bxH2x92erkGfr+vDFPlAkBt4+RCrC9mXeoQNdajPLyp6oAxrFqTiRJseVZXyCpra+c9wxYItQQ4BVfDTMjkLWdebkxhxfmeeH+vm3ePdQYdvODBYh2n3W2eG+h+ZbPoghLKf3551UudB925wG7eFDVPj/0z9WEd+/bQEsG6fZlh97YyB5IjreEQ9vYTOhnJFqoFhL2+TNq37Zzmxym/r6HsnEF5Hop2lpuLscYryJh2F0PC8DbHcjx81bncpnhm2MVX0BYNeslyl9S6+R5lNi X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230016)(4636009)(39860400002)(136003)(396003)(346002)(376002)(40470700004)(36840700001)(46966006)(316002)(40480700001)(82310400005)(70206006)(70586007)(4326008)(5660300002)(8676002)(30864003)(41300700001)(6916009)(6666004)(40460700003)(2906002)(6266002)(54906003)(36756003)(8936002)(26005)(86362001)(478600001)(36860700001)(107886003)(1076003)(186003)(2616005)(336012)(66574015)(47076005)(82960400001)(356005)(7636003)(83380400001)(82740400003); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB8154 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 Move the statistics from the service data structure to the per-lcore struct. This eliminates contention for the counter cache lines, which decreases the producer-side statistics overhead for services deployed across many lcores. Prior to this patch, enabling statistics for a service with a per-service function call latency of 1000 clock cycles deployed across 16 cores on a Intel Xeon 6230N @ 2,3 GHz would incur a cost of ~10000 core clock cycles per service call. After this patch, the statistics overhead is reduce to 22 clock cycles per call. Signed-off-by: Mattias Rönnblom Acked-by: Harry van Haaren --- lib/eal/common/rte_service.c | 182 +++++++++++++++++++++++------------ 1 file changed, 121 insertions(+), 61 deletions(-) diff --git a/lib/eal/common/rte_service.c b/lib/eal/common/rte_service.c index 94cb056196..b5103f2a20 100644 --- a/lib/eal/common/rte_service.c +++ b/lib/eal/common/rte_service.c @@ -50,17 +50,8 @@ struct rte_service_spec_impl { * on currently. */ uint32_t num_mapped_cores; - - /* 32-bit builds won't naturally align a uint64_t, so force alignment, - * allowing regular reads to be atomic. - */ - uint64_t calls __rte_aligned(8); - uint64_t cycles_spent __rte_aligned(8); } __rte_cache_aligned; -/* Mask used to ensure uint64_t 8 byte vars are naturally aligned. */ -#define RTE_SERVICE_STAT_ALIGN_MASK (8 - 1) - /* the internal values of a service core */ struct core_state { /* map of services IDs are run on this core */ @@ -71,6 +62,7 @@ struct core_state { uint8_t service_active_on_lcore[RTE_SERVICE_NUM_MAX]; uint64_t loops; uint64_t calls_per_service[RTE_SERVICE_NUM_MAX]; + uint64_t cycles_per_service[RTE_SERVICE_NUM_MAX]; } __rte_cache_aligned; static uint32_t rte_service_count; @@ -138,13 +130,16 @@ rte_service_finalize(void) rte_service_library_initialized = 0; } -/* returns 1 if service is registered and has not been unregistered - * Returns 0 if service never registered, or has been unregistered - */ -static inline int +static inline bool +service_registered(uint32_t id) +{ + return rte_services[id].internal_flags & SERVICE_F_REGISTERED; +} + +static inline bool service_valid(uint32_t id) { - return !!(rte_services[id].internal_flags & SERVICE_F_REGISTERED); + return id < RTE_SERVICE_NUM_MAX && service_registered(id); } static struct rte_service_spec_impl * @@ -155,7 +150,7 @@ service_get(uint32_t id) /* validate ID and retrieve service pointer, or return error value */ #define SERVICE_VALID_GET_OR_ERR_RET(id, service, retval) do { \ - if (id >= RTE_SERVICE_NUM_MAX || !service_valid(id)) \ + if (!service_valid(id)) \ return retval; \ service = &rte_services[id]; \ } while (0) @@ -217,7 +212,7 @@ rte_service_get_by_name(const char *name, uint32_t *service_id) int i; for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) { - if (service_valid(i) && + if (service_registered(i) && strcmp(name, rte_services[i].spec.name) == 0) { *service_id = i; return 0; @@ -254,7 +249,7 @@ rte_service_component_register(const struct rte_service_spec *spec, return -EINVAL; for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) { - if (!service_valid(i)) { + if (!service_registered(i)) { free_slot = i; break; } @@ -366,29 +361,24 @@ service_runner_do_callback(struct rte_service_spec_impl *s, { void *userdata = s->spec.callback_userdata; - /* Ensure the atomically stored variables are naturally aligned, - * as required for regular loads to be atomic. - */ - RTE_BUILD_BUG_ON((offsetof(struct rte_service_spec_impl, calls) - & RTE_SERVICE_STAT_ALIGN_MASK) != 0); - RTE_BUILD_BUG_ON((offsetof(struct rte_service_spec_impl, cycles_spent) - & RTE_SERVICE_STAT_ALIGN_MASK) != 0); - if (service_stats_enabled(s)) { uint64_t start = rte_rdtsc(); s->spec.callback(userdata); uint64_t end = rte_rdtsc(); uint64_t cycles = end - start; - cs->calls_per_service[service_idx]++; - if (service_mt_safe(s)) { - __atomic_fetch_add(&s->cycles_spent, cycles, __ATOMIC_RELAXED); - __atomic_fetch_add(&s->calls, 1, __ATOMIC_RELAXED); - } else { - uint64_t cycles_new = s->cycles_spent + cycles; - uint64_t calls_new = s->calls++; - __atomic_store_n(&s->cycles_spent, cycles_new, __ATOMIC_RELAXED); - __atomic_store_n(&s->calls, calls_new, __ATOMIC_RELAXED); - } + + /* The lcore service worker thread is the only writer, + * and thus only a non-atomic load and an atomic store + * is needed, and not the more expensive atomic + * add. + */ + __atomic_store_n(&cs->calls_per_service[service_idx], + cs->calls_per_service[service_idx] + 1, + __ATOMIC_RELAXED); + + __atomic_store_n(&cs->cycles_per_service[service_idx], + cs->cycles_per_service[service_idx] + cycles, + __ATOMIC_RELAXED); } else s->spec.callback(userdata); } @@ -436,7 +426,7 @@ rte_service_may_be_active(uint32_t id) int32_t lcore_count = rte_service_lcore_list(ids, RTE_MAX_LCORE); int i; - if (id >= RTE_SERVICE_NUM_MAX || !service_valid(id)) + if (!service_valid(id)) return -EINVAL; for (i = 0; i < lcore_count; i++) { @@ -483,16 +473,17 @@ service_runner_func(void *arg) */ while (__atomic_load_n(&cs->runstate, __ATOMIC_ACQUIRE) == RUNSTATE_RUNNING) { + const uint64_t service_mask = cs->service_mask; for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) { - if (!service_valid(i)) + if (!service_registered(i)) continue; /* return value ignored as no change to code flow */ service_run(i, cs, service_mask, service_get(i), 1); } - cs->loops++; + __atomic_store_n(&cs->loops, cs->loops + 1, __ATOMIC_RELAXED); } /* Use SEQ CST memory ordering to avoid any re-ordering around @@ -608,8 +599,8 @@ static int32_t service_update(uint32_t sid, uint32_t lcore, uint32_t *set, uint32_t *enabled) { /* validate ID, or return error value */ - if (sid >= RTE_SERVICE_NUM_MAX || !service_valid(sid) || - lcore >= RTE_MAX_LCORE || !lcore_states[lcore].is_service_core) + if (!service_valid(sid) || lcore >= RTE_MAX_LCORE || + !lcore_states[lcore].is_service_core) return -EINVAL; uint64_t sid_mask = UINT64_C(1) << sid; @@ -813,21 +804,75 @@ rte_service_lcore_stop(uint32_t lcore) return 0; } +static uint64_t +lcore_attr_get_loops(unsigned int lcore) +{ + struct core_state *cs = &lcore_states[lcore]; + + return __atomic_load_n(&cs->loops, __ATOMIC_RELAXED); +} + +static uint64_t +lcore_attr_get_service_calls(uint32_t service_id, unsigned int lcore) +{ + struct core_state *cs = &lcore_states[lcore]; + + return __atomic_load_n(&cs->calls_per_service[service_id], + __ATOMIC_RELAXED); +} + +static uint64_t +lcore_attr_get_service_cycles(uint32_t service_id, unsigned int lcore) +{ + struct core_state *cs = &lcore_states[lcore]; + + return __atomic_load_n(&cs->cycles_per_service[service_id], + __ATOMIC_RELAXED); +} + +typedef uint64_t (*lcore_attr_get_fun)(uint32_t service_id, + unsigned int lcore); + +static uint64_t +attr_get(uint32_t id, lcore_attr_get_fun lcore_attr_get) +{ + unsigned int lcore; + uint64_t sum = 0; + + for (lcore = 0; lcore < RTE_MAX_LCORE; lcore++) + if (lcore_states[lcore].is_service_core) + sum += lcore_attr_get(id, lcore); + + return sum; +} + +static uint64_t +attr_get_service_calls(uint32_t service_id) +{ + return attr_get(service_id, lcore_attr_get_service_calls); +} + +static uint64_t +attr_get_service_cycles(uint32_t service_id) +{ + return attr_get(service_id, lcore_attr_get_service_cycles); +} + int32_t rte_service_attr_get(uint32_t id, uint32_t attr_id, uint64_t *attr_value) { - struct rte_service_spec_impl *s; - SERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL); + if (!service_valid(id)) + return -EINVAL; if (!attr_value) return -EINVAL; switch (attr_id) { - case RTE_SERVICE_ATTR_CYCLES: - *attr_value = s->cycles_spent; - return 0; case RTE_SERVICE_ATTR_CALL_COUNT: - *attr_value = s->calls; + *attr_value = attr_get_service_calls(id); + return 0; + case RTE_SERVICE_ATTR_CYCLES: + *attr_value = attr_get_service_cycles(id); return 0; default: return -EINVAL; @@ -849,7 +894,7 @@ rte_service_lcore_attr_get(uint32_t lcore, uint32_t attr_id, switch (attr_id) { case RTE_SERVICE_LCORE_ATTR_LOOPS: - *attr_value = cs->loops; + *attr_value = lcore_attr_get_loops(lcore); return 0; default: return -EINVAL; @@ -859,11 +904,18 @@ rte_service_lcore_attr_get(uint32_t lcore, uint32_t attr_id, int32_t rte_service_attr_reset_all(uint32_t id) { - struct rte_service_spec_impl *s; - SERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL); + unsigned int lcore; + + if (!service_valid(id)) + return -EINVAL; + + for (lcore = 0; lcore < RTE_MAX_LCORE; lcore++) { + struct core_state *cs = &lcore_states[lcore]; + + cs->calls_per_service[id] = 0; + cs->cycles_per_service[id] = 0; + } - s->cycles_spent = 0; - s->calls = 0; return 0; } @@ -885,17 +937,25 @@ rte_service_lcore_attr_reset_all(uint32_t lcore) } static void -service_dump_one(FILE *f, struct rte_service_spec_impl *s) +service_dump_one(FILE *f, uint32_t id) { + struct rte_service_spec_impl *s; + uint64_t service_calls; + uint64_t service_cycles; + + service_calls = attr_get_service_calls(id); + service_cycles = attr_get_service_cycles(id); + /* avoid divide by zero */ - int calls = 1; + if (service_calls == 0) + service_calls = 1; + + s = service_get(id); - if (s->calls != 0) - calls = s->calls; fprintf(f, " %s: stats %d\tcalls %"PRIu64"\tcycles %" PRIu64"\tavg: %"PRIu64"\n", - s->spec.name, service_stats_enabled(s), s->calls, - s->cycles_spent, s->cycles_spent / calls); + s->spec.name, service_stats_enabled(s), service_calls, + service_cycles, service_cycles / service_calls); } static void @@ -906,7 +966,7 @@ service_dump_calls_per_lcore(FILE *f, uint32_t lcore) fprintf(f, "%02d\t", lcore); for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) { - if (!service_valid(i)) + if (!service_registered(i)) continue; fprintf(f, "%"PRIu64"\t", cs->calls_per_service[i]); } @@ -924,16 +984,16 @@ rte_service_dump(FILE *f, uint32_t id) struct rte_service_spec_impl *s; SERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL); fprintf(f, "Service %s Summary\n", s->spec.name); - service_dump_one(f, s); + service_dump_one(f, id); return 0; } /* print all services, as UINT32_MAX was passed as id */ fprintf(f, "Services Summary\n"); for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) { - if (!service_valid(i)) + if (!service_registered(i)) continue; - service_dump_one(f, &rte_services[i]); + service_dump_one(f, i); } fprintf(f, "Service Cores Summary\n"); From patchwork Tue Sep 6 16:13:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 115984 X-Patchwork-Delegate: david.marchand@redhat.com 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 B229AA0542; Tue, 6 Sep 2022 18:16:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE61E42829; Tue, 6 Sep 2022 18:16:37 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2051.outbound.protection.outlook.com [40.107.22.51]) by mails.dpdk.org (Postfix) with ESMTP id DC37B427F6 for ; Tue, 6 Sep 2022 18:16:36 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SLnnJG4toXlUK7yaXzloQ7h5pFNkKkxsbo5uWqwHcxf4/oMJLr3ttOl7+UDayRtJwyhlaTZZSXFwc52Nci0rlClOr+qZwKLb/kP17MRZ/fEX46MWW058iqLKVkls7XNy7XySbeV5ZvrFdWe+BnFBWRrgMU81Ap81/JZlIVHB2DsFyyQztA+xLmSHIti4TT8/W7aR/cew+ibVezJnDx42wXOEwCldv++elME/vxGnpelCfAYiDQrvV0+4ch1AqRbO4igR+fdYD0qIDwY1+rPWXq/00Swwv146YMjlhzRztcPtbARtZltbHo1to24xsVaW0pWAvzJggFiVDcjvtrQA7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oZ/FMY9oP1zSTckIX5lsjE8pX4fNFLPrnoDV6KD9e70=; b=iba+h5Cln2HYLvB+ftAKVSvpEBB2RS6KS8MV8xSNFm6Cla276WBiCHfTyG7hIId9cW/MAWnETqFXUZJkMVPBtBGBIScvH8vPa1F5CNsWvxOXOYibehgsp7ML+4BFNoBaeBka9CvNUXZeJKtdIleuWpNSZzIQsTkkZnj+Fcf7N6YVNjfp5buYJXbEWKN+vk/w9Q1mXvvXoppBiDVIoTExoD2SDlyLlYUJbkpwuawz7YJWfB8kPl4qGTdzL/l0heS84qYi/lJuICJfZnT1YrHuv2eXK1lXDQsdQG5SbFCUT2jgH1s7DtKwQzTICKYpHyeDVPz8dytjZqyS4p4gi1QUkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oZ/FMY9oP1zSTckIX5lsjE8pX4fNFLPrnoDV6KD9e70=; b=dfvy+n/9q4YFC6wb9cLK6B8AE+JFFpwitV5lMDVkYuNc206HYHyk7EPIJSsbw5syWy/Z7MVWlQbWbEEnhAKivaaIoWNyQiy8sgxRSsSTUYpvj8vkRoc6z0GF1P9um72UG5UDQt6kqFgld3/GnlWqoyVc/hi/orHRuA8DuoG/U7U= Received: from GV3P280CA0037.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:9::20) by VI1PR07MB3982.eurprd07.prod.outlook.com (2603:10a6:803:37::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.12; Tue, 6 Sep 2022 16:16:30 +0000 Received: from HE1EUR02FT030.eop-EUR02.prod.protection.outlook.com (2603:10a6:150:9:cafe::d8) by GV3P280CA0037.outlook.office365.com (2603:10a6:150:9::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.11 via Frontend Transport; Tue, 6 Sep 2022 16:16:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; pr=C Received: from oa.msg.ericsson.com (192.176.1.74) by HE1EUR02FT030.mail.protection.outlook.com (10.152.10.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.5588.10 via Frontend Transport; Tue, 6 Sep 2022 16:16:30 +0000 Received: from ESESSMB502.ericsson.se (153.88.183.163) by ESESSMR503.ericsson.se (153.88.183.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Tue, 6 Sep 2022 18:16:30 +0200 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.190) with Microsoft SMTP Server id 15.1.2375.31 via Frontend Transport; Tue, 6 Sep 2022 18:16:29 +0200 Received: from localhost.localdomain (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id 9B39F380061; Tue, 6 Sep 2022 18:16:29 +0200 (CEST) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: Van@dpdk.org, Haaren@dpdk.org, Harry CC: , Honnappa Nagarahalli , =?utf-8?q?Morten_Br=C3=B8rup?= , nd , =?utf-8?q?Mattias_R=C3=B6nnblom?= Subject: [PATCH 2/6] service: introduce per-lcore cycles counter Date: Tue, 6 Sep 2022 18:13:48 +0200 Message-ID: <20220906161352.296110-2-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220906161352.296110-1-mattias.ronnblom@ericsson.com> References: <20220708125645.3141464-2-harry.van.haaren@intel.com> <20220906161352.296110-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 119c1b03-a3e4-4a4d-e0d0-08da90232858 X-MS-TrafficTypeDiagnostic: VI1PR07MB3982:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hWC9ytwG1kUlWPEvSMc2SMihMGwhY8bMNwKj6P36ENcdh9Wu4Fbwnc55gzAel3jczqOac26LT5r83mWHS7cvi+TbYivYyd+tinG9ge3ZRr9y5Aynr3YWvRkkAuXTxAiu5lKZRMJ35c+j5zzo+H4LBVvQw89Eq0F6TbftYSHle6BOfwuaYrE6zyOtMN5y86xlT7B8X1HbBdGCNfCxF2RqBN806G+1q14CSpa5MRkJbdvOsSg9gMBtn0BjXgPu3KUBFVyAao1Upsm2J2o7UPi1Z8+Ic3l1eFlAgsk5UzjGxsnCynx6MQfFb/1w7sodaiwlXDmxq+FPCsAPzBj4/UknXpM2VXBTCROokakdkOgYu3wTiAjdwqE5XUVrIctPxTDQ78pMHKNk1+kiN8kMy5SuMBnwYroe0QxdJmKCJ2hBeld93TW6K9SVxzXhb8oi/jdrOx5pWRmQsEQuQnfhNbQJm4gqV4MDLee5neg2TKJ1JfZRP3hnwdO+CzQHsCldQ+rxB+XJ2KDPZ8Pf/0l0A2iv3QdksPBB5yfhHlQoJ0NzkX804YVkZryRyCQnT2FbNTRyn44UmNuBLR0fO3LdarC1fRdzC0eFy49pvyH57le5uXhD8yGYdiAvgtBI7g2Qt+pjCR1M+xXUvGwMk/XBk58LHWQ1qwOD1r2PNvn2kyNM8TqqP2QNsGPqymQMRgvvwujCB6Fs1g16n4tC5ixgdrHK2BecxkWUioqXFv1emwBBthwZwCUwv1QVfJD0ft/FbP2CwS/aQHCcBn9AggL9MTXvLw== X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230016)(4636009)(39860400002)(376002)(346002)(136003)(396003)(40470700004)(36840700001)(46966006)(8676002)(8936002)(4326008)(83380400001)(70586007)(336012)(70206006)(47076005)(66574015)(36860700001)(5660300002)(26005)(107886003)(478600001)(41300700001)(186003)(6266002)(1076003)(2616005)(6666004)(316002)(82310400005)(36756003)(54906003)(40460700003)(6916009)(86362001)(40480700001)(82740400003)(2906002)(82960400001)(356005)(7636003); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB3982 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 Introduce a per-lcore counter for the total time spent on processing services on that core. This counter is useful when measuring individual lcore load. Signed-off-by: Mattias Rönnblom --- app/test/test_service_cores.c | 2 +- lib/eal/common/rte_service.c | 14 ++++++++++++++ lib/eal/include/rte_service.h | 6 ++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c index 7415b6b686..096405133b 100644 --- a/app/test/test_service_cores.c +++ b/app/test/test_service_cores.c @@ -403,7 +403,7 @@ service_lcore_attr_get(void) "lcore_attr_get() failed to get loops " "(expected > zero)"); - lcore_attr_id++; // invalid lcore attr id + lcore_attr_id = 42; /* invalid lcore attr id */ TEST_ASSERT_EQUAL(-EINVAL, rte_service_lcore_attr_get(slcore_id, lcore_attr_id, &lcore_attr_value), "Invalid lcore attr didn't return -EINVAL"); diff --git a/lib/eal/common/rte_service.c b/lib/eal/common/rte_service.c index b5103f2a20..87df04e3ac 100644 --- a/lib/eal/common/rte_service.c +++ b/lib/eal/common/rte_service.c @@ -61,6 +61,7 @@ struct core_state { uint8_t is_service_core; /* set if core is currently a service core */ uint8_t service_active_on_lcore[RTE_SERVICE_NUM_MAX]; uint64_t loops; + uint64_t cycles; uint64_t calls_per_service[RTE_SERVICE_NUM_MAX]; uint64_t cycles_per_service[RTE_SERVICE_NUM_MAX]; } __rte_cache_aligned; @@ -372,6 +373,8 @@ service_runner_do_callback(struct rte_service_spec_impl *s, * is needed, and not the more expensive atomic * add. */ + __atomic_store_n(&cs->cycles, cs->cycles + cycles, + __ATOMIC_RELAXED); __atomic_store_n(&cs->calls_per_service[service_idx], cs->calls_per_service[service_idx] + 1, __ATOMIC_RELAXED); @@ -812,6 +815,14 @@ lcore_attr_get_loops(unsigned int lcore) return __atomic_load_n(&cs->loops, __ATOMIC_RELAXED); } +static uint64_t +lcore_attr_get_cycles(unsigned int lcore) +{ + struct core_state *cs = &lcore_states[lcore]; + + return __atomic_load_n(&cs->cycles, __ATOMIC_RELAXED); +} + static uint64_t lcore_attr_get_service_calls(uint32_t service_id, unsigned int lcore) { @@ -896,6 +907,9 @@ rte_service_lcore_attr_get(uint32_t lcore, uint32_t attr_id, case RTE_SERVICE_LCORE_ATTR_LOOPS: *attr_value = lcore_attr_get_loops(lcore); return 0; + case RTE_SERVICE_LCORE_ATTR_CYCLES: + *attr_value = lcore_attr_get_cycles(lcore); + return 0; default: return -EINVAL; } diff --git a/lib/eal/include/rte_service.h b/lib/eal/include/rte_service.h index 35d8018684..70deb6e53a 100644 --- a/lib/eal/include/rte_service.h +++ b/lib/eal/include/rte_service.h @@ -407,6 +407,12 @@ int32_t rte_service_attr_reset_all(uint32_t id); */ #define RTE_SERVICE_LCORE_ATTR_LOOPS 0 +/** + * Returns the total number of cycles that the lcore has spent on + * running services. + */ +#define RTE_SERVICE_LCORE_ATTR_CYCLES 1 + /** * Get an attribute from a service core. * From patchwork Tue Sep 6 16:13:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 115981 X-Patchwork-Delegate: david.marchand@redhat.com 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 5C224A0542; Tue, 6 Sep 2022 18:16:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 097A940143; Tue, 6 Sep 2022 18:16:35 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60060.outbound.protection.outlook.com [40.107.6.60]) by mails.dpdk.org (Postfix) with ESMTP id 9998E400D6 for ; Tue, 6 Sep 2022 18:16:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JLukPYzoZ1+KFN0wt1up49WwPN0XSxNP4bMsv0fheGxIeygBQ4RNCWPLWyUVUG/voXK4rSurQPYuK5IdRsAaUrt3e1F8rv/1p6TpjqRUIxwNx5oAZB5kQkrgpY3c/u8/nllJa097/kXB+3P0SQJTfIv7AlV4n9nXAsq2QFV+lvkzgEhgVcxMwnOIFEHT0oilp05HQ7pDMT9apEp3KD3ordIxH+d/mH/TRiLCBj9ctWCBptw88R06f4QFdd7iLiKeiz8udW6AsCeteJss29wgd9jyYS0UGVorxbtOvptBu5YD+uq8UA00usIXCdYPNjevtg5sW2RCmSh5c62xQHpWyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0tSQzgem4r0LhShtiU6p8Yc6xq4YhzAGqzI4smfF5Gs=; b=U5CFXPHxH8V+AqXOC2X9YkDHO+BBWOOv6NqqiyBXuQzcDVyotUnM9qivrla7LC7iCJ6onfBkKyST3LPNJyPoJO+9aVUl6gcXoiZd7DMKMEPB4hXBObahAYk3+kQwPANzpPse8fIvEcoIUhFUT0aBejYpkri43o7EPDP9cRbHUQRtbdSNK79TjWnguBI1GrD2TccM8E3JcHs4X3EgTBGqbQ/qD7kVkbmwuI2Xwo+VsjIFpuVacGSKhsSSoZLCo5WCD2lLmira3QskKInqRKNGT67cF6sZLqqbjHmbfJkgkeaI3THt4oecDMOLoyFKndFC2bv7ffxIjuQtVSGuAN8AZw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0tSQzgem4r0LhShtiU6p8Yc6xq4YhzAGqzI4smfF5Gs=; b=Nng1ayEBAqAwXFAdH0e2DYGJWPIw4ZRy9MUy1gq0uEmP2POktZFDNRihf/V5J61CSyAkLmgMYknvsOvLp8PmtY+Y5fKfI4nmz7B7mN0+Aq3fmsierbo6aloMuF2Ut1ORxuwaR9qBKxFL5f4ScSQQsr0O6r9m1Q6RvYhhXD4xnCM= Received: from OL1P279CA0034.NORP279.PROD.OUTLOOK.COM (2603:10a6:e10:13::21) by AM0PR07MB5202.eurprd07.prod.outlook.com (2603:10a6:208:f5::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.12; Tue, 6 Sep 2022 16:16:32 +0000 Received: from HE1EUR02FT101.eop-EUR02.prod.protection.outlook.com (2603:10a6:e10:13:cafe::66) by OL1P279CA0034.outlook.office365.com (2603:10a6:e10:13::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10 via Frontend Transport; Tue, 6 Sep 2022 16:16:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; pr=C Received: from oa.msg.ericsson.com (192.176.1.74) by HE1EUR02FT101.mail.protection.outlook.com (10.152.11.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.5588.10 via Frontend Transport; Tue, 6 Sep 2022 16:16:31 +0000 Received: from ESESBMB505.ericsson.se (153.88.183.172) by ESESSMR502.ericsson.se (153.88.183.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Tue, 6 Sep 2022 18:16:30 +0200 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.188) with Microsoft SMTP Server id 15.1.2375.31 via Frontend Transport; Tue, 6 Sep 2022 18:16:30 +0200 Received: from localhost.localdomain (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id 707B2380061; Tue, 6 Sep 2022 18:16:30 +0200 (CEST) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: Van@dpdk.org, Haaren@dpdk.org, Harry CC: , Honnappa Nagarahalli , =?utf-8?q?Morten_Br=C3=B8rup?= , nd , =?utf-8?q?Mattias_R=C3=B6nnblom?= Subject: [PATCH 3/6] service: reduce average case service core overhead Date: Tue, 6 Sep 2022 18:13:49 +0200 Message-ID: <20220906161352.296110-3-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220906161352.296110-1-mattias.ronnblom@ericsson.com> References: <20220708125645.3141464-2-harry.van.haaren@intel.com> <20220906161352.296110-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c1fc1c70-23bd-4b68-7446-08da90232970 X-MS-TrafficTypeDiagnostic: AM0PR07MB5202:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NQr+AVuv/dBKlEe6scVxa5DEFWyToT42yN/Y3iGMluNTmubA2KByY2mEUEehE+qCEqQD1esYqh3SPmSp6k24xvJOtPpZODOm8GL+1sNLfb6hfjuwiMu6byamZrbuFRsFSx0WT7m+Zpmw3+EFOKHYal7WZdbek8kdi3dvuGOtiteDaAeAzwj5LphGwPiV882hcfuekJ27kKPVmYGRQZXjERVXEt4yra5dEKNwI0H9Ab7AVs46720f6lQ5SfOv45PhebW1sdjTXt1G3MPLIkn0zCnYTS9dillqywfAUSK4GxP7H48EswYoW1CfuMYIff84An2/vcMCV5GlMEpR+19lgU02FBaT1bBuPklgNMVRrB4Q32j1Qq+lCDrRuG4NxeSK8tSah8+X/ChKeDhUpRkA0QBUJ6f1HpVtEW2a0QeoMmvZCflyRL7XH52wrj3LI+tKpe5IgPd03PWbVTh9h5aLznd6MLgpv9Jx2RZlryeHrwTXoS26gLGK6vj7BmYjuAkD15mskjIZU5tSMTr/uOf+b9jG5oqDObZ4eKgZQvGKO5gdSAfDWj2C0jsmQpcDNavOv0R+KDYCf1CjEpHqFqrGIv7W7Cbje4qXrnIP9E5NEYEwTY+TbwvOHIWDWEw5tApY4j+IEbl+njtyV3cGQTvE72fHktAWj9xn0wZBRLRm/FGR7RIwlZL17mKmFwzIOOhlUJa0rDB77TnfVny86YV2OJFzX08d2wIIOz+B1PzFFB8JzZ5WKTuKqCnuUA/yjZQxVwBcnfFbaGQUJiMeLLa18Q== X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230016)(4636009)(39860400002)(136003)(396003)(376002)(346002)(40470700004)(36840700001)(46966006)(186003)(1076003)(8936002)(83380400001)(6266002)(2906002)(5660300002)(40480700001)(107886003)(6666004)(36756003)(86362001)(41300700001)(47076005)(66574015)(336012)(2616005)(54906003)(26005)(478600001)(40460700003)(82960400001)(7636003)(356005)(70206006)(70586007)(82310400005)(4326008)(8676002)(6916009)(316002)(36860700001)(82740400003); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR07MB5202 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 Optimize service loop so that the starting point is the lowest-indexed service mapped to the lcore in question, and terminate the loop at the highest-indexed service. While the worst case latency remains the same, this patch significantly reduces the service framework overhead for the average case. In particular, scenarios where an lcore only runs a single service, or multiple services which id values are close (e.g., three services with ids 17, 18 and 22), show significant improvements. The worse case is a where the lcore two services mapped to it; one with service id 0 and the other with id 63. On a service lcore serving a single service, the service loop overhead is reduced from ~190 core clock cycles to ~46. (On an Intel Cascade Lake generation Xeon.) On weakly ordered CPUs, the gain is larger, since the loop included load-acquire atomic operations. Signed-off-by: Mattias Rönnblom Acked-by: Harry van Haaren --- lib/eal/common/rte_service.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/eal/common/rte_service.c b/lib/eal/common/rte_service.c index 87df04e3ac..4cac866792 100644 --- a/lib/eal/common/rte_service.c +++ b/lib/eal/common/rte_service.c @@ -464,7 +464,6 @@ static int32_t service_runner_func(void *arg) { RTE_SET_USED(arg); - uint32_t i; const int lcore = rte_lcore_id(); struct core_state *cs = &lcore_states[lcore]; @@ -478,10 +477,17 @@ service_runner_func(void *arg) RUNSTATE_RUNNING) { const uint64_t service_mask = cs->service_mask; + uint8_t start_id; + uint8_t end_id; + uint8_t i; - for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) { - if (!service_registered(i)) - continue; + if (service_mask == 0) + continue; + + start_id = __builtin_ctzl(service_mask); + end_id = 64 - __builtin_clzl(service_mask); + + for (i = start_id; i < end_id; i++) { /* return value ignored as no change to code flow */ service_run(i, cs, service_mask, service_get(i), 1); } From patchwork Tue Sep 6 16:13:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 115983 X-Patchwork-Delegate: david.marchand@redhat.com 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 77854A0542; Tue, 6 Sep 2022 18:16:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 99EB1427F3; Tue, 6 Sep 2022 18:16:36 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150041.outbound.protection.outlook.com [40.107.15.41]) by mails.dpdk.org (Postfix) with ESMTP id 577B140143 for ; Tue, 6 Sep 2022 18:16:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dJnlbCQnSizNZHh7asiAvQkOuCDWWtyBR8rv5j2NoM2L+NivXxdN+JnknHzPaSzAcvIt6KNXehNzo4QUZYruAvV1K2Rjp/Nmn7jVDBOurP6GGuMmBZrv54bsbvNIJC1tbZcGcMLqYhle5l4NDhtw/In/rEeaehd/p9MJQX8jGRzao7evw17mCpeGtD8DVp5o5Xih8IRzTs2qQM2k0EIVylXQ0etQArPD+B7cUfxUsRzF8ccsjV2rVoGyrnjuv2xbb61mfjscke9+tyAeIfdMrCWBh77M0aBfUC/k5RcAlFCWHf2v+CHn9XkOBclsn5OzblbzKkq3cS+Hm7QkWXYGKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=G7g0WGO32pOJMpygsNXlSSEBJ3wWSj0Wa9wtNmIMu/Y=; b=OgwxlWH/bCHpG9dOITVFCEUuQ8n7z3BYNTFYcOmnLkN8/Ops+zFwW5tnzO7v9+E8p3dvx5Zt0OG3o1y7iUXLoT64vbM5wO4O3eJx3dqAjXyRTMUptG4sYNMYvPsxF3cv+CrCnHZaRoqo8fOSWh+AX0LnbTqznV3wDagT/r544EKVO4yXOGmZ0pNYtvHMvEd9Zq3sLHcBHuY60h1/iCB8H34jD5azrPqrGtZIfHdpvKKrs7XbLv5Px2174U9RwO9Yx5BILsH7WPx6EvSBc7lRJ6rVa7fBW9dD8sYqXs49KC0AYDgMeFEqrfoBRjOosXK52uMlyXtpAgciJscWggOmFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G7g0WGO32pOJMpygsNXlSSEBJ3wWSj0Wa9wtNmIMu/Y=; b=Ro0sr23SjoyXSJX3JDCq4FLtJ5czwF5rrZ3uSyMIodJS0IMMOMvdMcDKFiQTa3+DB9KjpwZwrli6bwlWT0g7PhfNx/pkDBDMwlUWvgDyzFhQf0Z6mPTydckEX70OlXvPTXS3Z05KjHFstDviQqZv7MICxqiJG4kgHVLfY90+LEw= Received: from AS9PR06CA0214.eurprd06.prod.outlook.com (2603:10a6:20b:45e::19) by AM8PR07MB7601.eurprd07.prod.outlook.com (2603:10a6:20b:240::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.11; Tue, 6 Sep 2022 16:16:32 +0000 Received: from AM5EUR02FT052.eop-EUR02.prod.protection.outlook.com (2603:10a6:20b:45e:cafe::db) by AS9PR06CA0214.outlook.office365.com (2603:10a6:20b:45e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.12 via Frontend Transport; Tue, 6 Sep 2022 16:16:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; pr=C Received: from oa.msg.ericsson.com (192.176.1.74) by AM5EUR02FT052.mail.protection.outlook.com (10.152.9.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.5588.10 via Frontend Transport; Tue, 6 Sep 2022 16:16:32 +0000 Received: from ESESBMB502.ericsson.se (153.88.183.169) by ESESSMR505.ericsson.se (153.88.183.127) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Tue, 6 Sep 2022 18:16:31 +0200 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.185) with Microsoft SMTP Server id 15.1.2375.31 via Frontend Transport; Tue, 6 Sep 2022 18:16:31 +0200 Received: from localhost.localdomain (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id 545F6380061; Tue, 6 Sep 2022 18:16:31 +0200 (CEST) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: Van@dpdk.org, Haaren@dpdk.org, Harry CC: , Honnappa Nagarahalli , =?utf-8?q?Morten_Br=C3=B8rup?= , nd , =?utf-8?q?Mattias_R=C3=B6nnblom?= Subject: [PATCH 4/6] service: tweak cycle statistics semantics Date: Tue, 6 Sep 2022 18:13:50 +0200 Message-ID: <20220906161352.296110-4-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220906161352.296110-1-mattias.ronnblom@ericsson.com> References: <20220708125645.3141464-2-harry.van.haaren@intel.com> <20220906161352.296110-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 481e4f57-65d7-4e34-703c-08da902329f8 X-MS-TrafficTypeDiagnostic: AM8PR07MB7601:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F6NzZBK5YhdWdxFwKQA+/vV7fe8GGJ6iOekazLO0VWGYOXkz3N08vbFKtbgMihbYQWBOlmRk6ZrEtnB0HYIZWrUXdJjkqC/S2IPUBTX0RWoeO3iZ1uKtTbYYPCZx5hMtqZ70RnZV0FFNjAZNcaAz4pAaHb0ezyxLRnI2GRY5e+xR3nB2Zwmjauoyhb7pdxdzMvMxhXiqJj1O7vxGWr7BufjLr3LhaeQBVVQ7GAL7wqqH7LpGv8fATR/oYCLdESndyfGgoAbmTxCtRDpBmsQc0K6NWfOTF1Jw89cnRkAPNdAyoSb1Av08lJPd99aFRoYk4Lou9/BgWrbsHlh/UUtpvUiPNY7Dksvq+e3tIBf5h0E1HkB9g2Jcsaa3M1lY2UeB2G4QDFGrolqAo48edQfmBUAKzylcoRnJoiiNKvAqTFm6GG3TWiX6JfNC3kgkcOZMbufSMM/TWxpA2kebP0KMM/LUVVbIYvlHoYWhpCevNxjvtO1+5HSypnQMhBVwbEaqQbeeai00gXYb2ucZiZgljzyxyxSgPpEvxL/n/Tv/w2evYN+lk8SUKUE6F+SFszjIX8EujDzdQvtWYhS03cQDm7UEb7Znk1+LBuPooJUim78Cg/QxQnCKUFwdoA2anxTx2h6lTw31QU+6MDPs33T+wh/H3sD0npq7aGApMNuAaBgTaii91lWP62DDc3QCLCRpomZkDCuBxrcFq3npaMyBkqm8At2/lx3LLem8UisT2780YgP+9TWPIgNj2FtGK67iIdxZMZ2s+RU/93aDwz+8cA== X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230016)(4636009)(376002)(396003)(39860400002)(346002)(136003)(46966006)(36840700001)(40470700004)(26005)(6666004)(107886003)(41300700001)(478600001)(66574015)(6266002)(47076005)(83380400001)(336012)(2906002)(2616005)(5660300002)(8936002)(40480700001)(82310400005)(6916009)(40460700003)(186003)(54906003)(70206006)(4326008)(8676002)(36756003)(1076003)(82740400003)(86362001)(70586007)(316002)(7636003)(82960400001)(356005)(36860700001); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR07MB7601 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 As a part of its service function, a service usually polls some kind of source (e.g., an RX queue, a ring, an eventdev port, or a timer wheel) to retrieve one or more items of work. In low-load situations, the service framework reports a significant amount of cycles spent for all running services, despite the fact they have performed little or no actual work. The per-call cycle expenditure for an idle service (i.e., a service currently without pending jobs) is typically very low. Polling an empty ring or RX queue is inexpensive. However, since the service function call frequency on an idle or lightly loaded lcore is going to be very high indeed, the service function calls' cycles adds up to a significant amount. The only thing preventing the idle services' cycles counters to make up 100% of the available CPU cycles is the overhead of the service framework itself. If the RTE_SERVICE_ATTR_CYCLES or RTE_SERVICE_LCORE_ATTR_CYCLES are used to estimate service core load, the cores may look very busy when the system is mostly doing nothing useful at all. This patch allows for an idle service to indicate that no actual work was performed during a particular service function call (by returning -EAGAIN). In such cases the RTE_SERVICE_ATTR_CYCLES and RTE_SERVICE_LCORE_ATTR_CYCLES values are not incremented. The convention of returning -EAGAIN for idle services may in the future also be used to have the lcore enter a short sleep, or reduce its operating frequency, in case all services are currently idle. This change is backward-compatible. Signed-off-by: Mattias Rönnblom --- lib/eal/common/rte_service.c | 22 ++++++++++++++-------- lib/eal/include/rte_service_component.h | 5 +++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/lib/eal/common/rte_service.c b/lib/eal/common/rte_service.c index 4cac866792..123610688c 100644 --- a/lib/eal/common/rte_service.c +++ b/lib/eal/common/rte_service.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -364,24 +365,29 @@ service_runner_do_callback(struct rte_service_spec_impl *s, if (service_stats_enabled(s)) { uint64_t start = rte_rdtsc(); - s->spec.callback(userdata); - uint64_t end = rte_rdtsc(); - uint64_t cycles = end - start; + int rc = s->spec.callback(userdata); /* The lcore service worker thread is the only writer, * and thus only a non-atomic load and an atomic store * is needed, and not the more expensive atomic * add. */ - __atomic_store_n(&cs->cycles, cs->cycles + cycles, - __ATOMIC_RELAXED); + + if (likely(rc != -EAGAIN)) { + uint64_t end = rte_rdtsc(); + uint64_t cycles = end - start; + + __atomic_store_n(&cs->cycles, cs->cycles + cycles, + __ATOMIC_RELAXED); + __atomic_store_n(&cs->cycles_per_service[service_idx], + cs->cycles_per_service[service_idx] + + cycles, __ATOMIC_RELAXED); + } + __atomic_store_n(&cs->calls_per_service[service_idx], cs->calls_per_service[service_idx] + 1, __ATOMIC_RELAXED); - __atomic_store_n(&cs->cycles_per_service[service_idx], - cs->cycles_per_service[service_idx] + cycles, - __ATOMIC_RELAXED); } else s->spec.callback(userdata); } diff --git a/lib/eal/include/rte_service_component.h b/lib/eal/include/rte_service_component.h index 9e66ee7e29..9be49d698a 100644 --- a/lib/eal/include/rte_service_component.h +++ b/lib/eal/include/rte_service_component.h @@ -19,6 +19,11 @@ extern "C" { /** * Signature of callback function to run a service. + * + * A service function call resulting in no actual work being + * performed, should return -EAGAIN. In that case, the (presumbly few) + * cycles spent will not be counted toward the lcore or service-level + * cycles attributes. */ typedef int32_t (*rte_service_func)(void *args); From patchwork Tue Sep 6 16:13:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 115982 X-Patchwork-Delegate: david.marchand@redhat.com 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 535FFA0542; Tue, 6 Sep 2022 18:16:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C676E4114E; Tue, 6 Sep 2022 18:16:35 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80055.outbound.protection.outlook.com [40.107.8.55]) by mails.dpdk.org (Postfix) with ESMTP id 21150400D6 for ; Tue, 6 Sep 2022 18:16:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JQNtPle+37wg8G11dK8PcgxqrnZ7tBg+2lWU2CKzk25QE/Q+x8ZCXRCx/osnjqfHcc29RTPEL/URMBf+1DmEaOH6kvhdRUwrla5PpNZslNU+fHdPBBFUGX3/oCYpP7uQx+s3dLtnJF6EfB89mYB2yZdZQpDAj8/gu9ZMR/H2xuNW0z3Xagt131KFXkk4MiHybVTC+JqS+23oNmcO5CnC9mKt0ZG9IbxaJ3cgiPkZVYx7RTW8ecxp6yCwYL1X/6HzSxvmxvqfmfnXvmQ2u1JBZNxRqaQZnOIAvGRiGGRGqvY5dyxSafbPVXKPQ2BCckur2iH8CfEcZqh2WmNglQ3ovw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=veXA9g1hbNSFMW0epxpc/DkGOgomc2jfR8EDLPxBfu4=; b=EeSdGW9J5YiRXUK5WbCTw4NMLfqpOkJ3WLXMDjHy34OjF9VXa9JwMh2kgn7SGd+4J+lV2BHB1nPIjUQXss/TmBafTDgUqWWR2ZdbN8DGEO2Kv5lUJtaBbD0qbe/Waf8IRNvPlHX/yXS8RpnGmqt7UnYO++kca0LYKHD6TaKeYFykt033DbjJCgT2yCVQI4whCQDBIV5BiTb85JpkBX2vkRml6MjHn6vR9de7SZP0v+1wv9xS3bI//Q1BrkLeVb6zHUmVZh8pvHJRccLp1dOO5DsSBs82Pg705czauG3YP6e8rQoIiEw13Mmo0inq8Lm+NZNMnOr2730JQjb4w5kHGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=veXA9g1hbNSFMW0epxpc/DkGOgomc2jfR8EDLPxBfu4=; b=hleNlpAf8FoZi+vWyE2HhEWCE3eUujvcIVugxYOhhraRTEr9L9Tz/Z/kUaKAWMvAwRrBLoQ5di88max3c1QNWtADjyJs7PBCxOJcgqmjwKtwQFl2bEQ+kf1I4XAZywmTiScxMT1YFaaq/QE5dQ3Ckd/3VgODCDQv1YKTBz30mxg= Received: from AM6PR10CA0013.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:89::26) by AM6PR07MB3894.eurprd07.prod.outlook.com (2603:10a6:209:3a::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.12; Tue, 6 Sep 2022 16:16:32 +0000 Received: from VE1EUR02FT004.eop-EUR02.prod.protection.outlook.com (2603:10a6:209:89:cafe::30) by AM6PR10CA0013.outlook.office365.com (2603:10a6:209:89::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10 via Frontend Transport; Tue, 6 Sep 2022 16:16:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; pr=C Received: from oa.msg.ericsson.com (192.176.1.74) by VE1EUR02FT004.mail.protection.outlook.com (10.152.12.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.5588.10 via Frontend Transport; Tue, 6 Sep 2022 16:16:32 +0000 Received: from ESESBMB505.ericsson.se (153.88.183.172) by ESESSMR504.ericsson.se (153.88.183.126) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Tue, 6 Sep 2022 18:16:32 +0200 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.188) with Microsoft SMTP Server id 15.1.2375.31 via Frontend Transport; Tue, 6 Sep 2022 18:16:31 +0200 Received: from localhost.localdomain (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id 18BBB380061; Tue, 6 Sep 2022 18:16:32 +0200 (CEST) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: Van@dpdk.org, Haaren@dpdk.org, Harry CC: , Honnappa Nagarahalli , =?utf-8?q?Morten_Br=C3=B8rup?= , nd , =?utf-8?q?Mattias_R=C3=B6nnblom?= Subject: [PATCH 5/6] event/sw: report idle when no work is performed Date: Tue, 6 Sep 2022 18:13:51 +0200 Message-ID: <20220906161352.296110-5-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220906161352.296110-1-mattias.ronnblom@ericsson.com> References: <20220708125645.3141464-2-harry.van.haaren@intel.com> <20220906161352.296110-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d4418b41-ae20-47f1-abcc-08da902329c8 X-MS-TrafficTypeDiagnostic: AM6PR07MB3894:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sL6YOm2GC8/QMSEE1pnYoy5Og3ZTEkFVq3wpzl4vqqcvoG+oUXVx53Vhv4TVVJDk/eSXYVdT0Diw3iSop3bUH8i1RhLIz/LIMV8cHIO2O3x/Bbv9aXRNFOW+VzwNIRA1pjmWDytxgc/M6v0GhZTH8qDQQ0ebprc4X6LmDHbpwo2JpcL4bz0jUmEBg4ST+fhze2dG0YuB89NDd02S3ECnL5bCAdzEbmZ2/jXHIs6z5smoo1tOdcse5Eybdq6/U8Y1eKZmDzODtl50d5xfq4IS/EWm7xHMm+Mvkx6qBVfYVyd5NLBOHjiFVQmky44EGjNkjjT4UQm1BdhacrZ0ZPwgHcmggTU7VDWuzoIifk/8XPOpRORzLQLwd0/GYVVn5ZcYp+uEA4LqrwquEmCw42mVhLS1A3hvLP4BXEx5Wl5n8to3XQ6Ev8bx/uZdO7v7WLse8Psihf0DeBCgkHg4xi/6Vnw3PmX6RjGG/S3ohXi3FSHJINuHTfjlpJd3juEiW0efpQSdCs6I2bIy2FYGWiW1rymptB9XifivImvMdFBBiViETFhmgCYZhjPJRshwHuWNWPwBogWRbvEM0MdEiduK3qGa9ZTwZhU+CPuzLS4FaroerKBbZ6mlVkb0MrkT3Nr74yvuCcjyhcqFRGmQgSQNc8w8T1M6rG6ZGYKue4bB7+v8wS14FNOaUHDxUkWCykArI8kbzeYd8s6n4dEf0W2tAYZMS43y7LsvLFaqc6J/yTZnazjK8qQJ2vLVb1kJsaTs8XGZUoJc1AcyHaxwGm5Luw== X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230016)(4636009)(376002)(346002)(136003)(39860400002)(396003)(36840700001)(40470700004)(46966006)(356005)(7636003)(82740400003)(36860700001)(54906003)(40460700003)(83380400001)(82310400005)(82960400001)(40480700001)(336012)(316002)(4326008)(8676002)(70586007)(70206006)(2616005)(1076003)(47076005)(186003)(36756003)(2906002)(86362001)(478600001)(41300700001)(6266002)(6666004)(26005)(107886003)(5660300002)(6916009)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR07MB3894 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 Have the SW event device conform to the service core convention, where -EAGAIN is return in case no work was performed. Prior to this patch, for an idle SW event device, a service lcore load estimate based on RTE_SERVICE_ATTR_CYCLES would suggest 48% core load. At 7% of its maximum capacity, the SW event device needs about 15% of the available CPU cycles* to perform its duties, but RTE_SERVICE_ATTR_CYCLES would suggest the SW service used 48% of the service core. After this change, load deduced from RTE_SERVICE_ATTR_CYCLES will only be a minor overestimation of the actual cycles used. * The SW scheduler becomes more efficient at higher loads. Signed-off-by: Mattias Rönnblom --- drivers/event/sw/sw_evdev.c | 3 +-- drivers/event/sw/sw_evdev.h | 2 +- drivers/event/sw/sw_evdev_scheduler.c | 6 ++++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c index f93313b31b..f14c6427dd 100644 --- a/drivers/event/sw/sw_evdev.c +++ b/drivers/event/sw/sw_evdev.c @@ -933,8 +933,7 @@ set_refill_once(const char *key __rte_unused, const char *value, void *opaque) static int32_t sw_sched_service_func(void *args) { struct rte_eventdev *dev = args; - sw_event_schedule(dev); - return 0; + return sw_event_schedule(dev); } static int diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h index 4fd1054470..8542b7d34d 100644 --- a/drivers/event/sw/sw_evdev.h +++ b/drivers/event/sw/sw_evdev.h @@ -295,7 +295,7 @@ uint16_t sw_event_enqueue_burst(void *port, const struct rte_event ev[], uint16_t sw_event_dequeue(void *port, struct rte_event *ev, uint64_t wait); uint16_t sw_event_dequeue_burst(void *port, struct rte_event *ev, uint16_t num, uint64_t wait); -void sw_event_schedule(struct rte_eventdev *dev); +int32_t sw_event_schedule(struct rte_eventdev *dev); int sw_xstats_init(struct sw_evdev *dev); int sw_xstats_uninit(struct sw_evdev *dev); int sw_xstats_get_names(const struct rte_eventdev *dev, diff --git a/drivers/event/sw/sw_evdev_scheduler.c b/drivers/event/sw/sw_evdev_scheduler.c index 809a54d731..8bc21944f5 100644 --- a/drivers/event/sw/sw_evdev_scheduler.c +++ b/drivers/event/sw/sw_evdev_scheduler.c @@ -506,7 +506,7 @@ sw_schedule_pull_port_dir(struct sw_evdev *sw, uint32_t port_id) return pkts_iter; } -void +int32_t sw_event_schedule(struct rte_eventdev *dev) { struct sw_evdev *sw = sw_pmd_priv(dev); @@ -517,7 +517,7 @@ sw_event_schedule(struct rte_eventdev *dev) sw->sched_called++; if (unlikely(!sw->started)) - return; + return -EAGAIN; do { uint32_t in_pkts_this_iteration = 0; @@ -610,4 +610,6 @@ sw_event_schedule(struct rte_eventdev *dev) sw->sched_last_iter_bitmask = cqs_scheds_last_iter; if (unlikely(sw->port_count >= 64)) sw->sched_last_iter_bitmask = UINT64_MAX; + + return work_done ? 0 : -EAGAIN; } From patchwork Tue Sep 6 16:13:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 115986 X-Patchwork-Delegate: david.marchand@redhat.com 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 047A5A0542; Tue, 6 Sep 2022 18:17:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8E3E642905; Tue, 6 Sep 2022 18:16:40 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70059.outbound.protection.outlook.com [40.107.7.59]) by mails.dpdk.org (Postfix) with ESMTP id 087804282D for ; Tue, 6 Sep 2022 18:16:38 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EdGo3MQqTHR+0zzrh2tXMfRlVuqaQ0g3+7Gt7CCRCctkG5MtBVogNw9EShWEzhQJjp+iXAVBuIeO9ziRhXFmxWs6i78vzJ+U6rFSGUNzxRPTPV9Yn8kKxorzm8v8dOxHPJZqV0vjyLBuuEq8b/ypJAsaqYoSWseXxIRB1Vby8Q9tp8jhKjDlNo+W+DAmT4+KilobufdXXen/lszDRq7oxorHzlXepIlxARhENmUUL/zLIKdTU8wz7a1tOXa7QsMVvfjPoQP4yZrfRuCTsqdPt/RYPDjyzFh5toCnq7d1z1B5AwPxa58fMpLL3V3w0/YR7LnLty9tm7Z5rTB5BCp5XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2LS0P000MZ7yF1YZP1Cn00rREYWnihJtZCoXwThnuGs=; b=BoYSENSxo3onZzq4UryC6in5xIY7t99uGIcIU4ZG6xrIYH6rxJK3COfOdA9uZebRJvurDFj0ZGwUAAKSrYju3zYPnQlzWXcfgpsuPBlcXCrSYghhbJBjv67q07Uy+2Xs6gQsXb6AMQU5zMajM+sBZV43xgLe8vCg3f21UFWzLpleezdBbByrlBwx+V1sxfPH3v0IYHFj0Si/fBsN+CNkD/Edvggr3kTjFIVDRu7quqzOrK8KPHkxo90lxHGMhNSu1KK6WXu3jjT2OKOMe4DXzXchQ4j2X6KCXEKIOEEn9YkRkHRrj9Q2UcAgAtFIUxqxbCClBjOIUZ1BmjceFUoZzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2LS0P000MZ7yF1YZP1Cn00rREYWnihJtZCoXwThnuGs=; b=bTRlhqebCXuxDVFimOT9tS0WxiDB1/DapvGrh4mmAfIAaZlj/HRQrCxeZDLC0ttEcmRi+xsLB0XjH+ykaKfv+NGh0AhvjqtToENX9+r3ctj+aLZgg/zWdd/9rju0B7o0ZJpe2R/YoWkduHS0ZyWLP+MvHcpIWyjxvf8UQUQC6Tk= Received: from AS8P189CA0046.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:458::18) by AM6PR07MB6134.eurprd07.prod.outlook.com (2603:10a6:20b:28::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.12; Tue, 6 Sep 2022 16:16:36 +0000 Received: from VE1EUR02FT013.eop-EUR02.prod.protection.outlook.com (2603:10a6:20b:458:cafe::9f) by AS8P189CA0046.outlook.office365.com (2603:10a6:20b:458::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10 via Frontend Transport; Tue, 6 Sep 2022 16:16:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; pr=C Received: from oa.msg.ericsson.com (192.176.1.74) by VE1EUR02FT013.mail.protection.outlook.com (10.152.12.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.5588.10 via Frontend Transport; Tue, 6 Sep 2022 16:16:36 +0000 Received: from ESESSMB502.ericsson.se (153.88.183.163) by ESESSMR506.ericsson.se (153.88.183.128) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Tue, 6 Sep 2022 18:16:32 +0200 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.190) with Microsoft SMTP Server id 15.1.2375.31 via Frontend Transport; Tue, 6 Sep 2022 18:16:32 +0200 Received: from localhost.localdomain (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id E2B59380061; Tue, 6 Sep 2022 18:16:32 +0200 (CEST) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: Van@dpdk.org, Haaren@dpdk.org, Harry CC: , Honnappa Nagarahalli , =?utf-8?q?Morten_Br=C3=B8rup?= , nd , =?utf-8?q?Mattias_R=C3=B6nnblom?= Subject: [PATCH 6/6] service: provide links to functions in documentation Date: Tue, 6 Sep 2022 18:13:52 +0200 Message-ID: <20220906161352.296110-6-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220906161352.296110-1-mattias.ronnblom@ericsson.com> References: <20220708125645.3141464-2-harry.van.haaren@intel.com> <20220906161352.296110-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e4e2e420-a285-4da9-5066-08da90232bfa X-MS-TrafficTypeDiagnostic: AM6PR07MB6134:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5TKQk1AQE/qthojjaeGUGhAAt8klo2e1sK3yu1v+ELPBjN8q5eNHJBWk3U5q9aN/kYpgkSlchnoslzZ8GCr5w7Z5BAycCrILksofsDsU3UArdIn8wlF3uyBGKG+fu9DOhp6RDHV7iQkbN/BzQw8CJioutJrlQgF+4weMDLgt94XhcL5JoU0+j3e5x86zQDARri1PJYWn0KyMm2qSjeA3nERI3oOogBx7vxyfj+LQwsUNKFmz0zZ+co7I+e231oRSi2EH806vqtVCMx5cP3OuBjKGbLiVD8irHxium3jjcOb+dvPt9elqtCjJiS0aEAUAub8ywv8bqSNKMHZV9LFhs9ONUlZ4ah66hKOUTfW97scpzuAPxxOVOT7X7GYT96AMjytr+Db5iSeq9AbcMYKqRbhJGGh11XiYNuEYwDbg+tkOTRGfUoKye+p5jVdxa6wA6CIVZGuwcPVewH7e5svy6HGL30ncwnMbzUn3A0kU/GB/3bpp+Eiyq72HGDXnMf10NJKniN73fRbc9FxWLTL1ww4Y7wXlT1HTDZkiDszq2eEHoVfBHeS9n36QjvXzunRZOaX82WZXALKNpZXpfChP3u541UTTffdnkGHZZEgCIcRfPJAzXLWXY6Ebf5r5b4WM1semk57NbLTaqfC+TBUjWwODncKXYUEwZx4mrOa625PwBaLBTVkZdAcSIw9pOAgn2ogbRlgGNJykSnE8AX1OtVhCeDpgyT+KAeAPe2vcyNTWdETjQJHsBnfNaxqG/Si0TUSNIUPhN956vBXGcL53Dg== X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230016)(4636009)(346002)(376002)(39860400002)(136003)(396003)(40470700004)(36840700001)(46966006)(82960400001)(40460700003)(7636003)(356005)(36860700001)(8676002)(4326008)(82740400003)(70586007)(70206006)(6916009)(316002)(82310400005)(1076003)(2906002)(40480700001)(5660300002)(8936002)(2616005)(83380400001)(6266002)(186003)(336012)(66574015)(47076005)(54906003)(478600001)(26005)(6666004)(41300700001)(86362001)(107886003)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR07MB6134 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 Refer to API functions with parenthesis, making doxygen create hyperlinks. Signed-off-by: Mattias Rönnblom --- lib/eal/include/rte_service.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/eal/include/rte_service.h b/lib/eal/include/rte_service.h index 70deb6e53a..90116a773a 100644 --- a/lib/eal/include/rte_service.h +++ b/lib/eal/include/rte_service.h @@ -37,7 +37,7 @@ extern "C" { /* Capabilities of a service. * - * Use the *rte_service_probe_capability* function to check if a service is + * Use the rte_service_probe_capability() function to check if a service is * capable of a specific capability. */ /** When set, the service is capable of having multiple threads run it at the @@ -147,13 +147,13 @@ int32_t rte_service_map_lcore_get(uint32_t service_id, uint32_t lcore); int32_t rte_service_runstate_set(uint32_t id, uint32_t runstate); /** - * Get the runstate for the service with *id*. See *rte_service_runstate_set* + * Get the runstate for the service with *id*. See rte_service_runstate_set() * for details of runstates. A service can call this function to ensure that * the application has indicated that it will receive CPU cycles. Either a * service-core is mapped (default case), or the application has explicitly * disabled the check that a service-cores is mapped to the service and takes * responsibility to run the service manually using the available function - * *rte_service_run_iter_on_app_lcore* to do so. + * rte_service_run_iter_on_app_lcore() to do so. * * @retval 1 Service is running * @retval 0 Service is stopped @@ -181,7 +181,7 @@ rte_service_may_be_active(uint32_t id); /** * Enable or disable the check for a service-core being mapped to the service. * An application can disable the check when takes the responsibility to run a - * service itself using *rte_service_run_iter_on_app_lcore*. + * service itself using rte_service_run_iter_on_app_lcore(). * * @param id The id of the service to set the check on * @param enable When zero, the check is disabled. Non-zero enables the check. @@ -216,7 +216,7 @@ int32_t rte_service_set_runstate_mapped_check(uint32_t id, int32_t enable); * atomics, applications can choose to enable or disable this feature * * Note that any thread calling this function MUST be a DPDK EAL thread, as - * the *rte_lcore_id* function is used to access internal data structures. + * the rte_lcore_id() function is used to access internal data structures. * * @retval 0 Service was run on the calling thread successfully * @retval -EBUSY Another lcore is executing the service, and it is not a @@ -232,7 +232,7 @@ int32_t rte_service_run_iter_on_app_lcore(uint32_t id, * * Starting a core makes the core begin polling. Any services assigned to it * will be run as fast as possible. The application must ensure that the lcore - * is in a launchable state: e.g. call *rte_eal_lcore_wait* on the lcore_id + * is in a launchable state: e.g. call rte_eal_lcore_wait() on the lcore_id * before calling this function. * * @retval 0 Success @@ -248,7 +248,7 @@ int32_t rte_service_lcore_start(uint32_t lcore_id); * service core. Note that the service lcore thread may not have returned from * the service it is running when this API returns. * - * The *rte_service_lcore_may_be_active* API can be used to check if the + * The rte_service_lcore_may_be_active() API can be used to check if the * service lcore is * still active. * * @retval 0 Success @@ -265,7 +265,7 @@ int32_t rte_service_lcore_stop(uint32_t lcore_id); * Reports if a service lcore is currently running. * * This function returns if the core has finished service cores code, and has - * returned to EAL control. If *rte_service_lcore_stop* has been called but + * returned to EAL control. If rte_service_lcore_stop() has been called but * the lcore has not returned to EAL yet, it might be required to wait and call * this function again. The amount of time to wait before the core returns * depends on the duration of the services being run. @@ -293,7 +293,7 @@ int32_t rte_service_lcore_add(uint32_t lcore); /** * Removes lcore from the list of service cores. * - * This can fail if the core is not stopped, see *rte_service_core_stop*. + * This can fail if the core is not stopped, see rte_service_core_stop(). * * @retval 0 Success * @retval -EBUSY Lcore is not stopped, stop service core before removing. @@ -308,7 +308,7 @@ int32_t rte_service_lcore_del(uint32_t lcore); * service core count can be used in mapping logic when creating mappings * from service cores to services. * - * See *rte_service_lcore_list* for details on retrieving the lcore_id of each + * See rte_service_lcore_list() for details on retrieving the lcore_id of each * service core. * * @return The number of service cores currently configured. @@ -344,14 +344,14 @@ int32_t rte_service_set_stats_enable(uint32_t id, int32_t enable); * indicating the lcore_id of a service core. * * Adding and removing service cores can be performed using - * *rte_service_lcore_add* and *rte_service_lcore_del*. - * @param [out] array An array of at least *rte_service_lcore_count* items. + * rte_service_lcore_add() and rte_service_lcore_del(). + * @param [out] array An array of at least rte_service_lcore_count() items. * If statically allocating the buffer, use RTE_MAX_LCORE. * @param [out] n The size of *array*. * @retval >=0 Number of service cores that have been populated in the array * @retval -ENOMEM The provided array is not large enough to fill in the * service core list. No items have been populated, call this function - * with a size of at least *rte_service_core_count* items. + * with a size of at least rte_service_core_count() items. */ int32_t rte_service_lcore_list(uint32_t array[], uint32_t n);