From patchwork Thu Feb 1 16:00:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 126546 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1840056ljc; Thu, 1 Feb 2018 08:03:24 -0800 (PST) X-Google-Smtp-Source: AH8x226AyIELvlyOu5vPbe6/e3a8ql5l9S2vebD1+Y/2v5tCFJl46KOEWpvAR+ykwqFnWiSpDAVg X-Received: by 10.200.58.97 with SMTP id w88mr41010194qte.236.1517501004260; Thu, 01 Feb 2018 08:03:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517501004; cv=none; d=google.com; s=arc-20160816; b=DaCi22BgeUKYcRcdV3Lb64khWDwiNmti+aLBeJ+NjuP5an6xqvQX/JcKOkOmjkdGJR F/6nZ5SGl3zic93becv/rz346HDr3QPPrCTUgcyDlnf0/wcAupvw00kkUEiRO3cU5rXK DmHTXpQeb5ySDq8IVMMsSaiM1iICWi3TnFkotKo/IwgEmWT5I6kDd51TcIBwGZyjnNdD 6U0gN4FdzLlrQrcfhaykNYsyXl8Wy55bumxtRX13deG2VgYR3n07GKLTUBCdPbbClLSZ 2sX9o8QPOg+hEsptFxu0HW0KhMUVpqp+nfftKd7Dij+gsYXTSYeN8VYux+zCyGmOCyKx +ZnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=pFYn4gHxJIELCTAC9TOFJMw4gNVFjnZY8heE7HXM/hE=; b=SYptNRwc3+mSSKBOFx3ZqYG1smPYYnO7AmwGQq1mA+kc0Pzu2hreuB7Rj9/zg4aXlO 3iXC15AWg928MfOBrYoQVMJDvIONgoU2QXWPgkRcng9IEsRgvJZhi6CmGjQ0iojywpiU 7NdSblwY6M3MxK6SOJUSRrBccaaJnpcCOIqHbQQq6Ax1lpDcFWXUF2YBtOBYOBo8YnJm U4WIGOscHKJi0eijTtkW7kvHzi4dCMx837/TRLlU+lyeTcA2oFnwuzK2kZvGb9IGNIro 2ZCunCIIEART0es66Henp4qWaWt8TJSKb8wKDS0tluD5ecjAzECCd9ZzmUK5ewiEy7t9 AhBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id s28si4499894qtg.322.2018.02.01.08.03.24; Thu, 01 Feb 2018 08:03:24 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id E3553617B7; Thu, 1 Feb 2018 16:03:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id B1299617BE; Thu, 1 Feb 2018 16:00:35 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 8BD456176F; Thu, 1 Feb 2018 16:00:25 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id CF20760B04 for ; Thu, 1 Feb 2018 16:00:14 +0000 (UTC) Received: from mxback18j.mail.yandex.net (mxback18j.mail.yandex.net [IPv6:2a02:6b8:0:1619::94]) by forward106o.mail.yandex.net (Yandex) with ESMTP id C0A37786545 for ; Thu, 1 Feb 2018 19:00:12 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback18j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id MgTg9embow-0BniXn4f; Thu, 01 Feb 2018 19:00:11 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id IQBTIJTeEr-0BdSNsS2; Thu, 01 Feb 2018 19:00:11 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 1 Feb 2018 19:00:08 +0300 Message-Id: <1517500809-452-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517500809-452-1-git-send-email-odpbot@yandex.ru> References: <1517500809-452-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 446 Subject: [lng-odp] [PATCH API-NEXT v1 2/3] api: init: add shm memory size parameter X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Application memory usage may vary a lot. Implementation may need to pre-allocate memory or address space already at init time to be able to guarantee e.g. the same VA address space for all threads. Total SHM memory usage information is needed at global init time, as implementation likely uses the same shared memory for its own global memory allocations. Signed-off-by: Petri Savolainen --- /** Email created from pull request 446 (psavol:next-global-init-shm-size-2) ** https://github.com/Linaro/odp/pull/446 ** Patch: https://github.com/Linaro/odp/pull/446.patch ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3 ** Merge commit sha: 5beffee2f03442764ec79a301dd6608c8e82c8b4 **/ include/odp/api/spec/init.h | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/include/odp/api/spec/init.h b/include/odp/api/spec/init.h index 21734db2a..7c18cf45a 100644 --- a/include/odp/api/spec/init.h +++ b/include/odp/api/spec/init.h @@ -107,23 +107,29 @@ typedef int (*odp_log_func_t)(odp_log_level_t level, const char *fmt, ...); typedef void (*odp_abort_func_t)(void) ODP_NORETURN; /** - * ODP initialization data + * Global initialization parameters * - * Data that is required to initialize the ODP API with the - * application specific data such as specifying a logging callback, the log - * level etc. + * These parameters may be used at global initialization time to configure and + * optimize ODP implementation to match the intended usage. Application + * specifies maximum resource usage. Implementation may round up resource + * reservations as needed. Initialization function returns a failure if resource + * requirements are too high. Init parameters may be used also to override + * logging and abort functions. * - * @note It is expected that all unassigned members are zero + * Use odp_init_param_init() to initialize the parameters into their default + * values. Unused parameters are left to default values. */ typedef struct odp_init_t { /** Maximum number of worker threads the user will run concurrently. Valid range is from 0 to platform specific maximum. Set both num_worker and num_control to zero for default number of threads. */ int num_worker; + /** Maximum number of control threads the user will run concurrently. Valid range is from 0 to platform specific maximum. Set both num_worker and num_control to zero for default number of threads. */ int num_control; + /** Pointer to bit mask mapping CPUs available to this ODP instance for running worker threads. Initialize to a NULL pointer to use default CPU mapping. @@ -139,6 +145,7 @@ typedef struct odp_init_t { worker masks */ const odp_cpumask_t *worker_cpus; + /** Pointer to bit mask mapping CPUs available to this ODP instance for running control threads. Initialize to a NULL pointer to use default CPU mapping. @@ -150,10 +157,13 @@ typedef struct odp_init_t { worker and control masks do not overlap. */ const odp_cpumask_t *control_cpus; + /** Replacement for the default log fn */ odp_log_func_t log_fn; + /** Replacement for the default abort fn */ odp_abort_func_t abort_fn; + /** Unused features. These are hints to the ODP implementation that * the application will not use any APIs associated with these * features. Implementations may use this information to provide @@ -161,6 +171,15 @@ typedef struct odp_init_t { * that a feature will not be used and it is used anyway. */ odp_feature_t not_used; + + /** Shared memory parameters */ + struct { + /** Maximum memory usage in bytes. This is the maximum + * amount of shared memory that application will reserve + * concurrently. */ + uint64_t max_memory; + } shm; + } odp_init_t; /** @@ -189,7 +208,8 @@ void odp_init_param_init(odp_init_t *param); * system and outputs a handle for it. The handle is used in other calls * (e.g. odp_init_local()) as a reference to the instance. When user provides * configuration parameters, the platform may configure and optimize the - * instance to match user requirements. + * instance to match user requirements. A failure is returned if requirements + * cannot be met. * * Configuration parameters are divided into standard and platform specific * parts. Standard parameters are supported by any ODP platform, where as