From patchwork Fri Oct 20 14:00:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 116497 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp8834edm; Fri, 20 Oct 2017 07:02:16 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RzLOaR9W1Dz6s+ffG3GyodOf3ZCiEFJcQU5o44nqSqrU8jEj+QOabOK1jkhs7kBoOpdjg7 X-Received: by 10.233.239.140 with SMTP id d134mr7060915qkg.308.1508508136794; Fri, 20 Oct 2017 07:02:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508508136; cv=none; d=google.com; s=arc-20160816; b=yk2jHKPJpA2Ma9Zmjlrqf8CKvSO9UAGQiZ0FLM/+04a3E1+NgCFtpth1F+wHoqRb2r uyE3nybOuNCTC33IEgngqGZmD7S1FAGsxJXE48zXBgOu+bqQJKuN4sSlDL9uRlTUJna5 Iy+PzFBKumhJN9WsooyBIpMvRi0RV5Ad6bOql3BNeeeOBd+tQqPMjnbOCFdmFIq+TErH wi6a8XXAtM4MhZ2BEFWery20RcOCEjFtyyGQOQe1+hloyNkoY5U6U3OVEVoI/gv2oNt0 07cErmT2rOAv3zDGSfozNocSR+i/s4X4Hr+8AD7L0eVqiX+hMNv9RoNVZAKlV4nT+Znb wJjA== 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=9b60StTe0RVn3BLJi1uJ9k7nGo4iYEXPrTKoDWvOUQU=; b=w/iCPp4oJJFy36XyWmK64peGbAvKXGA6BKwJtQOJ+MWYxeFvLy//H8dlWGV/6drIT7 GBQRmKQRCB0JteLRw/12R4UIyoDr4BZyOjrqf94D4WpAiwjVBPsDTVXxLy8NXRTx4nf+ Ujt+HAGdpSTTDnzrXPuALiZEZ8LqRRl8cVvwVp2AggbC+Zv5KVz/+FXyiHRqd2SQQK8C PK+79up4mu55Z9gBAlXYhQ2GkynUieHhQs8MSUK0brILk82SE2SOmVAgNgVCqhfhAAvx z7DTk0liUoIxlRDZi8BXynZlRWfbogjbkTVt7ENMFeOc/+xUOrfPY10aatiwlf8Jb67+ 2q3g== 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 y4si818619qtk.318.2017.10.20.07.02.16; Fri, 20 Oct 2017 07:02:16 -0700 (PDT) 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 523EE61027; Fri, 20 Oct 2017 14:02:16 +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,URIBL_BLOCKED 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 9A8D860FFD; Fri, 20 Oct 2017 14:00:43 +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 76A6260C9B; Fri, 20 Oct 2017 14:00:21 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id A532960C88 for ; Fri, 20 Oct 2017 14:00:18 +0000 (UTC) Received: from mxback13g.mail.yandex.net (mxback13g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:92]) by forward101o.mail.yandex.net (Yandex) with ESMTP id 9367E1343311 for ; Fri, 20 Oct 2017 17:00:16 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback13g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Q2STKsxcYb-0GvuqoOi; Fri, 20 Oct 2017 17:00:16 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id EU0BCjigMs-0GdeIXKq; Fri, 20 Oct 2017 17:00:16 +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: Fri, 20 Oct 2017 17:00:08 +0300 Message-Id: <1508508011-21260-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508508011-21260-1-git-send-email-odpbot@yandex.ru> References: <1508508011-21260-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 246 Subject: [lng-odp] [PATCH API-NEXT v1 1/4] api: shm: style clean up 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 Clean up shm header file. Remove [in] Doxygen tags as function parameters are by default input. Move @note text to the main text block, as it's usual API specification text. Signed-off-by: Petri Savolainen --- /** Email created from pull request 246 (psavol:next-shm-print) ** https://github.com/Linaro/odp/pull/246 ** Patch: https://github.com/Linaro/odp/pull/246.patch ** Base sha: e3108af2f0b58c2ceca422b418439bba5de04b11 ** Merge commit sha: d02ca128bb3e497ed54c1224b5bd9d9f707870b3 **/ include/odp/api/spec/shared_memory.h | 63 +++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/include/odp/api/spec/shared_memory.h b/include/odp/api/spec/shared_memory.h index 1a9c1299e..2c0db1021 100644 --- a/include/odp/api/spec/shared_memory.h +++ b/include/odp/api/spec/shared_memory.h @@ -50,6 +50,7 @@ extern "C" { */ #define ODP_SHM_SW_ONLY 0x1 /**< Application SW only, no HW access */ #define ODP_SHM_PROC 0x2 /**< Share with external processes */ + /** * Single virtual address * @@ -58,6 +59,7 @@ extern "C" { * of ODP thread type (e.g. pthread vs. process (or fork process time)). */ #define ODP_SHM_SINGLE_VA 0x4 + /** * Export memory * @@ -70,11 +72,20 @@ extern "C" { * Shared memory block info */ typedef struct odp_shm_info_t { - const char *name; /**< Block name */ - void *addr; /**< Block address */ - uint64_t size; /**< Block size in bytes */ - uint64_t page_size; /**< Memory page size */ - uint32_t flags; /**< ODP_SHM_* flags */ + /** Block name */ + const char *name; + + /** Block address */ + void *addr; + + /** Block size in bytes */ + uint64_t size; + + /** Memory page size */ + uint64_t page_size; + + /** ODP_SHM_* flags */ + uint32_t flags; } odp_shm_info_t; /** @@ -116,11 +127,10 @@ int odp_shm_capability(odp_shm_capability_t *capa); /** * Reserve a contiguous block of shared memory * - * @param[in] name Name of the block (maximum ODP_SHM_NAME_LEN - 1 chars) - * @param[in] size Block size in bytes - * @param[in] align Block alignment in bytes - * @param[in] flags Shared memory parameter flags (ODP_SHM_*). - * Default value is 0. + * @param name Name of the block (maximum ODP_SHM_NAME_LEN - 1 chars) + * @param size Block size in bytes + * @param align Block alignment in bytes + * @param flags Shared memory parameter flags (ODP_SHM_*). Default value is 0. * * @return Handle of the reserved block * @retval ODP_SHM_INVALID on failure @@ -131,10 +141,10 @@ odp_shm_t odp_shm_reserve(const char *name, uint64_t size, uint64_t align, /** * Free a contiguous block of shared memory * - * Frees a previously reserved block of shared memory. - * @note Freeing memory that is in use will result in UNDEFINED behavior + * Frees a previously reserved block of shared memory. Freeing memory that is + * in use will result in UNDEFINED behavior * - * @param[in] shm Block handle + * @param shm Block handle * * @retval 0 on success * @retval <0 on failure @@ -144,7 +154,7 @@ int odp_shm_free(odp_shm_t shm); /** * Lookup for a block of shared memory * - * @param[in] name Name of the block + * @param name Name of the block * * @return A handle to the block if it is found by name * @retval ODP_SHM_INVALID on failure @@ -177,20 +187,21 @@ odp_shm_t odp_shm_import(const char *remote_name, /** * Shared memory block address * - * @param[in] shm Block handle + * @param shm Block handle * * @return Memory block address * @retval NULL on failure */ void *odp_shm_addr(odp_shm_t shm); - /** * Shared memory block info - * @note This is the only shared memory API function which accepts invalid - * shm handles (any bit value) without causing undefined behavior. * - * @param[in] shm Block handle + * Get information about the specified shared memory block. This is the only + * shared memory API function which accepts invalid shm handles (any bit value) + * without causing undefined behavior. + * + * @param shm Block handle * @param[out] info Block info pointer for output * * @retval 0 on success @@ -207,15 +218,15 @@ void odp_shm_print_all(void); /** * Get printable value for an odp_shm_t * - * @param hdl odp_shm_t handle to be printed - * @return uint64_t value that can be used to print/display this - * handle + * This routine is intended to be used for diagnostic purposes to enable + * applications to generate a printable value that represents an odp_shm_t + * handle. + * + * @param shm Block handle * - * @note This routine is intended to be used for diagnostic purposes - * to enable applications to generate a printable value that represents - * an odp_shm_t handle. + * @return uint64_t value that can be used to print this handle */ -uint64_t odp_shm_to_u64(odp_shm_t hdl); +uint64_t odp_shm_to_u64(odp_shm_t shm); /** * @} From patchwork Fri Oct 20 14:00:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 116499 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp11588edm; Fri, 20 Oct 2017 07:04:18 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TygWTRI9cY9rjB9G5rz8sUhaLtw9pKVdkqDzQvncHmZERzF2CvXtfv5wbGFk1Ki/I2TWIn X-Received: by 10.55.75.75 with SMTP id y72mr6742596qka.118.1508508258861; Fri, 20 Oct 2017 07:04:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508508258; cv=none; d=google.com; s=arc-20160816; b=emhpvNqBQH8V0GkocawVY6q1oobel9x8bf55uI9PbxNN1pRBv/62W1bXlxFjw2micV WQTuxCV7TJLVuT/Xcp0prbJEjapn9Vf+qxYQT7B117Hs9VR6nCUqwOX31mjcGTeYbKGu 5oUiNh4m91pP0cAUSw99H3rjnhmDIL6qleuHXgrLMhF4Avzg40hWsbUqAwXc2HyoEay5 13m6A77iWVzuZ00c1YgdD6uiY8altiFCTJKy2owaD5kI/knfh0e1flX1qYdDtPCU0vrP 7zkmhAEXKzN83YWDKaeiiKrL1hiyNvtoXnQY9MuxC/zkwXTJxIBUS+91Y7LCp8bKmv99 Vuzw== 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=nqXZc3DcqmIrwLjoiYJeCsFmAu7yRKG38pXoped4Ado=; b=atkmW5NudpQwBaEXZW4iE4AJ4xBFA7iueuD8cYbyIM/+CIcDpCXNyc+FSL2gu0ZAQe MANmD7i2UV2B04FuMFb8f0XfveOD4pR+mBSe1+p9Fs0xgKnOkBaePpz3/bOX0Y7DRh96 ZJzVYOjYrofufWwYcMjA8AkMGNcIM5SAkevh9sjp0HqGi0YqR8zlxPVbHrt1Xug4NOOj NAsazgZ3ZdM4iMKakUInubuuTufvhrRVt5LtW3HICKicWWGU/XdGyRY0iuygeTZc93tF KhEKVCKjinl1k/zZOjPNm39KPCx+rsqi6PQ7o4vvl9EY+awGXkr/q4Li183VY4aVtwfQ d9vA== 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 x6si839655qkg.233.2017.10.20.07.04.15; Fri, 20 Oct 2017 07:04:18 -0700 (PDT) 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 23BAA60FFA; Fri, 20 Oct 2017 14:04:15 +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,URIBL_BLOCKED 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 5275261007; Fri, 20 Oct 2017 14:00:49 +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 3682060D35; Fri, 20 Oct 2017 14:00:24 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id 288F0609AC for ; Fri, 20 Oct 2017 14:00:18 +0000 (UTC) Received: from mxback6j.mail.yandex.net (mxback6j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10f]) by forward106p.mail.yandex.net (Yandex) with ESMTP id 1F4592D853E1 for ; Fri, 20 Oct 2017 17:00:17 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback6j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id YJQC8kWY7R-0HTukRth; Fri, 20 Oct 2017 17:00:17 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id EU0BCjigMs-0Gd0JnpY; Fri, 20 Oct 2017 17:00:16 +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: Fri, 20 Oct 2017 17:00:09 +0300 Message-Id: <1508508011-21260-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508508011-21260-1-git-send-email-odpbot@yandex.ru> References: <1508508011-21260-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 246 Subject: [lng-odp] [PATCH API-NEXT v1 2/4] api: shm: print shm block info 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 Added function to print debugging information about the specified shared memory block. Info is implementation defined but should include information about allocated memory addresses, pages, etc. Signed-off-by: Petri Savolainen --- /** Email created from pull request 246 (psavol:next-shm-print) ** https://github.com/Linaro/odp/pull/246 ** Patch: https://github.com/Linaro/odp/pull/246.patch ** Base sha: e3108af2f0b58c2ceca422b418439bba5de04b11 ** Merge commit sha: d02ca128bb3e497ed54c1224b5bd9d9f707870b3 **/ include/odp/api/spec/shared_memory.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/odp/api/spec/shared_memory.h b/include/odp/api/spec/shared_memory.h index 2c0db1021..60a0cdde3 100644 --- a/include/odp/api/spec/shared_memory.h +++ b/include/odp/api/spec/shared_memory.h @@ -209,13 +209,22 @@ void *odp_shm_addr(odp_shm_t shm); */ int odp_shm_info(odp_shm_t shm, odp_shm_info_t *info); - /** * Print all shared memory blocks */ void odp_shm_print_all(void); /** + * Print shared memory block info + * + * Print implementation defined information about the specified shared memory + * block to the ODP log. The information is intended to be used for debugging. + * + * @param shm Block handle + */ +void odp_shm_print(odp_shm_t shm); + +/** * Get printable value for an odp_shm_t * * This routine is intended to be used for diagnostic purposes to enable From patchwork Fri Oct 20 14:00:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 116500 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp13688edm; Fri, 20 Oct 2017 07:05:51 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RBmvljnntgSIU30xXloHST9o6FViUSAMFn1tG579X5UxgS3DGdrVkV5VAgPRhYNReHQYmx X-Received: by 10.55.125.196 with SMTP id y187mr7447035qkc.180.1508508351059; Fri, 20 Oct 2017 07:05:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508508351; cv=none; d=google.com; s=arc-20160816; b=EolAcverp/yp33uBKD3fqylcUh9N1Bo2GCNjuIOLTjDZSuSqFIRuvCofZLgiXSLNI/ pUzgk8sE3y4hMS42iaO0IK+c5nyOSEF3LxTa9xh15Prtcnm3fw+ZB+N/KxTrPd9wpTcj jHStd5gtByyx4qWqhANLpz3qNoQn6yoorahFj2JgkKo9oNYWM6CYllxCSz4tAkgYgFvz /eWnVqW+5p36ehUTRcltM4HJchiUSGo/BavjZVYaaWhk5WvT0zzVnQOtvEMqj0I0N6Kz lOHbbgjZ8p6xOf0baicoSolAiulq6XvU6Qloi35rHF0tuVNTRLCIKEPEyPYl2UELRak2 1mMA== 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=DiiMywTk0owXMfWjiIhCaN7bcQTTI75LzX2wtMMtNk4=; b=wo05Z/U5l1CyVJOn1Gye2hUKXgY2hntcLJu69UoH9yBI/yepwlHQYEFzajjH5GIw/O Z3GFzn38dN2eT84hsEpkwqMNn+MLPoSI2uwTu6+kmrWoXWARu/x5sSXn7jwz3wCIZqhn 69eO2xupmEraSx/x6nLpdJ+GqicTmNMQZLePG0WSfRfZtzIb6jSbDqaDJM7661QhxA9w tgLzoAg1hWl+GVTRT3PMjMDPcCZw8rVhnBPWiW1zfX/AAGUYM7qXowkUzZQvTu7pSg3T D611MVEEDRnolhrGilNtijetyrkATPTHycjeDVxBjIze4ipdyBMSZZCL9AA4GU5UpjXG k60Q== 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 x42si816409qtx.462.2017.10.20.07.05.50; Fri, 20 Oct 2017 07:05:51 -0700 (PDT) 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 C1F95608C4; Fri, 20 Oct 2017 14:05:50 +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=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED 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 0EDB861012; Fri, 20 Oct 2017 14:00:59 +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 45A4E609AC; Fri, 20 Oct 2017 14:00:26 +0000 (UTC) Received: from forward103o.mail.yandex.net (forward103o.mail.yandex.net [37.140.190.177]) by lists.linaro.org (Postfix) with ESMTPS id 2788060C8F for ; Fri, 20 Oct 2017 14:00:19 +0000 (UTC) Received: from mxback11j.mail.yandex.net (mxback11j.mail.yandex.net [IPv6:2a02:6b8:0:1619::84]) by forward103o.mail.yandex.net (Yandex) with ESMTP id BC8365886466 for ; Fri, 20 Oct 2017 17:00:17 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback11j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Jr7uLcRgdA-0HcaeoD4; Fri, 20 Oct 2017 17:00:17 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id EU0BCjigMs-0HdG63Gv; Fri, 20 Oct 2017 17:00:17 +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: Fri, 20 Oct 2017 17:00:10 +0300 Message-Id: <1508508011-21260-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508508011-21260-1-git-send-email-odpbot@yandex.ru> References: <1508508011-21260-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 246 Subject: [lng-odp] [PATCH API-NEXT v1 3/4] linux-gen: shm: make odp_shm_print_all readable again 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 Use ODP_PRINT instead of ODP_DBG in the print function. The idea of a print function is that it prints information when application calls it. ODP_DBG does not print anything by default. Format printted output to be a readable table of shm blocks. Signed-off-by: Petri Savolainen --- /** Email created from pull request 246 (psavol:next-shm-print) ** https://github.com/Linaro/odp/pull/246 ** Patch: https://github.com/Linaro/odp/pull/246.patch ** Base sha: e3108af2f0b58c2ceca422b418439bba5de04b11 ** Merge commit sha: d02ca128bb3e497ed54c1224b5bd9d9f707870b3 **/ platform/linux-generic/_ishm.c | 69 +++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 27 deletions(-) diff --git a/platform/linux-generic/_ishm.c b/platform/linux-generic/_ishm.c index 6e5bc61fe..e7a6c2357 100644 --- a/platform/linux-generic/_ishm.c +++ b/platform/linux-generic/_ishm.c @@ -1708,11 +1708,28 @@ int _odp_ishm_status(const char *title) int nb_allocated_frgments = 0; /* nb frag describing an allocated VA */ int nb_blocks = 0; int single_va_blocks = 0; + int max_name_len = 0; odp_spinlock_lock(&ishm_tbl->lock); procsync(); - ODP_DBG("ishm blocks allocated at: %s\n", title); + /* find longest block name */ + for (i = 0; i < ISHM_MAX_NB_BLOCKS; i++) { + int str_len; + + if (ishm_tbl->block[i].len <= 0) + continue; + + str_len = strlen(ishm_tbl->block[i].name); + + if (max_name_len < str_len) + max_name_len = str_len; + } + + ODP_PRINT("ishm blocks allocated at: %s\n", title); + + ODP_PRINT(" %-*s flag len user_len seq ref start fd" + " file\n", max_name_len, "name"); /* display block table: 1 line per entry +1 extra line if mapped here */ for (i = 0; i < ISHM_MAX_NB_BLOCKS; i++) { @@ -1742,41 +1759,39 @@ int _odp_ishm_status(const char *title) huge = '?'; } proc_index = procfind_block(i); - ODP_DBG("%-3d: name:%-.24s file:%-.24s" - " flags:%s,%c len:0x%-08lx" - " user_len:%-8ld seq:%-3ld refcnt:%-4d\n", - i, - ishm_tbl->block[i].name, - ishm_tbl->block[i].filename, - flags, huge, - ishm_tbl->block[i].len, - ishm_tbl->block[i].user_len, - ishm_tbl->block[i].seq, - ishm_tbl->block[i].refcnt); + ODP_PRINT("%2i %-*s %s%c 0x%-08lx %-8lu %-3lu %-3lu", + i, max_name_len, ishm_tbl->block[i].name, + flags, huge, + ishm_tbl->block[i].len, + ishm_tbl->block[i].user_len, + ishm_tbl->block[i].seq, + ishm_tbl->block[i].refcnt); if (proc_index < 0) continue; - ODP_DBG(" start:%-08lx fd:%-3d\n", - ishm_proctable->entry[proc_index].start, - ishm_proctable->entry[proc_index].fd); + ODP_PRINT("%-08lx %-3d", + ishm_proctable->entry[proc_index].start, + ishm_proctable->entry[proc_index].fd); + + ODP_PRINT("%s\n", ishm_tbl->block[i].filename); } /* display the virtual space allocations... : */ - ODP_DBG("ishm virtual space:\n"); + ODP_PRINT("\nishm virtual space:\n"); for (fragmnt = ishm_ftbl->used_fragmnts; fragmnt; fragmnt = fragmnt->next) { if (fragmnt->block_index >= 0) { nb_allocated_frgments++; - ODP_DBG(" %08p - %08p: ALLOCATED by block:%d\n", - (uintptr_t)fragmnt->start, - (uintptr_t)fragmnt->start + fragmnt->len - 1, - fragmnt->block_index); + ODP_PRINT(" %08p - %08p: ALLOCATED by block:%d\n", + (uintptr_t)fragmnt->start, + (uintptr_t)fragmnt->start + fragmnt->len - 1, + fragmnt->block_index); consecutive_unallocated = 0; } else { - ODP_DBG(" %08p - %08p: NOT ALLOCATED\n", - (uintptr_t)fragmnt->start, - (uintptr_t)fragmnt->start + fragmnt->len - 1); + ODP_PRINT(" %08p - %08p: NOT ALLOCATED\n", + (uintptr_t)fragmnt->start, + (uintptr_t)fragmnt->start + fragmnt->len - 1); if (consecutive_unallocated++) ODP_ERR("defragmentation error\n"); } @@ -1807,9 +1822,9 @@ int _odp_ishm_status(const char *title) fragmnt; fragmnt = fragmnt->next) nb_unused_frgments++; - ODP_DBG("ishm: %d fragment used. %d fragments unused. (total=%d)\n", - nb_used_frgments, nb_unused_frgments, - nb_used_frgments + nb_unused_frgments); + ODP_PRINT("ishm: %d fragment used. %d fragments unused. (total=%d)\n", + nb_used_frgments, nb_unused_frgments, + nb_used_frgments + nb_unused_frgments); if ((nb_used_frgments + nb_unused_frgments) != ISHM_NB_FRAGMNTS) ODP_ERR("lost fragments!\n"); @@ -1817,7 +1832,7 @@ int _odp_ishm_status(const char *title) if (nb_blocks < ishm_proctable->nb_entries) ODP_ERR("process known block cannot exceed main total sum!\n"); - ODP_DBG("\n"); + ODP_PRINT("\n"); odp_spinlock_unlock(&ishm_tbl->lock); return nb_blocks; From patchwork Fri Oct 20 14:00:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 116498 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp10251edm; Fri, 20 Oct 2017 07:03:20 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RR1a7JEee8FpdNjjmdZK7vJeKwGfXp4MXsM6n0fHQ6+8sEJJH+fmPH6N4laevp/isaeEIa X-Received: by 10.37.194.130 with SMTP id s124mr3319278ybf.271.1508508200076; Fri, 20 Oct 2017 07:03:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508508200; cv=none; d=google.com; s=arc-20160816; b=CYkg0S9BlX4SMXOdOl0UqBDlyeTxyfK3Dtfj90XKdXrzV1ApUdoqHzrVflh1bSQOJs 33L+aS1oSL0YT725+SZ4WfGrJAGpZG90LBAJY4Cl0qRQ/uMhPdptzO5dem5WhPi9/Gwv RqS2gtNPF7uq8x+gW0Rgr22zYogZFq4RwqvCKxgCjyLXmjo+puFjLx1RQvepLsU7rSuf AaL+/crsRsxzUwjA84H/QKhK+l3FhKXFeAKLS/H0GLXVuYE1Wbwkd8xtcULSwslHcJle 9/nlZq6LdXn6TwneAZi3j4JJNjM5X8Qhf5jXe9pm2ZuY2h1j1LwlCn0uTqdjRucZW4dV fOBw== 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=Dtb5uIe+coLPNK8Yes3jf9GqKv3migtaUqPxwGH/ORw=; b=YpuLvdyrnftQncJNjLliq1zgkz9GHyg73ie666CiaMqUHAA9jKnuhG1wqhj6O+/vkk acXtE/tTWTXG+UktrX2vcsRhNDfXB/7CeR/ZIMkbSY6o12EJC2dP8H1qGHWvVk1NBNUU ChjRh0YB7hPHRnMNMQFNzoWFPebz+9w2QiznNyFjQc9LF8GD1gYm8WEbD8/d/F8X8tem SfpGRLtotX/nI/XFhZCD1jMjCdVGWQ/HakR3q6T4Ls1wcCIk8umU2sluS0U8Pe7jkiyU HHtEp/7v4dp3T+nJlvkzjGlv7qJY9JWXfosG/fRRHkzFmq3oU76XZjcY7DeP3ffPwHsh l8GQ== 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 n17si792976qki.236.2017.10.20.07.03.18; Fri, 20 Oct 2017 07:03:20 -0700 (PDT) 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 129A160CF7; Fri, 20 Oct 2017 14:03:18 +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=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED 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 E309960FFA; Fri, 20 Oct 2017 14:00:45 +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 B1C2760D36; Fri, 20 Oct 2017 14:00:23 +0000 (UTC) Received: from forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) by lists.linaro.org (Postfix) with ESMTPS id ACC316013A for ; Fri, 20 Oct 2017 14:00:19 +0000 (UTC) Received: from mxback12g.mail.yandex.net (mxback12g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:91]) by forward101p.mail.yandex.net (Yandex) with ESMTP id 3C8876A84485 for ; Fri, 20 Oct 2017 17:00:18 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback12g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id lH0nCV7tXt-0IDCLEBv; Fri, 20 Oct 2017 17:00:18 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id EU0BCjigMs-0Hdm3GvM; Fri, 20 Oct 2017 17:00:17 +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: Fri, 20 Oct 2017 17:00:11 +0300 Message-Id: <1508508011-21260-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508508011-21260-1-git-send-email-odpbot@yandex.ru> References: <1508508011-21260-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 246 Subject: [lng-odp] [PATCH API-NEXT v1 4/4] linux-gen: shm: implement odp_shm_print 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 Implement the new block level debug print function. Signed-off-by: Petri Savolainen --- /** Email created from pull request 246 (psavol:next-shm-print) ** https://github.com/Linaro/odp/pull/246 ** Patch: https://github.com/Linaro/odp/pull/246.patch ** Base sha: e3108af2f0b58c2ceca422b418439bba5de04b11 ** Merge commit sha: d02ca128bb3e497ed54c1224b5bd9d9f707870b3 **/ platform/linux-generic/_ishm.c | 49 +++++++++++++++++++++++++ platform/linux-generic/include/_ishm_internal.h | 1 + platform/linux-generic/odp_shared_memory.c | 5 +++ test/common_plat/validation/api/shmem/shmem.c | 2 + 4 files changed, 57 insertions(+) diff --git a/platform/linux-generic/_ishm.c b/platform/linux-generic/_ishm.c index e7a6c2357..238efb81a 100644 --- a/platform/linux-generic/_ishm.c +++ b/platform/linux-generic/_ishm.c @@ -1837,3 +1837,52 @@ int _odp_ishm_status(const char *title) odp_spinlock_unlock(&ishm_tbl->lock); return nb_blocks; } + +void _odp_ishm_print(int block_index) +{ + ishm_block_t *block; + const char *str; + + odp_spinlock_lock(&ishm_tbl->lock); + + if ((block_index < 0) || + (block_index >= ISHM_MAX_NB_BLOCKS) || + (ishm_tbl->block[block_index].len == 0)) { + odp_spinlock_unlock(&ishm_tbl->lock); + ODP_ERR("Request for info on an invalid block\n"); + return; + } + + block = &ishm_tbl->block[block_index]; + + ODP_PRINT("\nSHM block info\n--------------\n"); + ODP_PRINT(" name: %s\n", block->name); + ODP_PRINT(" file: %s\n", block->filename); + ODP_PRINT(" expt: %s\n", block->exptname); + ODP_PRINT(" user_flags: 0x%x\n", block->user_flags); + ODP_PRINT(" flags: 0x%x\n", block->flags); + ODP_PRINT(" user_len: %lu\n", block->user_len); + ODP_PRINT(" start: %p\n", block->start); + ODP_PRINT(" len: %lu\n", block->len); + + switch (block->huge) { + case HUGE: + str = "huge"; + break; + case NORMAL: + str = "normal"; + break; + case EXTERNAL: + str = "external"; + break; + default: + str = "??"; + } + + ODP_PRINT(" page type: %s\n", str); + ODP_PRINT(" seq: %lu\n", block->seq); + ODP_PRINT(" refcnt: %lu\n", block->refcnt); + ODP_PRINT("\n"); + + odp_spinlock_unlock(&ishm_tbl->lock); +} diff --git a/platform/linux-generic/include/_ishm_internal.h b/platform/linux-generic/include/_ishm_internal.h index 005d6b551..34068bc0c 100644 --- a/platform/linux-generic/include/_ishm_internal.h +++ b/platform/linux-generic/include/_ishm_internal.h @@ -45,6 +45,7 @@ void *_odp_ishm_address(int block_index); int _odp_ishm_info(int block_index, _odp_ishm_info_t *info); int _odp_ishm_status(const char *title); int _odp_ishm_cleanup_files(const char *dirpath); +void _odp_ishm_print(int block_index); #ifdef __cplusplus } diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c index ccd25c8c8..aabecd9b0 100644 --- a/platform/linux-generic/odp_shared_memory.c +++ b/platform/linux-generic/odp_shared_memory.c @@ -116,6 +116,11 @@ void odp_shm_print_all(void) _odp_ishm_status("Memory allocation status:"); } +void odp_shm_print(odp_shm_t shm) +{ + _odp_ishm_print(from_handle(shm)); +} + uint64_t odp_shm_to_u64(odp_shm_t hdl) { return _odp_pri(hdl); diff --git a/test/common_plat/validation/api/shmem/shmem.c b/test/common_plat/validation/api/shmem/shmem.c index 08587940c..d5335afa9 100644 --- a/test/common_plat/validation/api/shmem/shmem.c +++ b/test/common_plat/validation/api/shmem/shmem.c @@ -152,6 +152,8 @@ void shmem_test_basic(void) odp_cunit_thread_create(run_test_basic_thread, &thrdarg); CU_ASSERT(odp_cunit_thread_exit(&thrdarg) >= 0); + odp_shm_print(shm); + CU_ASSERT(0 == odp_shm_free(shm)); }