From patchwork Wed Jan 7 14:10:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ola Liljedahl X-Patchwork-Id: 42819 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 95A5D20558 for ; Wed, 7 Jan 2015 14:10:29 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id d49sf2497415eek.0 for ; Wed, 07 Jan 2015 06:10:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :date:message-id:from:to:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :content-type:content-transfer-encoding:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=OjcmyEMsKDaVU+C4LhYmAMd5X3aqXOxLPnUDuAtJgwQ=; b=J4bNTkZ9u2mg5w8+eyAKqIAmnCNAnV2hmcbu5C0JX7ePPpM2yPwOV46sv5UTOCeUFY oCyR4RYL5jGKGrowYvm5b0Nl6iMMSOEUlhhjQGsYnPNJHiv/XMdHjtqmD5S5re1ZhNUA 1n3JwKbbyjvCNWeB+FvlHpTzrSoZQJhethCUYNnI6CUOigvUwkx5w+x5M/FOU54s2cOf M7RwBtesImYvl+ik51H29Em/ksga8C6tnsNuoXuF9QKKnmb4PlP6FUUpEnX6AIZO8IWU T9jMew6Wuykw95OsyWbTTJbkf9QQmtOmSDGjiTomm+fX4A1YBxHhHOsoH25UjLalibU+ 6I6A== X-Gm-Message-State: ALoCoQk01srcH7PG+9TP3dszHiOIB/llAbt+ykjAVU5Tk6hMEErN1OrzrEYn2thE2GlBpZYq/PDl X-Received: by 10.112.147.195 with SMTP id tm3mr102414lbb.18.1420639828862; Wed, 07 Jan 2015 06:10:28 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.121.106 with SMTP id lj10ls173011lab.6.gmail; Wed, 07 Jan 2015 06:10:28 -0800 (PST) X-Received: by 10.112.150.102 with SMTP id uh6mr4836217lbb.66.1420639828685; Wed, 07 Jan 2015 06:10:28 -0800 (PST) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id g2si2978103lbs.85.2015.01.07.06.10.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 07 Jan 2015 06:10:28 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id z11so1117447lbi.24 for ; Wed, 07 Jan 2015 06:10:28 -0800 (PST) X-Received: by 10.152.5.226 with SMTP id v2mr4926847lav.34.1420639828464; Wed, 07 Jan 2015 06:10:28 -0800 (PST) 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.9.200 with SMTP id c8csp1492825lbb; Wed, 7 Jan 2015 06:10:27 -0800 (PST) X-Received: by 10.224.136.7 with SMTP id p7mr4770560qat.65.1420639826353; Wed, 07 Jan 2015 06:10:26 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id s106si1985482qgd.103.2015.01.07.06.10.25 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 07 Jan 2015 06:10:26 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y8rJW-0004e9-Ie; Wed, 07 Jan 2015 14:10:22 +0000 Received: from mail-la0-f51.google.com ([209.85.215.51]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y8rJQ-0004cL-QA for lng-odp@lists.linaro.org; Wed, 07 Jan 2015 14:10:17 +0000 Received: by mail-la0-f51.google.com with SMTP id ms9so3596270lab.10 for ; Wed, 07 Jan 2015 06:10:10 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.152.205.75 with SMTP id le11mr4905515lac.20.1420639809155; Wed, 07 Jan 2015 06:10:09 -0800 (PST) Received: by 10.112.43.227 with HTTP; Wed, 7 Jan 2015 06:10:09 -0800 (PST) In-Reply-To: <1420639600-15980-2-git-send-email-ola.liljedahl@linaro.org> References: <1420639600-15980-1-git-send-email-ola.liljedahl@linaro.org> <1420639600-15980-2-git-send-email-ola.liljedahl@linaro.org> Date: Wed, 7 Jan 2015 15:10:09 +0100 Message-ID: From: Ola Liljedahl To: Bill Fischofer , Mike Holmes X-Topics: patch Cc: "lng-odp@lists.linaro.org" Subject: [lng-odp] Fwd: [PATCHv2 1/2] api: odp_system_info.h: change core to cpu everywhere X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ola.liljedahl@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.179 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 If you apply this patch, I hope the timer patches shall apply. At least this was the conflict that Stuart found. I don't know why patch complained on something completely unrelated for me. I probably will have to post a v2 of the timer patches anyway because I messed up with the commit messages (too long, too short, in the wrong place etc). I cleared this up with Anders. --Ola ---------- Forwarded message ---------- From: Ola Liljedahl Date: 7 January 2015 at 15:06 Subject: [PATCHv2 1/2] api: odp_system_info.h: change core to cpu everywhere To: lng-odp@lists.linaro.org Cc: Ola Liljedahl Rename odp_core_count() to odp_cpu_count(). Change "core" to "cpu"/"CPU" in messages and comments. Signed-off-by: Ola Liljedahl --- (This document/code contribution attached is provided under the terms of agreement LES-LTM-21309) example/generator/odp_generator.c | 38 ++++++++++---------- example/ipsec/odp_ipsec.c | 32 ++++++++--------- example/l2fwd/odp_l2fwd.c | 42 +++++++++++----------- example/packet/odp_pktio.c | 41 ++++++++++----------- example/timer/odp_timer_test.c | 38 ++++++++++---------- helper/include/odph_linux.h | 24 ++++++------- .../linux-generic/include/api/odp_system_info.h | 8 +++-- platform/linux-generic/include/api/odp_thread.h | 6 ++-- platform/linux-generic/odp_linux.c | 34 +++++++++--------- platform/linux-generic/odp_system_info.c | 22 ++++++------ platform/linux-generic/odp_thread.c | 2 +- test/api_test/odp_atomic_test.c | 6 ++-- test/api_test/odp_common.c | 8 ++--- test/api_test/odp_ring_test.c | 2 +- test/api_test/odp_shm_test.c | 2 +- test/performance/odp_scheduling.c | 38 ++++++++++---------- test/validation/odp_schedule.c | 26 +++++++------- test/validation/odp_shm.c | 2 +- 18 files changed, 187 insertions(+), 184 deletions(-) -- 1.9.1 diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index d4bea92..95b4b3c 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -44,7 +44,7 @@ * Parsed command line application arguments */ typedef struct { - int core_count; /**< system core count */ + int cpu_count; /**< system CPU count */ int if_count; /**< Number of interfaces to be used */ char **if_names; /**< Array of pointers to interface names */ odp_buffer_pool_t pool; /**< Buffer pool for packet IO */ @@ -527,8 +527,8 @@ int main(int argc, char *argv[]) odp_buffer_pool_t pool; int num_workers; int i; - int first_core; - int core_count; + int first_cpu; + int cpu_count; odp_shm_t shm; odp_buffer_pool_param_t params; @@ -566,11 +566,11 @@ int main(int argc, char *argv[]) /* Print both system and application information */ print_info(NO_PATH(argv[0]), &args->appl); - core_count = odp_sys_core_count(); - num_workers = core_count; + cpu_count = odp_sys_cpu_count(); + num_workers = cpu_count; - if (args->appl.core_count) - num_workers = args->appl.core_count; + if (args->appl.cpu_count) + num_workers = args->appl.cpu_count; if (num_workers > MAX_WORKERS) num_workers = MAX_WORKERS; @@ -582,15 +582,15 @@ int main(int argc, char *argv[]) printf("Num worker threads: %i\n", num_workers); /* - * By default core #0 runs Linux kernel background tasks. - * Start mapping thread from core #1 + * By default CPU #0 runs Linux kernel background tasks. + * Start mapping thread from CPU #1 */ - first_core = 1; + first_cpu = 1; - if (core_count == 1) - first_core = 0; + if (cpu_count == 1) + first_cpu = 0; - printf("First core: %i\n\n", first_core); + printf("First CPU: %i\n\n", first_cpu); /* Create packet pool */ params.buf_size = SHM_PKT_POOL_BUF_SIZE; @@ -627,10 +627,10 @@ int main(int argc, char *argv[]) } else { for (i = 0; i < num_workers; ++i) { void *(*thr_run_func) (void *); - int core; + int cpu; int if_idx; - core = (first_core + i) % core_count; + cpu = (first_cpu + i) % cpu_count; if_idx = i % args->appl.if_count; @@ -652,7 +652,7 @@ int main(int argc, char *argv[]) * Calls odp_thread_create(cpu) for each thread */ odph_linux_pthread_create(&thread_tbl[i], 1, - core, thr_run_func, + cpu, thr_run_func, &args->thread[i]); } } @@ -708,7 +708,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) switch (opt) { case 'w': - appl_args->core_count = atoi(optarg); + appl_args->cpu_count = atoi(optarg); break; /* parse packet-io interface names */ case 'I': @@ -846,10 +846,10 @@ static void print_info(char *progname, appl_args_t *appl_args) "CPU model: %s\n" "CPU freq (hz): %"PRIu64"\n" "Cache line size: %i\n" - "Core count: %i\n" + "CPU count: %i\n" "\n", odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(), - odp_sys_cache_line_size(), odp_sys_core_count()); + odp_sys_cache_line_size(), odp_sys_cpu_count()); printf("Running ODP appl: \"%s\"\n" "-----------------\n" diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 223ca61..7a0fbef 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -49,7 +49,7 @@ * Parsed command line application arguments */ typedef struct { - int core_count; + int cpu_count; int if_count; /**< Number of interfaces to be used */ char **if_names; /**< Array of pointers to interface names */ crypto_api_mode_e mode; /**< Crypto API preferred mode */ @@ -1172,8 +1172,8 @@ main(int argc, char *argv[]) odph_linux_pthread_t thread_tbl[MAX_WORKERS]; int num_workers; int i; - int first_core; - int core_count; + int first_cpu; + int cpu_count; int stream_count; odp_shm_t shm; odp_buffer_pool_param_t params; @@ -1214,11 +1214,11 @@ main(int argc, char *argv[]) /* Print both system and application information */ print_info(NO_PATH(argv[0]), &args->appl); - core_count = odp_sys_core_count(); - num_workers = core_count; + cpu_count = odp_sys_cpu_count(); + num_workers = cpu_count; - if (args->appl.core_count) - num_workers = args->appl.core_count; + if (args->appl.cpu_count) + num_workers = args->appl.cpu_count; if (num_workers > MAX_WORKERS) num_workers = MAX_WORKERS; @@ -1229,11 +1229,11 @@ main(int argc, char *argv[]) odp_barrier_init(&sync_barrier, num_workers); /* - * By default core #0 runs Linux kernel background tasks. - * Start mapping thread from core #1 + * By default CPU #0 runs Linux kernel background tasks. + * Start mapping thread from CPU #1 */ - first_core = (1 == core_count) ? 0 : 1; - printf("First core: %i\n\n", first_core); + first_cpu = (1 == cpu_count) ? 0 : 1; + printf("First CPU: %i\n\n", first_cpu); /* Create packet buffer pool */ params.buf_size = SHM_PKT_POOL_BUF_SIZE; @@ -1285,7 +1285,7 @@ main(int argc, char *argv[]) /* * Create and init worker threads */ - odph_linux_pthread_create(thread_tbl, num_workers, first_core, + odph_linux_pthread_create(thread_tbl, num_workers, first_cpu, pktio_thread, NULL); /* @@ -1353,7 +1353,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) switch (opt) { case 'c': - appl_args->core_count = atoi(optarg); + appl_args->cpu_count = atoi(optarg); break; /* parse packet-io interface names */ case 'i': @@ -1460,10 +1460,10 @@ static void print_info(char *progname, appl_args_t *appl_args) "CPU model: %s\n" "CPU freq (hz): %"PRIu64"\n" "Cache line size: %i\n" - "Core count: %i\n" + "CPU count: %i\n" "\n", odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(), - odp_sys_cache_line_size(), odp_sys_core_count()); + odp_sys_cache_line_size(), odp_sys_cpu_count()); printf("Running ODP appl: \"%s\"\n" "-----------------\n" @@ -1519,7 +1519,7 @@ static void usage(char *progname) " -a 192.168.111.2:192.168.222.2:md5:201:a731649644c5dee92cbd9c2e7e188ee6\n" "\n" "Optional OPTIONS\n" - " -c, --count Core count.\n" + " -c, --count CPU count.\n" " -h, --help Display help and exit.\n" " environment variables: ODP_PKTIO_DISABLE_SOCKET_MMAP\n" " ODP_PKTIO_DISABLE_SOCKET_MMSG\n" diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index 3e11b60..34289b1 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -65,7 +65,7 @@ * Parsed command line application arguments */ typedef struct { - int core_count; + int cpu_count; int if_count; /**< Number of interfaces to be used */ char **if_names; /**< Array of pointers to interface names */ int mode; /**< Packet IO mode */ @@ -314,8 +314,8 @@ int main(int argc, char *argv[]) odph_linux_pthread_t thread_tbl[MAX_WORKERS]; odp_buffer_pool_t pool; int i; - int first_core; - int core_count; + int first_cpu; + int cpu_count; odp_pktio_t pktio; odp_shm_t shm; odp_buffer_pool_param_t params; @@ -349,11 +349,11 @@ int main(int argc, char *argv[]) /* Print both system and application information */ print_info(NO_PATH(argv[0]), &gbl_args->appl); - core_count = odp_sys_core_count(); - num_workers = core_count; + cpu_count = odp_sys_cpu_count(); + num_workers = cpu_count; - if (gbl_args->appl.core_count) - num_workers = gbl_args->appl.core_count; + if (gbl_args->appl.cpu_count) + num_workers = gbl_args->appl.cpu_count; if (num_workers > MAX_WORKERS) num_workers = MAX_WORKERS; @@ -361,7 +361,7 @@ int main(int argc, char *argv[]) printf("Num worker threads: %i\n", num_workers); if (num_workers < gbl_args->appl.if_count) { - EXAMPLE_ERR("Error: core count %d is less than interface " + EXAMPLE_ERR("Error: CPU count %d is less than interface " "count\n", num_workers); exit(EXIT_FAILURE); } @@ -371,15 +371,15 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } /* - * By default core #0 runs Linux kernel background tasks. - * Start mapping thread from core #1 + * By default CPU #0 runs Linux kernel background tasks. + * Start mapping thread from CPU #1 */ - first_core = 1; + first_cpu = 1; - if (core_count == 1) - first_core = 0; + if (cpu_count == 1) + first_cpu = 0; - printf("First core: %i\n\n", first_core); + printf("First cpu: %i\n\n", first_cpu); /* Create packet pool */ params.buf_size = SHM_PKT_POOL_BUF_SIZE; @@ -434,15 +434,15 @@ int main(int argc, char *argv[]) /* Create worker threads */ for (i = 0; i < num_workers; ++i) { void *(*thr_run_func) (void *); - int core; + int cpu; - core = (first_core + i) % core_count; + cpu = (first_cpu + i) % cpu_count; if (gbl_args->appl.mode == APPL_MODE_PKT_BURST) thr_run_func = pktio_ifburst_thread; else /* APPL_MODE_PKT_QUEUE */ thr_run_func = pktio_queue_thread; - odph_linux_pthread_create(&thread_tbl[i], 1, core, thr_run_func, + odph_linux_pthread_create(&thread_tbl[i], 1, cpu, thr_run_func, &gbl_args->thread[i]); } @@ -518,7 +518,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) switch (opt) { case 'c': - appl_args->core_count = atoi(optarg); + appl_args->cpu_count = atoi(optarg); break; /* parse packet-io interface names */ case 'i': @@ -603,10 +603,10 @@ static void print_info(char *progname, appl_args_t *appl_args) "CPU model: %s\n" "CPU freq (hz): %"PRIu64"\n" "Cache line size: %i\n" - "Core count: %i\n" + "CPU count: %i\n" "\n", odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(), - odp_sys_cache_line_size(), odp_sys_core_count()); + odp_sys_cache_line_size(), odp_sys_cpu_count()); printf("Running ODP appl: \"%s\"\n" "-----------------\n" @@ -645,7 +645,7 @@ static void usage(char *progname) " 1: Send&receive packets through ODP queues.\n" "\n" "Optional OPTIONS\n" - " -c, --count Core count.\n" + " -c, --count CPU count.\n" " -h, --help Display help and exit.\n\n" " environment variables: ODP_PKTIO_DISABLE_SOCKET_MMAP\n" " ODP_PKTIO_DISABLE_SOCKET_MMSG\n" diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 0a38ec2..3ccd99f 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -65,7 +65,7 @@ * Parsed command line application arguments */ typedef struct { - int core_count; + int cpu_count; int if_count; /**< Number of interfaces to be used */ char **if_names; /**< Array of pointers to interface names */ int mode; /**< Packet IO mode */ @@ -312,9 +312,10 @@ int main(int argc, char *argv[]) odp_buffer_pool_t pool; int num_workers; int i; - int first_core; - int core_count; + int first_cpu; + int cpu_count; odp_buffer_pool_param_t params; + odp_shm_t shm; args = calloc(1, sizeof(args_t)); if (args == NULL) { @@ -340,11 +341,11 @@ int main(int argc, char *argv[]) /* Print both system and application information */ print_info(NO_PATH(argv[0]), &args->appl); - core_count = odp_sys_core_count(); - num_workers = core_count; + cpu_count = odp_sys_cpu_count(); + num_workers = cpu_count; - if (args->appl.core_count) - num_workers = args->appl.core_count; + if (args->appl.cpu_count) + num_workers = args->appl.cpu_count; if (num_workers > MAX_WORKERS) num_workers = MAX_WORKERS; @@ -352,15 +353,15 @@ int main(int argc, char *argv[]) printf("Num worker threads: %i\n", num_workers); /* - * By default core #0 runs Linux kernel background tasks. - * Start mapping thread from core #1 + * By default CPU #0 runs Linux kernel background tasks. + * Start mapping thread from CPU #1 */ - first_core = 1; + first_cpu = 1; - if (core_count == 1) - first_core = 0; + if (cpu_count == 1) + first_cpu = 0; - printf("First core: %i\n\n", first_core); + printf("First CPU: %i\n\n", first_cpu); /* Create packet pool */ params.buf_size = SHM_PKT_POOL_BUF_SIZE; @@ -380,10 +381,10 @@ int main(int argc, char *argv[]) memset(thread_tbl, 0, sizeof(thread_tbl)); for (i = 0; i < num_workers; ++i) { void *(*thr_run_func) (void *); - int core; + int cpu; int if_idx; - core = (first_core + i) % core_count; + cpu = (first_cpu + i) % cpu_count; if_idx = i % args->appl.if_count; @@ -400,7 +401,7 @@ int main(int argc, char *argv[]) * because each thread might get different arguments. * Calls odp_thread_create(cpu) for each thread */ - odph_linux_pthread_create(&thread_tbl[i], 1, core, thr_run_func, + odph_linux_pthread_create(&thread_tbl[i], 1, cpu, thr_run_func, &args->thread[i]); } @@ -515,7 +516,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) switch (opt) { case 'c': - appl_args->core_count = atoi(optarg); + appl_args->cpu_count = atoi(optarg); break; /* parse packet-io interface names */ case 'i': @@ -599,10 +600,10 @@ static void print_info(char *progname, appl_args_t *appl_args) "CPU model: %s\n" "CPU freq (hz): %"PRIu64"\n" "Cache line size: %i\n" - "Core count: %i\n" + "CPU count: %i\n" "\n", odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(), - odp_sys_cache_line_size(), odp_sys_core_count()); + odp_sys_cache_line_size(), odp_sys_cpu_count()); printf("Running ODP appl: \"%s\"\n" "-----------------\n" @@ -638,7 +639,7 @@ static void usage(char *progname) " 1: Send&receive packets through ODP queues.\n" "\n" "Optional OPTIONS\n" - " -c, --count Core count.\n" + " -c, --count CPU count.\n" " -h, --help Display help and exit.\n" " environment variables: ODP_PKTIO_DISABLE_SOCKET_MMAP\n" " ODP_PKTIO_DISABLE_SOCKET_MMSG\n" diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index c754695..2acf2fc 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -32,7 +32,7 @@ /** Test arguments */ typedef struct { - int core_count; /**< Core count*/ + int cpu_count; /**< CPU count*/ int resolution_us; /**< Timeout resolution in usec*/ int min_us; /**< Minimum timeout in usec*/ int max_us; /**< Maximum timeout in usec*/ @@ -126,7 +126,7 @@ static void *run_thread(void *ptr) args = ptr; thr = odp_thread_id(); - printf("Thread %i starts on core %i\n", thr, odp_thread_core()); + printf("Thread %i starts on cpu %i\n", thr, odp_thread_cpu()); /* * Find the buffer pool @@ -156,7 +156,7 @@ static void print_usage(void) { printf("\n\nUsage: ./odp_example [options]\n"); printf("Options:\n"); - printf(" -c, --count core count, core IDs start from 1\n"); + printf(" -c, --count CPU count\n"); printf(" -r, --resolution timeout resolution in usec\n"); printf(" -m, --min minimum timeout in usec\n"); printf(" -x, --max maximum timeout in usec\n"); @@ -191,7 +191,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) }; /* defaults */ - args->core_count = 0; /* all cores */ + args->cpu_count = 0; /* all CPU's */ args->resolution_us = 10000; args->min_us = args->resolution_us; args->max_us = 10000000; @@ -207,7 +207,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) switch (opt) { case 'c': - args->core_count = atoi(optarg); + args->cpu_count = atoi(optarg); break; case 'r': args->resolution_us = atoi(optarg); @@ -246,7 +246,7 @@ int main(int argc, char *argv[]) int num_workers; odp_buffer_pool_t pool; odp_queue_t queue; - int first_core; + int first_cpu; uint64_t cycles, ns; odp_queue_param_t param; odp_shm_t shm; @@ -277,32 +277,32 @@ int main(int argc, char *argv[]) printf("CPU model: %s\n", odp_sys_cpu_model_str()); printf("CPU freq (hz): %"PRIu64"\n", odp_sys_cpu_hz()); printf("Cache line size: %i\n", odp_sys_cache_line_size()); - printf("Max core count: %i\n", odp_sys_core_count()); + printf("Max CPU count: %i\n", odp_sys_cpu_count()); printf("\n"); - /* A worker thread per core */ - num_workers = odp_sys_core_count(); + /* A worker thread per CPU */ + num_workers = odp_sys_cpu_count(); - if (args.core_count) - num_workers = args.core_count; + if (args.cpu_count) + num_workers = args.cpu_count; - /* force to max core count */ + /* force to max CPU count */ if (num_workers > MAX_WORKERS) num_workers = MAX_WORKERS; printf("num worker threads: %i\n", num_workers); /* - * By default core #0 runs Linux kernel background tasks. - * Start mapping thread from core #1 + * By default CPU #0 runs Linux kernel background tasks. + * Start mapping thread from CPU #1 */ - first_core = 1; + first_cpu = 1; - if (odp_sys_core_count() == 1) - first_core = 0; + if (odp_sys_cpu_count() == 1) + first_cpu = 0; - printf("first core: %i\n", first_core); + printf("first CPU: %i\n", first_cpu); printf("resolution: %i usec\n", args.resolution_us); printf("min timeout: %i usec\n", args.min_us); printf("max timeout: %i usec\n", args.max_us); @@ -379,7 +379,7 @@ int main(int argc, char *argv[]) odp_barrier_init(&test_barrier, num_workers); /* Create and launch worker threads */ - odph_linux_pthread_create(thread_tbl, num_workers, first_core, + odph_linux_pthread_create(thread_tbl, num_workers, first_cpu, run_thread, &args); /* Wait for worker threads to exit */ diff --git a/helper/include/odph_linux.h b/helper/include/odph_linux.h index 8671dc0..4ed8bbe 100644 --- a/helper/include/odph_linux.h +++ b/helper/include/odph_linux.h @@ -30,14 +30,14 @@ extern "C" { typedef struct { pthread_t thread; /**< Pthread ID */ pthread_attr_t attr; /**< Pthread attributes */ - int core; /**< Core ID */ + int cpu; /**< CPU ID */ } odph_linux_pthread_t; /** Linux process state information */ typedef struct { pid_t pid; /**< Process ID */ - int core; /**< Core ID */ + int cpu; /**< CPU ID */ int status; /**< Process state change status */ } odph_linux_process_t; @@ -45,17 +45,17 @@ typedef struct { /** * Creates and launches pthreads * - * Creates, pins and launches num threads to separate cores starting from - * first_core. + * Creates, pins and launches num threads to separate CPU's starting from + * first_cpu. * * @param thread_tbl Thread table * @param num Number of threads to create - * @param first_core First physical core + * @param first_cpu First physical CPU * @param start_routine Thread start function * @param arg Thread argument */ void odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl, - int num, int first_core, + int num, int first_cpu, void *(*start_routine) (void *), void *arg); @@ -74,31 +74,31 @@ void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num); /** * Fork a process * - * Forks and sets core affinity for the child process + * Forks and sets CPU affinity for the child process * * @param proc Pointer to process state info (for output) - * @param core Destination core for the child process + * @param cpu Destination CPU for the child process * * @return On success: 1 for the parent, 0 for the child * On failure: -1 for the parent, -2 for the child */ -int odph_linux_process_fork(odph_linux_process_t *proc, int core); +int odph_linux_process_fork(odph_linux_process_t *proc, int cpu); /** * Fork a number of processes * - * Forks and sets core affinity for child processes + * Forks and sets CPU affinity for child processes * * @param proc_tbl Process state info table (for output) * @param num Number of processes to create - * @param first_core Destination core for the first process + * @param first_cpu Destination CPU for the first process * * @return On success: 1 for the parent, 0 for the child * On failure: -1 for the parent, -2 for the child */ int odph_linux_process_fork_n(odph_linux_process_t *proc_tbl, - int num, int first_core); + int num, int first_cpu); /** diff --git a/platform/linux-generic/include/api/odp_system_info.h b/platform/linux-generic/include/api/odp_system_info.h index bcd08d7..42ab054 100644 --- a/platform/linux-generic/include/api/odp_system_info.h +++ b/platform/linux-generic/include/api/odp_system_info.h @@ -61,11 +61,13 @@ const char *odp_sys_cpu_model_str(void); int odp_sys_cache_line_size(void); /** - * Core count + * CPU count + * Report the number of CPU's available to this ODP program. + * This may be smaller than the number of (online) CPU's in the system. * - * @return Core count + * @return Number of available CPU's */ -int odp_sys_core_count(void); +int odp_sys_cpu_count(void); /** * @} diff --git a/platform/linux-generic/include/api/odp_thread.h b/platform/linux-generic/include/api/odp_thread.h index 2b7177d..469d298 100644 --- a/platform/linux-generic/include/api/odp_thread.h +++ b/platform/linux-generic/include/api/odp_thread.h @@ -31,11 +31,11 @@ int odp_thread_id(void); /** - * Get core id + * Get CPU number * - * @return Core id where the thread is running currently + * @return CPU ID where the thread is currently running */ -int odp_thread_core(void); +int odp_thread_cpu(void); /** * @} diff --git a/platform/linux-generic/odp_linux.c b/platform/linux-generic/odp_linux.c index 229d24e..79192cf 100644 --- a/platform/linux-generic/odp_linux.c +++ b/platform/linux-generic/odp_linux.c @@ -56,27 +56,27 @@ static void *odp_run_start_routine(void *arg) void odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl, int num, - int first_core, + int first_cpu, void *(*start_routine) (void *), void *arg) { int i; cpu_set_t cpu_set; odp_start_args_t *start_args; - int core_count; + int cpu_count; int cpu; - core_count = odp_sys_core_count(); + cpu_count = odp_sys_cpu_count(); - assert((first_core >= 0) && (first_core < core_count)); - assert((num >= 0) && (num <= core_count)); + assert((first_cpu >= 0) && (first_cpu < cpu_count)); + assert((num >= 0) && (num <= cpu_count)); memset(thread_tbl, 0, num * sizeof(odph_linux_pthread_t)); for (i = 0; i < num; i++) { pthread_attr_init(&thread_tbl[i].attr); - cpu = (first_core + i) % core_count; - thread_tbl[i].core = cpu; + cpu = (first_cpu + i) % cpu_count; + thread_tbl[i].cpu = cpu; CPU_ZERO(&cpu_set); CPU_SET(cpu, &cpu_set); @@ -109,30 +109,30 @@ void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num) int odph_linux_process_fork_n(odph_linux_process_t *proc_tbl, - int num, int first_core) + int num, int first_cpu) { cpu_set_t cpu_set; pid_t pid; - int core_count; + int cpu_count; int cpu; int i; memset(proc_tbl, 0, num*sizeof(odph_linux_process_t)); - core_count = odp_sys_core_count(); + cpu_count = odp_sys_cpu_count(); - if (first_core < 0 || first_core >= core_count) { - ODP_ERR("Bad first_core\n"); + if (first_cpu < 0 || first_cpu >= cpu_count) { + ODP_ERR("Bad first_cpu\n"); return -1; } - if (num < 0 || num > core_count) { + if (num < 0 || num > cpu_count) { ODP_ERR("Bad num\n"); return -1; } for (i = 0; i < num; i++) { - cpu = (first_core + i) % core_count; + cpu = (first_cpu + i) % cpu_count; pid = fork(); if (pid < 0) { @@ -143,7 +143,7 @@ int odph_linux_process_fork_n(odph_linux_process_t *proc_tbl, /* Parent continues to fork */ if (pid > 0) { proc_tbl[i].pid = pid; - proc_tbl[i].core = cpu; + proc_tbl[i].cpu = cpu; continue; } @@ -168,9 +168,9 @@ int odph_linux_process_fork_n(odph_linux_process_t *proc_tbl, } -int odph_linux_process_fork(odph_linux_process_t *proc, int core) +int odph_linux_process_fork(odph_linux_process_t *proc, int cpu) { - return odph_linux_process_fork_n(proc, 1, core); + return odph_linux_process_fork_n(proc, 1, cpu); } diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index 7d18573..aab3f6f 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -24,7 +24,7 @@ typedef struct { uint64_t huge_page_size; uint64_t page_size; int cache_line_size; - int core_count; + int cpu_count; char model_str[128]; } odp_system_info_t; @@ -45,9 +45,9 @@ static odp_system_info_t odp_system_info; /* - * Sysconf + * Report the number of online CPU's */ -static int sysconf_core_count(void) +static int sysconf_cpu_count(void) { long ret; @@ -287,13 +287,13 @@ static int systemcpu(odp_system_info_t *sysinfo) { int ret; - ret = sysconf_core_count(); + ret = sysconf_cpu_count(); if (ret == 0) { - ODP_ERR("sysconf_core_count failed.\n"); + ODP_ERR("sysconf_cpu_count failed.\n"); return -1; } - sysinfo->core_count = ret; + sysinfo->cpu_count = ret; ret = systemcpu_cache_line_size(); @@ -325,13 +325,13 @@ static int systemcpu(odp_system_info_t *sysinfo) { int ret; - ret = sysconf_core_count(); + ret = sysconf_cpu_count(); if (ret == 0) { - ODP_ERR("sysconf_core_count failed.\n"); + ODP_ERR("sysconf_cpu_count failed.\n"); return -1; } - sysinfo->core_count = ret; + sysinfo->cpu_count = ret; /* Dummy values */ sysinfo->cpu_hz = 1400000000; @@ -403,7 +403,7 @@ int odp_sys_cache_line_size(void) return odp_system_info.cache_line_size; } -int odp_sys_core_count(void) +int odp_sys_cpu_count(void) { - return odp_system_info.core_count; + return odp_system_info.cpu_count; } diff --git a/platform/linux-generic/odp_thread.c b/platform/linux-generic/odp_thread.c index 01c8147..ccbd068 100644 --- a/platform/linux-generic/odp_thread.c +++ b/platform/linux-generic/odp_thread.c @@ -118,7 +118,7 @@ int odp_thread_id(void) } -int odp_thread_core(void) +int odp_thread_cpu(void) { return this_thread->cpu; } diff --git a/test/api_test/odp_atomic_test.c b/test/api_test/odp_atomic_test.c index 5563606..ec4a8d8 100644 --- a/test/api_test/odp_atomic_test.c +++ b/test/api_test/odp_atomic_test.c @@ -37,7 +37,7 @@ static void usage(void) "\t\t5 - Test add/sub of 64-bit atomic int\n" "\t\t-n <1 - 31> - no of threads to start\n" "\t\tif user doesn't specify this option, then\n" - "\t\tno of threads created is equivalent to no of cores\n" + "\t\tno of threads created is equivalent to no of CPU's\n" "\t\tavailable in the system\n" "\tExample usage:\n" "\t\t./odp_atomic -t 2\n" @@ -254,7 +254,7 @@ int main(int argc, char *argv[]) goto err_exit; } if (test_type < TEST_MIX || test_type > TEST_MAX || - pthrdnum > odp_sys_core_count() || pthrdnum < 0) { + pthrdnum > odp_sys_cpu_count() || pthrdnum < 0) { usage(); goto err_exit; } @@ -262,7 +262,7 @@ int main(int argc, char *argv[]) } if (pthrdnum == 0) - pthrdnum = odp_sys_core_count(); + pthrdnum = odp_sys_cpu_count(); test_atomic_init(); test_atomic_store(); diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c index 329d4d4..e585ef5 100644 --- a/test/api_test/odp_common.c +++ b/test/api_test/odp_common.c @@ -46,8 +46,8 @@ void odp_print_system_info(void) printf("CPU model: %s\n", odp_sys_cpu_model_str()); printf("CPU freq (hz): %"PRIu64"\n", odp_sys_cpu_hz()); printf("Cache line size: %i\n", odp_sys_cache_line_size()); - printf("Core count: %i\n", odp_sys_core_count()); - printf("Core mask: %s\n", str); + printf("CPU count: %i\n", odp_sys_cpu_count()); + printf("CPU mask: %s\n", str); printf("\n"); } @@ -62,8 +62,8 @@ int odp_test_global_init(void) return -1; } - num_workers = odp_sys_core_count(); - /* force to max core count */ + num_workers = odp_sys_cpu_count(); + /* force to max CPU count */ if (num_workers > MAX_WORKERS) num_workers = MAX_WORKERS; diff --git a/test/api_test/odp_ring_test.c b/test/api_test/odp_ring_test.c index 54398f0..e3d7b4e 100644 --- a/test/api_test/odp_ring_test.c +++ b/test/api_test/odp_ring_test.c @@ -430,7 +430,7 @@ int main(int argc __attribute__((__unused__)), odph_ring_tailq_init(); - rarg.thrdarg.numthrds = odp_sys_core_count(); + rarg.thrdarg.numthrds = odp_sys_cpu_count(); #ifdef RING_TEST_BASIC rarg.thrdarg.testcase = ODP_RING_TEST_BASIC; diff --git a/test/api_test/odp_shm_test.c b/test/api_test/odp_shm_test.c index 5163337..be83657 100644 --- a/test/api_test/odp_shm_test.c +++ b/test/api_test/odp_shm_test.c @@ -58,7 +58,7 @@ int main(int argc __attribute__((__unused__)), printf("test shared data at %p\n\n", test_shared_data); thrdarg.testcase = ODP_SHM_TEST; - thrdarg.numthrds = odp_sys_core_count(); + thrdarg.numthrds = odp_sys_cpu_count(); odp_test_thread_create(run_thread, &thrdarg); odp_test_thread_exit(&thrdarg); diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index a18e858..ba7528d 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -48,7 +48,7 @@ typedef struct { /** Test arguments */ typedef struct { - int core_count; /**< Core count */ + int cpu_count; /**< CPU count */ int proc_mode; /**< Process mode */ } test_args_t; @@ -714,7 +714,7 @@ static void *run_thread(void *arg) thr = odp_thread_id(); - printf("Thread %i starts on core %i\n", thr, odp_thread_core()); + printf("Thread %i starts on CPU %i\n", thr, odp_thread_cpu()); shm = odp_shm_lookup("test_globals"); globals = odp_shm_addr(shm); @@ -893,7 +893,7 @@ static void print_usage(void) { printf("\n\nUsage: ./odp_example [options]\n"); printf("Options:\n"); - printf(" -c, --count core count, core IDs start from 1\n"); + printf(" -c, --count CPU count\n"); printf(" -h, --help this help\n"); printf(" --proc process mode\n"); printf("\n\n"); @@ -930,7 +930,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) break; case 'c': - args->core_count = atoi(optarg); + args->cpu_count = atoi(optarg); break; case 'h': @@ -957,7 +957,7 @@ int main(int argc, char *argv[]) odp_queue_t queue; int i, j; int prios; - int first_core; + int first_cpu; odp_shm_t shm; test_globals_t *globals; odp_buffer_pool_param_t params; @@ -996,32 +996,32 @@ int main(int argc, char *argv[]) printf("CPU model: %s\n", odp_sys_cpu_model_str()); printf("CPU freq (hz): %"PRIu64"\n", odp_sys_cpu_hz()); printf("Cache line size: %i\n", odp_sys_cache_line_size()); - printf("Max core count: %i\n", odp_sys_core_count()); + printf("Max CPU count: %i\n", odp_sys_cpu_count()); printf("\n"); - /* A worker thread per core */ - num_workers = odp_sys_core_count(); + /* A worker thread per CPU */ + num_workers = odp_sys_cpu_count(); - if (args.core_count) - num_workers = args.core_count; + if (args.cpu_count) + num_workers = args.cpu_count; - /* force to max core count */ + /* force to max CPU count */ if (num_workers > MAX_WORKERS) num_workers = MAX_WORKERS; printf("num worker threads: %i\n", num_workers); /* - * By default core #0 runs Linux kernel background tasks. - * Start mapping thread from core #1 + * By default CPU #0 runs Linux kernel background tasks. + * Start mapping thread from CPU #1 */ - first_core = 1; + first_cpu = 1; - if (odp_sys_core_count() == 1) - first_core = 0; + if (odp_sys_cpu_count() == 1) + first_cpu = 0; - printf("first core: %i\n", first_core); + printf("first CPU: %i\n", first_cpu); /* Test cycle count accuracy */ @@ -1112,7 +1112,7 @@ int main(int argc, char *argv[]) /* Fork worker processes */ ret = odph_linux_process_fork_n(proc, num_workers, - first_core); + first_cpu); if (ret < 0) { LOG_ERR("Fork workers failed %i\n", ret); @@ -1130,7 +1130,7 @@ int main(int argc, char *argv[]) } else { /* Create and launch worker threads */ - odph_linux_pthread_create(thread_tbl, num_workers, first_core, + odph_linux_pthread_create(thread_tbl, num_workers, first_cpu, run_thread, NULL); /* Wait for worker threads to terminate */ diff --git a/test/validation/odp_schedule.c b/test/validation/odp_schedule.c index 31be742..5df3c86 100644 --- a/test/validation/odp_schedule.c +++ b/test/validation/odp_schedule.c @@ -34,7 +34,7 @@ /* Test global variables */ typedef struct { - int core_count; + int cpu_count; odp_barrier_t barrier; odp_schedule_prio_t current_prio; int prio_buf_count; @@ -48,7 +48,7 @@ typedef struct ODP_PACKED { int num_queues; int num_prio; int num_bufs; - int num_cores; + int num_cpus; int enable_schd_multi; int enable_excl_atomic; } thread_args_t; @@ -82,7 +82,7 @@ static void *schedule_common_(void *arg) { thread_args_t *args = (thread_args_t *)arg; odp_schedule_sync_t sync; - int num_queues, num_prio, num_bufs, num_cores; + int num_queues, num_prio, num_bufs, num_cpus; odp_shm_t shm; test_globals_t *globals; @@ -90,7 +90,7 @@ static void *schedule_common_(void *arg) num_queues = args->num_queues; num_prio = args->num_prio; num_bufs = args->num_bufs; - num_cores = args->num_cores; + num_cpus = args->num_cpus; shm = odp_shm_lookup(GLOBALS_SHM_NAME); CU_ASSERT_FATAL(shm != ODP_SHM_INVALID); @@ -98,7 +98,7 @@ static void *schedule_common_(void *arg) CU_ASSERT_FATAL(globals != NULL); - if (num_cores == globals->core_count) + if (num_cpus == globals->cpu_count) odp_barrier_wait(&globals->barrier); while (1) { @@ -230,9 +230,9 @@ 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_cores = 1; + args.num_cpus = 1; args.enable_schd_multi = enable_schd_multi; - args.enable_excl_atomic = 0; /* Not needed with a single core */ + args.enable_excl_atomic = 0; /* Not needed with a single CPU */ fill_queues(&args); @@ -264,7 +264,7 @@ static void parallel_execute(odp_schedule_sync_t sync, int num_queues, thr_args->num_bufs = TEST_NUM_BUFS_EXCL; else thr_args->num_bufs = TEST_NUM_BUFS; - thr_args->num_cores = globals->core_count; + thr_args->num_cpus = globals->cpu_count; thr_args->enable_schd_multi = enable_schd_multi; thr_args->enable_excl_atomic = enable_excl_atomic; @@ -275,7 +275,7 @@ static void parallel_execute(odp_schedule_sync_t sync, int num_queues, globals->prio_buf_count = 0; /* Create and launch worker threads */ - thr_args->thrdarg.numthrds = globals->core_count; + thr_args->thrdarg.numthrds = globals->cpu_count; odp_cunit_thread_create(schedule_common_, &thr_args->thrdarg); /* Wait for worker threads to terminate */ @@ -539,9 +539,9 @@ static int schd_suite_init(void) memset(globals, 0, sizeof(test_globals_t)); - globals->core_count = odp_sys_core_count(); - if (globals->core_count > MAX_WORKERS) - globals->core_count = MAX_WORKERS; + globals->cpu_count = odp_sys_cpu_count(); + if (globals->cpu_count > MAX_WORKERS) + globals->cpu_count = MAX_WORKERS; shm = odp_shm_reserve(SHM_THR_ARGS_NAME, sizeof(thread_args_t), ODP_CACHE_LINE_SIZE, 0); @@ -555,7 +555,7 @@ static int schd_suite_init(void) memset(thr_args, 0, sizeof(thread_args_t)); /* Barrier to sync test case execution */ - odp_barrier_init(&globals->barrier, globals->core_count); + odp_barrier_init(&globals->barrier, globals->cpu_count); odp_ticketlock_init(&globals->count_lock); odp_spinlock_init(&globals->atomic_lock); diff --git a/test/validation/odp_shm.c b/test/validation/odp_shm.c index 63353db..c26925b 100644 --- a/test/validation/odp_shm.c +++ b/test/validation/odp_shm.c @@ -61,7 +61,7 @@ static void test_odp_shm_sunnyday(void) test_shared_data->foo = TEST_SHARE_FOO; test_shared_data->bar = TEST_SHARE_BAR; - thrdarg.numthrds = odp_sys_core_count(); + thrdarg.numthrds = odp_sys_cpu_count(); if (thrdarg.numthrds > MAX_WORKERS) thrdarg.numthrds = MAX_WORKERS;