From patchwork Fri Feb 2 10:00:10 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: 126623 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp484960ljc; Fri, 2 Feb 2018 02:02:54 -0800 (PST) X-Google-Smtp-Source: AH8x227Ov9cHXJUNu7SBlgtLwPF8QO1J1mgpXLvnzKOvG6T/9US64EUmA9k+MvAeliqZozzEmzBb X-Received: by 10.55.170.150 with SMTP id t144mr24065077qke.339.1517565774579; Fri, 02 Feb 2018 02:02:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517565774; cv=none; d=google.com; s=arc-20160816; b=Mkn8TrqzMF3yPj4+s6BNIfvYpKCdO6uNq9pba+ldCx+JyvOx2G1k9lUfQ4VxgovDHI WM2Rwa5jmky++uVqSDgo0AOBEVoBerpQmO7gJ/69mKKeVmi06SayQjxRC82sBEjge/VZ 7NlS9kJ3Ox4/cBkvCtP/qO0U5QCDtS96coSOhvvgCk2G0vBYNzFO1y+hKiD/Rq+LryEL +vr2geOb3vI9fis31g1nHjtK6cH2owEf3vE94apZF/EJJ5yMzzgCg6xsXNTQCRIDatsp y130m7x1YuRkCoLfG8GdFnFCo+aiOcjj2BdXh4Mk8nsW1DTq3zg3P/Gh6JFsdUdRZuyN zK+g== 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=MMCS9TlrIoXP7xXY7N8n0rvkrZkQPW/lSdSP2hxlcFc=; b=jxRPUWPjToipzP1qGqxQK3sNWXntwWjcv/LKar/U35mfZqoTWrXIe5NjUN3KWjCIo6 h7KjiqUcFr1d7YGQpWhIN4zpZS7UED/ntPb5WUTjv30f2BTdGECfc6DVJULZSP8EgFIZ f0LOIS4QsNA+INEh1jWgKkxIJEa9h73pQS30MzhWG/7jkiK9W2Y+iCMCtjph301NVV+k 3RTNfYiYLq9YYgXP4Hyi6flOWaPJFfOGi4lG2Swk2oX5a1oQ2NeoFs0VWUWt2xJN7SSJ ZJ82Nevxo3t0jawMZtxv/9AUyrGsiP+Zzc9TrbVxc9u/JQFy9TtJKm8ttiD0vsga3mGh t4kQ== 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 j68si1844974qka.214.2018.02.02.02.02.54; Fri, 02 Feb 2018 02:02:54 -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 40E40617CB; Fri, 2 Feb 2018 10:02:54 +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 64B2D617A6; Fri, 2 Feb 2018 10:00:37 +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 2481C617A2; Fri, 2 Feb 2018 10:00:28 +0000 (UTC) Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by lists.linaro.org (Postfix) with ESMTPS id 2F069607C9 for ; Fri, 2 Feb 2018 10:00:16 +0000 (UTC) Received: from mxback7j.mail.yandex.net (mxback7j.mail.yandex.net [IPv6:2a02:6b8:0:1619::110]) by forward103j.mail.yandex.net (Yandex) with ESMTP id C501334C3E78 for ; Fri, 2 Feb 2018 13:00:13 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback7j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 9g1LSSIZdP-0DJS0nnE; Fri, 02 Feb 2018 13:00:13 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id opjCzdDZJW-0DjqdphH; Fri, 02 Feb 2018 13:00:13 +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, 2 Feb 2018 13:00:10 +0300 Message-Id: <1517565612-17887-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517565612-17887-1-git-send-email-odpbot@yandex.ru> References: <1517565612-17887-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 446 Subject: [lng-odp] [PATCH API-NEXT v2 1/3] validation: shm: test capa and maximum reservation 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 test which uses capability API, and tries to reserve and use maximum sized block. 100 MB shm memory is assumed to be available to ODP validation tests. 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: 3ceb1d8923dfe4b778ca652825396e422766c012 **/ test/validation/api/shmem/shmem.c | 54 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/test/validation/api/shmem/shmem.c b/test/validation/api/shmem/shmem.c index bda07011c..74eaa32d5 100644 --- a/test/validation/api/shmem/shmem.c +++ b/test/validation/api/shmem/shmem.c @@ -22,6 +22,8 @@ #define STRESS_SIZE 32 /* power of 2 and <=256 */ #define STRESS_RANDOM_SZ 5 #define STRESS_ITERATION 5000 +#define MAX_SIZE_TESTED (100 * 1000000UL) +#define MAX_ALIGN_TESTED (1024 * 1024) typedef enum { STRESS_FREE, /* entry is free and can be allocated */ @@ -212,6 +214,57 @@ void shmem_test_basic(void) CU_ASSERT(0 == odp_shm_free(shm)); } +/* + * maximum size reservation + */ +static void shmem_test_max_reserve(void) +{ + odp_shm_capability_t capa; + odp_shm_t shm; + uint64_t size, align; + uint8_t *data; + uint64_t i; + + memset(&capa, 0, sizeof(odp_shm_capability_t)); + CU_ASSERT_FATAL(odp_shm_capability(&capa) == 0); + + CU_ASSERT(capa.max_blocks > 0); + + size = capa.max_size; + align = capa.max_align; + + /* Assuming that system has at least MAX_SIZE_TESTED bytes available */ + if (capa.max_size == 0 || capa.max_size > MAX_SIZE_TESTED) + size = MAX_SIZE_TESTED; + + if (capa.max_align == 0 || capa.max_align > MAX_ALIGN_TESTED) + align = MAX_ALIGN_TESTED; + + printf("\n size: %" PRIu64 "\n", size); + printf(" align: %" PRIu64 "\n", align); + + shm = odp_shm_reserve("test_max_reserve", size, align, 0); + CU_ASSERT(shm != ODP_SHM_INVALID); + + data = odp_shm_addr(shm); + CU_ASSERT(data != NULL); + + if (data) { + memset(data, 0xde, size); + for (i = 0; i < size; i++) { + if (data[i] != 0xde) { + printf(" data error i:%" PRIu64 ", data %x" + "\n", i, data[i]); + CU_FAIL("Data error"); + break; + } + } + } + + if (shm != ODP_SHM_INVALID) + CU_ASSERT(odp_shm_free(shm) == 0); +} + /* * thread part for the shmem_test_reserve_after_fork */ @@ -769,6 +822,7 @@ void shmem_test_stress(void) odp_testinfo_t shmem_suite[] = { ODP_TEST_INFO(shmem_test_basic), + ODP_TEST_INFO(shmem_test_max_reserve), ODP_TEST_INFO(shmem_test_reserve_after_fork), ODP_TEST_INFO(shmem_test_singleva_after_fork), ODP_TEST_INFO(shmem_test_stress),