From patchwork Mon Jul 20 16:28:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 51290 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 25DAA20323 for ; Mon, 20 Jul 2015 16:28:46 +0000 (UTC) Received: by lagw2 with SMTP id w2sf42044967lag.3 for ; Mon, 20 Jul 2015 09:28:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=9WCjzyNsITW+7YWa29GO/BwEx1KPishYxr92V4q5XXM=; b=e6IxS3nW7N+8zCxrwoRve79V0WC3tjHgJbDAsbI+AUDqsIDZyoRmBXioTc5I3h1yAn ygIkzL8X390LI/9ZBb+A8Ez6Ou1sYWb80FqlQeTjN0RRZwBbxxGkymbvWoP+j+Fm7yr4 3iq5C0suxPmjTTBxC6XQt73UjzOmjqRxz0aaPQ0RBAoyZyndTBxMEQk0pzrm1LvZeBPF 6Ikng6HjPD2iq5yQ2E0ViEnbNZKZitNA57Ph1tFosR5gitTqbf8NqznZoLJDX2+z49m7 RlgJZU1MJGBu1rbLJgA1lijWe3Le4NZa98n97+Q2k1yeHUZzU27EhzN7l+xj0t2QXUSj wOiw== X-Gm-Message-State: ALoCoQm6bPpZJre++HAzytojVsNoUiEvQ/wDeJXKdKsph0dafF4HP6SISOG63Pi34r+3+fyLghlv X-Received: by 10.194.5.229 with SMTP id v5mr15439707wjv.0.1437409725046; Mon, 20 Jul 2015 09:28:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.165 with SMTP id p5ls660336lal.68.gmail; Mon, 20 Jul 2015 09:28:44 -0700 (PDT) X-Received: by 10.112.137.1 with SMTP id qe1mr27896389lbb.22.1437409724880; Mon, 20 Jul 2015 09:28:44 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id dw10si18351233lbd.67.2015.07.20.09.28.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jul 2015 09:28:44 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lbbyj8 with SMTP id yj8so98679466lbb.0 for ; Mon, 20 Jul 2015 09:28:44 -0700 (PDT) X-Received: by 10.112.220.7 with SMTP id ps7mr28169581lbc.72.1437409724731; Mon, 20 Jul 2015 09:28:44 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp894925lba; Mon, 20 Jul 2015 09:28:43 -0700 (PDT) X-Received: by 10.140.34.135 with SMTP id l7mr46945279qgl.79.1437409723366; Mon, 20 Jul 2015 09:28:43 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id r138si5340498qha.90.2015.07.20.09.28.42; Mon, 20 Jul 2015 09:28:43 -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; Received: by lists.linaro.org (Postfix, from userid 109) id 3E60F61DE1; Mon, 20 Jul 2015 16:28:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal 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 ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 9C7BC61DD4; Mon, 20 Jul 2015 16:28: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 2ED1861DD5; Mon, 20 Jul 2015 16:28:35 +0000 (UTC) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by lists.linaro.org (Postfix) with ESMTPS id 0773F61DD1 for ; Mon, 20 Jul 2015 16:28:34 +0000 (UTC) Received: by wgav7 with SMTP id v7so69432481wga.2 for ; Mon, 20 Jul 2015 09:28:33 -0700 (PDT) X-Received: by 10.180.80.138 with SMTP id r10mr22405824wix.18.1437409713293; Mon, 20 Jul 2015 09:28:33 -0700 (PDT) Received: from localhost.localdomain ([87.120.178.39]) by smtp.gmail.com with ESMTPSA id ex8sm32732047wjc.34.2015.07.20.09.28.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Jul 2015 09:28:32 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Mon, 20 Jul 2015 19:28:29 +0300 Message-Id: <1437409709-20665-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv2] validation: scheduler: use number of workers X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxim.uvarov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Use number of workes instead of number of total cpus. Signed-off-by: Maxim Uvarov Reviewed-by: Bill Fischofer --- v2: rename also thread arguments from cpus to workers. test/validation/scheduler/scheduler.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/test/validation/scheduler/scheduler.c b/test/validation/scheduler/scheduler.c index f73c23a..fe03ab7 100644 --- a/test/validation/scheduler/scheduler.c +++ b/test/validation/scheduler/scheduler.c @@ -38,7 +38,7 @@ /* Test global variables */ typedef struct { - int cpu_count; + int num_workers; odp_barrier_t barrier; int buf_count; odp_ticketlock_t lock; @@ -52,7 +52,7 @@ typedef struct { int num_queues; int num_prio; int num_bufs; - int num_cpus; + int num_workers; int enable_schd_multi; int enable_excl_atomic; } thread_args_t; @@ -164,14 +164,12 @@ static void *schedule_common_(void *arg) { thread_args_t *args = (thread_args_t *)arg; odp_schedule_sync_t sync; - int num_cpus; test_globals_t *globals; globals = args->globals; sync = args->sync; - num_cpus = args->num_cpus; - if (num_cpus == globals->cpu_count) + if (args->num_workers > 1) odp_barrier_wait(&globals->barrier); while (1) { @@ -317,7 +315,7 @@ static void schedule_common(odp_schedule_sync_t sync, int num_queues, args.num_queues = num_queues; args.num_prio = num_prio; args.num_bufs = TEST_NUM_BUFS; - args.num_cpus = 1; + args.num_workers = 1; args.enable_schd_multi = enable_schd_multi; args.enable_excl_atomic = 0; /* Not needed with a single CPU */ @@ -352,14 +350,14 @@ static void parallel_execute(odp_schedule_sync_t sync, int num_queues, args->num_bufs = NUM_BUFS_EXCL; else args->num_bufs = TEST_NUM_BUFS; - args->num_cpus = globals->cpu_count; + args->num_workers = globals->num_workers; args->enable_schd_multi = enable_schd_multi; args->enable_excl_atomic = enable_excl_atomic; fill_queues(args); /* Create and launch worker threads */ - args->cu_thr.numthrds = globals->cpu_count; + args->cu_thr.numthrds = globals->num_workers; odp_cunit_thread_create(schedule_common_, &args->cu_thr); /* Wait for worker threads to terminate */ @@ -662,6 +660,7 @@ static int create_queues(void) static int scheduler_suite_init(void) { + odp_cpumask_t mask; odp_shm_t shm; odp_pool_t pool; test_globals_t *globals; @@ -692,9 +691,9 @@ static int scheduler_suite_init(void) memset(globals, 0, sizeof(test_globals_t)); - globals->cpu_count = odp_cpu_count(); - if (globals->cpu_count > MAX_WORKERS) - globals->cpu_count = MAX_WORKERS; + globals->num_workers = odp_cpumask_def_worker(&mask, 0); + if (globals->num_workers > MAX_WORKERS) + globals->num_workers = MAX_WORKERS; shm = odp_shm_reserve(SHM_THR_ARGS_NAME, sizeof(thread_args_t), ODP_CACHE_LINE_SIZE, 0); @@ -708,7 +707,7 @@ static int scheduler_suite_init(void) memset(args, 0, sizeof(thread_args_t)); /* Barrier to sync test case execution */ - odp_barrier_init(&globals->barrier, globals->cpu_count); + odp_barrier_init(&globals->barrier, globals->num_workers); odp_ticketlock_init(&globals->lock); odp_spinlock_init(&globals->atomic_lock);