From patchwork Thu Jul 9 13:46:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 50964 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 857DE228E5 for ; Thu, 9 Jul 2015 13:51:45 +0000 (UTC) Received: by lagc2 with SMTP id c2sf30539712lag.0 for ; Thu, 09 Jul 2015 06:51:44 -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:in-reply-to:references:cc: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=YY9NIMG2J7QpBuhBvII79+qvYg5z/I5aVxGQVYz9iEE=; b=LiasUPvEOw83CuXxe1o/rVqSczNPDDFcrIfSCF20BV7/UZ0rt2XeWc3XBE20IMl/ia VT08O6gFooTi2yQrqPgZx/F6O+TgEMWJf3+HsP/M+6PeOvTNVXcvc4CgNIcIOBWKvt/I xs1se1F4Nn0CdKzphjXql3XaLijG4Xwl/Vp6xaXktw3uk8goxgFV05gBEiB/XrL8Tuz3 zUM+AymhI+0oO+Q66r6/rVE/EcEfaN4xLuCl5LWXB7kJsl9Jmo0aY/l32DxtC5gvZucM 2cfX9Sl7Xpz9CJZx5BHy6qOHqHq65yO8d1BvHV8vGSinntwyvf3ro6Cag2Xn/zfzdeOA G6tQ== X-Gm-Message-State: ALoCoQlZO3L/dLA4z4A7dLjy3rJj6NdD67mcedmKFRMme8W4ZkwjNjGyFDOtheXDe+F2AOAwoVYF X-Received: by 10.112.181.37 with SMTP id dt5mr7919953lbc.10.1436449904502; Thu, 09 Jul 2015 06:51:44 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.18 with SMTP id s18ls1103328lal.63.gmail; Thu, 09 Jul 2015 06:51:44 -0700 (PDT) X-Received: by 10.152.25.227 with SMTP id f3mr14591808lag.67.1436449904332; Thu, 09 Jul 2015 06:51:44 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id u2si4565949laj.34.2015.07.09.06.51.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jul 2015 06:51:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lblf12 with SMTP id f12so6004399lbl.2 for ; Thu, 09 Jul 2015 06:51:43 -0700 (PDT) X-Received: by 10.152.4.163 with SMTP id l3mr15210881lal.35.1436449903880; Thu, 09 Jul 2015 06:51:43 -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.108.230 with SMTP id hn6csp682929lbb; Thu, 9 Jul 2015 06:51:42 -0700 (PDT) X-Received: by 10.140.145.78 with SMTP id 75mr25859111qhr.61.1436449902175; Thu, 09 Jul 2015 06:51:42 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 203si6669075qhv.15.2015.07.09.06.51.41; Thu, 09 Jul 2015 06:51:42 -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 4CF7361FCA; Thu, 9 Jul 2015 13:51:41 +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 B77EC61FE0; Thu, 9 Jul 2015 13:47: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 50EA961FE4; Thu, 9 Jul 2015 13:47:40 +0000 (UTC) Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by lists.linaro.org (Postfix) with ESMTPS id 118D561FCB for ; Thu, 9 Jul 2015 13:46:44 +0000 (UTC) Received: by wicmv11 with SMTP id mv11so1737028wic.1 for ; Thu, 09 Jul 2015 06:46:43 -0700 (PDT) X-Received: by 10.180.83.137 with SMTP id q9mr128565235wiy.68.1436449603270; Thu, 09 Jul 2015 06:46:43 -0700 (PDT) Received: from localhost.localdomain ([87.120.178.39]) by smtp.gmail.com with ESMTPSA id df1sm8414627wib.12.2015.07.09.06.46.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Jul 2015 06:46:42 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 9 Jul 2015 16:46:20 +0300 Message-Id: <1436449585-23252-7-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436449585-23252-1-git-send-email-maxim.uvarov@linaro.org> References: <1436449585-23252-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Cc: Petri Savolainen Subject: [lng-odp] [PATCH 06/11] api: helper: deleted odph_linux_cpumask_default 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.178 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 From: Petri Savolainen The linux specific helper was replaced by default cpumask calls (odp_cpumask_def_worker()) in the cpumask API. Signed-off-by: Petri Savolainen Reviewed-by: Christophe Milard Signed-off-by: Maxim Uvarov Conflicts: helper/linux.c --- example/classifier/odp_classifier.c | 7 ++----- example/generator/odp_generator.c | 7 ++----- example/ipsec/odp_ipsec.c | 7 ++----- example/packet/odp_pktio.c | 7 ++----- example/timer/odp_timer_test.c | 7 ++----- helper/include/odp/helper/linux.h | 11 ----------- helper/linux.c | 31 ------------------------------- helper/test/odp_process.c | 2 +- helper/test/odp_thread.c | 2 +- test/api_test/odp_common.c | 2 +- test/performance/odp_atomic.c | 2 +- test/performance/odp_l2fwd.c | 7 ++----- test/performance/odp_pktio_perf.c | 4 ++-- test/performance/odp_scheduling.c | 7 ++----- test/validation/common/odp_cunit_common.c | 2 +- 15 files changed, 21 insertions(+), 84 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index a716966..7b1a1c4 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -417,11 +417,8 @@ int main(int argc, char *argv[]) if (args->cpu_count) num_workers = args->cpu_count; - /* - * By default CPU #0 runs Linux kernel background tasks. - * Start mapping thread from CPU #1 - */ - num_workers = odph_linux_cpumask_default(&cpumask, num_workers); + /* Get default worker cpumask */ + num_workers = odp_cpumask_def_worker(&cpumask, num_workers); (void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr)); printf("num worker threads: %i\n", num_workers); diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 76b6f42..36219a0 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -636,11 +636,8 @@ int main(int argc, char *argv[]) if (args->appl.mode == APPL_MODE_PING) num_workers = 2; - /* - * By default CPU #0 runs Linux kernel background tasks. - * Start mapping thread from CPU #1 - */ - num_workers = odph_linux_cpumask_default(&cpumask, num_workers); + /* Get default worker cpumask */ + num_workers = odp_cpumask_def_worker(&cpumask, num_workers); (void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr)); printf("num worker threads: %i\n", num_workers); diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 471a390..0206d93 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1273,11 +1273,8 @@ main(int argc, char *argv[]) if (args->appl.cpu_count) num_workers = args->appl.cpu_count; - /* - * By default CPU #0 runs Linux kernel background tasks. - * Start mapping thread from CPU #1 - */ - num_workers = odph_linux_cpumask_default(&cpumask, num_workers); + /* Get default worker cpumask */ + num_workers = odp_cpumask_def_worker(&cpumask, num_workers); (void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr)); printf("num worker threads: %i\n", num_workers); diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index a71b5d4..865996c 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -358,11 +358,8 @@ int main(int argc, char *argv[]) if (args->appl.cpu_count) num_workers = args->appl.cpu_count; - /* - * By default CPU #0 runs Linux kernel background tasks. - * Start mapping thread from CPU #1 - */ - num_workers = odph_linux_cpumask_default(&cpumask, num_workers); + /* Get default worker cpumask */ + num_workers = odp_cpumask_def_worker(&cpumask, num_workers); (void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr)); printf("num worker threads: %i\n", num_workers); diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index f184eda..f7b1a3f 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -395,11 +395,8 @@ int main(int argc, char *argv[]) if (gbls->args.cpu_count) num_workers = gbls->args.cpu_count; - /* - * By default CPU #0 runs Linux kernel background tasks. - * Start mapping thread from CPU #1 - */ - num_workers = odph_linux_cpumask_default(&cpumask, num_workers); + /* Get default worker cpumask */ + num_workers = odp_cpumask_def_worker(&cpumask, num_workers); (void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr)); printf("num worker threads: %i\n", num_workers); diff --git a/helper/include/odp/helper/linux.h b/helper/include/odp/helper/linux.h index 44ee787..ce61fdf 100644 --- a/helper/include/odp/helper/linux.h +++ b/helper/include/odp/helper/linux.h @@ -51,17 +51,6 @@ typedef struct { } odph_linux_process_t; /** - * Creates default pthread/process cpumask - * - * Creates cpumask based on starting count, actual value returned - * - * @param mask CPU mask to initialize - * @param num Number of threads to create, zero for all available - * @return Actual values of CPUs used to create mask - */ -int odph_linux_cpumask_default(odp_cpumask_t *mask, int num); - -/** * Creates and launches pthreads * * Creates, pins and launches threads to separate CPU's based on the cpumask. diff --git a/helper/linux.c b/helper/linux.c index a2eacc1..4256f43 100644 --- a/helper/linux.c +++ b/helper/linux.c @@ -22,37 +22,6 @@ #include #include "odph_debug.h" -int odph_linux_cpumask_default(odp_cpumask_t *mask, int num) -{ - int ret, cpu, i; - cpu_set_t cpuset; - - ret = pthread_getaffinity_np(pthread_self(), - sizeof(cpu_set_t), &cpuset); - if (ret != 0) - ODPH_ABORT("failed to read CPU affinity value\n"); - - odp_cpumask_zero(mask); - - /* - * If no user supplied number or it's too large, then attempt - * to use all CPUs - */ - if (0 == num || CPU_SETSIZE < num) - num = CPU_COUNT(&cpuset); - - /* build the mask, allocating down from highest numbered CPU */ - for (cpu = 0, i = CPU_SETSIZE-1; i >= 0 && cpu < num; --i) { - if (CPU_ISSET(i, &cpuset)) { - odp_cpumask_set(mask, i); - cpu++; - } - } - - return cpu; -} - - static void *odp_run_start_routine(void *arg) { odp_start_args_t *start_args = arg; diff --git a/helper/test/odp_process.c b/helper/test/odp_process.c index 97f4669..d3a5943 100644 --- a/helper/test/odp_process.c +++ b/helper/test/odp_process.c @@ -39,7 +39,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) } /* discover how many processes this system can support */ - num_workers = odph_linux_cpumask_default(&cpu_mask, NUMBER_WORKERS); + num_workers = odp_cpumask_def_worker(&cpu_mask, NUMBER_WORKERS); if (num_workers < NUMBER_WORKERS) { printf("System can only support %d processes and not the %d requested\n", num_workers, NUMBER_WORKERS); diff --git a/helper/test/odp_thread.c b/helper/test/odp_thread.c index 634be96..1de30ab 100644 --- a/helper/test/odp_thread.c +++ b/helper/test/odp_thread.c @@ -40,7 +40,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) } /* discover how many threads this system can support */ - num_workers = odph_linux_cpumask_default(&cpu_mask, NUMBER_WORKERS); + num_workers = odp_cpumask_def_worker(&cpu_mask, NUMBER_WORKERS); if (num_workers < NUMBER_WORKERS) { printf("System can only support %d threads and not the %d requested\n", num_workers, NUMBER_WORKERS); diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c index 0677f9b..0dbefa5 100644 --- a/test/api_test/odp_common.c +++ b/test/api_test/odp_common.c @@ -74,7 +74,7 @@ int odp_test_thread_create(void *func_ptr(void *), pthrd_arg *arg) odp_cpumask_t cpumask; /* Create and init additional threads */ - odph_linux_cpumask_default(&cpumask, arg->numthrds); + odp_cpumask_def_worker(&cpumask, arg->numthrds); odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr, (void *)arg); diff --git a/test/performance/odp_atomic.c b/test/performance/odp_atomic.c index 861ab83..eefce06 100644 --- a/test/performance/odp_atomic.c +++ b/test/performance/odp_atomic.c @@ -284,7 +284,7 @@ int odp_test_thread_create(void *func_ptr(void *), pthrd_arg *arg) odp_cpumask_t cpumask; /* Create and init additional threads */ - odph_linux_cpumask_default(&cpumask, arg->numthrds); + odp_cpumask_def_worker(&cpumask, arg->numthrds); odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr, (void *)arg); diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 3184147..f1a5683 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -394,11 +394,8 @@ int main(int argc, char *argv[]) if (gbl_args->appl.cpu_count) num_workers = gbl_args->appl.cpu_count; - /* - * By default CPU #0 runs Linux kernel background tasks. - * Start mapping thread from CPU #1 - */ - num_workers = odph_linux_cpumask_default(&cpumask, num_workers); + /* Get default worker cpumask */ + num_workers = odp_cpumask_def_worker(&cpumask, num_workers); (void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr)); printf("num worker threads: %i\n", num_workers); diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index c3cc54d..77cb88c 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -529,8 +529,8 @@ static int setup_txrx_masks(odp_cpumask_t *thd_mask_tx, int num_workers, num_tx_workers, num_rx_workers; int i, cpu; - num_workers = odph_linux_cpumask_default(&cpumask, - gbl_args->args.cpu_count); + num_workers = odp_cpumask_def_worker(&cpumask, + gbl_args->args.cpu_count); if (num_workers < 2) { LOG_ERR("Need at least two cores\n"); return -1; diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index ee1c5da..f3a4f93 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -881,11 +881,8 @@ int main(int argc, char *argv[]) if (args.cpu_count) num_workers = args.cpu_count; - /* - * By default CPU #0 runs Linux kernel background tasks. - * Start mapping thread from CPU #1 - */ - num_workers = odph_linux_cpumask_default(&cpumask, num_workers); + /* Get default worker cpumask */ + num_workers = odp_cpumask_def_worker(&cpumask, num_workers); (void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr)); printf("num worker threads: %i\n", num_workers); diff --git a/test/validation/common/odp_cunit_common.c b/test/validation/common/odp_cunit_common.c index f7b7ea1..caf4ace 100644 --- a/test/validation/common/odp_cunit_common.c +++ b/test/validation/common/odp_cunit_common.c @@ -26,7 +26,7 @@ int odp_cunit_thread_create(void *func_ptr(void *), pthrd_arg *arg) odp_cpumask_t cpumask; /* Create and init additional threads */ - odph_linux_cpumask_default(&cpumask, arg->numthrds); + odp_cpumask_def_worker(&cpumask, arg->numthrds); odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr, (void *)arg);