From patchwork Fri May 27 17:01:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 68778 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp198808qge; Fri, 27 May 2016 10:02:33 -0700 (PDT) X-Received: by 10.55.168.86 with SMTP id r83mr2096574qke.24.1464368553147; Fri, 27 May 2016 10:02:33 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f79si18329807qke.2.2016.05.27.10.02.32; Fri, 27 May 2016 10:02:33 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 3A250617C3; Fri, 27 May 2016 17:02:32 +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, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 BD7336174F; Fri, 27 May 2016 17:02:27 +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 0F2C561761; Fri, 27 May 2016 17:02:26 +0000 (UTC) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com [209.85.217.170]) by lists.linaro.org (Postfix) with ESMTPS id 12C0D61722 for ; Fri, 27 May 2016 17:02:24 +0000 (UTC) Received: by mail-lb0-f170.google.com with SMTP id sh2so33205752lbb.1 for ; Fri, 27 May 2016 10:02:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=xFdHEW7fItTI9dacwylT/S54huQDvHY4Adfxylclacc=; b=UngyKmV7oJXpX+vMZow0gbcXmWx05hev+QBuEXPSzibO4Ulhv2CXn1Nw8Ds2NGV5vL zvR2dn1vw5/KKB0D+qdYfMBFR7TSuRHIQinn9MhKokC3BCa71cD5Xag13aKFWcFR9t6W UXADBqZUxAfOKmsbDYnAp7pqzIvAp19OyQQBRs9slqy2XFCkVRgXU4YLKKklR05chFkb F7UVCXISjDe8bRRDppbxEqedbF/iImjI+m7/DGP8Alwx4M8CsMNhB/Yk2DRQl1Y1i5vy S2nXaymGXs3I5EfPNQR7pkTfxXw0MOlmrktvDlEFLychhJL+j+P1wUsNXil/FicIEQH2 T8KQ== X-Gm-Message-State: ALyK8tLkIJ63EZdhmSBcZR+t9/i7dB0tz4tPRAJJIwL9g0R8sEyAxnndDQTtLNo4RW6oPC5X8bc= X-Received: by 10.112.198.169 with SMTP id jd9mr4179023lbc.94.1464368542688; Fri, 27 May 2016 10:02:22 -0700 (PDT) Received: from localhost.localdomain (ppp91-77-173-31.pppoe.mtu-net.ru. [91.77.173.31]) by smtp.gmail.com with ESMTPSA id rf7sm3053458lbb.11.2016.05.27.10.02.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 May 2016 10:02:22 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Fri, 27 May 2016 20:01:27 +0300 Message-Id: <1464368487-17510-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 2.7.1.250.gff4ea60 X-Topics: patch Subject: [lng-odp] [PATCH] validation: sched: fix out of array reference 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: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" If MAX_CPUS defined to less then current cpus, then odp call calculates current available cpus and references to array on thread creation. Do change to allocate array dynamically. Signed-off-by: Maxim Uvarov --- Looks like I found why this test fails on arm64 :) test/performance/odp_scheduling.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index 1d3bfd1..e64de6e 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -27,8 +27,6 @@ /* GNU lib C */ #include - -#define MAX_WORKERS 32 /**< Max worker threads */ #define MSG_POOL_SIZE (4*1024*1024) /**< Message pool size */ #define MAX_ALLOCS 35 /**< Alloc burst size */ #define QUEUES_PER_PRIO 64 /**< Queue per priority */ @@ -775,7 +773,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) */ int main(int argc, char *argv[]) { - odph_odpthread_t thread_tbl[MAX_WORKERS]; + odph_odpthread_t *thread_tbl; test_args_t args; int num_workers; odp_cpumask_t cpumask; @@ -795,8 +793,6 @@ int main(int argc, char *argv[]) memset(&args, 0, sizeof(args)); parse_args(argc, argv, &args); - memset(thread_tbl, 0, sizeof(thread_tbl)); - /* ODP global init */ if (odp_init_global(&instance, NULL, NULL)) { LOG_ERR("ODP global init failed.\n"); @@ -826,9 +822,8 @@ int main(int argc, char *argv[]) printf("\n"); /* Default to system CPU count unless user specified */ - num_workers = MAX_WORKERS; - if (args.cpu_count) - num_workers = args.cpu_count; + num_workers = args.cpu_count; + thread_tbl = calloc(sizeof(odph_odpthread_t), num_workers); /* Get default worker cpumask */ num_workers = odp_cpumask_default_worker(&cpumask, num_workers); @@ -947,6 +942,7 @@ int main(int argc, char *argv[]) /* Wait for worker threads to terminate */ odph_odpthreads_join(thread_tbl); + free(thread_tbl); printf("ODP example complete\n\n");