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 8C26AA00C3; Fri, 13 May 2022 19:58:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3104940DF7; Fri, 13 May 2022 19:58:51 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60077.outbound.protection.outlook.com [40.107.6.77]) by mails.dpdk.org (Postfix) with ESMTP id 3D90340DDE for ; Fri, 13 May 2022 19:58:50 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hzvhKEND6lHdO1FBeo1KKWopo7HCTHA3lCYbmxDswGWXW0QR6bFoVOPwchJkfV0xBJMsNiSLZKxvEL0Eev7I2EPGH3VWIp7bwhRol44yigpKFy3Q4ljKqM/+8ZMt1ximNf2SFIwgc7VBmgSLXVmK+jr3T9Z9qZ+ytkuawkL6h3bSPlCZACjP1alLBffkkzR2CUQDhYb4GvqP6jVy1uh0ik3qR4lWgKS5yRzDW2Kmm0b51/p90Mqkdc84lq4QBByxFjR5nZYvP4dAYkpaDaJ765gdaPs1Cduafm5nkCr80Eba6jF5+etlAhbLgQpfOwk88doUfO34IDDqAYCsF83v0Q== 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=SqXox45JITI3s0klWTD3pTESWYaI8RxqaVfDCFvWylM=; b=POlX4uN9HEON6eYnr1BJWNW1r2YRR+j2uXx3j0JC28Wg8y7Os9DrmTvj7LPn5PoAV2VA9GrnYvEWzqp+4+ZvqKMbEVFdoM2wEseRw9fuzHaFVpHQefyyo/jizN2jsRFPsF1tiq6FWxI0MRZA1w3gorDp2m5rMsT9JV6XwQSE7QIF9p5/vS36qdqH1NC4W9/xK4nEoWpqksRM8Oj7esW7Zhj+C+jOQkkY19hiLcKa+rVVLR8KRbMLRey4tLYB64wkvbLAGxUODrQzcOcNAVhGmkdCv5G5IXTv0It7hjvIoDxmGqju5lKTVHeYyw8gKlAtx2wDGL/2PBpqMUMCMCoBbQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=xsightlabs.com; dmarc=pass action=none header.from=xsightlabs.com; dkim=pass header.d=xsightlabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xsightlabs.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SqXox45JITI3s0klWTD3pTESWYaI8RxqaVfDCFvWylM=; b=Ypdplv6ExmSwox6tsUUMnhOkTvm1jwebKOPXdu9pzrAk7NwVTfhIzxG2CCwKO1Kk84NAVEnleE0y4WD8EytRqXWBtywIJsXzzJh/6dcLKIfmwKFv+xpXNC8L6+fcNRnfMmQHvMCmL63w6pGKmtH9XjA1K01ZxXbfpOMYXkQjxPM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=xsightlabs.com; Received: from DB9P193MB1482.EURP193.PROD.OUTLOOK.COM (2603:10a6:10:2a6::7) by PAXP193MB1950.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:1cf::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Fri, 13 May 2022 17:58:48 +0000 Received: from DB9P193MB1482.EURP193.PROD.OUTLOOK.COM ([fe80::3c11:328c:a5e5:7253]) by DB9P193MB1482.EURP193.PROD.OUTLOOK.COM ([fe80::3c11:328c:a5e5:7253%6]) with mapi id 15.20.5250.015; Fri, 13 May 2022 17:58:47 +0000 From: Don Wallwork To: dev@dpdk.org Cc: donw@xsightlabs.com, stephen@networkplumber.org, mb@smartsharesystems.com, anatoly.burakov@intel.com, dmitry.kozliuk@gmail.com, bruce.richardson@intel.com, Honnappa.Nagarahalli@arm.com, nd@arm.com, haiyue.wang@intel.com Subject: [PATCH v2] eal: allow worker lcore stacks to be allocated from hugepage memory Date: Fri, 13 May 2022 13:58:22 -0400 Message-Id: <20220513175822.69905-1-donw@xsightlabs.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220502141058.12707-1-donw@xsightlabs.com> References: <20220502141058.12707-1-donw@xsightlabs.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BL1P222CA0010.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:2c7::15) To DB9P193MB1482.EURP193.PROD.OUTLOOK.COM (2603:10a6:10:2a6::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a6340bbf-1ebb-4a8e-7677-08da350a3a8b X-MS-TrafficTypeDiagnostic: PAXP193MB1950:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PhXTpt/KP6CyO++EPgyqRdg0juck4oBZmt0wZImI4DuNXNQKfu3xJEWOecAFUZyFxyjH1hVV9Wp7f+qL8NHLDW3cG36+vNDPuIOMopQc46j88kwQpVmfhB4lsR/pabDRzYrqs8h/kWq8XdmGbMhkN83bWK7buX0OaeNK6gNM7scqKY/r6oK/hF9WvDwV462Ad7gulZ9nTte9r5buL3dm06XTtKibbTugZyYlZgJPmJ2EkhNmTkaOlwTngf7ryUOVJMwgDePi9PiqrRRD4KENY5htyMtiHaj2La8mLzNq7fjQBCavsSnhEZoh1kiOnchG6v0xJAVVgDeVZwEcvOcf+7BNGpvH2fmKEA/OnC3TsM9QRiMmVJ7OnjNqIaUYCG6TONMQYm+t0EpJob0CcMDalcIyM79qVF1hrzKqUlOQLq/oOjc+uhRs3iqhn3T4kXE0tljFW7XtnCEJZbmoQ+4oqCwPeeZ3YUredDCChGRl19dSLgjs9dMlNpBykZci2tFqUercc8xDWYZe46dvZ+Q56GNfmyNWQ6A0lqCDKRx+6MJi9hq8M8ERuDJEiFSK01cX2FA3ARtVz0qTFqbuYUtBs01d1jgRGVkLP4jkOtOcsRF2SKJN+Z5zEORN0sv89Np9jl+i0/GQZqA2P11WIeiN09FGHQr7SoFi7lOr637Vo1bhzhgOkGrHcm7RAfmDCAY+p8+ARoxPUdUME0mIWlrnYw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9P193MB1482.EURP193.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(186003)(8676002)(66476007)(66556008)(5660300002)(4326008)(66574015)(66946007)(83380400001)(508600001)(52116002)(38100700002)(6666004)(6512007)(8936002)(38350700002)(6486002)(6916009)(1076003)(316002)(36756003)(26005)(2616005)(2906002)(86362001)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YzhCd1N6d2JXT0Fnb3ROY09ZVE5uNk1FZFF5RlV4am9OTEFVazFRbDRDeTQr?= =?utf-8?B?cDVjUVhPenhPSmlWSSs3RjNhRnRodkdwV3JKQVhqM25MbUF6WHZPeHYvQUJF?= =?utf-8?B?QndMVS9KeDRPaFJKTEZSTUU3YjA5Rm5QYnJkLzQwNm1yTEcyN2JvUG1yU0FT?= =?utf-8?B?ZXQ0SmswTEZsZ0ZsOHU3Y0NsVDZZODlxY1hpWTJMcjB2VWZNNXNCMEoyekxz?= =?utf-8?B?OXhKTU5RUkQzdGNId1d2NmlxYTFMZEw0UFBrdkVQSEozM3dyVzlNaVFLUXJT?= =?utf-8?B?VHV6VGZ1WGkraXNaRnl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MWNva0pL?= =?utf-8?B?ZDZZZEhseWFLMVJmRGhjQ05KejQzYk41RmlIK3dDU0pFWUhkSG8rZU9SRDZw?= =?utf-8?B?TUlaOCtGK2cvR0NnQk9KVStPLzFPYjd3MGhDblBieTZORlY0dmFYZWpIYXAz?= =?utf-8?B?UXlscksxazI2YXg0VkRsU3pwSVdDUlFpWkdobWFtRHR0YVNIallvYnFaVkxJ?= =?utf-8?B?TXZrbDFyRUFyNHZqSU9LWTZXWlhzcVdnZmZoSVpYYXFCVm1pZ0h4QT09?= X-OriginatorOrg: xsightlabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6340bbf-1ebb-4a8e-7677-08da350a3a8b X-MS-Exchange-CrossTenant-AuthSource: DB9P193MB1482.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2022 17:58:47.6385 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 646a3e34-83ea-4273-9177-ab01923abaa9 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JaE5bP0C8mUwo1/gHerKWLCMBpv2d3Bwwe84QbLEvpM+E1U6o4tZRCKx6YWDGfpcKIqiNeVyUqzo7XE5vKzEeQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXP193MB1950 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 Add support for using hugepages for worker lcore stack memory. The intent is to improve performance by reducing stack memory related TLB misses and also by using memory local to the NUMA node of each lcore. EAL option '--huge-worker-stack [stack-size-in-KiB]' is added to allow the feature to be enabled at runtime. If the size is not specified, the system pthread stack size will be used. Signed-off-by: Don Wallwork Acked-by: Morten Brørup --- doc/guides/linux_gsg/eal_args.include.rst | 6 ++ .../prog_guide/env_abstraction_layer.rst | 21 ++++++ lib/eal/common/eal_common_options.c | 28 ++++++++ lib/eal/common/eal_internal_cfg.h | 4 ++ lib/eal/common/eal_options.h | 2 + lib/eal/linux/eal.c | 65 ++++++++++++++++++- 6 files changed, 124 insertions(+), 2 deletions(-) diff --git a/doc/guides/linux_gsg/eal_args.include.rst b/doc/guides/linux_gsg/eal_args.include.rst index 3549a0cf56..d189109a55 100644 --- a/doc/guides/linux_gsg/eal_args.include.rst +++ b/doc/guides/linux_gsg/eal_args.include.rst @@ -116,6 +116,12 @@ Memory-related options Force IOVA mode to a specific value. +* ``--huge-worker-stack[=size]`` + + Allocate worker stack memory from hugepage memory. Stack size defaults + to system pthread stack size unless the optional size (in kbytes) is + specified. + Debugging options ~~~~~~~~~~~~~~~~~ diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst index 5f0748fba1..e74516f0cf 100644 --- a/doc/guides/prog_guide/env_abstraction_layer.rst +++ b/doc/guides/prog_guide/env_abstraction_layer.rst @@ -329,6 +329,27 @@ Another option is to use bigger page sizes. Since fewer pages are required to cover the same memory area, fewer file descriptors will be stored internally by EAL. +.. _huge-worker-stack: + +Hugepage Worker Stacks +^^^^^^^^^^^^^^^^^^^^^^ + +When the ``--huge-worker-stack[=size]`` EAL option is specified, worker +thread stacks are allocated from hugepage memory local to the NUMA node +of the thread. Worker stack size defaults to system pthread stack size +if the optional size parameter is not specified. + +.. warning:: + Stacks allocated from hugepage memory are not protected by guard + pages. Worker stacks must be sufficiently sized to prevent stack + overflow when this option is used. + + As with normal thread stacks, hugepage worker thread stack size is + fixed and is not dynamically resized. Therefore, an application that + is free of stack page faults under a given load should be safe with + hugepage worker thread stacks given the same thread stack size and + loading conditions. + Support for Externally Allocated Memory ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c index f247a42455..7fc5e10928 100644 --- a/lib/eal/common/eal_common_options.c +++ b/lib/eal/common/eal_common_options.c @@ -103,6 +103,7 @@ eal_long_options[] = { {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM }, {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM }, {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM}, + {OPT_HUGE_WORKER_STACK, 2, NULL, OPT_HUGE_WORKER_STACK_NUM }, {0, 0, NULL, 0 } }; @@ -1618,6 +1619,22 @@ eal_parse_huge_unlink(const char *arg, struct hugepage_file_discipline *out) return -1; } +static int +eal_parse_huge_worker_stack(const char *arg, size_t *huge_worker_stack_size) +{ + size_t worker_stack_size; + if (arg == NULL) { + *huge_worker_stack_size = USE_OS_STACK_SIZE; + return 0; + } + worker_stack_size = atoi(arg); + if (worker_stack_size == 0) + return -1; + + *huge_worker_stack_size = worker_stack_size * 1024; + return 0; +} + int eal_parse_common_option(int opt, const char *optarg, struct internal_config *conf) @@ -1921,6 +1938,17 @@ eal_parse_common_option(int opt, const char *optarg, } break; +#ifndef RTE_EXEC_ENV_WINDOWS + case OPT_HUGE_WORKER_STACK_NUM: + if (eal_parse_huge_worker_stack(optarg, + &conf->huge_worker_stack_size) < 0) { + RTE_LOG(ERR, EAL, "invalid parameter for --" + OPT_HUGE_WORKER_STACK"\n"); + return -1; + } + break; +#endif /* !RTE_EXEC_ENV_WINDOWS */ + /* don't know what to do, leave this to caller */ default: return 1; diff --git a/lib/eal/common/eal_internal_cfg.h b/lib/eal/common/eal_internal_cfg.h index b71faadd18..8ac710da02 100644 --- a/lib/eal/common/eal_internal_cfg.h +++ b/lib/eal/common/eal_internal_cfg.h @@ -48,6 +48,9 @@ struct hugepage_file_discipline { bool unlink_existing; }; +/** Worker hugepage stack size should default to OS value. */ +#define USE_OS_STACK_SIZE ((size_t)~0) + /** * internal configuration */ @@ -102,6 +105,7 @@ struct internal_config { unsigned int no_telemetry; /**< true to disable Telemetry */ struct simd_bitwidth max_simd_bitwidth; /**< max simd bitwidth path to use */ + size_t huge_worker_stack_size; /**< worker thread stack size in KiB */ }; void eal_reset_internal_config(struct internal_config *internal_cfg); diff --git a/lib/eal/common/eal_options.h b/lib/eal/common/eal_options.h index 8e4f7202a2..3cc9cb6412 100644 --- a/lib/eal/common/eal_options.h +++ b/lib/eal/common/eal_options.h @@ -87,6 +87,8 @@ enum { OPT_NO_TELEMETRY_NUM, #define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth" OPT_FORCE_MAX_SIMD_BITWIDTH_NUM, +#define OPT_HUGE_WORKER_STACK "huge-worker-stack" + OPT_HUGE_WORKER_STACK_NUM, OPT_LONG_MAX_NUM }; diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index 1ef263434a..e8c872ef7b 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -1144,8 +1144,69 @@ rte_eal_init(int argc, char **argv) lcore_config[i].state = WAIT; /* create a thread for each lcore */ - ret = pthread_create(&lcore_config[i].thread_id, NULL, - eal_thread_loop, (void *)(uintptr_t)i); + if (internal_conf->huge_worker_stack_size == 0) { + ret = pthread_create(&lcore_config[i].thread_id, NULL, + eal_thread_loop, + (void *)(uintptr_t)i); + } else { + /* Allocate NUMA aware stack memory and set + * pthread attributes + */ + pthread_attr_t attr; + size_t stack_size; + void *stack_ptr; + + if (pthread_attr_init(&attr) != 0) { + rte_eal_init_alert("Cannot init pthread " + "attributes"); + rte_errno = EFAULT; + return -1; + } + if (internal_conf->huge_worker_stack_size == + USE_OS_STACK_SIZE) { + if (pthread_attr_getstacksize(&attr, + &stack_size) != 0) { + rte_errno = EFAULT; + return -1; + } + } else { + stack_size = + internal_conf->huge_worker_stack_size; + } + stack_ptr = + rte_zmalloc_socket("lcore_stack", + stack_size, + stack_size, + rte_lcore_to_socket_id(i)); + + if (stack_ptr == NULL) { + rte_eal_init_alert("Cannot allocate stack " + "memory for worker lcore"); + rte_errno = ENOMEM; + return -1; + } + + if (pthread_attr_setstack(&attr, + stack_ptr, + stack_size) != 0) { + rte_eal_init_alert("Cannot set pthread " + "stack attributes"); + rte_errno = EFAULT; + return -1; + } + + /* create a thread for each lcore */ + ret = pthread_create(&lcore_config[i].thread_id, &attr, + eal_thread_loop, + (void *)(uintptr_t)i); + + if (pthread_attr_destroy(&attr) != 0) { + rte_eal_init_alert("Cannot destroy pthread " + "attributes"); + rte_errno = EFAULT; + return -1; + } + } if (ret != 0) rte_panic("Cannot create thread\n"); -- 2.17.1