Re: [lng-odp] [PATCH] linux-generic: make x86 cpuinfo parser more robust

2016-02-26 Thread Hongbo Zhang
Please notice that this patch can only solve segfault to let odp run.
If there is no speed in model string, system validation will report
cpu max hz fail in such a case.

Full propose is to use cpufreq under /sys/devices/system/cpu/,
advantage of it is that this can be a common way for all platforms,
but this isn't always enabled on some platforms and virtual machines.
Then if cpufreq isn't there, we can fall back to each platform
specific cpuinfo parse, if there isn't any max freq info in model
string, the 'cpu mhz' is max freq now because when cpufreq isn't
enabled, cpus always run at max speed.

If we still plan to keep cpu hz api, it deserves to do such a
modification, but now I was using a ubuntu running in vm, don't have
cpufreq sysfs to test with, and what's more, I won't have time to
spend on this...


On 25 February 2016 at 17:52,  <hongbo.zh...@linaro.org> wrote:
> From: Hongbo Zhang <hongbo.zh...@linaro.org>
>
> This is for https://bugs.linaro.org/show_bug.cgi?id=2033
> If the model string doesn't include speed info, segfault should
> be avoided.
>
> Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
> ---
>  platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
> b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
> index 2ef49e4..c1e05c0 100644
> --- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
> +++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
> @@ -24,10 +24,12 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
> *sysinfo)
> sizeof(sysinfo->model_str[id]) - 1);
>
> pos = strchr(sysinfo->model_str[id], '@');
> -   *(pos - 1) = '\0';
> -   if (sscanf(pos, "@ %lfGHz", ) == 1) {
> -   hz = (uint64_t)(ghz * 10.0);
> -   sysinfo->cpu_hz_max[id] = hz;
> +   if (pos) {
> +   *(pos - 1) = '\0';
> +   if (sscanf(pos, "@ %lfGHz", ) == 1) {
> +   hz = (uint64_t)(ghz * 10.0);
> +   sysinfo->cpu_hz_max[id] = hz;
> +   }
> }
> id++;
> }
> --
> 2.1.4
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH] linux-generic: make x86 cpuinfo parser more robust

2016-02-25 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This is for https://bugs.linaro.org/show_bug.cgi?id=2033
If the model string doesn't include speed info, segfault should
be avoided.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
index 2ef49e4..c1e05c0 100644
--- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -24,10 +24,12 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
sizeof(sysinfo->model_str[id]) - 1);
 
pos = strchr(sysinfo->model_str[id], '@');
-   *(pos - 1) = '\0';
-   if (sscanf(pos, "@ %lfGHz", ) == 1) {
-   hz = (uint64_t)(ghz * 10.0);
-   sysinfo->cpu_hz_max[id] = hz;
+   if (pos) {
+   *(pos - 1) = '\0';
+   if (sscanf(pos, "@ %lfGHz", ) == 1) {
+   hz = (uint64_t)(ghz * 10.0);
+   sysinfo->cpu_hz_max[id] = hz;
+   }
}
id++;
}
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v4 0/8] separate ODP_CACHE_LINE_SIZE to arch files and clean-up

2016-02-23 Thread Hongbo Zhang
There are checkpatch warnings, but they should be acceptable, because
chechpatch rules don't apply some changes for example the edit in
configure.ac.

On 23 February 2016 at 16:12,  <hongbo.zh...@linaro.org> wrote:
> From: Hongbo Zhang <hongbo.zh...@linaro.org>
>
> v3-v4 changes:
>  - merge previous two patch sets into one:
> "[PATCH v3 API-NEXT 0/4] separate ODP_CACHE_LINE_SIZE to arch files"
> and "[PATCH API-NEXT 0/4] linux-generic sysinfo codes clean-ups"
> then this patch set contains 8 patches, this is for easier merging
>  - add "Signed-off-by: Mike Holmes <mike.hol...@linaro.org>" for patch 1/8
> (was 1/4) since he contributed some change of doxygen system
>  - add "Reviewed-and-tested-by: Bill Fischofer <bill.fischo...@linaro.org>"
> for all patches since he's already done this in previous review
>  - return document of ODP_CACHE_LINE_SIZE to original API header file and
> fix the defect of its documentation
>
> v2-v3 change:
>
> Eliminate a doxygen-html compiling warning.
>
> v1-v2 change:
>
> Add macro __OCTEON for patch 2.
>
> Hongbo Zhang (8):
>   linux-generic: separate x86 ODP_CACHE_LINE_SIZE to its arch file
>   linux-generic: separate MIPS ODP_CACHE_LINE_SIZE to its arch file
>   linux-generic: separate PowerPC ODP_CACHE_LINE_SIZE to its arch file
>   linux-generic: create ARM files and move ARM ODP_CACHE_LINE_SIZE in it
>   linux-generic: move CPU info dummy data to generic default file
>   linux-generic: systemcpu(): use input parameter instead of global data
>   linux-generic: use one uniform call systemcpu()
>   linux-generic: sysinfo clean up for ARM
>
>  configure.ac   |  2 +
>  doc/application-api-guide/doxygen.cfg  |  1 +
>  m4/ax_prog_doxygen.m4  |  1 +
>  platform/linux-generic/Makefile.am |  2 +
>  platform/linux-generic/arch/arm/odp/cpu_arch.h | 32 +++
>  platform/linux-generic/arch/arm/odp_cpu_arch.c |  1 +
>  .../linux-generic/arch/arm/odp_sysinfo_parse.c | 28 +
>  .../linux-generic/arch/linux/odp_sysinfo_parse.c   | 12 +-
>  platform/linux-generic/arch/mips64/odp/cpu_arch.h  | 12 ++
>  platform/linux-generic/arch/powerpc/odp/cpu_arch.h | 33 ++-
>  platform/linux-generic/arch/x86/odp/cpu_arch.h | 10 +
>  platform/linux-generic/include/odp/align.h | 21 +-
>  platform/linux-generic/odp_system_info.c   | 47 
> +-
>  13 files changed, 141 insertions(+), 61 deletions(-)
>  create mode 100644 platform/linux-generic/arch/arm/odp/cpu_arch.h
>  create mode 12 platform/linux-generic/arch/arm/odp_cpu_arch.c
>  create mode 100644 platform/linux-generic/arch/arm/odp_sysinfo_parse.c
>  mode change 12 => 100644 
> platform/linux-generic/arch/powerpc/odp/cpu_arch.h
>
> --
> 2.1.4
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH] linux-generic: fix usage of function strncpy

2016-02-23 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This is for https://bugs.linaro.org/show_bug.cgi?id=2030:
"Memory - illegal accesses  (BUFFER_SIZE_WARNING)
Calling strncpy with a maximum size argument of 128 bytes on destination
array "sysinfo->model_str[id]" of size 128 bytes might leave the
destination string unterminated."

In fact in the following code there is operation like this:
sysinfo->model_str[id][len - 1] = 0
to handle the last character of string, but is is also good to eliminate
this coding warning.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c  | 2 +-
 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c | 2 +-
 platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index 53074f7..d45b420 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -39,7 +39,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 
pos = strchr(str, ':');
strncpy(sysinfo->model_str[id], pos + 2,
-   sizeof(sysinfo->model_str[id]));
+   sizeof(sysinfo->model_str[id]) - 1);
len = strlen(sysinfo->model_str[id]);
sysinfo->model_str[id][len - 1] = 0;
model = 1;
diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index 99457ce..95200ee 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -38,7 +38,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 
pos = strchr(str, ':');
strncpy(sysinfo->model_str[id], pos + 2,
-   sizeof(sysinfo->model_str[id]));
+   sizeof(sysinfo->model_str[id]) - 1);
len = strlen(sysinfo->model_str[id]);
sysinfo->model_str[id][len - 1] = 0;
model = 1;
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
index 816629d..2ef49e4 100644
--- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -21,7 +21,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
if (pos) {
pos = strchr(str, ':');
strncpy(sysinfo->model_str[id], pos + 2,
-   sizeof(sysinfo->model_str[id]));
+   sizeof(sysinfo->model_str[id]) - 1);
 
pos = strchr(sysinfo->model_str[id], '@');
*(pos - 1) = '\0';
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v4 8/8] linux-generic: sysinfo clean up for ARM

2016-02-23 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

The arch/arm/odp_sysinfo_parse.c is currently a symlink to
arch/linux/odp_sysinfo_parse.c, but in fact there should be defferences
between them.

A separated real arch/arm/odp_sysinfo_parse.c is created for ARM, and
the model_str is set to a general "ARM", which is much better then the
general defaul "UNKNOWN" although not so accurate in detailed ARM CPU
model string.

ODP_DBG("TODO: true values should be implemented when possible\n") is
added for ARM too, this means when possible true values can be implemented
for ARM, and only ARM odp_cpuinfo_parser() is updated, while the general
defaul odp_cpuinfo_parser() should be leave there unchanged. In other
words the current implementation for ARM is a temporary work around, but
for the generic default dummy data has to be accepted.

ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n;) is
deleted, because this bug describes another thing, eg in previous code,
only cpu_hz_max[0] and model_str[0] were set, the others such as
cpu_hz_max[1...n-1] and model_str[1...n-1] were missing, it isn't related
with the value itself is dummy or not, and this bug was already fixed.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
Reviewed-and-tested-by: Bill Fischofer <bill.fischo...@linaro.org>
---
 .../linux-generic/arch/arm/odp_sysinfo_parse.c | 29 +-
 .../linux-generic/arch/linux/odp_sysinfo_parse.c   |  1 -
 2 files changed, 28 insertions(+), 2 deletions(-)
 mode change 12 => 100644 
platform/linux-generic/arch/arm/odp_sysinfo_parse.c

diff --git a/platform/linux-generic/arch/arm/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
deleted file mode 12
index 2f368af..000
--- a/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
+++ /dev/null
@@ -1 +0,0 @@
-../linux/odp_sysinfo_parse.c
\ No newline at end of file
diff --git a/platform/linux-generic/arch/arm/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
new file mode 100644
index 000..b141168
--- /dev/null
+++ b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
@@ -0,0 +1,28 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+#include 
+
+int odp_cpuinfo_parser(FILE *file ODP_UNUSED, odp_system_info_t *sysinfo)
+{
+   int i;
+
+   ODP_DBG("Warning: use dummy values for freq and model string\n");
+   ODP_DBG("TODO: true values should be implemented when possible\n");
+   for (i = 0; i < MAX_CPU_NUMBER; i++) {
+   sysinfo->cpu_hz_max[i] = 14;
+   strcpy(sysinfo->model_str[i], "ARM");
+   }
+
+   return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
+{
+   return 0;
+}
diff --git a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
index 4a22a61..4dcd6d1 100644
--- a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
@@ -13,7 +13,6 @@ int odp_cpuinfo_parser(FILE *file ODP_UNUSED, 
odp_system_info_t *sysinfo)
int i;
 
ODP_DBG("Warning: use dummy values for freq and model string\n");
-   ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n;);
for (i = 0; i < MAX_CPU_NUMBER; i++) {
sysinfo->cpu_hz_max[i] = 14;
strcpy(sysinfo->model_str[i], "UNKNOWN");
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v4 7/8] linux-generic: use one uniform call systemcpu()

2016-02-23 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

Currently there are two systemcpu() functions, one is for some specific
platforms and the other is for default dummy, but most of the contents
are same except for sysinfo->cache_line_size: one is true data from
calling systemcpu_cache_line_size() and another is dummy data.
In such a situation we can create another systemcpu_cache_line_size() to
return dummy data for platforms which are lack of it, then only one
function systemcpu() is enough.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
Reviewed-and-tested-by: Bill Fischofer <bill.fischo...@linaro.org>
---
 platform/linux-generic/odp_system_info.c | 40 +++-
 1 file changed, 9 insertions(+), 31 deletions(-)

diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 2d202a0..6f9fb6e 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -73,6 +73,15 @@ static int systemcpu_cache_line_size(void)
 
return size;
 }
+
+#else
+/*
+ * Use dummy data if not available from /sys/devices/system/cpu/
+ */
+static int systemcpu_cache_line_size(void)
+{
+   return 64;
+}
 #endif
 
 
@@ -105,9 +114,6 @@ static int huge_page_size(void)
 }
 
 
-#if defined __x86_64__ || defined __i386__ || defined __OCTEON__ || \
-defined __powerpc__
-
 /*
  * Analysis of /sys/devices/system/cpu/ files
  */
@@ -142,34 +148,6 @@ static int systemcpu(odp_system_info_t *sysinfo)
return 0;
 }
 
-#else
-
-/*
- * Use sysconf and dummy values in generic case
- */
-
-
-static int systemcpu(odp_system_info_t *sysinfo)
-{
-   int ret;
-
-   ret = sysconf_cpu_count();
-   if (ret == 0) {
-   ODP_ERR("sysconf_cpu_count failed.\n");
-   return -1;
-   }
-
-   sysinfo->cpu_count = ret;
-
-   sysinfo->huge_page_size = huge_page_size();
-
-   /* Dummy values */
-   sysinfo->cache_line_size = 64;
-
-   return 0;
-}
-
-#endif
 
 /*
  * System info initialisation
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v4 5/8] linux-generic: move CPU info dummy data to generic default file

2016-02-23 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

The dummy data of cpu_hz_max and model_str are used when platform is
unknown or data cannot be acquired, but these variables should be set
in function odp_cpuinfo_parser() instead of the systemcpu() which should
cover only the cpu_count, huge_page_size and cache_line_size.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
Reviewed-and-tested-by: Bill Fischofer <bill.fischo...@linaro.org>
---
 platform/linux-generic/arch/linux/odp_sysinfo_parse.c | 13 +++--
 platform/linux-generic/odp_system_info.c  |  9 +
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
index 8ff6f48..4a22a61 100644
--- a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
@@ -5,11 +5,20 @@
  */
 
 #include 
+#include 
 #include 
 
-int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
-  odp_system_info_t *sysinfo ODP_UNUSED)
+int odp_cpuinfo_parser(FILE *file ODP_UNUSED, odp_system_info_t *sysinfo)
 {
+   int i;
+
+   ODP_DBG("Warning: use dummy values for freq and model string\n");
+   ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n;);
+   for (i = 0; i < MAX_CPU_NUMBER; i++) {
+   sysinfo->cpu_hz_max[i] = 14;
+   strcpy(sysinfo->model_str[i], "UNKNOWN");
+   }
+
return 0;
 }
 
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 42aef8a..bedbbc8 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -151,7 +151,7 @@ static int systemcpu(odp_system_info_t *sysinfo)
 
 static int systemcpu(odp_system_info_t *sysinfo)
 {
-   int ret, i;
+   int ret;
 
ret = sysconf_cpu_count();
if (ret == 0) {
@@ -166,13 +166,6 @@ static int systemcpu(odp_system_info_t *sysinfo)
/* Dummy values */
sysinfo->cache_line_size = 64;
 
-   ODP_DBG("Warning: use dummy values for freq and model string\n");
-   ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n;);
-   for (i = 0; i < MAX_CPU_NUMBER; i++) {
-   sysinfo->cpu_hz_max[i] = 14;
-   strcpy(sysinfo->model_str[i], "UNKNOWN");
-   }
-
return 0;
 }
 
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v4 6/8] linux-generic: systemcpu(): use input parameter instead of global data

2016-02-23 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

In the systemcpu() function, odp_global_data.system_info.huge_page_size
should be sysinfo->huge_page_size instead, because when systemcpu() is
called, the _global_data.system_info is passed as parameter, we should
operate the parameter instead of the global data directly, what's more,
in function systemcpu(), sysinfo->cpu_count and sysinfo->cache_line_size
are used, we should follow same pattern for sysinfo->huge_page_size.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
Reviewed-and-tested-by: Bill Fischofer <bill.fischo...@linaro.org>
---
 platform/linux-generic/odp_system_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index bedbbc8..2d202a0 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -137,7 +137,7 @@ static int systemcpu(odp_system_info_t *sysinfo)
return -1;
}
 
-   odp_global_data.system_info.huge_page_size = huge_page_size();
+   sysinfo->huge_page_size = huge_page_size();
 
return 0;
 }
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v4 4/8] linux-generic: create ARM files and move ARM ODP_CACHE_LINE_SIZE in it

2016-02-23 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
held in one header file, they should be moved to their own arch file.
And in the legacy codes there was no ARM architecture directory, so this
patch create it, the odp_cpu_arch.c and odp_sysinfo_parse.c are still
symlink to the general default ones under arch/linux/, and a real file
arm/odp/cpu_arch.h is created from the linux/odp/cpu_arch.h, and then the
ODP_CACHE_LINE_SIZE for ARM is moved to this arch specific file.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
Reviewed-and-tested-by: Bill Fischofer <bill.fischo...@linaro.org>
---
 configure.ac   |  1 +
 platform/linux-generic/Makefile.am |  2 ++
 platform/linux-generic/arch/arm/odp/cpu_arch.h | 32 ++
 platform/linux-generic/arch/arm/odp_cpu_arch.c |  1 +
 .../linux-generic/arch/arm/odp_sysinfo_parse.c |  1 +
 platform/linux-generic/include/odp/align.h |  6 
 6 files changed, 37 insertions(+), 6 deletions(-)
 create mode 100644 platform/linux-generic/arch/arm/odp/cpu_arch.h
 create mode 12 platform/linux-generic/arch/arm/odp_cpu_arch.c
 create mode 12 platform/linux-generic/arch/arm/odp_sysinfo_parse.c

diff --git a/configure.ac b/configure.ac
index c8ee8f8..01b1a93 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,6 +54,7 @@ AX_VALGRIND_CHECK
 ##
 AS_CASE([$host],
   [x86*], [ARCH=x86],
+  [arm*], [ARCH=arm],
   [mips64*], [ARCH=mips64],
   [powerpc*], [ARCH=powerpc],
   [ARCH=linux]
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index a9090a3..42c1657 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -157,6 +157,8 @@ __LIB__libodp_la_SOURCES = \
 EXTRA_DIST = \
 arch/linux/odp_cpu_arch.c \
 arch/linux/odp_sysinfo_parse.c \
+arch/arm/odp_cpu_arch.c \
+arch/arm/odp_sysinfo_parse.c \
 arch/mips64/odp_cpu_arch.c \
 arch/mips64/odp_sysinfo_parse.c \
 arch/powerpc/odp_cpu_arch.c \
diff --git a/platform/linux-generic/arch/arm/odp/cpu_arch.h 
b/platform/linux-generic/arch/arm/odp/cpu_arch.h
new file mode 100644
index 000..29f8889
--- /dev/null
+++ b/platform/linux-generic/arch/arm/odp/cpu_arch.h
@@ -0,0 +1,32 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_PLAT_CPU_ARCH_H_
+#define ODP_PLAT_CPU_ARCH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @ingroup odp_compiler_optim
+ *  @{
+ */
+
+#define ODP_CACHE_LINE_SIZE 64
+
+/**
+ * @}
+ */
+
+static inline void odp_cpu_pause(void)
+{
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/arch/arm/odp_cpu_arch.c 
b/platform/linux-generic/arch/arm/odp_cpu_arch.c
new file mode 12
index 000..c5fe400
--- /dev/null
+++ b/platform/linux-generic/arch/arm/odp_cpu_arch.c
@@ -0,0 +1 @@
+../linux/odp_cpu_arch.c
\ No newline at end of file
diff --git a/platform/linux-generic/arch/arm/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
new file mode 12
index 000..2f368af
--- /dev/null
+++ b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
@@ -0,0 +1 @@
+../linux/odp_sysinfo_parse.c
\ No newline at end of file
diff --git a/platform/linux-generic/include/odp/align.h 
b/platform/linux-generic/include/odp/align.h
index 46b30dc..d824d57 100644
--- a/platform/linux-generic/include/odp/align.h
+++ b/platform/linux-generic/include/odp/align.h
@@ -31,12 +31,6 @@ extern "C" {
 
 #define ODP_FIELD_SIZEOF(type, member) sizeof(((type *)0)->member)
 
-#if defined __arm__ || defined __aarch64__
-
-#define ODP_CACHE_LINE_SIZE 64
-
-#endif
-
 #else
 #error Non-gcc compatible compiler
 #endif
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v4 2/8] linux-generic: separate MIPS ODP_CACHE_LINE_SIZE to its arch file

2016-02-23 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
held in one header file, they should be moved to their own arch file.
This patch moves ODP_CACHE_LINE_SIZE for MIPS.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
Reviewed-and-tested-by: Bill Fischofer <bill.fischo...@linaro.org>
---
 platform/linux-generic/arch/mips64/odp/cpu_arch.h | 12 
 platform/linux-generic/include/odp/align.h|  4 
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/platform/linux-generic/arch/mips64/odp/cpu_arch.h 
b/platform/linux-generic/arch/mips64/odp/cpu_arch.h
index 3bfa0dc..7b5bfd2 100644
--- a/platform/linux-generic/arch/mips64/odp/cpu_arch.h
+++ b/platform/linux-generic/arch/mips64/odp/cpu_arch.h
@@ -11,6 +11,18 @@
 extern "C" {
 #endif
 
+/** @ingroup odp_compiler_optim
+ *  @{
+ */
+
+#if defined __OCTEON__
+#define ODP_CACHE_LINE_SIZE 128
+#endif
+
+/**
+ * @}
+ */
+
 static inline void odp_cpu_pause(void)
 {
__asm__ __volatile__ ("nop");
diff --git a/platform/linux-generic/include/odp/align.h 
b/platform/linux-generic/include/odp/align.h
index 161a302..0f11569 100644
--- a/platform/linux-generic/include/odp/align.h
+++ b/platform/linux-generic/include/odp/align.h
@@ -35,10 +35,6 @@ extern "C" {
 
 #define ODP_CACHE_LINE_SIZE 64
 
-#elif defined __OCTEON__
-
-#define ODP_CACHE_LINE_SIZE 128
-
 #elif defined __powerpc__
 
 #define ODP_CACHE_LINE_SIZE 64
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v4 3/8] linux-generic: separate PowerPC ODP_CACHE_LINE_SIZE to its arch file

2016-02-23 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
held in one header file, they should be moved to their own arch file.
This patch moves ODP_CACHE_LINE_SIZE for PowerPC.
The previous arch/powerpc/odp/cpu_arch.h was a symlink to the generic
arch/linux/odp/cpu_arch.h, but now this PowerPC header file has more
specific content than the generic one, so a real file is created and the
ODP_CACHE_LINE_SIZE is added to it.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
Reviewed-and-tested-by: Bill Fischofer <bill.fischo...@linaro.org>
---
 platform/linux-generic/arch/powerpc/odp/cpu_arch.h | 33 +-
 platform/linux-generic/include/odp/align.h |  4 ---
 2 files changed, 32 insertions(+), 5 deletions(-)
 mode change 12 => 100644 platform/linux-generic/arch/powerpc/odp/cpu_arch.h

diff --git a/platform/linux-generic/arch/powerpc/odp/cpu_arch.h 
b/platform/linux-generic/arch/powerpc/odp/cpu_arch.h
deleted file mode 12
index 0617d7f..000
--- a/platform/linux-generic/arch/powerpc/odp/cpu_arch.h
+++ /dev/null
@@ -1 +0,0 @@
-../../linux/odp/cpu_arch.h
\ No newline at end of file
diff --git a/platform/linux-generic/arch/powerpc/odp/cpu_arch.h 
b/platform/linux-generic/arch/powerpc/odp/cpu_arch.h
new file mode 100644
index 000..29f8889
--- /dev/null
+++ b/platform/linux-generic/arch/powerpc/odp/cpu_arch.h
@@ -0,0 +1,32 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_PLAT_CPU_ARCH_H_
+#define ODP_PLAT_CPU_ARCH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @ingroup odp_compiler_optim
+ *  @{
+ */
+
+#define ODP_CACHE_LINE_SIZE 64
+
+/**
+ * @}
+ */
+
+static inline void odp_cpu_pause(void)
+{
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/align.h 
b/platform/linux-generic/include/odp/align.h
index 0f11569..46b30dc 100644
--- a/platform/linux-generic/include/odp/align.h
+++ b/platform/linux-generic/include/odp/align.h
@@ -35,10 +35,6 @@ extern "C" {
 
 #define ODP_CACHE_LINE_SIZE 64
 
-#elif defined __powerpc__
-
-#define ODP_CACHE_LINE_SIZE 64
-
 #endif
 
 #else
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v4 1/8] linux-generic: separate x86 ODP_CACHE_LINE_SIZE to its arch file

2016-02-23 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
held in one header file, they should be moved to their own arch file.
This patch moves ODP_CACHE_LINE_SIZE for x86.

Signed-off-by: Mike Holmes <mike.hol...@linaro.org>
Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
Reviewed-and-tested-by: Bill Fischofer <bill.fischo...@linaro.org>
---
 configure.ac   |  1 +
 doc/application-api-guide/doxygen.cfg  |  1 +
 m4/ax_prog_doxygen.m4  |  1 +
 platform/linux-generic/arch/x86/odp/cpu_arch.h | 10 ++
 platform/linux-generic/include/odp/align.h |  9 ++---
 5 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index a7cb035..c8ee8f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -392,6 +392,7 @@ AC_MSG_RESULT([
libdir: ${libdir}
includedir: ${includedir}
testdir:${testdir}
+   WITH_ARCH:  ${WITH_ARCH}
 
cc: ${CC}
cppflags:   ${CPPFLAGS}
diff --git a/doc/application-api-guide/doxygen.cfg 
b/doc/application-api-guide/doxygen.cfg
index 7951e9e..4d6506d 100644
--- a/doc/application-api-guide/doxygen.cfg
+++ b/doc/application-api-guide/doxygen.cfg
@@ -14,6 +14,7 @@ INPUT = $(SRCDIR)/doc \
$(SRCDIR)/doc/users-guide \
$(SRCDIR)/include \
$(SRCDIR)/platform/$(WITH_PLATFORM)/include/odp \
+   $(SRCDIR)/platform/$(WITH_PLATFORM)/arch/$(WITH_ARCH) \
$(SRCDIR)/helper/include
 FILE_PATTERNS = *.h odp*.c *.dox
 RECURSIVE = YES
diff --git a/m4/ax_prog_doxygen.m4 b/m4/ax_prog_doxygen.m4
index 58bb016..de6d18e 100644
--- a/m4/ax_prog_doxygen.m4
+++ b/m4/ax_prog_doxygen.m4
@@ -409,6 +409,7 @@ DX_ENV_APPEND(PROJECT, $DX_PROJECT)
 DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
 DX_ENV_APPEND(VERSION, $VERSION)
 DX_ENV_APPEND(WITH_PLATFORM, $with_platform)
+DX_ENV_APPEND(WITH_ARCH, $ARCH)
 
 # Doxygen itself:
 DX_ARG_ABLE(doc, [generate any doxygen documentation],
diff --git a/platform/linux-generic/arch/x86/odp/cpu_arch.h 
b/platform/linux-generic/arch/x86/odp/cpu_arch.h
index 997a954..3a16fa6 100644
--- a/platform/linux-generic/arch/x86/odp/cpu_arch.h
+++ b/platform/linux-generic/arch/x86/odp/cpu_arch.h
@@ -11,6 +11,16 @@
 extern "C" {
 #endif
 
+/** @ingroup odp_compiler_optim
+ *  @{
+ */
+
+#define ODP_CACHE_LINE_SIZE 64
+
+/**
+ * @}
+ */
+
 static inline void odp_cpu_pause(void)
 {
 #ifdef __SSE2__
diff --git a/platform/linux-generic/include/odp/align.h 
b/platform/linux-generic/include/odp/align.h
index be8c9ae..161a302 100644
--- a/platform/linux-generic/include/odp/align.h
+++ b/platform/linux-generic/include/odp/align.h
@@ -31,11 +31,7 @@ extern "C" {
 
 #define ODP_FIELD_SIZEOF(type, member) sizeof(((type *)0)->member)
 
-#if defined __x86_64__ || defined __i386__
-
-#define ODP_CACHE_LINE_SIZE 64
-
-#elif defined __arm__ || defined __aarch64__
+#if defined __arm__ || defined __aarch64__
 
 #define ODP_CACHE_LINE_SIZE 64
 
@@ -47,8 +43,6 @@ extern "C" {
 
 #define ODP_CACHE_LINE_SIZE 64
 
-#else
-#error GCC target not found
 #endif
 
 #else
@@ -65,6 +59,7 @@ extern "C" {
  * @}
  */
 
+#include 
 #include 
 
 #ifdef __cplusplus
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v4 0/8] separate ODP_CACHE_LINE_SIZE to arch files and clean-up

2016-02-23 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

v3-v4 changes:
 - merge previous two patch sets into one:
"[PATCH v3 API-NEXT 0/4] separate ODP_CACHE_LINE_SIZE to arch files"
and "[PATCH API-NEXT 0/4] linux-generic sysinfo codes clean-ups"
then this patch set contains 8 patches, this is for easier merging
 - add "Signed-off-by: Mike Holmes <mike.hol...@linaro.org>" for patch 1/8
(was 1/4) since he contributed some change of doxygen system
 - add "Reviewed-and-tested-by: Bill Fischofer <bill.fischo...@linaro.org>"
for all patches since he's already done this in previous review
 - return document of ODP_CACHE_LINE_SIZE to original API header file and
fix the defect of its documentation

v2-v3 change:

Eliminate a doxygen-html compiling warning.

v1-v2 change:

Add macro __OCTEON for patch 2.

Hongbo Zhang (8):
  linux-generic: separate x86 ODP_CACHE_LINE_SIZE to its arch file
  linux-generic: separate MIPS ODP_CACHE_LINE_SIZE to its arch file
  linux-generic: separate PowerPC ODP_CACHE_LINE_SIZE to its arch file
  linux-generic: create ARM files and move ARM ODP_CACHE_LINE_SIZE in it
  linux-generic: move CPU info dummy data to generic default file
  linux-generic: systemcpu(): use input parameter instead of global data
  linux-generic: use one uniform call systemcpu()
  linux-generic: sysinfo clean up for ARM

 configure.ac   |  2 +
 doc/application-api-guide/doxygen.cfg  |  1 +
 m4/ax_prog_doxygen.m4  |  1 +
 platform/linux-generic/Makefile.am |  2 +
 platform/linux-generic/arch/arm/odp/cpu_arch.h | 32 +++
 platform/linux-generic/arch/arm/odp_cpu_arch.c |  1 +
 .../linux-generic/arch/arm/odp_sysinfo_parse.c | 28 +
 .../linux-generic/arch/linux/odp_sysinfo_parse.c   | 12 +-
 platform/linux-generic/arch/mips64/odp/cpu_arch.h  | 12 ++
 platform/linux-generic/arch/powerpc/odp/cpu_arch.h | 33 ++-
 platform/linux-generic/arch/x86/odp/cpu_arch.h | 10 +
 platform/linux-generic/include/odp/align.h | 21 +-
 platform/linux-generic/odp_system_info.c   | 47 +-
 13 files changed, 141 insertions(+), 61 deletions(-)
 create mode 100644 platform/linux-generic/arch/arm/odp/cpu_arch.h
 create mode 12 platform/linux-generic/arch/arm/odp_cpu_arch.c
 create mode 100644 platform/linux-generic/arch/arm/odp_sysinfo_parse.c
 mode change 12 => 100644 platform/linux-generic/arch/powerpc/odp/cpu_arch.h

-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v3 API-NEXT 1/4] linux-generic: separate x86 ODP_CACHE_LINE_SIZE to its arch file

2016-02-18 Thread Hongbo Zhang
On 9 February 2016 at 18:41, Anders Roxell <anders.rox...@linaro.org> wrote:
> On 2016-02-05 16:56, hongbo.zh...@linaro.org wrote:
>> From: Hongbo Zhang <hongbo.zh...@linaro.org>
>>
>> Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
>> held in one header file, they should be moved to their own arch file.
>> This patch moves ODP_CACHE_LINE_SIZE for x86.
>>
>> Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
>> ---
>>  doc/application-api-guide/doxygen.cfg  |  1 +
>>  include/odp/api/align.h|  5 -
>>  platform/linux-generic/arch/x86/odp/cpu_arch.h | 14 ++
>>  platform/linux-generic/include/odp/align.h |  9 ++---
>>  4 files changed, 17 insertions(+), 12 deletions(-)
>>
>> diff --git a/doc/application-api-guide/doxygen.cfg 
>> b/doc/application-api-guide/doxygen.cfg
>> index 7951e9e..c585108 100644
>> --- a/doc/application-api-guide/doxygen.cfg
>> +++ b/doc/application-api-guide/doxygen.cfg
>> @@ -14,6 +14,7 @@ INPUT = $(SRCDIR)/doc \
>>   $(SRCDIR)/doc/users-guide \
>>   $(SRCDIR)/include \
>>   $(SRCDIR)/platform/$(WITH_PLATFORM)/include/odp \
>> + $(SRCDIR)/platform/$(WITH_PLATFORM)/arch/ \
>>   $(SRCDIR)/helper/include
>>  FILE_PATTERNS = *.h odp*.c *.dox
>>  RECURSIVE = YES
>> diff --git a/include/odp/api/align.h b/include/odp/api/align.h
>> index 677ff12..f4b4be6 100644
>> --- a/include/odp/api/align.h
>> +++ b/include/odp/api/align.h
>> @@ -47,11 +47,6 @@ extern "C" {
>>   */
>>
>>  /**
>> - * @def ODP_CACHE_LINE_SIZE
>> - * Cache line size
>> - */
>> -
>> -/**
>
> I'm not convinced that we should move the documentation away from the
> "generic" header file.
>

Well, after tried, if I leave this documentation still in
include/odp/api/align.h, I cannot 'make doxygen-html' correctly, there
is either compiling or the macro missing in html files.

Anybody who is familiar with this doxygen grammar has any suggestions?

Thanks.

> Cheers,
> Anders
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v3 API-NEXT 1/4] linux-generic: separate x86 ODP_CACHE_LINE_SIZE to its arch file

2016-02-17 Thread Hongbo Zhang
Thanks all for the review.

When patch finished, which branch should I base on, api-next or master?

I think it is master because what I need are all in master now, and
this isn't an api changing, agree?

On 12 February 2016 at 16:16, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
> On 02/09/16 18:48, Savolainen, Petri (Nokia - FI/Espoo) wrote:
>>
>>
>>> -Original Message-
>>> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
>>> Anders Roxell
>>> Sent: Tuesday, February 09, 2016 12:42 PM
>>> To: hongbo.zh...@linaro.org
>>> Cc: lng-odp@lists.linaro.org
>>> Subject: Re: [lng-odp] [PATCH v3 API-NEXT 1/4] linux-generic: separate
>>> x86
>>> ODP_CACHE_LINE_SIZE to its arch file
>>>
>>> On 2016-02-05 16:56, hongbo.zh...@linaro.org wrote:
>>>>
>>>> From: Hongbo Zhang <hongbo.zh...@linaro.org>
>>>>
>>>> Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
>>>> held in one header file, they should be moved to their own arch file.
>>>> This patch moves ODP_CACHE_LINE_SIZE for x86.
>>>>
>>>> Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
>>>> ---
>>>>   doc/application-api-guide/doxygen.cfg  |  1 +
>>>>   include/odp/api/align.h|  5 -
>>>>   platform/linux-generic/arch/x86/odp/cpu_arch.h | 14 ++
>>>>   platform/linux-generic/include/odp/align.h |  9 ++---
>>>>   4 files changed, 17 insertions(+), 12 deletions(-)
>>>>
>>>> diff --git a/doc/application-api-guide/doxygen.cfg b/doc/application-
>>>
>>> api-guide/doxygen.cfg
>>>>
>>>> index 7951e9e..c585108 100644
>>>> --- a/doc/application-api-guide/doxygen.cfg
>>>> +++ b/doc/application-api-guide/doxygen.cfg
>>>> @@ -14,6 +14,7 @@ INPUT = $(SRCDIR)/doc \
>>>> $(SRCDIR)/doc/users-guide \
>>>> $(SRCDIR)/include \
>>>> $(SRCDIR)/platform/$(WITH_PLATFORM)/include/odp \
>>>> +   $(SRCDIR)/platform/$(WITH_PLATFORM)/arch/ \
>>>> $(SRCDIR)/helper/include
>>>>   FILE_PATTERNS = *.h odp*.c *.dox
>>>>   RECURSIVE = YES
>>>> diff --git a/include/odp/api/align.h b/include/odp/api/align.h
>>>> index 677ff12..f4b4be6 100644
>>>> --- a/include/odp/api/align.h
>>>> +++ b/include/odp/api/align.h
>>>> @@ -47,11 +47,6 @@ extern "C" {
>>>>*/
>>>>
>>>>   /**
>>>> - * @def ODP_CACHE_LINE_SIZE
>>>> - * Cache line size
>>>> - */
>>>> -
>>>> -/**
>>>
>>> I'm not convinced that we should move the documentation away from the
>>> "generic" header file.
>>>
>>> Cheers,
>>> Anders
>>
>> Yes, the doxygen documentation (API spec) of this API definition must stay
>> in the main API header file. Arch specific files are for implementation and
>> must not doxygen document API definitions.
>>
>> -Petri
>>
> waiting for v4 then.
> Maxim.
>
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v3 API-NEXT 2/4] linux-generic: separate MIPS ODP_CACHE_LINE_SIZE to its arch file

2016-02-05 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
held in one header file, they should be moved to their own arch file.
This patch moves ODP_CACHE_LINE_SIZE for MIPS.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/arch/mips64/odp/cpu_arch.h | 16 
 platform/linux-generic/include/odp/align.h|  4 
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/platform/linux-generic/arch/mips64/odp/cpu_arch.h 
b/platform/linux-generic/arch/mips64/odp/cpu_arch.h
index 3bfa0dc..303520b 100644
--- a/platform/linux-generic/arch/mips64/odp/cpu_arch.h
+++ b/platform/linux-generic/arch/mips64/odp/cpu_arch.h
@@ -11,6 +11,22 @@
 extern "C" {
 #endif
 
+/** @ingroup odp_compiler_optim
+ *  @{
+ */
+
+/**
+ * @def ODP_CACHE_LINE_SIZE
+ * Cache line size
+ */
+#if defined __OCTEON__
+#define ODP_CACHE_LINE_SIZE 128
+#endif
+
+/**
+ * @}
+ */
+
 static inline void odp_cpu_pause(void)
 {
__asm__ __volatile__ ("nop");
diff --git a/platform/linux-generic/include/odp/align.h 
b/platform/linux-generic/include/odp/align.h
index 161a302..0f11569 100644
--- a/platform/linux-generic/include/odp/align.h
+++ b/platform/linux-generic/include/odp/align.h
@@ -35,10 +35,6 @@ extern "C" {
 
 #define ODP_CACHE_LINE_SIZE 64
 
-#elif defined __OCTEON__
-
-#define ODP_CACHE_LINE_SIZE 128
-
 #elif defined __powerpc__
 
 #define ODP_CACHE_LINE_SIZE 64
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v3 API-NEXT 3/4] linux-generic: separate PowerPC ODP_CACHE_LINE_SIZE to its arch file

2016-02-05 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
held in one header file, they should be moved to their own arch file.
This patch moves ODP_CACHE_LINE_SIZE for PowerPC.
The previous arch/powerpc/odp/cpu_arch.h was a symlink to the generic
arch/linux/odp/cpu_arch.h, but now this PowerPC header file has more
specific content than the generic one, so a real file is created and the
ODP_CACHE_LINE_SIZE is added to it.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/arch/powerpc/odp/cpu_arch.h | 37 +-
 platform/linux-generic/include/odp/align.h |  4 ---
 2 files changed, 36 insertions(+), 5 deletions(-)
 mode change 12 => 100644 platform/linux-generic/arch/powerpc/odp/cpu_arch.h

diff --git a/platform/linux-generic/arch/powerpc/odp/cpu_arch.h 
b/platform/linux-generic/arch/powerpc/odp/cpu_arch.h
deleted file mode 12
index 0617d7f..000
--- a/platform/linux-generic/arch/powerpc/odp/cpu_arch.h
+++ /dev/null
@@ -1 +0,0 @@
-../../linux/odp/cpu_arch.h
\ No newline at end of file
diff --git a/platform/linux-generic/arch/powerpc/odp/cpu_arch.h 
b/platform/linux-generic/arch/powerpc/odp/cpu_arch.h
new file mode 100644
index 000..5539185
--- /dev/null
+++ b/platform/linux-generic/arch/powerpc/odp/cpu_arch.h
@@ -0,0 +1,36 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_PLAT_CPU_ARCH_H_
+#define ODP_PLAT_CPU_ARCH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @ingroup odp_compiler_optim
+ *  @{
+ */
+
+/**
+ * @def ODP_CACHE_LINE_SIZE
+ * Cache line size
+ */
+#define ODP_CACHE_LINE_SIZE 64
+
+/**
+ * @}
+ */
+
+static inline void odp_cpu_pause(void)
+{
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/align.h 
b/platform/linux-generic/include/odp/align.h
index 0f11569..46b30dc 100644
--- a/platform/linux-generic/include/odp/align.h
+++ b/platform/linux-generic/include/odp/align.h
@@ -35,10 +35,6 @@ extern "C" {
 
 #define ODP_CACHE_LINE_SIZE 64
 
-#elif defined __powerpc__
-
-#define ODP_CACHE_LINE_SIZE 64
-
 #endif
 
 #else
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH API-NEXT 0/4] linux-generic sysinfo codes clean-ups

2016-02-05 Thread Hongbo Zhang
Thanks Bill.

I've re-send the updated prerequisite series:
[PATCH v3 API-NEXT 0/4] separate ODP_CACHE_LINE_SIZE to arch files.

And this series still applies well, so I don't re-send this one.

On 4 February 2016 at 09:54, Bill Fischofer <bill.fischo...@linaro.org> wrote:
> OK, thanks.  After applying that prereq series this series looks OK, so for
> it:
>
> Reviewed-and-tested-by: Bill Fischofer <bill.fischo...@linaro.org>
>
> However, as I noted on it's thread, the odp_cache_line_size patch introduces
> a doxygen error that should be corrected before that series can be applied.
>
> On Tue, Feb 2, 2016 at 9:48 PM, Hongbo Zhang <hongbo.zh...@linaro.org>
> wrote:
>>
>> On 3 February 2016 at 06:03, Bill Fischofer <bill.fischo...@linaro.org>
>> wrote:
>> > Part 4 of this patch does not apply to api-next for me:
>> >
>>
>> This patch set is on top of my previous 4 patches:
>> "separate ODP_CACHE_LINE_SIZE to arch files"
>>
>> After applying that, this patch set should apply.
>>
>> > bill@Ubuntu15:~/linaro/hongbo$ git am --reject ~/Mail/Incoming/Hongbo/4
>> > Applying: linux-generic: sysinfo clean up for ARM
>> > Checking patch platform/linux-generic/arch/arm/odp_sysinfo_parse.c...
>> > error: platform/linux-generic/arch/arm/odp_sysinfo_parse.c: does not
>> > exist
>> > in index
>> > Checking patch platform/linux-generic/arch/arm/odp_sysinfo_parse.c...
>> > Checking patch platform/linux-generic/arch/linux/odp_sysinfo_parse.c...
>> > Applied patch platform/linux-generic/arch/arm/odp_sysinfo_parse.c
>> > cleanly.
>> > Applied patch platform/linux-generic/arch/linux/odp_sysinfo_parse.c
>> > cleanly.
>> > Patch failed at 0001 linux-generic: sysinfo clean up for ARM
>> > The copy of the patch that failed is found in:
>> >/home/bill/linaro/hongbo/.git/rebase-apply/patch
>> > When you have resolved this problem, run "git am --continue".
>> > If you prefer to skip this patch, run "git am --skip" instead.
>> > To restore the original branch and stop patching, run "git am --abort".
>> >
>> >
>> > On Tue, Feb 2, 2016 at 4:32 AM, Maxim Uvarov <maxim.uva...@linaro.org>
>> > wrote:
>> >>
>> >> Ping.
>> >>
>> >> This fixes have to be in 1.7.
>> >>
>> >> Trivial, but please one more review.
>> >>
>> >> Maxim.
>> >>
>> >> On 01/29/2016 14:30, hongbo.zh...@linaro.org wrote:
>> >>>
>> >>> From: Hongbo Zhang <hongbo.zh...@linaro.org>
>> >>>
>> >>> This patch set does some architecture clean-ups for linux-generic
>> >>> sysinfo codes.
>> >>>
>> >>> This patch set is based on my previous patch set
>> >>> "separate ODP_CACHE_LINE_SIZE to arch files", so "API-NEXT" is uesed
>> >>> although no API is touched.
>> >>>
>> >>> Hongbo Zhang (4):
>> >>>linux-generic: move CPU info dummy data to generic default file
>> >>>linux-generic: systemcpu(): use input parameter instead of global
>> >>> data
>> >>>linux-generic: use one uniform call systemcpu()
>> >>>linux-generic: sysinfo clean up for ARM
>> >>>
>> >>>   .../linux-generic/arch/arm/odp_sysinfo_parse.c | 29
>> >>> -
>> >>>   .../linux-generic/arch/linux/odp_sysinfo_parse.c   | 12 +-
>> >>>   platform/linux-generic/odp_system_info.c   | 47
>> >>> +-
>> >>>   3 files changed, 47 insertions(+), 41 deletions(-)
>> >>>   mode change 12 => 100644
>> >>> platform/linux-generic/arch/arm/odp_sysinfo_parse.c
>> >>>
>> >>
>> >> ___
>> >> lng-odp mailing list
>> >> lng-odp@lists.linaro.org
>> >> https://lists.linaro.org/mailman/listinfo/lng-odp
>> >
>> >
>> >
>> > ___
>> > lng-odp mailing list
>> > lng-odp@lists.linaro.org
>> > https://lists.linaro.org/mailman/listinfo/lng-odp
>> >
>
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v3 API-NEXT 4/4] linux-generic: create ARM files and move ARM ODP_CACHE_LINE_SIZE in it

2016-02-05 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
held in one header file, they should be moved to their own arch file.
And in the legacy codes there was no ARM architecture directory, so this
patch create it, the odp_cpu_arch.c and odp_sysinfo_parse.c are still
symlink to the general default ones under arch/linux/, and a real file
arm/odp/cpu_arch.h is created from the linux/odp/cpu_arch.h, and then the
ODP_CACHE_LINE_SIZE for ARM is moved to this arch specific file.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 configure.ac   |  1 +
 platform/linux-generic/Makefile.am |  2 ++
 platform/linux-generic/arch/arm/odp/cpu_arch.h | 36 ++
 platform/linux-generic/arch/arm/odp_cpu_arch.c |  1 +
 .../linux-generic/arch/arm/odp_sysinfo_parse.c |  1 +
 platform/linux-generic/include/odp/align.h |  6 
 6 files changed, 41 insertions(+), 6 deletions(-)
 create mode 100644 platform/linux-generic/arch/arm/odp/cpu_arch.h
 create mode 12 platform/linux-generic/arch/arm/odp_cpu_arch.c
 create mode 12 platform/linux-generic/arch/arm/odp_sysinfo_parse.c

diff --git a/configure.ac b/configure.ac
index add8308..eab1753 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,6 +54,7 @@ AX_VALGRIND_CHECK
 ##
 AS_CASE([$host],
   [x86*], [ARCH=x86],
+  [arm*], [ARCH=arm],
   [mips64*], [ARCH=mips64],
   [powerpc*], [ARCH=powerpc],
   [ARCH=linux]
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 94f1408..c242d8c 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -169,6 +169,8 @@ __LIB__libodp_la_SOURCES = \
 EXTRA_DIST = \
 arch/linux/odp_cpu_arch.c \
 arch/linux/odp_sysinfo_parse.c \
+arch/arm/odp_cpu_arch.c \
+arch/arm/odp_sysinfo_parse.c \
 arch/mips64/odp_cpu_arch.c \
 arch/mips64/odp_sysinfo_parse.c \
 arch/powerpc/odp_cpu_arch.c \
diff --git a/platform/linux-generic/arch/arm/odp/cpu_arch.h 
b/platform/linux-generic/arch/arm/odp/cpu_arch.h
new file mode 100644
index 000..5539185
--- /dev/null
+++ b/platform/linux-generic/arch/arm/odp/cpu_arch.h
@@ -0,0 +1,36 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_PLAT_CPU_ARCH_H_
+#define ODP_PLAT_CPU_ARCH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @ingroup odp_compiler_optim
+ *  @{
+ */
+
+/**
+ * @def ODP_CACHE_LINE_SIZE
+ * Cache line size
+ */
+#define ODP_CACHE_LINE_SIZE 64
+
+/**
+ * @}
+ */
+
+static inline void odp_cpu_pause(void)
+{
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/arch/arm/odp_cpu_arch.c 
b/platform/linux-generic/arch/arm/odp_cpu_arch.c
new file mode 12
index 000..c5fe400
--- /dev/null
+++ b/platform/linux-generic/arch/arm/odp_cpu_arch.c
@@ -0,0 +1 @@
+../linux/odp_cpu_arch.c
\ No newline at end of file
diff --git a/platform/linux-generic/arch/arm/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
new file mode 12
index 000..2f368af
--- /dev/null
+++ b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
@@ -0,0 +1 @@
+../linux/odp_sysinfo_parse.c
\ No newline at end of file
diff --git a/platform/linux-generic/include/odp/align.h 
b/platform/linux-generic/include/odp/align.h
index 46b30dc..d824d57 100644
--- a/platform/linux-generic/include/odp/align.h
+++ b/platform/linux-generic/include/odp/align.h
@@ -31,12 +31,6 @@ extern "C" {
 
 #define ODP_FIELD_SIZEOF(type, member) sizeof(((type *)0)->member)
 
-#if defined __arm__ || defined __aarch64__
-
-#define ODP_CACHE_LINE_SIZE 64
-
-#endif
-
 #else
 #error Non-gcc compatible compiler
 #endif
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v3 API-NEXT 1/4] linux-generic: separate x86 ODP_CACHE_LINE_SIZE to its arch file

2016-02-05 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
held in one header file, they should be moved to their own arch file.
This patch moves ODP_CACHE_LINE_SIZE for x86.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 doc/application-api-guide/doxygen.cfg  |  1 +
 include/odp/api/align.h|  5 -
 platform/linux-generic/arch/x86/odp/cpu_arch.h | 14 ++
 platform/linux-generic/include/odp/align.h |  9 ++---
 4 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/doc/application-api-guide/doxygen.cfg 
b/doc/application-api-guide/doxygen.cfg
index 7951e9e..c585108 100644
--- a/doc/application-api-guide/doxygen.cfg
+++ b/doc/application-api-guide/doxygen.cfg
@@ -14,6 +14,7 @@ INPUT = $(SRCDIR)/doc \
$(SRCDIR)/doc/users-guide \
$(SRCDIR)/include \
$(SRCDIR)/platform/$(WITH_PLATFORM)/include/odp \
+   $(SRCDIR)/platform/$(WITH_PLATFORM)/arch/ \
$(SRCDIR)/helper/include
 FILE_PATTERNS = *.h odp*.c *.dox
 RECURSIVE = YES
diff --git a/include/odp/api/align.h b/include/odp/api/align.h
index 677ff12..f4b4be6 100644
--- a/include/odp/api/align.h
+++ b/include/odp/api/align.h
@@ -47,11 +47,6 @@ extern "C" {
  */
 
 /**
- * @def ODP_CACHE_LINE_SIZE
- * Cache line size
- */
-
-/**
  * @def ODP_PAGE_SIZE
  * Page size
  */
diff --git a/platform/linux-generic/arch/x86/odp/cpu_arch.h 
b/platform/linux-generic/arch/x86/odp/cpu_arch.h
index 997a954..58836c6 100644
--- a/platform/linux-generic/arch/x86/odp/cpu_arch.h
+++ b/platform/linux-generic/arch/x86/odp/cpu_arch.h
@@ -11,6 +11,20 @@
 extern "C" {
 #endif
 
+/** @ingroup odp_compiler_optim
+ *  @{
+ */
+
+/**
+ * @def ODP_CACHE_LINE_SIZE
+ * Cache line size
+ */
+#define ODP_CACHE_LINE_SIZE 64
+
+/**
+ * @}
+ */
+
 static inline void odp_cpu_pause(void)
 {
 #ifdef __SSE2__
diff --git a/platform/linux-generic/include/odp/align.h 
b/platform/linux-generic/include/odp/align.h
index be8c9ae..161a302 100644
--- a/platform/linux-generic/include/odp/align.h
+++ b/platform/linux-generic/include/odp/align.h
@@ -31,11 +31,7 @@ extern "C" {
 
 #define ODP_FIELD_SIZEOF(type, member) sizeof(((type *)0)->member)
 
-#if defined __x86_64__ || defined __i386__
-
-#define ODP_CACHE_LINE_SIZE 64
-
-#elif defined __arm__ || defined __aarch64__
+#if defined __arm__ || defined __aarch64__
 
 #define ODP_CACHE_LINE_SIZE 64
 
@@ -47,8 +43,6 @@ extern "C" {
 
 #define ODP_CACHE_LINE_SIZE 64
 
-#else
-#error GCC target not found
 #endif
 
 #else
@@ -65,6 +59,7 @@ extern "C" {
  * @}
  */
 
+#include 
 #include 
 
 #ifdef __cplusplus
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] validation: system: fix return code for checks

2016-02-04 Thread Hongbo Zhang
Reviewed-by: Hongbo Zhang <hongbo.zh...@linaro.org>

On 4 February 2016 at 15:49, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
> From doc: "A return value of 0 meansinactive,
> anything else is active.".
>
> Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
> ---
>  test/validation/system/system.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/test/validation/system/system.c b/test/validation/system/system.c
> index 5b5a3f0..5d87b8b 100644
> --- a/test/validation/system/system.c
> +++ b/test/validation/system/system.c
> @@ -218,10 +218,10 @@ int system_check_odp_cpu_hz(void)
>  {
> if (odp_cpu_hz() == 0) {
> fprintf(stderr, "odp_cpu_hz is not supported, skipping\n");
> -   return -1;
> +   return 0;
> }
>
> -   return 0;
> +   return 1;
>  }
>
>  void system_test_odp_cpu_hz(void)
> @@ -250,12 +250,12 @@ int system_check_odp_cpu_hz_id(void)
> fprintf(stderr, "cpu %d does not support"
> " odp_cpu_hz_id(),"
> "skip that test\n", cpu);
> -   return -1;
> +   return 0;
> }
> cpu = odp_cpumask_next(, cpu);
> }
>
> -   return 0;
> +   return 1;
>  }
>
>  void system_test_odp_cpu_hz_id(void)
> --
> 1.9.1
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] test/validation/system/system_main fails on arm64

2016-02-03 Thread Hongbo Zhang
On 3 February 2016 at 17:13, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
>
>
> On 3 February 2016 at 11:34, Hongbo Zhang <hongbo.zh...@linaro.org> wrote:
>>
>> On 3 February 2016 at 16:08, Savolainen, Petri (Nokia - FI/Espoo)
>> <petri.savolai...@nokia.com> wrote:
>> > I think we updated the API to return 0, when a CPU frequency (max or
>> > current) cannot be read. You just need to return 0 on ARM (== "was not able
>> > to read current frequency"). Validation test needs to accept both zero and
>> > non-zero values.
>>
>> It already returns 0, see
>>
>> uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
>> {
>> return 0;
>> }
>>
>> and the odp_cpu_hz() return value is uint64_t, it means it will return
>> value >= 0
>>
>> if in validation we accept both 0 and >0, that is meaningless, and
>> even compile warning IIRC.
>>
>
>
> In validation you need to test first if call is supported.
> Refrer how it's done for pktio:
> ./test/validation/pktio/pktio.c
> ODP_TEST_INFO_CONDITIONAL(pktio_test_statistics_counters,
>   pktio_check_statistics_counters),
>
>
> So you check first, if supported run test. If not - just skip.
>

ODP_TEST_INFO_CONDITIONAL looks not so good, I have to write another
function as the 2nd parameter of it.

But I found ODP_TEST_INFO_INACTIVE seems better, we just temporarily
disable the test.


> Maxim.
>
>
>
>>
>> >
>> > -Petri
>> >
>> >
>> >
>> >> -Original Message-
>> >> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
>> >> EXT
>> >> Hongbo Zhang
>> >> Sent: Wednesday, February 03, 2016 5:46 AM
>> >> To: Maxim Uvarov
>> >> Cc: lng-odp-forward
>> >> Subject: Re: [lng-odp] test/validation/system/system_main fails on
>> >> arm64
>> >>
>> >> No, not fixed.
>> >>
>> >> One reason is there isn't such info in /proc/cpuinfo for ARM, another
>> >> reason is there isn't any user calling "current freq" interfaces.
>> >>
>> >> This "current freq" api was introduced because we have "max freq" api,
>> >> so "current freq" can be a complement, what's more in the original
>> >> codes, "max freq" and "current freq" were mixed, I just made them
>> >> clear.
>> >>
>> >> If we don't want to see any failure in validation. one suggestion is
>> >> to delete the |current freq" validation codes, another suggestion it
>> >> to delete the "current freq" interfaces.
>> >>
>> >> On 2 February 2016 at 18:35, Maxim Uvarov <maxim.uva...@linaro.org>
>> >> wrote:
>> >> > Hongbo, you fixed that in the latest patch set right?
>> >> >
>> >> > Maxim.
>> >> >
>> >> >
>> >> > On 02/02/2016 11:28, Hongbo Zhang wrote:
>> >> >>
>> >> >> Sorry, please forget my previous reply.
>> >> >>
>> >> >> I checked again, system_test_odp_cpu_hz and
>> >> >> system_test_odp_cpu_hz_id
>> >> >> failed, while system_test_odp_cpu_hz_max and
>> >> >> system_test_odp_cpu_hz_max_id passed.
>> >> >>
>> >> >> As I've mentioned before in some cover letter, this fail can be
>> >> >> expected because on arm, mips and power, the "current freq" isn't
>> >> >> implemented, only the "max freq" is implemented now, so there are
>> >> >> such
>> >> >> failures.
>> >> >>
>> >> >> On x86, there is no "current freq" failures because it is
>> >> >> implemented.
>> >> >>
>> >> >> On 2 February 2016 at 16:14, Hongbo Zhang <hongbo.zh...@linaro.org>
>> >> wrote:
>> >> >>>
>> >> >>> On 1 February 2016 at 21:20, Mike Holmes <mike.hol...@linaro.org>
>> >> wrote:
>> >> >>>>
>> >> >>>> system_test_odp_cpu_hz_id
>> >> >>>>
>> >> >>>> ./../../platform/linux-
>> >> generic/odp_cpumask_task.c:44:odp_cpumask_default_worker():
>> >> >>>> CPU0 will be used for both control and worker threads,
>> >> >>>

Re: [lng-odp] test/validation/system/system_main fails on arm64

2016-02-03 Thread Hongbo Zhang
I mean, use ODP_TEST_INFO_INACTIVE currently, and when everything
becomes ready, we will come back to use ODP_TEST_INFO again.

On 3 February 2016 at 17:56, Hongbo Zhang <hongbo.zh...@linaro.org> wrote:
> I prefer ODP_TEST_INFO_INACTIVE at this stage, agree?
>
> And after 1.7, there still be something to be updated, for example,
> ARM max freq is still using dummy data, and I still think the
> /sys/devices/system/cpu/ should be the first place for getting cpu
> freq, it is a common way of cpu freq, from here we can get both max
> and current freq, if it ins't enabled, then let's go to each arch's
> parsing of /proc/cpuinfo.
>
>
>
> On 3 February 2016 at 17:51, Hongbo Zhang <hongbo.zh...@linaro.org> wrote:
>> On 3 February 2016 at 17:27, Savolainen, Petri (Nokia - FI/Espoo)
>> <petri.savolai...@nokia.com> wrote:
>>> The test should look like this. Zero is acceptable, otherwise hz value 
>>> should be in a sane range.
>>>
>>> void system_test_odp_cpu_hz(void)
>>> {
>>> uint64_t hz;
>>>
>>> hz = odp_cpu_hz();
>>>
>>> if (hz == 0)
>>> print warning ("cpu_hz not supported or other failure") and return 
>>> (with skipped status?)
>>>
>> not so accurate I think.
>> if not supported, it is ok to skip,
>> but if it is a real failure, it should report failure of course
>> here we mix the two different cases.
>>
>>> /* Test value sanity: less than 10GHz */
>>> CU_ASSERT(hz < 10GHz);
>>>
>>> /* larger than 1kHz */
>>> CU_ASSERT(hz > 1kHz);
>>> }
>>>
>>>
>>> -Petri
>>>
>>>
>>> From: EXT Maxim Uvarov [mailto:maxim.uva...@linaro.org]
>>> Sent: Wednesday, February 03, 2016 11:16 AM
>>> To: Hongbo Zhang
>>> Cc: Savolainen, Petri (Nokia - FI/Espoo); lng-odp-forward
>>> Subject: Re: [lng-odp] test/validation/system/system_main fails on arm64
>>>
>>> but here :
>>> void system_test_odp_cpu_hz(void)
>>> {
>>> uint64_t hz;
>>>
>>> hz = odp_cpu_hz();
>>> CU_ASSERT(0 < hz);
>>> }
>>> it looks like simple change to 0 <= hz is right. You can add some comment.
>>> Maxim.
>>>
>>> On 3 February 2016 at 12:13, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
>>>
>>>
>>> On 3 February 2016 at 11:34, Hongbo Zhang <hongbo.zh...@linaro.org> wrote:
>>> On 3 February 2016 at 16:08, Savolainen, Petri (Nokia - FI/Espoo)
>>> <petri.savolai...@nokia.com> wrote:
>>>> I think we updated the API to return 0, when a CPU frequency (max or 
>>>> current) cannot be read. You just need to return 0 on ARM (== "was not 
>>>> able to read current frequency"). Validation test needs to accept both 
>>>> zero and non-zero values.
>>>
>>> It already returns 0, see
>>>
>>> uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
>>> {
>>> return 0;
>>> }
>>>
>>> and the odp_cpu_hz() return value is uint64_t, it means it will return
>>> value >= 0
>>>
>>> if in validation we accept both 0 and >0, that is meaningless, and
>>> even compile warning IIRC.
>>>
>>>
>>> In validation you need to test first if call is supported.
>>> Refrer how it's done for pktio:
>>> ./test/validation/pktio/pktio.c
>>> ODP_TEST_INFO_CONDITIONAL(pktio_test_statistics_counters,
>>>   pktio_check_statistics_counters),
>>>
>>> So you check first, if supported run test. If not - just skip.
>>> Maxim.
>>>
>>>
>>>
>>>>
>>>> -Petri
>>>>
>>>>
>>>>
>>>>> -Original Message-
>>>>> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
>>>>> Hongbo Zhang
>>>>> Sent: Wednesday, February 03, 2016 5:46 AM
>>>>> To: Maxim Uvarov
>>>>> Cc: lng-odp-forward
>>>>> Subject: Re: [lng-odp] test/validation/system/system_main fails on arm64
>>>>>
>>>>> No, not fixed.
>>>>>
>>>>> One reason is there isn't such info in /proc/cpuinfo for ARM, another
>>>>> reason is there isn't any user calling "current freq" interfaces.
>>>>>
>>>>> This "current freq" api was introduced because we have "max freq" 

Re: [lng-odp] test/validation/system/system_main fails on arm64

2016-02-03 Thread Hongbo Zhang
On 3 February 2016 at 16:08, Savolainen, Petri (Nokia - FI/Espoo)
<petri.savolai...@nokia.com> wrote:
> I think we updated the API to return 0, when a CPU frequency (max or current) 
> cannot be read. You just need to return 0 on ARM (== "was not able to read 
> current frequency"). Validation test needs to accept both zero and non-zero 
> values.

It already returns 0, see

uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
{
return 0;
}

and the odp_cpu_hz() return value is uint64_t, it means it will return
value >= 0

if in validation we accept both 0 and >0, that is meaningless, and
even compile warning IIRC.

>
> -Petri
>
>
>
>> -Original Message-
>> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
>> Hongbo Zhang
>> Sent: Wednesday, February 03, 2016 5:46 AM
>> To: Maxim Uvarov
>> Cc: lng-odp-forward
>> Subject: Re: [lng-odp] test/validation/system/system_main fails on arm64
>>
>> No, not fixed.
>>
>> One reason is there isn't such info in /proc/cpuinfo for ARM, another
>> reason is there isn't any user calling "current freq" interfaces.
>>
>> This "current freq" api was introduced because we have "max freq" api,
>> so "current freq" can be a complement, what's more in the original
>> codes, "max freq" and "current freq" were mixed, I just made them
>> clear.
>>
>> If we don't want to see any failure in validation. one suggestion is
>> to delete the |current freq" validation codes, another suggestion it
>> to delete the "current freq" interfaces.
>>
>> On 2 February 2016 at 18:35, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
>> > Hongbo, you fixed that in the latest patch set right?
>> >
>> > Maxim.
>> >
>> >
>> > On 02/02/2016 11:28, Hongbo Zhang wrote:
>> >>
>> >> Sorry, please forget my previous reply.
>> >>
>> >> I checked again, system_test_odp_cpu_hz and system_test_odp_cpu_hz_id
>> >> failed, while system_test_odp_cpu_hz_max and
>> >> system_test_odp_cpu_hz_max_id passed.
>> >>
>> >> As I've mentioned before in some cover letter, this fail can be
>> >> expected because on arm, mips and power, the "current freq" isn't
>> >> implemented, only the "max freq" is implemented now, so there are such
>> >> failures.
>> >>
>> >> On x86, there is no "current freq" failures because it is implemented.
>> >>
>> >> On 2 February 2016 at 16:14, Hongbo Zhang <hongbo.zh...@linaro.org>
>> wrote:
>> >>>
>> >>> On 1 February 2016 at 21:20, Mike Holmes <mike.hol...@linaro.org>
>> wrote:
>> >>>>
>> >>>> system_test_odp_cpu_hz_id
>> >>>>
>> >>>> ./../../platform/linux-
>> generic/odp_cpumask_task.c:44:odp_cpumask_default_worker():
>> >>>> CPU0 will be used for both control and worker threads,
>> >>>> this will likely have a performance impact on the worker thread.
>> >>>> FAILED
>> >>>>
>> >>>>
>> >>>> http://snapshots.linaro.org/components/lng/odp/odp-api-check/api-
>> next/docker-utopic-arm64/559/log/system_main.log
>> >>>>
>> >>>> My first guess is Hongbo's changes to the system info, but maybe a
>> quick
>> >>>> bisect is needed
>> >>>>
>> >>> I checked the log but got this:
>> >>>
>> >>> Test: system_test_odp_cpu_hz_max ...passed
>> >>>Test: system_test_odp_cpu_hz_max_id
>> >>>
>> >>> ./../../platform/linux-
>> generic/odp_cpumask_task.c:44:odp_cpumask_default_worker():
>> >>> CPU0 will be used for both control and worker threads,
>> >>> this will likely have a performance impact on the worker thread.
>> >>> passed
>> >>>
>> >>> There is a "passed" at the end.
>> >>>
>> >>> Will check further.
>> >>>>
>> >>>> On 1 February 2016 at 08:13, Maxim Uvarov <maxim.uva...@linaro.org>
>> >>>> wrote:
>> >>>>>
>> >>>>> Subj.
>> >>>>>
>> >>>>> Does somebody already look at this?
>> >>>>>
>> >>>>> Thanks,
>> >>>>> Maxim.

Re: [lng-odp] test/validation/system/system_main fails on arm64

2016-02-03 Thread Hongbo Zhang
I had already tried this before sending patch, we will get compile warning:

system.c:222:14: error: comparison of unsigned expression >= 0 is
always true [-Werror=type-limits]
  CU_ASSERT(0 <= hz);

On 3 February 2016 at 17:16, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
> but here :
> void system_test_odp_cpu_hz(void)
> {
> uint64_t hz;
>
> hz = odp_cpu_hz();
> CU_ASSERT(0 < hz);
> }
>
> it looks like simple change to 0 <= hz is right. You can add some comment.
>
> Maxim.
>
> On 3 February 2016 at 12:13, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
>>
>>
>>
>> On 3 February 2016 at 11:34, Hongbo Zhang <hongbo.zh...@linaro.org> wrote:
>>>
>>> On 3 February 2016 at 16:08, Savolainen, Petri (Nokia - FI/Espoo)
>>> <petri.savolai...@nokia.com> wrote:
>>> > I think we updated the API to return 0, when a CPU frequency (max or
>>> > current) cannot be read. You just need to return 0 on ARM (== "was not 
>>> > able
>>> > to read current frequency"). Validation test needs to accept both zero and
>>> > non-zero values.
>>>
>>> It already returns 0, see
>>>
>>> uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
>>> {
>>> return 0;
>>> }
>>>
>>> and the odp_cpu_hz() return value is uint64_t, it means it will return
>>> value >= 0
>>>
>>> if in validation we accept both 0 and >0, that is meaningless, and
>>> even compile warning IIRC.
>>>
>>
>>
>> In validation you need to test first if call is supported.
>> Refrer how it's done for pktio:
>> ./test/validation/pktio/pktio.c
>> ODP_TEST_INFO_CONDITIONAL(pktio_test_statistics_counters,
>>   pktio_check_statistics_counters),
>>
>>
>> So you check first, if supported run test. If not - just skip.
>>
>> Maxim.
>>
>>
>>
>>>
>>> >
>>> > -Petri
>>> >
>>> >
>>> >
>>> >> -Original Message-
>>> >> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
>>> >> EXT
>>> >> Hongbo Zhang
>>> >> Sent: Wednesday, February 03, 2016 5:46 AM
>>> >> To: Maxim Uvarov
>>> >> Cc: lng-odp-forward
>>> >> Subject: Re: [lng-odp] test/validation/system/system_main fails on
>>> >> arm64
>>> >>
>>> >> No, not fixed.
>>> >>
>>> >> One reason is there isn't such info in /proc/cpuinfo for ARM, another
>>> >> reason is there isn't any user calling "current freq" interfaces.
>>> >>
>>> >> This "current freq" api was introduced because we have "max freq" api,
>>> >> so "current freq" can be a complement, what's more in the original
>>> >> codes, "max freq" and "current freq" were mixed, I just made them
>>> >> clear.
>>> >>
>>> >> If we don't want to see any failure in validation. one suggestion is
>>> >> to delete the |current freq" validation codes, another suggestion it
>>> >> to delete the "current freq" interfaces.
>>> >>
>>> >> On 2 February 2016 at 18:35, Maxim Uvarov <maxim.uva...@linaro.org>
>>> >> wrote:
>>> >> > Hongbo, you fixed that in the latest patch set right?
>>> >> >
>>> >> > Maxim.
>>> >> >
>>> >> >
>>> >> > On 02/02/2016 11:28, Hongbo Zhang wrote:
>>> >> >>
>>> >> >> Sorry, please forget my previous reply.
>>> >> >>
>>> >> >> I checked again, system_test_odp_cpu_hz and
>>> >> >> system_test_odp_cpu_hz_id
>>> >> >> failed, while system_test_odp_cpu_hz_max and
>>> >> >> system_test_odp_cpu_hz_max_id passed.
>>> >> >>
>>> >> >> As I've mentioned before in some cover letter, this fail can be
>>> >> >> expected because on arm, mips and power, the "current freq" isn't
>>> >> >> implemented, only the "max freq" is implemented now, so there are
>>> >> >> such
>>> >> >> failures.
>>> >> >>
>>> >> >> On x86, there is no "current freq" failures bec

Re: [lng-odp] test/validation/system/system_main fails on arm64

2016-02-03 Thread Hongbo Zhang
On 3 February 2016 at 17:27, Savolainen, Petri (Nokia - FI/Espoo)
<petri.savolai...@nokia.com> wrote:
> The test should look like this. Zero is acceptable, otherwise hz value should 
> be in a sane range.
>
> void system_test_odp_cpu_hz(void)
> {
> uint64_t hz;
>
> hz = odp_cpu_hz();
>
> if (hz == 0)
> print warning ("cpu_hz not supported or other failure") and return 
> (with skipped status?)
>
not so accurate I think.
if not supported, it is ok to skip,
but if it is a real failure, it should report failure of course
here we mix the two different cases.

> /* Test value sanity: less than 10GHz */
> CU_ASSERT(hz < 10GHz);
>
> /* larger than 1kHz */
> CU_ASSERT(hz > 1kHz);
> }
>
>
> -Petri
>
>
> From: EXT Maxim Uvarov [mailto:maxim.uva...@linaro.org]
> Sent: Wednesday, February 03, 2016 11:16 AM
> To: Hongbo Zhang
> Cc: Savolainen, Petri (Nokia - FI/Espoo); lng-odp-forward
> Subject: Re: [lng-odp] test/validation/system/system_main fails on arm64
>
> but here :
> void system_test_odp_cpu_hz(void)
> {
> uint64_t hz;
>
> hz = odp_cpu_hz();
> CU_ASSERT(0 < hz);
> }
> it looks like simple change to 0 <= hz is right. You can add some comment.
> Maxim.
>
> On 3 February 2016 at 12:13, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
>
>
> On 3 February 2016 at 11:34, Hongbo Zhang <hongbo.zh...@linaro.org> wrote:
> On 3 February 2016 at 16:08, Savolainen, Petri (Nokia - FI/Espoo)
> <petri.savolai...@nokia.com> wrote:
>> I think we updated the API to return 0, when a CPU frequency (max or 
>> current) cannot be read. You just need to return 0 on ARM (== "was not able 
>> to read current frequency"). Validation test needs to accept both zero and 
>> non-zero values.
>
> It already returns 0, see
>
> uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
> {
> return 0;
> }
>
> and the odp_cpu_hz() return value is uint64_t, it means it will return
> value >= 0
>
> if in validation we accept both 0 and >0, that is meaningless, and
> even compile warning IIRC.
>
>
> In validation you need to test first if call is supported.
> Refrer how it's done for pktio:
> ./test/validation/pktio/pktio.c
> ODP_TEST_INFO_CONDITIONAL(pktio_test_statistics_counters,
>   pktio_check_statistics_counters),
>
> So you check first, if supported run test. If not - just skip.
> Maxim.
>
>
>
>>
>> -Petri
>>
>>
>>
>>> -Original Message-
>>> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
>>> Hongbo Zhang
>>> Sent: Wednesday, February 03, 2016 5:46 AM
>>> To: Maxim Uvarov
>>> Cc: lng-odp-forward
>>> Subject: Re: [lng-odp] test/validation/system/system_main fails on arm64
>>>
>>> No, not fixed.
>>>
>>> One reason is there isn't such info in /proc/cpuinfo for ARM, another
>>> reason is there isn't any user calling "current freq" interfaces.
>>>
>>> This "current freq" api was introduced because we have "max freq" api,
>>> so "current freq" can be a complement, what's more in the original
>>> codes, "max freq" and "current freq" were mixed, I just made them
>>> clear.
>>>
>>> If we don't want to see any failure in validation. one suggestion is
>>> to delete the |current freq" validation codes, another suggestion it
>>> to delete the "current freq" interfaces.
>>>
>>> On 2 February 2016 at 18:35, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
>>> > Hongbo, you fixed that in the latest patch set right?
>>> >
>>> > Maxim.
>>> >
>>> >
>>> > On 02/02/2016 11:28, Hongbo Zhang wrote:
>>> >>
>>> >> Sorry, please forget my previous reply.
>>> >>
>>> >> I checked again, system_test_odp_cpu_hz and system_test_odp_cpu_hz_id
>>> >> failed, while system_test_odp_cpu_hz_max and
>>> >> system_test_odp_cpu_hz_max_id passed.
>>> >>
>>> >> As I've mentioned before in some cover letter, this fail can be
>>> >> expected because on arm, mips and power, the "current freq" isn't
>>> >> implemented, only the "max freq" is implemented now, so there are such
>>> >> failures.
>>> >>
>>> >> On x86, there is no "current freq" failures because it is implemen

[lng-odp] [PATCH API-NEXT] validation: system: disable validation of CPU current requency

2016-02-03 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This patch disable validation of CPU current frequency because it isn't
fully implemented on every platform, then unnecesary failures are reported.
This validation can be re-enable again in furture if every thing is ready.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 test/validation/system/system.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/validation/system/system.c b/test/validation/system/system.c
index c72590b..ae84549 100644
--- a/test/validation/system/system.c
+++ b/test/validation/system/system.c
@@ -270,8 +270,8 @@ odp_testinfo_t system_suite[] = {
ODP_TEST_INFO(system_test_odp_cpu_model_str_id),
ODP_TEST_INFO(system_test_odp_sys_page_size),
ODP_TEST_INFO(system_test_odp_sys_huge_page_size),
-   ODP_TEST_INFO(system_test_odp_cpu_hz),
-   ODP_TEST_INFO(system_test_odp_cpu_hz_id),
+   ODP_TEST_INFO_INACTIVE(system_test_odp_cpu_hz),
+   ODP_TEST_INFO_INACTIVE(system_test_odp_cpu_hz_id),
ODP_TEST_INFO(system_test_odp_cpu_hz_max),
ODP_TEST_INFO(system_test_odp_cpu_hz_max_id),
ODP_TEST_INFO(system_test_odp_cpu_cycles),
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] test/validation/system/system_main fails on arm64

2016-02-03 Thread Hongbo Zhang
On 3 February 2016 at 15:29, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
> On 02/03/2016 06:45, Hongbo Zhang wrote:
>>
>> No, not fixed.
>>
>> One reason is there isn't such info in /proc/cpuinfo for ARM, another
>> reason is there isn't any user calling "current freq" interfaces.
>>
>> This "current freq" api was introduced because we have "max freq" api,
>> so "current freq" can be a complement, what's more in the original
>> codes, "max freq" and "current freq" were mixed, I just made them
>> clear.
>>
>> If we don't want to see any failure in validation. one suggestion is
>> to delete the |current freq" validation codes, another suggestion it
>> to delete the "current freq" interfaces.
>
> That means that we can not accept that API until everything is resolved.
>
> So we need to remove all: api, linux-generic and validation for current
> freq.
>
> I'm not sure if it's possible to do with reverting existence commits or it
> has
> to be separate patch. Please fix it ASAP, we need to release 1.7 and that
> api can not go there.
>

Reverting isn't a good way, those patches contains other things.
So a separate patch is needed,  but we need to find an acceptable solution.

> Maxim.
>
>
>> On 2 February 2016 at 18:35, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
>>>
>>> Hongbo, you fixed that in the latest patch set right?
>>>
>>> Maxim.
>>>
>>>
>>> On 02/02/2016 11:28, Hongbo Zhang wrote:
>>>>
>>>> Sorry, please forget my previous reply.
>>>>
>>>> I checked again, system_test_odp_cpu_hz and system_test_odp_cpu_hz_id
>>>> failed, while system_test_odp_cpu_hz_max and
>>>> system_test_odp_cpu_hz_max_id passed.
>>>>
>>>> As I've mentioned before in some cover letter, this fail can be
>>>> expected because on arm, mips and power, the "current freq" isn't
>>>> implemented, only the "max freq" is implemented now, so there are such
>>>> failures.
>>>>
>>>> On x86, there is no "current freq" failures because it is implemented.
>>>>
>>>> On 2 February 2016 at 16:14, Hongbo Zhang <hongbo.zh...@linaro.org>
>>>> wrote:
>>>>>
>>>>> On 1 February 2016 at 21:20, Mike Holmes <mike.hol...@linaro.org>
>>>>> wrote:
>>>>>>
>>>>>> system_test_odp_cpu_hz_id
>>>>>>
>>>>>>
>>>>>> ./../../platform/linux-generic/odp_cpumask_task.c:44:odp_cpumask_default_worker():
>>>>>> CPU0 will be used for both control and worker threads,
>>>>>> this will likely have a performance impact on the worker thread.
>>>>>> FAILED
>>>>>>
>>>>>>
>>>>>>
>>>>>> http://snapshots.linaro.org/components/lng/odp/odp-api-check/api-next/docker-utopic-arm64/559/log/system_main.log
>>>>>>
>>>>>> My first guess is Hongbo's changes to the system info, but maybe a
>>>>>> quick
>>>>>> bisect is needed
>>>>>>
>>>>> I checked the log but got this:
>>>>>
>>>>> Test: system_test_odp_cpu_hz_max ...passed
>>>>> Test: system_test_odp_cpu_hz_max_id
>>>>>
>>>>>
>>>>> ./../../platform/linux-generic/odp_cpumask_task.c:44:odp_cpumask_default_worker():
>>>>> CPU0 will be used for both control and worker threads,
>>>>> this will likely have a performance impact on the worker thread.
>>>>> passed
>>>>>
>>>>> There is a "passed" at the end.
>>>>>
>>>>> Will check further.
>>>>>>
>>>>>> On 1 February 2016 at 08:13, Maxim Uvarov <maxim.uva...@linaro.org>
>>>>>> wrote:
>>>>>>>
>>>>>>> Subj.
>>>>>>>
>>>>>>> Does somebody already look at this?
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Maxim.
>>>>>>>
>>>>>>>  Forwarded Message 
>>>>>>> Subject:[lng-ci] Build failed in Jenkins: ODP API check »
>>>>>>> ar

Re: [lng-odp] test/validation/system/system_main fails on arm64

2016-02-03 Thread Hongbo Zhang
I prefer ODP_TEST_INFO_INACTIVE at this stage, agree?

And after 1.7, there still be something to be updated, for example,
ARM max freq is still using dummy data, and I still think the
/sys/devices/system/cpu/ should be the first place for getting cpu
freq, it is a common way of cpu freq, from here we can get both max
and current freq, if it ins't enabled, then let's go to each arch's
parsing of /proc/cpuinfo.



On 3 February 2016 at 17:51, Hongbo Zhang <hongbo.zh...@linaro.org> wrote:
> On 3 February 2016 at 17:27, Savolainen, Petri (Nokia - FI/Espoo)
> <petri.savolai...@nokia.com> wrote:
>> The test should look like this. Zero is acceptable, otherwise hz value 
>> should be in a sane range.
>>
>> void system_test_odp_cpu_hz(void)
>> {
>> uint64_t hz;
>>
>> hz = odp_cpu_hz();
>>
>> if (hz == 0)
>> print warning ("cpu_hz not supported or other failure") and return 
>> (with skipped status?)
>>
> not so accurate I think.
> if not supported, it is ok to skip,
> but if it is a real failure, it should report failure of course
> here we mix the two different cases.
>
>> /* Test value sanity: less than 10GHz */
>> CU_ASSERT(hz < 10GHz);
>>
>> /* larger than 1kHz */
>> CU_ASSERT(hz > 1kHz);
>> }
>>
>>
>> -Petri
>>
>>
>> From: EXT Maxim Uvarov [mailto:maxim.uva...@linaro.org]
>> Sent: Wednesday, February 03, 2016 11:16 AM
>> To: Hongbo Zhang
>> Cc: Savolainen, Petri (Nokia - FI/Espoo); lng-odp-forward
>> Subject: Re: [lng-odp] test/validation/system/system_main fails on arm64
>>
>> but here :
>> void system_test_odp_cpu_hz(void)
>> {
>> uint64_t hz;
>>
>>     hz = odp_cpu_hz();
>> CU_ASSERT(0 < hz);
>> }
>> it looks like simple change to 0 <= hz is right. You can add some comment.
>> Maxim.
>>
>> On 3 February 2016 at 12:13, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
>>
>>
>> On 3 February 2016 at 11:34, Hongbo Zhang <hongbo.zh...@linaro.org> wrote:
>> On 3 February 2016 at 16:08, Savolainen, Petri (Nokia - FI/Espoo)
>> <petri.savolai...@nokia.com> wrote:
>>> I think we updated the API to return 0, when a CPU frequency (max or 
>>> current) cannot be read. You just need to return 0 on ARM (== "was not able 
>>> to read current frequency"). Validation test needs to accept both zero and 
>>> non-zero values.
>>
>> It already returns 0, see
>>
>> uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
>> {
>> return 0;
>> }
>>
>> and the odp_cpu_hz() return value is uint64_t, it means it will return
>> value >= 0
>>
>> if in validation we accept both 0 and >0, that is meaningless, and
>> even compile warning IIRC.
>>
>>
>> In validation you need to test first if call is supported.
>> Refrer how it's done for pktio:
>> ./test/validation/pktio/pktio.c
>> ODP_TEST_INFO_CONDITIONAL(pktio_test_statistics_counters,
>>   pktio_check_statistics_counters),
>>
>> So you check first, if supported run test. If not - just skip.
>> Maxim.
>>
>>
>>
>>>
>>> -Petri
>>>
>>>
>>>
>>>> -Original Message-
>>>> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
>>>> Hongbo Zhang
>>>> Sent: Wednesday, February 03, 2016 5:46 AM
>>>> To: Maxim Uvarov
>>>> Cc: lng-odp-forward
>>>> Subject: Re: [lng-odp] test/validation/system/system_main fails on arm64
>>>>
>>>> No, not fixed.
>>>>
>>>> One reason is there isn't such info in /proc/cpuinfo for ARM, another
>>>> reason is there isn't any user calling "current freq" interfaces.
>>>>
>>>> This "current freq" api was introduced because we have "max freq" api,
>>>> so "current freq" can be a complement, what's more in the original
>>>> codes, "max freq" and "current freq" were mixed, I just made them
>>>> clear.
>>>>
>>>> If we don't want to see any failure in validation. one suggestion is
>>>> to delete the |current freq" validation codes, another suggestion it
>>>> to delete the "current freq" interfaces.
>>>>
>>>> On 2 February 2016 at 18:35, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
>>>> > Hongbo, you fixed that in the latest patch set right?

Re: [lng-odp] [PATCH API-NEXT] validation: system: disable validation of CPU current requency

2016-02-03 Thread Hongbo Zhang
I send this out today before going home, when at home I won't have a
Linux PC to work.

On 3 February 2016 at 18:48,  <hongbo.zh...@linaro.org> wrote:
> From: Hongbo Zhang <hongbo.zh...@linaro.org>
>
> This patch disable validation of CPU current frequency because it isn't
> fully implemented on every platform, then unnecesary failures are reported.
> This validation can be re-enable again in furture if every thing is ready.
>
> Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
> ---
>  test/validation/system/system.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/test/validation/system/system.c b/test/validation/system/system.c
> index c72590b..ae84549 100644
> --- a/test/validation/system/system.c
> +++ b/test/validation/system/system.c
> @@ -270,8 +270,8 @@ odp_testinfo_t system_suite[] = {
> ODP_TEST_INFO(system_test_odp_cpu_model_str_id),
> ODP_TEST_INFO(system_test_odp_sys_page_size),
> ODP_TEST_INFO(system_test_odp_sys_huge_page_size),
> -   ODP_TEST_INFO(system_test_odp_cpu_hz),
> -   ODP_TEST_INFO(system_test_odp_cpu_hz_id),
> +   ODP_TEST_INFO_INACTIVE(system_test_odp_cpu_hz),
> +   ODP_TEST_INFO_INACTIVE(system_test_odp_cpu_hz_id),
> ODP_TEST_INFO(system_test_odp_cpu_hz_max),
> ODP_TEST_INFO(system_test_odp_cpu_hz_max_id),
> ODP_TEST_INFO(system_test_odp_cpu_cycles),
> --
> 2.1.4
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH] validation: system: make odp_cpu_hz optional in validation test

2016-02-03 Thread Hongbo Zhang
Maxim,
you only handled system_test_odp_cpu_hz(), you should do the same for
system_test_odp_cpu_hz_id()

On 3 February 2016 at 21:55, Savolainen, Petri (Nokia - FI/Espoo)
 wrote:
>
>
>> -Original Message-
>> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
>> Maxim Uvarov
>> Sent: Wednesday, February 03, 2016 3:42 PM
>> To: lng-odp@lists.linaro.org
>> Subject: [lng-odp] [API-NEXT PATCH] validation: system: make odp_cpu_hz
>> optional in validation test
>>
>> Do not fail if odp_cpu_hz() returns 0, just skip the test.
>>
>> Suggested-by: Petri Savolainen 
>> Signed-off-by: Maxim Uvarov 
>> ---
>>  test/validation/system/system.c | 22 ++
>>  test/validation/system/system.h |  4 
>>  2 files changed, 22 insertions(+), 4 deletions(-)
>>
>> diff --git a/test/validation/system/system.c
>> b/test/validation/system/system.c
>> index c72590b..0216624 100644
>> --- a/test/validation/system/system.c
>> +++ b/test/validation/system/system.c
>> @@ -214,12 +214,25 @@ void system_test_odp_sys_huge_page_size(void)
>>   CU_ASSERT(0 < page);
>>  }
>>
>> +int system_check_odp_cpu_hz(void)
>> +{
>> + if (odp_cpu_hz() == 0) {
>> + fprintf(stderr, "odp_cpu_hz is not supported, skipping\n");
>> + return -1;
>> + }
>> +
>> + return 0;
>> +}
>> +
>>  void system_test_odp_cpu_hz(void)
>>  {
>> - uint64_t hz;
>> + uint64_t hz = odp_cpu_hz();
>>
>> - hz = odp_cpu_hz();
>> - CU_ASSERT(0 < hz);
>> + /* Test value sanity: less than 10GHz */
>> + CU_ASSERT(hz < 10 * GHz);
>> +
>> + /* larger than 1kHz */
>> + CU_ASSERT(hz > 1 * kHz);
>>  }
>>
>>  void system_test_odp_cpu_hz_id(void)
>> @@ -270,7 +283,8 @@ odp_testinfo_t system_suite[] = {
>>   ODP_TEST_INFO(system_test_odp_cpu_model_str_id),
>>   ODP_TEST_INFO(system_test_odp_sys_page_size),
>>   ODP_TEST_INFO(system_test_odp_sys_huge_page_size),
>> - ODP_TEST_INFO(system_test_odp_cpu_hz),
>> + ODP_TEST_INFO_CONDITIONAL(system_test_odp_cpu_hz,
>> +   system_check_odp_cpu_hz),
>>   ODP_TEST_INFO(system_test_odp_cpu_hz_id),
>>   ODP_TEST_INFO(system_test_odp_cpu_hz_max),
>>   ODP_TEST_INFO(system_test_odp_cpu_hz_max_id),
>> diff --git a/test/validation/system/system.h
>> b/test/validation/system/system.h
>> index c5f3058..4f8c67f 100644
>> --- a/test/validation/system/system.h
>> +++ b/test/validation/system/system.h
>> @@ -9,6 +9,9 @@
>>
>>  #include 
>>
>> +#define GHz 10
>> +#define kHz 1000
>
>
> I guess CamelCase should be avoided. Use e.g. GIGA_HZ and KILO_HZ instead.
>
> -Petri
>
>
>
>> +
>>  /* test functions: */
>>  void system_test_odp_version_numbers(void);
>>  void system_test_odp_cpu_count(void);
>> @@ -17,6 +20,7 @@ void system_test_odp_cpu_model_str(void);
>>  void system_test_odp_cpu_model_str_id(void);
>>  void system_test_odp_sys_page_size(void);
>>  void system_test_odp_sys_huge_page_size(void);
>> +int system_check_odp_cpu_hz(void);
>>  void system_test_odp_cpu_hz(void);
>>  void system_test_odp_cpu_hz_id(void);
>>  void system_test_odp_cpu_hz_max(void);
>> --
>> 1.9.1
>>
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCHv2] validation: system: make odp_cpu_hz optional in validation test

2016-02-03 Thread Hongbo Zhang
Please wait,
As I replied in the v1 patch, system_test_odp_cpu_hz_id() should be
done with the same solution.


On 3 February 2016 at 22:22, Savolainen, Petri (Nokia - FI/Espoo)
 wrote:
> Reviewed-by: Petri Savolainen 
>
>> -Original Message-
>> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
>> Maxim Uvarov
>> Sent: Wednesday, February 03, 2016 4:10 PM
>> To: lng-odp@lists.linaro.org
>> Subject: [lng-odp] [API-NEXT PATCHv2] validation: system: make odp_cpu_hz
>> optional in validation test
>>
>> Do not fail if odp_cpu_hz() returns 0, just skip the test.
>>
>> Suggested-by: Petri Savolainen 
>> Signed-off-by: Maxim Uvarov 
>> ---
>>  test/validation/system/system.c | 22 ++
>>  test/validation/system/system.h |  4 
>>  2 files changed, 22 insertions(+), 4 deletions(-)
>>
>> diff --git a/test/validation/system/system.c
>> b/test/validation/system/system.c
>> index c72590b..942905a 100644
>> --- a/test/validation/system/system.c
>> +++ b/test/validation/system/system.c
>> @@ -214,12 +214,25 @@ void system_test_odp_sys_huge_page_size(void)
>>   CU_ASSERT(0 < page);
>>  }
>>
>> +int system_check_odp_cpu_hz(void)
>> +{
>> + if (odp_cpu_hz() == 0) {
>> + fprintf(stderr, "odp_cpu_hz is not supported, skipping\n");
>> + return -1;
>> + }
>> +
>> + return 0;
>> +}
>> +
>>  void system_test_odp_cpu_hz(void)
>>  {
>> - uint64_t hz;
>> + uint64_t hz = odp_cpu_hz();
>>
>> - hz = odp_cpu_hz();
>> - CU_ASSERT(0 < hz);
>> + /* Test value sanity: less than 10GHz */
>> + CU_ASSERT(hz < 10 * GIGA_HZ);
>> +
>> + /* larger than 1kHz */
>> + CU_ASSERT(hz > 1 * KILO_HZ);
>>  }
>>
>>  void system_test_odp_cpu_hz_id(void)
>> @@ -270,7 +283,8 @@ odp_testinfo_t system_suite[] = {
>>   ODP_TEST_INFO(system_test_odp_cpu_model_str_id),
>>   ODP_TEST_INFO(system_test_odp_sys_page_size),
>>   ODP_TEST_INFO(system_test_odp_sys_huge_page_size),
>> - ODP_TEST_INFO(system_test_odp_cpu_hz),
>> + ODP_TEST_INFO_CONDITIONAL(system_test_odp_cpu_hz,
>> +   system_check_odp_cpu_hz),
>>   ODP_TEST_INFO(system_test_odp_cpu_hz_id),
>>   ODP_TEST_INFO(system_test_odp_cpu_hz_max),
>>   ODP_TEST_INFO(system_test_odp_cpu_hz_max_id),
>> diff --git a/test/validation/system/system.h
>> b/test/validation/system/system.h
>> index c5f3058..a258933 100644
>> --- a/test/validation/system/system.h
>> +++ b/test/validation/system/system.h
>> @@ -9,6 +9,9 @@
>>
>>  #include 
>>
>> +#define GIGA_HZ 10ULL
>> +#define KILO_HZ 1000ULL
>> +
>>  /* test functions: */
>>  void system_test_odp_version_numbers(void);
>>  void system_test_odp_cpu_count(void);
>> @@ -17,6 +20,7 @@ void system_test_odp_cpu_model_str(void);
>>  void system_test_odp_cpu_model_str_id(void);
>>  void system_test_odp_sys_page_size(void);
>>  void system_test_odp_sys_huge_page_size(void);
>> +int system_check_odp_cpu_hz(void);
>>  void system_test_odp_cpu_hz(void);
>>  void system_test_odp_cpu_hz_id(void);
>>  void system_test_odp_cpu_hz_max(void);
>> --
>> 1.9.1
>>
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v2 API-NEXT 0/4] separate ODP_CACHE_LINE_SIZE to arch files

2016-02-03 Thread Hongbo Zhang
Hi all,
Do we need this patch set?
This is for bug https://bugs.linaro.org/show_bug.cgi?id=1881


On 29 January 2016 at 19:22,  <hongbo.zh...@linaro.org> wrote:
> From: Hongbo Zhang <hongbo.zh...@linaro.org>
>
> v1-v2 change:
>
> Add macro __OCTEON for patch 2.
>
> v1 notes:
>
> This is for bug https://bugs.linaro.org/show_bug.cgi?id=1881
>
> This is on top of latest api-next branch because the latest
> platform/linux-generic/arch/ directory is needed, so I use "API-NEXT" tag
>
> There should be some check patch warnings for patch 4, because when new
> symlink is added in patch, there will be warnings like the following but
> they should be acceptable:
>
> WARNING: adding a line without newline at end of file
> #89: FILE: platform/linux-generic/arch/arm/odp_cpu_arch.c:1:
> +../linux/odp_cpu_arch.c
>
> CHECK: spaces preferred around that '/' (ctx:VxV)
> #89: FILE: platform/linux-generic/arch/arm/odp_cpu_arch.c:1:
> +../linux/odp_cpu_arch.c
>^
>
> CHECK: spaces preferred around that '/' (ctx:VxV)
> #89: FILE: platform/linux-generic/arch/arm/odp_cpu_arch.c:1:
> +../linux/odp_cpu_arch.c
>
> Hongbo Zhang (4):
>   linux-generic: separate x86 ODP_CACHE_LINE_SIZE to its arch file
>   linux-generic: separate MIPS ODP_CACHE_LINE_SIZE to its arch file
>   linux-generic: separate PowerPC ODP_CACHE_LINE_SIZE to its arch file
>   linux-generic: create ARM files and move ARM ODP_CACHE_LINE_SIZE in it
>
>  configure.ac   |  1 +
>  platform/linux-generic/Makefile.am |  2 ++
>  platform/linux-generic/arch/arm/odp/cpu_arch.h | 24 +
>  platform/linux-generic/arch/arm/odp_cpu_arch.c |  1 +
>  .../linux-generic/arch/arm/odp_sysinfo_parse.c |  1 +
>  platform/linux-generic/arch/mips64/odp/cpu_arch.h  |  2 ++
>  platform/linux-generic/arch/powerpc/odp/cpu_arch.h | 25 
> +-
>  platform/linux-generic/arch/x86/odp/cpu_arch.h |  2 ++
>  platform/linux-generic/include/odp/align.h | 20 -
>  .../linux-generic/include/odp_align_internal.h |  1 +
>  10 files changed, 58 insertions(+), 21 deletions(-)
>  create mode 100644 platform/linux-generic/arch/arm/odp/cpu_arch.h
>  create mode 12 platform/linux-generic/arch/arm/odp_cpu_arch.c
>  create mode 12 platform/linux-generic/arch/arm/odp_sysinfo_parse.c
>  mode change 12 => 100644 
> platform/linux-generic/arch/powerpc/odp/cpu_arch.h
>
> --
> 2.1.4
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] test/validation/system/system_main fails on arm64

2016-02-03 Thread Hongbo Zhang
OK.
Will follow Petri's suggestion.
But will send patch out my next morning, I don't have a Linux PC at
home right now.

Thank you all.

On 3 February 2016 at 19:31, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
> On 02/03/2016 14:23, Savolainen, Petri (Nokia - FI/Espoo) wrote:
>>
>> I still think that the test should pass with a warning when hz == 0, and
>> otherwise check that hz inside some sane range. If / when all platforms can
>> return a valid (non-zero) value, we can update the test to fail on hz == 0.
>> Today, the main thing is to call the function at least once (and get v1.7
>> out).
>>
>> -Petri
>
>
> +1 for that.
>
> Maxim.
>
>>
>>
>>> -Original Message-
>>> From: EXT Maxim Uvarov [mailto:maxim.uva...@linaro.org]
>>> Sent: Wednesday, February 03, 2016 1:15 PM
>>> To: Hongbo Zhang; Savolainen, Petri (Nokia - FI/Espoo)
>>> Cc: lng-odp-forward
>>> Subject: Re: [lng-odp] test/validation/system/system_main fails on arm64
>>>
>>> On 02/03/2016 13:16, Hongbo Zhang wrote:
>>>>
>>>> I mean, use ODP_TEST_INFO_INACTIVE currently, and when everything
>>>> becomes ready, we will come back to use ODP_TEST_INFO again.
>>>>
>>>> On 3 February 2016 at 17:56, Hongbo Zhang <hongbo.zh...@linaro.org>
>>>
>>> wrote:
>>>>>
>>>>> I prefer ODP_TEST_INFO_INACTIVE at this stage, agree?
>>>
>>> I don't agree. Acceptance criteria for master branch is code coverage by
>>> validation test. By using ODP_TEST_INACTIVE you disable test execution
>>> at all.
>>>
>>> Maxim.
>>>
>>>>> And after 1.7, there still be something to be updated, for example,
>>>>> ARM max freq is still using dummy data, and I still think the
>>>>> /sys/devices/system/cpu/ should be the first place for getting cpu
>>>>> freq, it is a common way of cpu freq, from here we can get both max
>>>>> and current freq, if it ins't enabled, then let's go to each arch's
>>>>> parsing of /proc/cpuinfo.
>>>>>
>>>>>
>>>>>
>>>>> On 3 February 2016 at 17:51, Hongbo Zhang <hongbo.zh...@linaro.org>
>>>
>>> wrote:
>>>>>>
>>>>>> On 3 February 2016 at 17:27, Savolainen, Petri (Nokia - FI/Espoo)
>>>>>> <petri.savolai...@nokia.com> wrote:
>>>>>>>
>>>>>>> The test should look like this. Zero is acceptable, otherwise hz
>>>
>>> value should be in a sane range.
>>>>>>>
>>>>>>> void system_test_odp_cpu_hz(void)
>>>>>>> {
>>>>>>>   uint64_t hz;
>>>>>>>
>>>>>>>   hz = odp_cpu_hz();
>>>>>>>
>>>>>>>   if (hz == 0)
>>>>>>>   print warning ("cpu_hz not supported or other failure") and
>>>
>>> return (with skipped status?)
>>>>>>
>>>>>> not so accurate I think.
>>>>>> if not supported, it is ok to skip,
>>>>>> but if it is a real failure, it should report failure of course
>>>>>> here we mix the two different cases.
>>>>>>
>>>>>>>   /* Test value sanity: less than 10GHz */
>>>>>>>   CU_ASSERT(hz < 10GHz);
>>>>>>>
>>>>>>>   /* larger than 1kHz */
>>>>>>>   CU_ASSERT(hz > 1kHz);
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> -Petri
>>>>>>>
>>>>>>>
>>>>>>> From: EXT Maxim Uvarov [mailto:maxim.uva...@linaro.org]
>>>>>>> Sent: Wednesday, February 03, 2016 11:16 AM
>>>>>>> To: Hongbo Zhang
>>>>>>> Cc: Savolainen, Petri (Nokia - FI/Espoo); lng-odp-forward
>>>>>>> Subject: Re: [lng-odp] test/validation/system/system_main fails on
>>>
>>> arm64
>>>>>>>
>>>>>>> but here :
>>>>>>> void system_test_odp_cpu_hz(void)
>>>>>>> {
>>>>>>>   uint64_t hz;
>>>>>>>
>>>>>>>   hz = odp_cpu_hz();
>>>>>>>   CU_ASSERT(0 < hz);
>>>>>>> }
>>>>>>

Re: [lng-odp] test/validation/system/system_main fails on arm64

2016-02-02 Thread Hongbo Zhang
Sorry, please forget my previous reply.

I checked again, system_test_odp_cpu_hz and system_test_odp_cpu_hz_id
failed, while system_test_odp_cpu_hz_max and
system_test_odp_cpu_hz_max_id passed.

As I've mentioned before in some cover letter, this fail can be
expected because on arm, mips and power, the "current freq" isn't
implemented, only the "max freq" is implemented now, so there are such
failures.

On x86, there is no "current freq" failures because it is implemented.

On 2 February 2016 at 16:14, Hongbo Zhang <hongbo.zh...@linaro.org> wrote:
> On 1 February 2016 at 21:20, Mike Holmes <mike.hol...@linaro.org> wrote:
>> system_test_odp_cpu_hz_id
>> ./../../platform/linux-generic/odp_cpumask_task.c:44:odp_cpumask_default_worker():
>> CPU0 will be used for both control and worker threads,
>> this will likely have a performance impact on the worker thread.
>> FAILED
>>
>> http://snapshots.linaro.org/components/lng/odp/odp-api-check/api-next/docker-utopic-arm64/559/log/system_main.log
>>
>> My first guess is Hongbo's changes to the system info, but maybe a quick
>> bisect is needed
>>
> I checked the log but got this:
>
> Test: system_test_odp_cpu_hz_max ...passed
>   Test: system_test_odp_cpu_hz_max_id
> ./../../platform/linux-generic/odp_cpumask_task.c:44:odp_cpumask_default_worker():
> CPU0 will be used for both control and worker threads,
> this will likely have a performance impact on the worker thread.
> passed
>
> There is a "passed" at the end.
>
> Will check further.
>>
>> On 1 February 2016 at 08:13, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
>>>
>>> Subj.
>>>
>>> Does somebody already look at this?
>>>
>>> Thanks,
>>> Maxim.
>>>
>>>  Forwarded Message 
>>> Subject:[lng-ci] Build failed in Jenkins: ODP API check »
>>> arm64,api-next,docker-utopic-arm64 #559
>>> Date:   Mon, 1 Feb 2016 01:28:23 + (UTC)
>>> From:   ci_not...@linaro.org
>>> To: lng...@lists.linaro.org
>>>
>>>
>>>
>>> See
>>> <https://ci.linaro.org/jenkins/job/odp-api-check/ARCH=arm64,GIT_BRANCH=api-next,label=docker-utopic-arm64/559/>
>>>
>>> --
>>> [...truncated 3602 lines...]
>>> make  check-TESTS
>>> make[3]: Entering directory
>>> '<https://ci.linaro.org/jenkins/job/odp-api-check/ARCH=arm64,GIT_BRANCH=api-next,label=docker-utopic-arm64/ws/check-odp/build/odp/testdir/test/miscellaneous'>
>>> make[4]: Entering directory
>>> '<https://ci.linaro.org/jenkins/job/odp-api-check/ARCH=arm64,GIT_BRANCH=api-next,label=docker-utopic-arm64/ws/check-odp/build/odp/testdir/test/miscellaneous'>
>>> make[5]: Entering directory
>>> '<https://ci.linaro.org/jenkins/job/odp-api-check/ARCH=arm64,GIT_BRANCH=api-next,label=docker-utopic-arm64/ws/check-odp/build/odp/testdir/test/miscellaneous'>
>>> make[5]: Nothing to be done for 'all'.
>>> make[5]: Leaving directory
>>> '<https://ci.linaro.org/jenkins/job/odp-api-check/ARCH=arm64,GIT_BRANCH=api-next,label=docker-utopic-arm64/ws/check-odp/build/odp/testdir/test/miscellaneous'>
>>>
>>> 
>>> Testsuite summary for OpenDataPlane 1.6.0.0.git383.g06be077
>>>
>>> 
>>> # TOTAL: 0
>>> # PASS:  0
>>> # SKIP:  0
>>> # XFAIL: 0
>>> # FAIL:  0
>>> # XPASS: 0
>>> # ERROR: 0
>>>
>>> 
>>> make[4]: Leaving directory
>>> '<https://ci.linaro.org/jenkins/job/odp-api-check/ARCH=arm64,GIT_BRANCH=api-next,label=docker-utopic-arm64/ws/check-odp/build/odp/testdir/test/miscellaneous'>
>>> make[3]: Leaving directory
>>> '<https://ci.linaro.org/jenkins/job/odp-api-check/ARCH=arm64,GIT_BRANCH=api-next,label=docker-utopic-arm64/ws/check-odp/build/odp/testdir/test/miscellaneous'>
>>> make[2]: Leaving directory
>>> '<https://ci.linaro.org/jenkins/job/odp-api-check/ARCH=arm64,GIT_BRANCH=api-next,label=docker-utopic-arm64/ws/check-odp/build/odp/testdir/test/miscellaneous'>
>>> Making check in validation
>>> make[2]: Entering directory
>>> '<https://ci.linaro.org/jenkins/job/odp-api-check/ARCH=arm64,GIT_BRANCH=api-next,label=docker-utopic-arm64/ws/check-odp/build/odp/testdir/test/validation'>
>>> Making check 

Re: [lng-odp] test/validation/system/system_main fails on arm64

2016-02-02 Thread Hongbo Zhang
On 1 February 2016 at 21:20, Mike Holmes  wrote:
> system_test_odp_cpu_hz_id
> ./../../platform/linux-generic/odp_cpumask_task.c:44:odp_cpumask_default_worker():
> CPU0 will be used for both control and worker threads,
> this will likely have a performance impact on the worker thread.
> FAILED
>
> http://snapshots.linaro.org/components/lng/odp/odp-api-check/api-next/docker-utopic-arm64/559/log/system_main.log
>
> My first guess is Hongbo's changes to the system info, but maybe a quick
> bisect is needed
>
I checked the log but got this:

Test: system_test_odp_cpu_hz_max ...passed
  Test: system_test_odp_cpu_hz_max_id
./../../platform/linux-generic/odp_cpumask_task.c:44:odp_cpumask_default_worker():
CPU0 will be used for both control and worker threads,
this will likely have a performance impact on the worker thread.
passed

There is a "passed" at the end.

Will check further.
>
> On 1 February 2016 at 08:13, Maxim Uvarov  wrote:
>>
>> Subj.
>>
>> Does somebody already look at this?
>>
>> Thanks,
>> Maxim.
>>
>>  Forwarded Message 
>> Subject:[lng-ci] Build failed in Jenkins: ODP API check »
>> arm64,api-next,docker-utopic-arm64 #559
>> Date:   Mon, 1 Feb 2016 01:28:23 + (UTC)
>> From:   ci_not...@linaro.org
>> To: lng...@lists.linaro.org
>>
>>
>>
>> See
>> 
>>
>> --
>> [...truncated 3602 lines...]
>> make  check-TESTS
>> make[3]: Entering directory
>> '
>> make[4]: Entering directory
>> '
>> make[5]: Entering directory
>> '
>> make[5]: Nothing to be done for 'all'.
>> make[5]: Leaving directory
>> '
>>
>> 
>> Testsuite summary for OpenDataPlane 1.6.0.0.git383.g06be077
>>
>> 
>> # TOTAL: 0
>> # PASS:  0
>> # SKIP:  0
>> # XFAIL: 0
>> # FAIL:  0
>> # XPASS: 0
>> # ERROR: 0
>>
>> 
>> make[4]: Leaving directory
>> '
>> make[3]: Leaving directory
>> '
>> make[2]: Leaving directory
>> '
>> Making check in validation
>> make[2]: Entering directory
>> '
>> Making check in common
>> make[3]: Entering directory
>> '
>> make[3]: Nothing to be done for 'check'.
>> make[3]: Leaving directory
>> '
>> Making check in atomic
>> make[3]: Entering directory
>> '
>> make[3]: Nothing to be done for 'check'.
>> make[3]: Leaving directory
>> '
>> Making check in barrier
>> make[3]: Entering directory
>> '
>> make[3]: Nothing to be done for 'check'.
>> make[3]: Leaving directory
>> '
>> 

Re: [lng-odp] test/validation/system/system_main fails on arm64

2016-02-02 Thread Hongbo Zhang
No, not fixed.

One reason is there isn't such info in /proc/cpuinfo for ARM, another
reason is there isn't any user calling "current freq" interfaces.

This "current freq" api was introduced because we have "max freq" api,
so "current freq" can be a complement, what's more in the original
codes, "max freq" and "current freq" were mixed, I just made them
clear.

If we don't want to see any failure in validation. one suggestion is
to delete the |current freq" validation codes, another suggestion it
to delete the "current freq" interfaces.

On 2 February 2016 at 18:35, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
> Hongbo, you fixed that in the latest patch set right?
>
> Maxim.
>
>
> On 02/02/2016 11:28, Hongbo Zhang wrote:
>>
>> Sorry, please forget my previous reply.
>>
>> I checked again, system_test_odp_cpu_hz and system_test_odp_cpu_hz_id
>> failed, while system_test_odp_cpu_hz_max and
>> system_test_odp_cpu_hz_max_id passed.
>>
>> As I've mentioned before in some cover letter, this fail can be
>> expected because on arm, mips and power, the "current freq" isn't
>> implemented, only the "max freq" is implemented now, so there are such
>> failures.
>>
>> On x86, there is no "current freq" failures because it is implemented.
>>
>> On 2 February 2016 at 16:14, Hongbo Zhang <hongbo.zh...@linaro.org> wrote:
>>>
>>> On 1 February 2016 at 21:20, Mike Holmes <mike.hol...@linaro.org> wrote:
>>>>
>>>> system_test_odp_cpu_hz_id
>>>>
>>>> ./../../platform/linux-generic/odp_cpumask_task.c:44:odp_cpumask_default_worker():
>>>> CPU0 will be used for both control and worker threads,
>>>> this will likely have a performance impact on the worker thread.
>>>> FAILED
>>>>
>>>>
>>>> http://snapshots.linaro.org/components/lng/odp/odp-api-check/api-next/docker-utopic-arm64/559/log/system_main.log
>>>>
>>>> My first guess is Hongbo's changes to the system info, but maybe a quick
>>>> bisect is needed
>>>>
>>> I checked the log but got this:
>>>
>>> Test: system_test_odp_cpu_hz_max ...passed
>>>Test: system_test_odp_cpu_hz_max_id
>>>
>>> ./../../platform/linux-generic/odp_cpumask_task.c:44:odp_cpumask_default_worker():
>>> CPU0 will be used for both control and worker threads,
>>> this will likely have a performance impact on the worker thread.
>>> passed
>>>
>>> There is a "passed" at the end.
>>>
>>> Will check further.
>>>>
>>>> On 1 February 2016 at 08:13, Maxim Uvarov <maxim.uva...@linaro.org>
>>>> wrote:
>>>>>
>>>>> Subj.
>>>>>
>>>>> Does somebody already look at this?
>>>>>
>>>>> Thanks,
>>>>> Maxim.
>>>>>
>>>>>  Forwarded Message 
>>>>> Subject:[lng-ci] Build failed in Jenkins: ODP API check »
>>>>> arm64,api-next,docker-utopic-arm64 #559
>>>>> Date:   Mon, 1 Feb 2016 01:28:23 + (UTC)
>>>>> From:   ci_not...@linaro.org
>>>>> To: lng...@lists.linaro.org
>>>>>
>>>>>
>>>>>
>>>>> See
>>>>>
>>>>> <https://ci.linaro.org/jenkins/job/odp-api-check/ARCH=arm64,GIT_BRANCH=api-next,label=docker-utopic-arm64/559/>
>>>>>
>>>>> --
>>>>> [...truncated 3602 lines...]
>>>>> make  check-TESTS
>>>>> make[3]: Entering directory
>>>>>
>>>>> '<https://ci.linaro.org/jenkins/job/odp-api-check/ARCH=arm64,GIT_BRANCH=api-next,label=docker-utopic-arm64/ws/check-odp/build/odp/testdir/test/miscellaneous'>
>>>>> make[4]: Entering directory
>>>>>
>>>>> '<https://ci.linaro.org/jenkins/job/odp-api-check/ARCH=arm64,GIT_BRANCH=api-next,label=docker-utopic-arm64/ws/check-odp/build/odp/testdir/test/miscellaneous'>
>>>>> make[5]: Entering directory
>>>>>
>>>>> '<https://ci.linaro.org/jenkins/job/odp-api-check/ARCH=arm64,GIT_BRANCH=api-next,label=docker-utopic-arm64/ws/check-odp/build/odp/testdir/test/miscellaneous'>
>>>>> make[5]: Nothing to be done for 'all'.
>>>>> make[5]: Leaving directory
>>>>>
>>>>> '<https://ci.linaro.org

Re: [lng-odp] [PATCH API-NEXT 0/4] linux-generic sysinfo codes clean-ups

2016-02-02 Thread Hongbo Zhang
On 3 February 2016 at 06:03, Bill Fischofer <bill.fischo...@linaro.org> wrote:
> Part 4 of this patch does not apply to api-next for me:
>

This patch set is on top of my previous 4 patches:
"separate ODP_CACHE_LINE_SIZE to arch files"

After applying that, this patch set should apply.

> bill@Ubuntu15:~/linaro/hongbo$ git am --reject ~/Mail/Incoming/Hongbo/4
> Applying: linux-generic: sysinfo clean up for ARM
> Checking patch platform/linux-generic/arch/arm/odp_sysinfo_parse.c...
> error: platform/linux-generic/arch/arm/odp_sysinfo_parse.c: does not exist
> in index
> Checking patch platform/linux-generic/arch/arm/odp_sysinfo_parse.c...
> Checking patch platform/linux-generic/arch/linux/odp_sysinfo_parse.c...
> Applied patch platform/linux-generic/arch/arm/odp_sysinfo_parse.c cleanly.
> Applied patch platform/linux-generic/arch/linux/odp_sysinfo_parse.c cleanly.
> Patch failed at 0001 linux-generic: sysinfo clean up for ARM
> The copy of the patch that failed is found in:
>/home/bill/linaro/hongbo/.git/rebase-apply/patch
> When you have resolved this problem, run "git am --continue".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --abort".
>
>
> On Tue, Feb 2, 2016 at 4:32 AM, Maxim Uvarov <maxim.uva...@linaro.org>
> wrote:
>>
>> Ping.
>>
>> This fixes have to be in 1.7.
>>
>> Trivial, but please one more review.
>>
>> Maxim.
>>
>> On 01/29/2016 14:30, hongbo.zh...@linaro.org wrote:
>>>
>>> From: Hongbo Zhang <hongbo.zh...@linaro.org>
>>>
>>> This patch set does some architecture clean-ups for linux-generic
>>> sysinfo codes.
>>>
>>> This patch set is based on my previous patch set
>>> "separate ODP_CACHE_LINE_SIZE to arch files", so "API-NEXT" is uesed
>>> although no API is touched.
>>>
>>> Hongbo Zhang (4):
>>>linux-generic: move CPU info dummy data to generic default file
>>>linux-generic: systemcpu(): use input parameter instead of global data
>>>linux-generic: use one uniform call systemcpu()
>>>linux-generic: sysinfo clean up for ARM
>>>
>>>   .../linux-generic/arch/arm/odp_sysinfo_parse.c | 29 -
>>>   .../linux-generic/arch/linux/odp_sysinfo_parse.c   | 12 +-
>>>   platform/linux-generic/odp_system_info.c   | 47
>>> +-
>>>   3 files changed, 47 insertions(+), 41 deletions(-)
>>>   mode change 12 => 100644
>>> platform/linux-generic/arch/arm/odp_sysinfo_parse.c
>>>
>>
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH API-NEXT 2/4] linux-generic: separate MIPS ODP_CACHE_LINE_SIZE to its arch file

2016-01-29 Thread Hongbo Zhang
On 29 January 2016 at 17:10, Savolainen, Petri (Nokia - FI/Espoo)
<petri.savolai...@nokia.com> wrote:
>
>
>> -Original Message-
>> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
>> hongbo.zh...@linaro.org
>> Sent: Friday, January 29, 2016 10:50 AM
>> To: lng-odp@lists.linaro.org
>> Subject: [lng-odp] [PATCH API-NEXT 2/4] linux-generic: separate MIPS
>> ODP_CACHE_LINE_SIZE to its arch file
>>
>> From: Hongbo Zhang <hongbo.zh...@linaro.org>
>>
>> Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
>> held in one header file, they should be moved to their own arch file.
>> This patch moves ODP_CACHE_LINE_SIZE for MIPS.
>>
>> Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
>> ---
>>  platform/linux-generic/arch/mips64/odp/cpu_arch.h | 2 ++
>>  platform/linux-generic/include/odp/align.h| 4 
>>  2 files changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/platform/linux-generic/arch/mips64/odp/cpu_arch.h
>> b/platform/linux-generic/arch/mips64/odp/cpu_arch.h
>> index 3bfa0dc..3e4a1ed 100644
>> --- a/platform/linux-generic/arch/mips64/odp/cpu_arch.h
>> +++ b/platform/linux-generic/arch/mips64/odp/cpu_arch.h
>> @@ -11,6 +11,8 @@
>>  extern "C" {
>>  #endif
>>
>> +#define ODP_CACHE_LINE_SIZE 128
>
>
> This is actually specific to octeon. MIPS spec allow extensions and Octeon 
> does that. MIPS64 arch file could have MIPS defaults and then use #ifdef 
> __OCTEON__ to override those which are Octeon specific. Maybe Cavium guys 
> could help and check these arch definitions.
>
Then in the arch/mips64/odp/cpu_arch.h

we do like this:

#if defined __OCTEON__
#define ODP_CACHE_LINE_SIZE 128
#endif

This should be OK?

>
> -Petri
>
>
>
>> +
>>  static inline void odp_cpu_pause(void)
>>  {
>>   __asm__ __volatile__ ("nop");
>> diff --git a/platform/linux-generic/include/odp/align.h b/platform/linux-
>> generic/include/odp/align.h
>> index 4e045c6..6aba925 100644
>> --- a/platform/linux-generic/include/odp/align.h
>> +++ b/platform/linux-generic/include/odp/align.h
>> @@ -35,10 +35,6 @@ extern "C" {
>>
>>  #define ODP_CACHE_LINE_SIZE 64
>>
>> -#elif defined __OCTEON__
>> -
>> -#define ODP_CACHE_LINE_SIZE 128
>> -
>>  #elif defined __powerpc__
>>
>>  #define ODP_CACHE_LINE_SIZE 64
>> --
>> 2.1.4
>>
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v2 API-NEXT 2/4] linux-generic: separate MIPS ODP_CACHE_LINE_SIZE to its arch file

2016-01-29 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
held in one header file, they should be moved to their own arch file.
This patch moves ODP_CACHE_LINE_SIZE for MIPS.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/arch/mips64/odp/cpu_arch.h | 2 ++
 platform/linux-generic/include/odp/align.h| 4 
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/platform/linux-generic/arch/mips64/odp/cpu_arch.h 
b/platform/linux-generic/arch/mips64/odp/cpu_arch.h
index 3bfa0dc..3e4a1ed 100644
--- a/platform/linux-generic/arch/mips64/odp/cpu_arch.h
+++ b/platform/linux-generic/arch/mips64/odp/cpu_arch.h
@@ -11,6 +11,8 @@
 extern "C" {
 #endif
 
+#define ODP_CACHE_LINE_SIZE 128
+
 static inline void odp_cpu_pause(void)
 {
__asm__ __volatile__ ("nop");
diff --git a/platform/linux-generic/include/odp/align.h 
b/platform/linux-generic/include/odp/align.h
index 4e045c6..6aba925 100644
--- a/platform/linux-generic/include/odp/align.h
+++ b/platform/linux-generic/include/odp/align.h
@@ -35,10 +35,6 @@ extern "C" {
 
 #define ODP_CACHE_LINE_SIZE 64
 
-#elif defined __OCTEON__
-
-#define ODP_CACHE_LINE_SIZE 128
-
 #elif defined __powerpc__
 
 #define ODP_CACHE_LINE_SIZE 64
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v2 API-NEXT 1/4] linux-generic: separate x86 ODP_CACHE_LINE_SIZE to its arch file

2016-01-29 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
held in one header file, they should be moved to their own arch file.
This patch moves ODP_CACHE_LINE_SIZE for x86.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/arch/x86/odp/cpu_arch.h  | 2 ++
 platform/linux-generic/include/odp/align.h  | 8 +---
 platform/linux-generic/include/odp_align_internal.h | 1 +
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/platform/linux-generic/arch/x86/odp/cpu_arch.h 
b/platform/linux-generic/arch/x86/odp/cpu_arch.h
index 997a954..24903ac 100644
--- a/platform/linux-generic/arch/x86/odp/cpu_arch.h
+++ b/platform/linux-generic/arch/x86/odp/cpu_arch.h
@@ -11,6 +11,8 @@
 extern "C" {
 #endif
 
+#define ODP_CACHE_LINE_SIZE 64
+
 static inline void odp_cpu_pause(void)
 {
 #ifdef __SSE2__
diff --git a/platform/linux-generic/include/odp/align.h 
b/platform/linux-generic/include/odp/align.h
index be8c9ae..4e045c6 100644
--- a/platform/linux-generic/include/odp/align.h
+++ b/platform/linux-generic/include/odp/align.h
@@ -31,11 +31,7 @@ extern "C" {
 
 #define ODP_FIELD_SIZEOF(type, member) sizeof(((type *)0)->member)
 
-#if defined __x86_64__ || defined __i386__
-
-#define ODP_CACHE_LINE_SIZE 64
-
-#elif defined __arm__ || defined __aarch64__
+#if defined __arm__ || defined __aarch64__
 
 #define ODP_CACHE_LINE_SIZE 64
 
@@ -47,8 +43,6 @@ extern "C" {
 
 #define ODP_CACHE_LINE_SIZE 64
 
-#else
-#error GCC target not found
 #endif
 
 #else
diff --git a/platform/linux-generic/include/odp_align_internal.h 
b/platform/linux-generic/include/odp_align_internal.h
index 4ca5ceb..99788e3 100644
--- a/platform/linux-generic/include/odp_align_internal.h
+++ b/platform/linux-generic/include/odp_align_internal.h
@@ -18,6 +18,7 @@ extern "C" {
 #endif
 
 #include 
+#include 
 
 /** @addtogroup odp_compiler_optim
  *  @{
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v2 API-NEXT 0/4] separate ODP_CACHE_LINE_SIZE to arch files

2016-01-29 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

v1-v2 change:

Add macro __OCTEON for patch 2.

v1 notes:

This is for bug https://bugs.linaro.org/show_bug.cgi?id=1881

This is on top of latest api-next branch because the latest
platform/linux-generic/arch/ directory is needed, so I use "API-NEXT" tag

There should be some check patch warnings for patch 4, because when new
symlink is added in patch, there will be warnings like the following but
they should be acceptable:

WARNING: adding a line without newline at end of file
#89: FILE: platform/linux-generic/arch/arm/odp_cpu_arch.c:1:
+../linux/odp_cpu_arch.c

CHECK: spaces preferred around that '/' (ctx:VxV)
#89: FILE: platform/linux-generic/arch/arm/odp_cpu_arch.c:1:
+../linux/odp_cpu_arch.c
   ^

CHECK: spaces preferred around that '/' (ctx:VxV)
#89: FILE: platform/linux-generic/arch/arm/odp_cpu_arch.c:1:
+../linux/odp_cpu_arch.c

Hongbo Zhang (4):
  linux-generic: separate x86 ODP_CACHE_LINE_SIZE to its arch file
  linux-generic: separate MIPS ODP_CACHE_LINE_SIZE to its arch file
  linux-generic: separate PowerPC ODP_CACHE_LINE_SIZE to its arch file
  linux-generic: create ARM files and move ARM ODP_CACHE_LINE_SIZE in it

 configure.ac   |  1 +
 platform/linux-generic/Makefile.am |  2 ++
 platform/linux-generic/arch/arm/odp/cpu_arch.h | 24 +
 platform/linux-generic/arch/arm/odp_cpu_arch.c |  1 +
 .../linux-generic/arch/arm/odp_sysinfo_parse.c |  1 +
 platform/linux-generic/arch/mips64/odp/cpu_arch.h  |  2 ++
 platform/linux-generic/arch/powerpc/odp/cpu_arch.h | 25 +-
 platform/linux-generic/arch/x86/odp/cpu_arch.h |  2 ++
 platform/linux-generic/include/odp/align.h | 20 -
 .../linux-generic/include/odp_align_internal.h |  1 +
 10 files changed, 58 insertions(+), 21 deletions(-)
 create mode 100644 platform/linux-generic/arch/arm/odp/cpu_arch.h
 create mode 12 platform/linux-generic/arch/arm/odp_cpu_arch.c
 create mode 12 platform/linux-generic/arch/arm/odp_sysinfo_parse.c
 mode change 12 => 100644 platform/linux-generic/arch/powerpc/odp/cpu_arch.h

-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH API-NEXT 4/4] linux-generic: sysinfo clean up for ARM

2016-01-29 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

The arch/arm/odp_sysinfo_parse.c is currently a symlink to
arch/linux/odp_sysinfo_parse.c, but in fact there should be defferences
between them.

A separated real arch/arm/odp_sysinfo_parse.c is created for ARM, and
the model_str is set to a general "ARM", which is much better then the
general defaul "UNKNOWN" although not so accurate in detailed ARM CPU
model string.

ODP_DBG("TODO: true values should be implemented when possible\n") is
added for ARM too, this means when possible true values can be implemented
for ARM, and only ARM odp_cpuinfo_parser() is updated, while the general
defaul odp_cpuinfo_parser() should be leave there unchanged. In other
words the current implementation for ARM is a temporary work around, but
for the generic default dummy data has to be accepted.

ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n;) is
deleted, because this bug describes another thing, eg in previous code,
only cpu_hz_max[0] and model_str[0] were set, the others such as
cpu_hz_max[1...n-1] and model_str[1...n-1] were missing, it isn't related
with the value itself is dummy or not, and this bug was already fixed.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 .../linux-generic/arch/arm/odp_sysinfo_parse.c | 29 +-
 .../linux-generic/arch/linux/odp_sysinfo_parse.c   |  1 -
 2 files changed, 28 insertions(+), 2 deletions(-)
 mode change 12 => 100644 
platform/linux-generic/arch/arm/odp_sysinfo_parse.c

diff --git a/platform/linux-generic/arch/arm/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
deleted file mode 12
index 2f368af..000
--- a/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
+++ /dev/null
@@ -1 +0,0 @@
-../linux/odp_sysinfo_parse.c
\ No newline at end of file
diff --git a/platform/linux-generic/arch/arm/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
new file mode 100644
index 000..b141168
--- /dev/null
+++ b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
@@ -0,0 +1,28 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+#include 
+
+int odp_cpuinfo_parser(FILE *file ODP_UNUSED, odp_system_info_t *sysinfo)
+{
+   int i;
+
+   ODP_DBG("Warning: use dummy values for freq and model string\n");
+   ODP_DBG("TODO: true values should be implemented when possible\n");
+   for (i = 0; i < MAX_CPU_NUMBER; i++) {
+   sysinfo->cpu_hz_max[i] = 14;
+   strcpy(sysinfo->model_str[i], "ARM");
+   }
+
+   return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
+{
+   return 0;
+}
diff --git a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
index 4a22a61..4dcd6d1 100644
--- a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
@@ -13,7 +13,6 @@ int odp_cpuinfo_parser(FILE *file ODP_UNUSED, 
odp_system_info_t *sysinfo)
int i;
 
ODP_DBG("Warning: use dummy values for freq and model string\n");
-   ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n;);
for (i = 0; i < MAX_CPU_NUMBER; i++) {
sysinfo->cpu_hz_max[i] = 14;
strcpy(sysinfo->model_str[i], "UNKNOWN");
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH API-NEXT 3/4] linux-generic: use one uniform call systemcpu()

2016-01-29 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

Currently there are two systemcpu() functions, one is for some specific
platforms and the other is for default dummy, but most of the contents
are same except for sysinfo->cache_line_size: one is true data from
calling systemcpu_cache_line_size() and another is dummy data.
In such a situation we can create another systemcpu_cache_line_size() to
return dummy data for platforms which are lack of it, then only one
function systemcpu() is enough.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/odp_system_info.c | 40 +++-
 1 file changed, 9 insertions(+), 31 deletions(-)

diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 2d202a0..6f9fb6e 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -73,6 +73,15 @@ static int systemcpu_cache_line_size(void)
 
return size;
 }
+
+#else
+/*
+ * Use dummy data if not available from /sys/devices/system/cpu/
+ */
+static int systemcpu_cache_line_size(void)
+{
+   return 64;
+}
 #endif
 
 
@@ -105,9 +114,6 @@ static int huge_page_size(void)
 }
 
 
-#if defined __x86_64__ || defined __i386__ || defined __OCTEON__ || \
-defined __powerpc__
-
 /*
  * Analysis of /sys/devices/system/cpu/ files
  */
@@ -142,34 +148,6 @@ static int systemcpu(odp_system_info_t *sysinfo)
return 0;
 }
 
-#else
-
-/*
- * Use sysconf and dummy values in generic case
- */
-
-
-static int systemcpu(odp_system_info_t *sysinfo)
-{
-   int ret;
-
-   ret = sysconf_cpu_count();
-   if (ret == 0) {
-   ODP_ERR("sysconf_cpu_count failed.\n");
-   return -1;
-   }
-
-   sysinfo->cpu_count = ret;
-
-   sysinfo->huge_page_size = huge_page_size();
-
-   /* Dummy values */
-   sysinfo->cache_line_size = 64;
-
-   return 0;
-}
-
-#endif
 
 /*
  * System info initialisation
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH API-NEXT 2/4] linux-generic: systemcpu(): use input parameter instead of global data

2016-01-29 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

In the systemcpu() function, odp_global_data.system_info.huge_page_size
should be sysinfo->huge_page_size instead, because when systemcpu() is
called, the _global_data.system_info is passed as parameter, we should
operate the parameter instead of the global data directly, what's more,
in function systemcpu(), sysinfo->cpu_count and sysinfo->cache_line_size
are used, we should follow same pattern for sysinfo->huge_page_size.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/odp_system_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index bedbbc8..2d202a0 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -137,7 +137,7 @@ static int systemcpu(odp_system_info_t *sysinfo)
return -1;
}
 
-   odp_global_data.system_info.huge_page_size = huge_page_size();
+   sysinfo->huge_page_size = huge_page_size();
 
return 0;
 }
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH API-NEXT 0/4] linux-generic sysinfo codes clean-ups

2016-01-29 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This patch set does some architecture clean-ups for linux-generic
sysinfo codes.

This patch set is based on my previous patch set
"separate ODP_CACHE_LINE_SIZE to arch files", so "API-NEXT" is uesed
although no API is touched.

Hongbo Zhang (4):
  linux-generic: move CPU info dummy data to generic default file
  linux-generic: systemcpu(): use input parameter instead of global data
  linux-generic: use one uniform call systemcpu()
  linux-generic: sysinfo clean up for ARM

 .../linux-generic/arch/arm/odp_sysinfo_parse.c | 29 -
 .../linux-generic/arch/linux/odp_sysinfo_parse.c   | 12 +-
 platform/linux-generic/odp_system_info.c   | 47 +-
 3 files changed, 47 insertions(+), 41 deletions(-)
 mode change 12 => 100644 
platform/linux-generic/arch/arm/odp_sysinfo_parse.c

-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH API-NEXT 1/4] linux-generic: move CPU info dummy data to generic default file

2016-01-29 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

The dummy data of cpu_hz_max and model_str are used when platform is
unknown or data cannot be acquired, but these variables should be set
in function odp_cpuinfo_parser() instead of the systemcpu() which should
cover only the cpu_count, huge_page_size and cache_line_size.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/arch/linux/odp_sysinfo_parse.c | 13 +++--
 platform/linux-generic/odp_system_info.c  |  9 +
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
index 8ff6f48..4a22a61 100644
--- a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
@@ -5,11 +5,20 @@
  */
 
 #include 
+#include 
 #include 
 
-int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
-  odp_system_info_t *sysinfo ODP_UNUSED)
+int odp_cpuinfo_parser(FILE *file ODP_UNUSED, odp_system_info_t *sysinfo)
 {
+   int i;
+
+   ODP_DBG("Warning: use dummy values for freq and model string\n");
+   ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n;);
+   for (i = 0; i < MAX_CPU_NUMBER; i++) {
+   sysinfo->cpu_hz_max[i] = 14;
+   strcpy(sysinfo->model_str[i], "UNKNOWN");
+   }
+
return 0;
 }
 
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 42aef8a..bedbbc8 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -151,7 +151,7 @@ static int systemcpu(odp_system_info_t *sysinfo)
 
 static int systemcpu(odp_system_info_t *sysinfo)
 {
-   int ret, i;
+   int ret;
 
ret = sysconf_cpu_count();
if (ret == 0) {
@@ -166,13 +166,6 @@ static int systemcpu(odp_system_info_t *sysinfo)
/* Dummy values */
sysinfo->cache_line_size = 64;
 
-   ODP_DBG("Warning: use dummy values for freq and model string\n");
-   ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n;);
-   for (i = 0; i < MAX_CPU_NUMBER; i++) {
-   sysinfo->cpu_hz_max[i] = 14;
-   strcpy(sysinfo->model_str[i], "UNKNOWN");
-   }
-
return 0;
 }
 
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v2 API-NEXT 3/4] linux-generic: separate PowerPC ODP_CACHE_LINE_SIZE to its arch file

2016-01-29 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
held in one header file, they should be moved to their own arch file.
This patch moves ODP_CACHE_LINE_SIZE for PowerPC.
The previous arch/powerpc/odp/cpu_arch.h was a symlink to the generic
arch/linux/odp/cpu_arch.h, but now this PowerPC header file has more
specific content than the generic one, so a real file is created and the
ODP_CACHE_LINE_SIZE is added to it.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/arch/powerpc/odp/cpu_arch.h | 25 +-
 platform/linux-generic/include/odp/align.h |  4 
 2 files changed, 24 insertions(+), 5 deletions(-)
 mode change 12 => 100644 platform/linux-generic/arch/powerpc/odp/cpu_arch.h

diff --git a/platform/linux-generic/arch/powerpc/odp/cpu_arch.h 
b/platform/linux-generic/arch/powerpc/odp/cpu_arch.h
deleted file mode 12
index 0617d7f..000
--- a/platform/linux-generic/arch/powerpc/odp/cpu_arch.h
+++ /dev/null
@@ -1 +0,0 @@
-../../linux/odp/cpu_arch.h
\ No newline at end of file
diff --git a/platform/linux-generic/arch/powerpc/odp/cpu_arch.h 
b/platform/linux-generic/arch/powerpc/odp/cpu_arch.h
new file mode 100644
index 000..e56523f
--- /dev/null
+++ b/platform/linux-generic/arch/powerpc/odp/cpu_arch.h
@@ -0,0 +1,24 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_PLAT_CPU_ARCH_H_
+#define ODP_PLAT_CPU_ARCH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ODP_CACHE_LINE_SIZE 64
+
+static inline void odp_cpu_pause(void)
+{
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/align.h 
b/platform/linux-generic/include/odp/align.h
index 6aba925..75c02ae 100644
--- a/platform/linux-generic/include/odp/align.h
+++ b/platform/linux-generic/include/odp/align.h
@@ -35,10 +35,6 @@ extern "C" {
 
 #define ODP_CACHE_LINE_SIZE 64
 
-#elif defined __powerpc__
-
-#define ODP_CACHE_LINE_SIZE 64
-
 #endif
 
 #else
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v2 API-NEXT 4/4] linux-generic: create ARM files and move ARM ODP_CACHE_LINE_SIZE in it

2016-01-29 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
held in one header file, they should be moved to their own arch file.
And in the legacy codes there was no ARM architecture directory, so this
patch create it, the odp_cpu_arch.c and odp_sysinfo_parse.c are still
symlink to the general default ones under arch/linux/, and a real file
arm/odp/cpu_arch.h is created from the linux/odp/cpu_arch.h, and then the
ODP_CACHE_LINE_SIZE for ARM is moved to this arch specific file.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 configure.ac   |  1 +
 platform/linux-generic/Makefile.am |  2 ++
 platform/linux-generic/arch/arm/odp/cpu_arch.h | 24 ++
 platform/linux-generic/arch/arm/odp_cpu_arch.c |  1 +
 .../linux-generic/arch/arm/odp_sysinfo_parse.c |  1 +
 platform/linux-generic/include/odp/align.h |  6 --
 6 files changed, 29 insertions(+), 6 deletions(-)
 create mode 100644 platform/linux-generic/arch/arm/odp/cpu_arch.h
 create mode 12 platform/linux-generic/arch/arm/odp_cpu_arch.c
 create mode 12 platform/linux-generic/arch/arm/odp_sysinfo_parse.c

diff --git a/configure.ac b/configure.ac
index 14a025e..23f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,6 +54,7 @@ AX_VALGRIND_CHECK
 ##
 AS_CASE([$host],
   [x86*], [ARCH=x86],
+  [arm*], [ARCH=arm],
   [mips64*], [ARCH=mips64],
   [powerpc*], [ARCH=powerpc],
   [ARCH=linux]
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index fded462..435d776 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -167,6 +167,8 @@ __LIB__libodp_la_SOURCES = \
 EXTRA_DIST = \
 arch/linux/odp_cpu_arch.c \
 arch/linux/odp_sysinfo_parse.c \
+arch/arm/odp_cpu_arch.c \
+arch/arm/odp_sysinfo_parse.c \
 arch/mips64/odp_cpu_arch.c \
 arch/mips64/odp_sysinfo_parse.c \
 arch/powerpc/odp_cpu_arch.c \
diff --git a/platform/linux-generic/arch/arm/odp/cpu_arch.h 
b/platform/linux-generic/arch/arm/odp/cpu_arch.h
new file mode 100644
index 000..e56523f
--- /dev/null
+++ b/platform/linux-generic/arch/arm/odp/cpu_arch.h
@@ -0,0 +1,24 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_PLAT_CPU_ARCH_H_
+#define ODP_PLAT_CPU_ARCH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ODP_CACHE_LINE_SIZE 64
+
+static inline void odp_cpu_pause(void)
+{
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/arch/arm/odp_cpu_arch.c 
b/platform/linux-generic/arch/arm/odp_cpu_arch.c
new file mode 12
index 000..c5fe400
--- /dev/null
+++ b/platform/linux-generic/arch/arm/odp_cpu_arch.c
@@ -0,0 +1 @@
+../linux/odp_cpu_arch.c
\ No newline at end of file
diff --git a/platform/linux-generic/arch/arm/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
new file mode 12
index 000..2f368af
--- /dev/null
+++ b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
@@ -0,0 +1 @@
+../linux/odp_sysinfo_parse.c
\ No newline at end of file
diff --git a/platform/linux-generic/include/odp/align.h 
b/platform/linux-generic/include/odp/align.h
index 75c02ae..81ef20f 100644
--- a/platform/linux-generic/include/odp/align.h
+++ b/platform/linux-generic/include/odp/align.h
@@ -31,12 +31,6 @@ extern "C" {
 
 #define ODP_FIELD_SIZEOF(type, member) sizeof(((type *)0)->member)
 
-#if defined __arm__ || defined __aarch64__
-
-#define ODP_CACHE_LINE_SIZE 64
-
-#endif
-
 #else
 #error Non-gcc compatible compiler
 #endif
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH API-NEXT 0/4] separate ODP_CACHE_LINE_SIZE to arch files

2016-01-29 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This is for bug https://bugs.linaro.org/show_bug.cgi?id=1881

This is on top of latest api-next branch because the latest
platform/linux-generic/arch/ directory is needed, so I use "API-NEXT" tag

There should be some check patch warnings for patch 4, because when new
symlink is added in patch, there will be warnings like the following but
they should be acceptable:

WARNING: adding a line without newline at end of file
#89: FILE: platform/linux-generic/arch/arm/odp_cpu_arch.c:1:
+../linux/odp_cpu_arch.c

CHECK: spaces preferred around that '/' (ctx:VxV)
#89: FILE: platform/linux-generic/arch/arm/odp_cpu_arch.c:1:
+../linux/odp_cpu_arch.c
   ^

CHECK: spaces preferred around that '/' (ctx:VxV)
#89: FILE: platform/linux-generic/arch/arm/odp_cpu_arch.c:1:
+../linux/odp_cpu_arch.c


Hongbo Zhang (4):
  linux-generic: separate x86 ODP_CACHE_LINE_SIZE to its arch file
  linux-generic: separate MIPS ODP_CACHE_LINE_SIZE to its arch file
  linux-generic: separate PowerPC ODP_CACHE_LINE_SIZE to its arch file
  linux-generic: create ARM files and move ARM ODP_CACHE_LINE_SIZE in it

 configure.ac   |  1 +
 platform/linux-generic/Makefile.am |  2 ++
 platform/linux-generic/arch/arm/odp/cpu_arch.h | 24 +
 platform/linux-generic/arch/arm/odp_cpu_arch.c |  1 +
 .../linux-generic/arch/arm/odp_sysinfo_parse.c |  1 +
 platform/linux-generic/arch/mips64/odp/cpu_arch.h  |  2 ++
 platform/linux-generic/arch/powerpc/odp/cpu_arch.h | 25 +-
 platform/linux-generic/arch/x86/odp/cpu_arch.h |  2 ++
 platform/linux-generic/include/odp/align.h | 20 -
 .../linux-generic/include/odp_align_internal.h |  1 +
 10 files changed, 58 insertions(+), 21 deletions(-)
 create mode 100644 platform/linux-generic/arch/arm/odp/cpu_arch.h
 create mode 12 platform/linux-generic/arch/arm/odp_cpu_arch.c
 create mode 12 platform/linux-generic/arch/arm/odp_sysinfo_parse.c
 mode change 12 => 100644 platform/linux-generic/arch/powerpc/odp/cpu_arch.h

-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH API-NEXT 4/4] linux-generic: create ARM files and move ARM ODP_CACHE_LINE_SIZE in it

2016-01-29 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
held in one header file, they should be moved to their own arch file.
And in the legacy codes there was no ARM architecture directory, so this
patch create it, the odp_cpu_arch.c and odp_sysinfo_parse.c are still
symlink to the general default ones under arch/linux/, and a real file
arm/odp/cpu_arch.h is created from the linux/odp/cpu_arch.h, and then the
ODP_CACHE_LINE_SIZE for ARM is moved to this arch specific file.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 configure.ac   |  1 +
 platform/linux-generic/Makefile.am |  2 ++
 platform/linux-generic/arch/arm/odp/cpu_arch.h | 24 ++
 platform/linux-generic/arch/arm/odp_cpu_arch.c |  1 +
 .../linux-generic/arch/arm/odp_sysinfo_parse.c |  1 +
 platform/linux-generic/include/odp/align.h |  6 --
 6 files changed, 29 insertions(+), 6 deletions(-)
 create mode 100644 platform/linux-generic/arch/arm/odp/cpu_arch.h
 create mode 12 platform/linux-generic/arch/arm/odp_cpu_arch.c
 create mode 12 platform/linux-generic/arch/arm/odp_sysinfo_parse.c

diff --git a/configure.ac b/configure.ac
index 14a025e..23f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,6 +54,7 @@ AX_VALGRIND_CHECK
 ##
 AS_CASE([$host],
   [x86*], [ARCH=x86],
+  [arm*], [ARCH=arm],
   [mips64*], [ARCH=mips64],
   [powerpc*], [ARCH=powerpc],
   [ARCH=linux]
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index fded462..435d776 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -167,6 +167,8 @@ __LIB__libodp_la_SOURCES = \
 EXTRA_DIST = \
 arch/linux/odp_cpu_arch.c \
 arch/linux/odp_sysinfo_parse.c \
+arch/arm/odp_cpu_arch.c \
+arch/arm/odp_sysinfo_parse.c \
 arch/mips64/odp_cpu_arch.c \
 arch/mips64/odp_sysinfo_parse.c \
 arch/powerpc/odp_cpu_arch.c \
diff --git a/platform/linux-generic/arch/arm/odp/cpu_arch.h 
b/platform/linux-generic/arch/arm/odp/cpu_arch.h
new file mode 100644
index 000..e56523f
--- /dev/null
+++ b/platform/linux-generic/arch/arm/odp/cpu_arch.h
@@ -0,0 +1,24 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_PLAT_CPU_ARCH_H_
+#define ODP_PLAT_CPU_ARCH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ODP_CACHE_LINE_SIZE 64
+
+static inline void odp_cpu_pause(void)
+{
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/arch/arm/odp_cpu_arch.c 
b/platform/linux-generic/arch/arm/odp_cpu_arch.c
new file mode 12
index 000..c5fe400
--- /dev/null
+++ b/platform/linux-generic/arch/arm/odp_cpu_arch.c
@@ -0,0 +1 @@
+../linux/odp_cpu_arch.c
\ No newline at end of file
diff --git a/platform/linux-generic/arch/arm/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
new file mode 12
index 000..2f368af
--- /dev/null
+++ b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
@@ -0,0 +1 @@
+../linux/odp_sysinfo_parse.c
\ No newline at end of file
diff --git a/platform/linux-generic/include/odp/align.h 
b/platform/linux-generic/include/odp/align.h
index 75c02ae..81ef20f 100644
--- a/platform/linux-generic/include/odp/align.h
+++ b/platform/linux-generic/include/odp/align.h
@@ -31,12 +31,6 @@ extern "C" {
 
 #define ODP_FIELD_SIZEOF(type, member) sizeof(((type *)0)->member)
 
-#if defined __arm__ || defined __aarch64__
-
-#define ODP_CACHE_LINE_SIZE 64
-
-#endif
-
 #else
 #error Non-gcc compatible compiler
 #endif
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH API-NEXT 1/4] linux-generic: separate x86 ODP_CACHE_LINE_SIZE to its arch file

2016-01-29 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
held in one header file, they should be moved to their own arch file.
This patch moves ODP_CACHE_LINE_SIZE for x86.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/arch/x86/odp/cpu_arch.h  | 2 ++
 platform/linux-generic/include/odp/align.h  | 8 +---
 platform/linux-generic/include/odp_align_internal.h | 1 +
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/platform/linux-generic/arch/x86/odp/cpu_arch.h 
b/platform/linux-generic/arch/x86/odp/cpu_arch.h
index 997a954..24903ac 100644
--- a/platform/linux-generic/arch/x86/odp/cpu_arch.h
+++ b/platform/linux-generic/arch/x86/odp/cpu_arch.h
@@ -11,6 +11,8 @@
 extern "C" {
 #endif
 
+#define ODP_CACHE_LINE_SIZE 64
+
 static inline void odp_cpu_pause(void)
 {
 #ifdef __SSE2__
diff --git a/platform/linux-generic/include/odp/align.h 
b/platform/linux-generic/include/odp/align.h
index be8c9ae..4e045c6 100644
--- a/platform/linux-generic/include/odp/align.h
+++ b/platform/linux-generic/include/odp/align.h
@@ -31,11 +31,7 @@ extern "C" {
 
 #define ODP_FIELD_SIZEOF(type, member) sizeof(((type *)0)->member)
 
-#if defined __x86_64__ || defined __i386__
-
-#define ODP_CACHE_LINE_SIZE 64
-
-#elif defined __arm__ || defined __aarch64__
+#if defined __arm__ || defined __aarch64__
 
 #define ODP_CACHE_LINE_SIZE 64
 
@@ -47,8 +43,6 @@ extern "C" {
 
 #define ODP_CACHE_LINE_SIZE 64
 
-#else
-#error GCC target not found
 #endif
 
 #else
diff --git a/platform/linux-generic/include/odp_align_internal.h 
b/platform/linux-generic/include/odp_align_internal.h
index 4ca5ceb..99788e3 100644
--- a/platform/linux-generic/include/odp_align_internal.h
+++ b/platform/linux-generic/include/odp_align_internal.h
@@ -18,6 +18,7 @@ extern "C" {
 #endif
 
 #include 
+#include 
 
 /** @addtogroup odp_compiler_optim
  *  @{
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH API-NEXT 2/4] linux-generic: separate MIPS ODP_CACHE_LINE_SIZE to its arch file

2016-01-29 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

Currently all ODP_CACHE_LINE_SIZE macros for different architectures are
held in one header file, they should be moved to their own arch file.
This patch moves ODP_CACHE_LINE_SIZE for MIPS.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/arch/mips64/odp/cpu_arch.h | 2 ++
 platform/linux-generic/include/odp/align.h| 4 
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/platform/linux-generic/arch/mips64/odp/cpu_arch.h 
b/platform/linux-generic/arch/mips64/odp/cpu_arch.h
index 3bfa0dc..3e4a1ed 100644
--- a/platform/linux-generic/arch/mips64/odp/cpu_arch.h
+++ b/platform/linux-generic/arch/mips64/odp/cpu_arch.h
@@ -11,6 +11,8 @@
 extern "C" {
 #endif
 
+#define ODP_CACHE_LINE_SIZE 128
+
 static inline void odp_cpu_pause(void)
 {
__asm__ __volatile__ ("nop");
diff --git a/platform/linux-generic/include/odp/align.h 
b/platform/linux-generic/include/odp/align.h
index 4e045c6..6aba925 100644
--- a/platform/linux-generic/include/odp/align.h
+++ b/platform/linux-generic/include/odp/align.h
@@ -35,10 +35,6 @@ extern "C" {
 
 #define ODP_CACHE_LINE_SIZE 64
 
-#elif defined __OCTEON__
-
-#define ODP_CACHE_LINE_SIZE 128
-
 #elif defined __powerpc__
 
 #define ODP_CACHE_LINE_SIZE 64
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 04/12] linux-generic: sysinfo: move x86 system info codes to its plarform file

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This patch moves the x86 system info codes into the newly added x86
specific platform file.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/Makefile.am |  6 +-
 .../linux-generic/arch/x86/odp_sysinfo_parse.c | 72 ++
 platform/linux-generic/include/odp_internal.h  |  4 ++
 platform/linux-generic/odp_system_info.c   | 68 +---
 4 files changed, 81 insertions(+), 69 deletions(-)
 create mode 100644 platform/linux-generic/arch/x86/odp_sysinfo_parse.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index c1e8ccb..ae32268 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -161,12 +161,14 @@ __LIB__libodp_la_SOURCES = \
   odp_traffic_mngr.c \
   odp_version.c \
   odp_weak.c \
-  arch/@ARCH@/odp_cpu_arch.c
+  arch/@ARCH@/odp_cpu_arch.c \
+  arch/@ARCH@/odp_sysinfo_parse.c
 
 EXTRA_DIST = \
 arch/linux/odp_cpu_arch.c \
 arch/mips64/odp_cpu_arch.c \
-arch/x86/odp_cpu_arch.c
+arch/x86/odp_cpu_arch.c \
+arch/x86/odp_sysinfo_parse.c
 
 if HAVE_PCAP
 __LIB__libodp_la_SOURCES += pktio/pcap.c
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
new file mode 100644
index 000..e2931cb
--- /dev/null
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -0,0 +1,72 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+
+int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
+{
+   char str[1024];
+   char *pos;
+   double ghz = 0.0;
+   uint64_t hz;
+   int id = 0;
+
+   while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
+   pos = strstr(str, "model name");
+   if (pos) {
+   pos = strchr(str, ':');
+   strncpy(sysinfo->model_str[id], pos + 2,
+   sizeof(sysinfo->model_str[id]));
+
+   pos = strchr(sysinfo->model_str[id], '@');
+   *(pos - 1) = '\0';
+   if (sscanf(pos, "@ %lfGHz", ) == 1) {
+   hz = (uint64_t)(ghz * 10.0);
+   sysinfo->cpu_hz[id] = hz;
+   }
+   id++;
+   }
+   }
+
+   return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id)
+{
+   char str[1024];
+   FILE *file;
+   int cpu;
+   char *pos;
+   double mhz = 0.0;
+
+   file = fopen("/proc/cpuinfo", "rt");
+
+   /* find the correct processor instance */
+   while (fgets(str, sizeof(str), file) != NULL) {
+   pos = strstr(str, "processor");
+   if (pos) {
+   if (sscanf(pos, "processor : %d", ) == 1)
+   if (cpu == id)
+   break;
+   }
+   }
+
+   /* extract the cpu current speed */
+   while (fgets(str, sizeof(str), file) != NULL) {
+   pos = strstr(str, "cpu MHz");
+   if (pos) {
+   if (sscanf(pos, "cpu MHz : %lf", ) == 1)
+   break;
+   }
+   }
+
+   fclose(file);
+   if (mhz)
+   return (uint64_t)(mhz * 100.0);
+
+   return -1;
+}
diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index 39e6f78..b527438 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -20,6 +20,7 @@ extern "C" {
 
 #include 
 #include 
+#include 
 
 extern __thread int __odp_errno;
 
@@ -108,6 +109,9 @@ int odp_tm_init_global(void);
 
 void _odp_flush_caches(void);
 
+int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo);
+uint64_t odp_cpu_hz_current(int id);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index fd6b866..fd25067 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -109,71 +109,7 @@ static int huge_page_size(void)
 /*
  * HW specific /proc/cpuinfo file parsing
  */
-#if defined __x86_64__ || defined __i386__
-
-static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
-{
-   char str[1024];
-   char *pos;
-   double ghz = 0.0;
-   int id = 0;
-
-   while (fgets(str, 

[lng-odp] [PATCH v8 API-NEXT 06/12] linux-generic: sysinfo: move ARM system info codes to default arch file

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This patch moves the ARM system info codes into the general arch file,
ARM sysinfo isn't implemented now and there is no need to create specific
arch file for it, but this can serve as the default implementaton instead.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/Makefile.am|  1 +
 platform/linux-generic/arch/linux/odp_sysinfo_parse.c | 19 +++
 platform/linux-generic/odp_system_info.c  | 15 +--
 3 files changed, 21 insertions(+), 14 deletions(-)
 create mode 100644 platform/linux-generic/arch/linux/odp_sysinfo_parse.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index d476ae9..f4bc58e 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -166,6 +166,7 @@ __LIB__libodp_la_SOURCES = \
 
 EXTRA_DIST = \
 arch/linux/odp_cpu_arch.c \
+arch/linux/odp_sysinfo_parse.c \
 arch/mips64/odp_cpu_arch.c \
 arch/mips64/odp_sysinfo_parse.c \
 arch/x86/odp_cpu_arch.c \
diff --git a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
new file mode 100644
index 000..881dd2d
--- /dev/null
+++ b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
@@ -0,0 +1,19 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+
+int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
+  odp_system_info_t *sysinfo ODP_UNUSED)
+{
+   return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
+{
+   return -1;
+}
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 1959434..7d68c2e 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -109,20 +109,7 @@ static int huge_page_size(void)
 /*
  * HW specific /proc/cpuinfo file parsing
  */
-#if defined __arm__ || defined __aarch64__
-
-static int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
- odp_system_info_t *sysinfo ODP_UNUSED)
-{
-   return 0;
-}
-
-static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
-{
-   return -1;
-}
-
-#elif defined __powerpc__
+#if defined __powerpc__
 static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
char str[1024];
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 03/12] linux-generic: sysinfo: rename odp_cpu_hz_current with odp_ prefix

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This function will be moved to their own platform specific files too,
it is better to be named with a odp_ prefix.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/odp_system_info.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 113ae63..fd6b866 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -137,7 +137,7 @@ static int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id)
+static uint64_t odp_cpu_hz_current(int id)
 {
char str[1024];
FILE *file;
@@ -181,7 +181,7 @@ static int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
+static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return -1;
 }
@@ -228,7 +228,7 @@ static int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
+static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return -1;
 }
@@ -274,7 +274,7 @@ static int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
+static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return -1;
 }
@@ -403,12 +403,12 @@ uint64_t odp_cpu_hz(void)
 {
int id = sched_getcpu();
 
-   return arch_cpu_hz_current(id);
+   return odp_cpu_hz_current(id);
 }
 
 uint64_t odp_cpu_hz_id(int id)
 {
-   return arch_cpu_hz_current(id);
+   return odp_cpu_hz_current(id);
 }
 
 uint64_t odp_cpu_hz_max(void)
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 00/12] Separate CPU info codes into their platform files

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

v7->v8 changes:
 - use file name odp_cpu_arch.c in this patch set instead of odp_cpu_cycles.c
since the top api-next tree did this change 

v6->v7 changes:
 - update symlink in patch 7

v5->v6 changes:
 - eliminate checkpatch.pl warnings

v4->v5 changes:
 - rebase to latest api-next branch

v3->v4 changes:
 - update patch 9 of platform naming
 - add new patch 12 to rename cpu_hz to cpu_hz_max

v2->v3 changes:
use "api: cpu:" tag in patch 8/11 title instead of "linux-generic: sysinfo"

v1->v2 changes:
 - don't create arch/arm/ since there isn't implementation now, use arch/linux
as default choice
 - create symlink to arch/linux/odp_cpu_cycles.c for powerpc, if absent this
arch cannot be compiled
 - add some clean-ups patches 8~11, these patches are against the previous ones
so send them together for better review and merge.

v1 notes:
This patch set separates the CPU info codes into their own platform sepcific
files.
It is common sence that the top general layer call an uniform interface to
initialize some plarform specific data structures, and this uniform interface
is implemented in their own platform specific files.
This patch set makes it.

Hongbo Zhang (12):
  linux-generic: sysinfo: move cpu_arch_str to odp_system_info_t
  linux-generic: sysinfo: use uniform call odp_sysinfo_parser
  linux-generic: sysinfo: rename odp_cpu_hz_current with odp_ prefix
  linux-generic: sysinfo: move x86 system info codes to its plarform
file
  linux-generic: sysinfo: move MIPS system info codes to its plarform
file
  linux-generic: sysinfo: move ARM system info codes to default arch
file
  linux-generic: sysinfo: move PowerPC system info codes to its plarform
file
  api: cpu: make frequency API return 0 on failure
  linux-generic: sysinfo: set values for cpu_arch_str
  linux-generic: sysinfo: apply per-CPU implementation to MIPS
  linux-generic: sysinfo: apply per-CPU implementation to PowerPC
  linux-generic: sysinfo: rename variable cpu_hz to cpu_hz_max

 configure.ac   |   1 +
 include/odp/api/cpu.h  |   4 +
 platform/linux-generic/Makefile.am |  10 +-
 .../linux-generic/arch/linux/odp_sysinfo_parse.c   |  19 ++
 .../linux-generic/arch/mips64/odp_sysinfo_parse.c  |  64 ++
 platform/linux-generic/arch/powerpc/odp/cpu_arch.h |   1 +
 platform/linux-generic/arch/powerpc/odp_cpu_arch.c |   1 +
 .../linux-generic/arch/powerpc/odp_sysinfo_parse.c |  63 ++
 .../linux-generic/arch/x86/odp_sysinfo_parse.c |  73 +++
 platform/linux-generic/include/odp_internal.h  |   7 +-
 platform/linux-generic/odp_system_info.c   | 220 +
 11 files changed, 246 insertions(+), 217 deletions(-)
 create mode 100644 platform/linux-generic/arch/linux/odp_sysinfo_parse.c
 create mode 100644 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
 create mode 12 platform/linux-generic/arch/powerpc/odp/cpu_arch.h
 create mode 12 platform/linux-generic/arch/powerpc/odp_cpu_arch.c
 create mode 100644 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
 create mode 100644 platform/linux-generic/arch/x86/odp_sysinfo_parse.c

-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 01/12] linux-generic: sysinfo: move cpu_arch_str to odp_system_info_t

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This is a pre-step for separating platform specific codes into their own
arch files.
Value of cpu_arch_str will be set later in separate arch parser code.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/include/odp_internal.h | 1 +
 platform/linux-generic/odp_system_info.c  | 5 -
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index cdbed7d..39e6f78 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -31,6 +31,7 @@ typedef struct {
uint64_t page_size;
int  cache_line_size;
int  cpu_count;
+   char cpu_arch_str[128];
char model_str[MAX_CPU_NUMBER][128];
 } odp_system_info_t;
 
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index de28fab..2e3726e 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -27,7 +27,6 @@
 
 
 typedef struct {
-   const char *cpu_arch_str;
int (*cpuinfo_parser)(FILE *file, odp_system_info_t *sysinfo);
 
 } odp_compiler_info_t;
@@ -292,19 +291,15 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
 
 static odp_compiler_info_t compiler_info = {
#if defined __x86_64__ || defined __i386__
-   .cpu_arch_str = "x86",
.cpuinfo_parser = cpuinfo_x86
 
#elif defined __arm__ || defined __aarch64__
-   .cpu_arch_str = "arm",
.cpuinfo_parser = cpuinfo_arm
 
#elif defined __OCTEON__
-   .cpu_arch_str = "octeon",
.cpuinfo_parser = cpuinfo_octeon
 
#elif defined __powerpc__
-   .cpu_arch_str = "powerpc",
.cpuinfo_parser = cpuinfo_powerpc
 
#else
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 02/12] linux-generic: sysinfo: use uniform call odp_sysinfo_parser

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

It is common way that the general top layer calls a uniform interface to
initialize data structrure for different plarform, this patch introduces
odp_sysinfo_parser() instead of using different interfaces for each
platform, and also removes using structure odp_compiler_info_t since both
members inside it become useless now.
This is still another pre-step for separating platform specific codes into
their own arch files.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/odp_system_info.c | 36 ++--
 1 file changed, 6 insertions(+), 30 deletions(-)

diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 2e3726e..113ae63 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -25,12 +25,6 @@
 #include 
 
 
-
-typedef struct {
-   int (*cpuinfo_parser)(FILE *file, odp_system_info_t *sysinfo);
-
-} odp_compiler_info_t;
-
 #define CACHE_LNSZ_FILE \
"/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size"
 
@@ -117,7 +111,7 @@ static int huge_page_size(void)
  */
 #if defined __x86_64__ || defined __i386__
 
-static int cpuinfo_x86(FILE *file, odp_system_info_t *sysinfo)
+static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
char str[1024];
char *pos;
@@ -181,8 +175,8 @@ static uint64_t arch_cpu_hz_current(int id)
 
 #elif defined __arm__ || defined __aarch64__
 
-static int cpuinfo_arm(FILE *file ODP_UNUSED,
-odp_system_info_t *sysinfo ODP_UNUSED)
+static int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
+ odp_system_info_t *sysinfo ODP_UNUSED)
 {
return 0;
 }
@@ -194,7 +188,7 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
 
 #elif defined __OCTEON__
 
-static int cpuinfo_octeon(FILE *file, odp_system_info_t *sysinfo)
+static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
char str[1024];
char *pos;
@@ -240,7 +234,7 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
 }
 
 #elif defined __powerpc__
-static int cpuinfo_powerpc(FILE *file, odp_system_info_t *sysinfo)
+static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
char str[1024];
char *pos;
@@ -289,24 +283,6 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
#error GCC target not found
 #endif
 
-static odp_compiler_info_t compiler_info = {
-   #if defined __x86_64__ || defined __i386__
-   .cpuinfo_parser = cpuinfo_x86
-
-   #elif defined __arm__ || defined __aarch64__
-   .cpuinfo_parser = cpuinfo_arm
-
-   #elif defined __OCTEON__
-   .cpuinfo_parser = cpuinfo_octeon
-
-   #elif defined __powerpc__
-   .cpuinfo_parser = cpuinfo_powerpc
-
-   #else
-   #error GCC target not found
-   #endif
-};
-
 
 #if defined __x86_64__ || defined __i386__ || defined __OCTEON__ || \
 defined __powerpc__
@@ -398,7 +374,7 @@ int odp_system_info_init(void)
return -1;
}
 
-   compiler_info.cpuinfo_parser(file, _global_data.system_info);
+   odp_cpuinfo_parser(file, _global_data.system_info);
 
fclose(file);
 
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 12/12] linux-generic: sysinfo: rename variable cpu_hz to cpu_hz_max

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

The legacy variable cpu_hz holds the max frequency for odp_cpu_hz_max(),
so rename it to cpu_hz_max for better meaning.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c  | 2 +-
 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c | 2 +-
 platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 2 +-
 platform/linux-generic/include/odp_internal.h   | 2 +-
 platform/linux-generic/odp_system_info.c| 4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index 64d65d2..53074f7 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -26,7 +26,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
if (sscanf(pos, "BogoMIPS : %lf", ) == 1) {
/* bogomips seems to be 2x freq */
hz = (uint64_t)(mhz * 100.0 / 2.0);
-   sysinfo->cpu_hz[id] = hz;
+   sysinfo->cpu_hz_max[id] = hz;
count--;
}
}
diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index 62c3ae3..99457ce 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -25,7 +25,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
if (pos)
if (sscanf(pos, "clock : %lf", ) == 1) {
hz = (uint64_t)(mhz * 100.0);
-   sysinfo->cpu_hz[id] = hz;
+   sysinfo->cpu_hz_max[id] = hz;
count--;
}
}
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
index d2b3c80..816629d 100644
--- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -27,7 +27,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
*(pos - 1) = '\0';
if (sscanf(pos, "@ %lfGHz", ) == 1) {
hz = (uint64_t)(ghz * 10.0);
-   sysinfo->cpu_hz[id] = hz;
+   sysinfo->cpu_hz_max[id] = hz;
}
id++;
}
diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index b527438..aac2ba9 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -27,7 +27,7 @@ extern __thread int __odp_errno;
 #define MAX_CPU_NUMBER 128
 
 typedef struct {
-   uint64_t cpu_hz[MAX_CPU_NUMBER];
+   uint64_t cpu_hz_max[MAX_CPU_NUMBER];
uint64_t huge_page_size;
uint64_t page_size;
int  cache_line_size;
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 727053a..42aef8a 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -169,7 +169,7 @@ static int systemcpu(odp_system_info_t *sysinfo)
ODP_DBG("Warning: use dummy values for freq and model string\n");
ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n;);
for (i = 0; i < MAX_CPU_NUMBER; i++) {
-   sysinfo->cpu_hz[i] = 14;
+   sysinfo->cpu_hz_max[i] = 14;
strcpy(sysinfo->model_str[i], "UNKNOWN");
}
 
@@ -240,7 +240,7 @@ uint64_t odp_cpu_hz_max(void)
 uint64_t odp_cpu_hz_max_id(int id)
 {
if (id >= 0 && id < MAX_CPU_NUMBER)
-   return odp_global_data.system_info.cpu_hz[id];
+   return odp_global_data.system_info.cpu_hz_max[id];
else
return 0;
 }
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 09/12] linux-generic: sysinfo: set values for cpu_arch_str

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

The values of cpu_arch_str were deleted due to codes reorganization, this
patch adds values to them again.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c  | 1 +
 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c | 1 +
 platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index b6e0e2c..dcecbb9 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -15,6 +15,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
int model = 0;
int count = 2;
 
+   strcpy(sysinfo->cpu_arch_str, "mips64");
while (fgets(str, sizeof(str), file) != NULL && count > 0) {
if (!mhz) {
pos = strstr(str, "BogoMIPS");
diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index 83d88ca..1ed95ad 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -15,6 +15,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
int model = 0;
int count = 2;
 
+   strcpy(sysinfo->cpu_arch_str, "powerpc");
while (fgets(str, sizeof(str), file) != NULL && count > 0) {
if (!mhz) {
pos = strstr(str, "clock");
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
index 831a53a..d2b3c80 100644
--- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -15,6 +15,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
uint64_t hz;
int id = 0;
 
+   strcpy(sysinfo->cpu_arch_str, "x86");
while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
pos = strstr(str, "model name");
if (pos) {
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 07/12] linux-generic: sysinfo: move PowerPC system info codes to its plarform file

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This patch moves the PowerPC system info codes into the newly added PowerPC
specific platform file.
This patch also creates syslink to arch/linux/odp_cpu_cycles.c for PowerPC.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 configure.ac   |  1 +
 platform/linux-generic/Makefile.am |  2 +
 platform/linux-generic/arch/powerpc/odp/cpu_arch.h |  1 +
 platform/linux-generic/arch/powerpc/odp_cpu_arch.c |  1 +
 .../linux-generic/arch/powerpc/odp_sysinfo_parse.c | 52 +
 platform/linux-generic/odp_system_info.c   | 53 --
 6 files changed, 57 insertions(+), 53 deletions(-)
 create mode 12 platform/linux-generic/arch/powerpc/odp/cpu_arch.h
 create mode 12 platform/linux-generic/arch/powerpc/odp_cpu_arch.c
 create mode 100644 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c

diff --git a/configure.ac b/configure.ac
index fbe7c08..14a025e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,6 +55,7 @@ AX_VALGRIND_CHECK
 AS_CASE([$host],
   [x86*], [ARCH=x86],
   [mips64*], [ARCH=mips64],
+  [powerpc*], [ARCH=powerpc],
   [ARCH=linux]
 )
 AC_SUBST([ARCH])
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index f4bc58e..fded462 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -169,6 +169,8 @@ EXTRA_DIST = \
 arch/linux/odp_sysinfo_parse.c \
 arch/mips64/odp_cpu_arch.c \
 arch/mips64/odp_sysinfo_parse.c \
+arch/powerpc/odp_cpu_arch.c \
+arch/powerpc/odp_sysinfo_parse.c \
 arch/x86/odp_cpu_arch.c \
 arch/x86/odp_sysinfo_parse.c
 
diff --git a/platform/linux-generic/arch/powerpc/odp/cpu_arch.h 
b/platform/linux-generic/arch/powerpc/odp/cpu_arch.h
new file mode 12
index 000..0617d7f
--- /dev/null
+++ b/platform/linux-generic/arch/powerpc/odp/cpu_arch.h
@@ -0,0 +1 @@
+../../linux/odp/cpu_arch.h
\ No newline at end of file
diff --git a/platform/linux-generic/arch/powerpc/odp_cpu_arch.c 
b/platform/linux-generic/arch/powerpc/odp_cpu_arch.c
new file mode 12
index 000..c5fe400
--- /dev/null
+++ b/platform/linux-generic/arch/powerpc/odp_cpu_arch.c
@@ -0,0 +1 @@
+../linux/odp_cpu_arch.c
\ No newline at end of file
diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
new file mode 100644
index 000..fe13f40
--- /dev/null
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -0,0 +1,52 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+
+int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
+{
+   char str[1024];
+   char *pos;
+   double mhz = 0.0;
+   int model = 0;
+   int count = 2;
+
+   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+   if (!mhz) {
+   pos = strstr(str, "clock");
+
+   if (pos)
+   if (sscanf(pos, "clock : %lf", ) == 1)
+   count--;
+   }
+
+   if (!model) {
+   pos = strstr(str, "cpu");
+
+   if (pos) {
+   int len;
+
+   pos = strchr(str, ':');
+   strncpy(sysinfo->model_str[0], pos + 2,
+   sizeof(sysinfo->model_str[0]));
+   len = strlen(sysinfo->model_str[0]);
+   sysinfo->model_str[0][len - 1] = 0;
+   model = 1;
+   count--;
+   }
+   }
+
+   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0);
+   }
+
+   return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
+{
+   return -1;
+}
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 7d68c2e..210dd1d 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -105,59 +105,6 @@ static int huge_page_size(void)
 }
 
 
-
-/*
- * HW specific /proc/cpuinfo file parsing
- */
-#if defined __powerpc__
-static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
-{
-   char str[1024];
-   char *pos;
-   double mhz = 0.0;
-   int model = 0;
-   int count = 2;
-
-   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
-   if (!mhz) {
-   pos = strstr(str, "clock");
-
-   if (pos) {
- 

[lng-odp] [PATCH v8 API-NEXT 10/12] linux-generic: sysinfo: apply per-CPU implementation to MIPS

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

When per-CPU framework was introduced, it was only implemented on x86,
for other platforms, only the model_str[0] and cpu_hz[0] are set to pass
compile, this patch set all values for model_str[] and cpu_hz[] on the
MIPS platform.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 .../linux-generic/arch/mips64/odp_sysinfo_parse.c  | 28 +++---
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index dcecbb9..64d65d2 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -12,17 +12,23 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
char str[1024];
char *pos;
double mhz = 0.0;
+   uint64_t hz;
int model = 0;
int count = 2;
+   int id = 0;
 
strcpy(sysinfo->cpu_arch_str, "mips64");
-   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+   while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
if (!mhz) {
pos = strstr(str, "BogoMIPS");
 
if (pos)
-   if (sscanf(pos, "BogoMIPS : %lf", ) == 1)
+   if (sscanf(pos, "BogoMIPS : %lf", ) == 1) {
+   /* bogomips seems to be 2x freq */
+   hz = (uint64_t)(mhz * 100.0 / 2.0);
+   sysinfo->cpu_hz[id] = hz;
count--;
+   }
}
 
if (!model) {
@@ -32,18 +38,22 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
int len;
 
pos = strchr(str, ':');
-   strncpy(sysinfo->model_str[0], pos + 2,
-   sizeof(sysinfo->model_str[0]));
-   len = strlen(sysinfo->model_str[0]);
-   sysinfo->model_str[0][len - 1] = 0;
+   strncpy(sysinfo->model_str[id], pos + 2,
+   sizeof(sysinfo->model_str[id]));
+   len = strlen(sysinfo->model_str[id]);
+   sysinfo->model_str[id][len - 1] = 0;
model = 1;
count--;
}
}
-   }
 
-   /* bogomips seems to be 2x freq */
-   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0 / 2.0);
+   if (count == 0) {
+   mhz = 0.0;
+   model = 0;
+   count = 2;
+   id++;
+   }
+   }
 
return 0;
 }
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 11/12] linux-generic: sysinfo: apply per-CPU implementation to PowerPC

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

When per-CPU framework was introduced, it was only implemented on x86,
for other platforms, only the model_str[0] and cpu_hz[0] are set to pass
compile, this patch set all values for model_str[] and cpu_hz[] on the
PowerPC platform.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 .../linux-generic/arch/powerpc/odp_sysinfo_parse.c | 24 +++---
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index 1ed95ad..62c3ae3 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -12,17 +12,22 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
char str[1024];
char *pos;
double mhz = 0.0;
+   uint64_t hz;
int model = 0;
int count = 2;
+   int id = 0;
 
strcpy(sysinfo->cpu_arch_str, "powerpc");
-   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+   while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
if (!mhz) {
pos = strstr(str, "clock");
 
if (pos)
-   if (sscanf(pos, "clock : %lf", ) == 1)
+   if (sscanf(pos, "clock : %lf", ) == 1) {
+   hz = (uint64_t)(mhz * 100.0);
+   sysinfo->cpu_hz[id] = hz;
count--;
+   }
}
 
if (!model) {
@@ -32,16 +37,21 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
int len;
 
pos = strchr(str, ':');
-   strncpy(sysinfo->model_str[0], pos + 2,
-   sizeof(sysinfo->model_str[0]));
-   len = strlen(sysinfo->model_str[0]);
-   sysinfo->model_str[0][len - 1] = 0;
+   strncpy(sysinfo->model_str[id], pos + 2,
+   sizeof(sysinfo->model_str[id]));
+   len = strlen(sysinfo->model_str[id]);
+   sysinfo->model_str[id][len - 1] = 0;
model = 1;
count--;
}
}
 
-   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0);
+   if (count == 0) {
+   mhz = 0.0;
+   model = 0;
+   count = 2;
+   id++;
+   }
}
 
return 0;
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 08/12] api: cpu: make frequency API return 0 on failure

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

All the CPU frequency API return value type is uint64_t, this patch makes
them return 0 on failure instead of -1.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 include/odp/api/cpu.h   | 4 
 platform/linux-generic/arch/linux/odp_sysinfo_parse.c   | 2 +-
 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c  | 2 +-
 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c | 2 +-
 platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 2 +-
 platform/linux-generic/odp_system_info.c| 2 +-
 6 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
index 4cbaf58..eaee24b 100644
--- a/include/odp/api/cpu.h
+++ b/include/odp/api/cpu.h
@@ -71,6 +71,7 @@ const char *odp_cpu_model_str_id(int id);
  * Returns current frequency of this CPU
  *
  * @return CPU frequency in Hz
+ * @retval 0 on failure
  */
 uint64_t odp_cpu_hz(void);
 
@@ -82,6 +83,7 @@ uint64_t odp_cpu_hz(void);
  * @param idCPU ID
  *
  * @return CPU frequency in Hz
+ * @retval 0 on failure
  */
 uint64_t odp_cpu_hz_id(int id);
 
@@ -91,6 +93,7 @@ uint64_t odp_cpu_hz_id(int id);
  * Returns maximum frequency of this CPU
  *
  * @return CPU frequency in Hz
+ * @retval 0 on failure
  */
 uint64_t odp_cpu_hz_max(void);
 
@@ -102,6 +105,7 @@ uint64_t odp_cpu_hz_max(void);
  * @param idCPU ID
  *
  * @return CPU frequency in Hz
+ * @retval 0 on failure
  */
 uint64_t odp_cpu_hz_max_id(int id);
 
diff --git a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
index 881dd2d..8ff6f48 100644
--- a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
@@ -15,5 +15,5 @@ int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
 
 uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
-   return -1;
+   return 0;
 }
diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index 264ab28..b6e0e2c 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -49,5 +49,5 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 
 uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
-   return -1;
+   return 0;
 }
diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index fe13f40..83d88ca 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -48,5 +48,5 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 
 uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
-   return -1;
+   return 0;
 }
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
index e2931cb..831a53a 100644
--- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -68,5 +68,5 @@ uint64_t odp_cpu_hz_current(int id)
if (mhz)
return (uint64_t)(mhz * 100.0);
 
-   return -1;
+   return 0;
 }
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 210dd1d..727053a 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -242,7 +242,7 @@ uint64_t odp_cpu_hz_max_id(int id)
if (id >= 0 && id < MAX_CPU_NUMBER)
return odp_global_data.system_info.cpu_hz[id];
else
-   return -1;
+   return 0;
 }
 
 uint64_t odp_sys_huge_page_size(void)
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v8 API-NEXT 05/12] linux-generic: sysinfo: move MIPS system info codes to its plarform file

2016-01-27 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This patch moves the MIPS system info codes into the newly added MIPS
specific platform file.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/Makefile.am |  1 +
 .../linux-generic/arch/mips64/odp_sysinfo_parse.c  | 53 ++
 platform/linux-generic/odp_system_info.c   | 47 ---
 3 files changed, 54 insertions(+), 47 deletions(-)
 create mode 100644 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index ae32268..d476ae9 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -167,6 +167,7 @@ __LIB__libodp_la_SOURCES = \
 EXTRA_DIST = \
 arch/linux/odp_cpu_arch.c \
 arch/mips64/odp_cpu_arch.c \
+arch/mips64/odp_sysinfo_parse.c \
 arch/x86/odp_cpu_arch.c \
 arch/x86/odp_sysinfo_parse.c
 
diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
new file mode 100644
index 000..264ab28
--- /dev/null
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -0,0 +1,53 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+
+int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
+{
+   char str[1024];
+   char *pos;
+   double mhz = 0.0;
+   int model = 0;
+   int count = 2;
+
+   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+   if (!mhz) {
+   pos = strstr(str, "BogoMIPS");
+
+   if (pos)
+   if (sscanf(pos, "BogoMIPS : %lf", ) == 1)
+   count--;
+   }
+
+   if (!model) {
+   pos = strstr(str, "cpu model");
+
+   if (pos) {
+   int len;
+
+   pos = strchr(str, ':');
+   strncpy(sysinfo->model_str[0], pos + 2,
+   sizeof(sysinfo->model_str[0]));
+   len = strlen(sysinfo->model_str[0]);
+   sysinfo->model_str[0][len - 1] = 0;
+   model = 1;
+   count--;
+   }
+   }
+   }
+
+   /* bogomips seems to be 2x freq */
+   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0 / 2.0);
+
+   return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
+{
+   return -1;
+}
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index fd25067..1959434 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -122,53 +122,6 @@ static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
return -1;
 }
 
-#elif defined __OCTEON__
-
-static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
-{
-   char str[1024];
-   char *pos;
-   double mhz = 0.0;
-   int model = 0;
-   int count = 2;
-
-   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
-   if (!mhz) {
-   pos = strstr(str, "BogoMIPS");
-
-   if (pos) {
-   sscanf(pos, "BogoMIPS : %lf", );
-   count--;
-   }
-   }
-
-   if (!model) {
-   pos = strstr(str, "cpu model");
-
-   if (pos) {
-   int len;
-   pos = strchr(str, ':');
-   strncpy(sysinfo->model_str[0], pos + 2,
-   sizeof(sysinfo->model_str[0]));
-   len = strlen(sysinfo->model_str[0]);
-   sysinfo->model_str[0][len - 1] = 0;
-   model = 1;
-   count--;
-   }
-   }
-   }
-
-   /* bogomips seems to be 2x freq */
-   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0 / 2.0);
-
-   return 0;
-}
-
-static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
-{
-   return -1;
-}
-
 #elif defined __powerpc__
 static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v7 API-NEXT 00/12] Separate CPU info codes into their platform files

2016-01-25 Thread Hongbo Zhang
On 21 January 2016 at 03:07, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
> Hi Hongbo,
>
> can you please test your patches with odp-check before sending?
> There is error that  there is no target for arch/powerpc/odp_cpu_cycles.c

The original file was named odp_cpu_cycles.c but re-named as
odp_cpu_arch.c in latest odp, I updated my powerpc symlink when
rebased my patches but forgot to update the Makefile.ac...

> for make distcheck.
>
> It takes me several hours to validate all that patch set and it will be
> great that at least from Linaro
> engineers patches were validated before sending.
>
>
> https://git.linaro.org/lng/check-odp.git
> export IGNORE_BASE=1
> (GIT_BRANCH=api-next PATCH_DIR=/opt/Linaro/odp2.git ./apply-and-build.sh )
> 2>&1
>
> and for hole patch set:
> GIT_URL=file:///opt/Linaro/odp2.git GIT_BRANCH=master ./detailed-analysis.sh
>
> Thanks,
> Maxim.
>
>
>
> On 01/20/2016 12:20, hongbo.zh...@linaro.org wrote:
>>
>> From: Hongbo Zhang <hongbo.zh...@linaro.org>
>>
>> v6->v7 changes:
>>   - update symlink in patch 7
>>
>> v5->v6 changes:
>>   - eliminate checkpatch.pl warnings
>>
>> v4->v5 changes:
>>   - rebase to latest api-next branch
>>
>> v3->v4 changes:
>>   - update patch 9 of platform naming
>>   - add new patch 12 to rename cpu_hz to cpu_hz_max
>>
>> v2->v3 changes:
>> use "api: cpu:" tag in patch 8/11 title instead of "linux-generic:
>> sysinfo"
>>
>> v1->v2 changes:
>>   - don't create arch/arm/ since there isn't implementation now, use
>> arch/linux
>> as default choice
>>   - create symlink to arch/linux/odp_cpu_cycles.c for powerpc, if absent
>> this
>> arch cannot be compiled
>>   - add some clean-ups patches 8~11, these patches are against the
>> previous ones
>> so send them together for better review and merge.
>>
>> v1 notes:
>> This patch set separates the CPU info codes into their own platform
>> sepcific
>> files.
>> It is common sence that the top general layer call an uniform interface to
>> initialize some plarform specific data structures, and this uniform
>> interface
>> is implemented in their own platform specific files.
>> This patch set makes it.
>>
>> Hongbo Zhang (12):
>>linux-generic: sysinfo: move cpu_arch_str to odp_system_info_t
>>linux-generic: sysinfo: use uniform call odp_sysinfo_parser
>>linux-generic: sysinfo: rename odp_cpu_hz_current with odp_ prefix
>>linux-generic: sysinfo: move x86 system info codes to its plarform
>>  file
>>linux-generic: sysinfo: move MIPS system info codes to its plarform
>>  file
>>linux-generic: sysinfo: move ARM system info codes to default arch
>>  file
>>linux-generic: sysinfo: move PowerPC system info codes to its plarform
>>  file
>>api: cpu: make frequency API return 0 on failure
>>linux-generic: sysinfo: set values for cpu_arch_str
>>linux-generic: sysinfo: apply per-CPU implementation to MIPS
>>linux-generic: sysinfo: apply per-CPU implementation to PowerPC
>>linux-generic: sysinfo: rename variable cpu_hz to cpu_hz_max
>>
>>   configure.ac   |   1 +
>>   include/odp/api/cpu.h  |   4 +
>>   platform/linux-generic/Makefile.am |  10 +-
>>   .../linux-generic/arch/linux/odp_sysinfo_parse.c   |  19 ++
>>   .../linux-generic/arch/mips64/odp_sysinfo_parse.c  |  64 ++
>>   platform/linux-generic/arch/powerpc/odp/cpu_arch.h |   1 +
>>   platform/linux-generic/arch/powerpc/odp_cpu_arch.c |   1 +
>>   .../linux-generic/arch/powerpc/odp_sysinfo_parse.c |  63 ++
>>   .../linux-generic/arch/x86/odp_sysinfo_parse.c |  73 +++
>>   platform/linux-generic/include/odp_internal.h  |   7 +-
>>   platform/linux-generic/odp_system_info.c   | 220
>> +
>>   11 files changed, 246 insertions(+), 217 deletions(-)
>>   create mode 100644 platform/linux-generic/arch/linux/odp_sysinfo_parse.c
>>   create mode 100644
>> platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
>>   create mode 12 platform/linux-generic/arch/powerpc/odp/cpu_arch.h
>>   create mode 12 platform/linux-generic/arch/powerpc/odp_cpu_arch.c
>>   create mode 100644
>> platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
>>   create mode 100644 platform/linux-generic/arch/x86/odp_sysinfo_parse.c
>>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v7 API-NEXT 00/12] Separate CPU info codes into their platform files

2016-01-20 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

v6->v7 changes:
 - update symlink in patch 7

v5->v6 changes:
 - eliminate checkpatch.pl warnings

v4->v5 changes:
 - rebase to latest api-next branch

v3->v4 changes:
 - update patch 9 of platform naming
 - add new patch 12 to rename cpu_hz to cpu_hz_max

v2->v3 changes:
use "api: cpu:" tag in patch 8/11 title instead of "linux-generic: sysinfo"

v1->v2 changes:
 - don't create arch/arm/ since there isn't implementation now, use arch/linux
as default choice
 - create symlink to arch/linux/odp_cpu_cycles.c for powerpc, if absent this
arch cannot be compiled
 - add some clean-ups patches 8~11, these patches are against the previous ones
so send them together for better review and merge.

v1 notes:
This patch set separates the CPU info codes into their own platform sepcific
files.
It is common sence that the top general layer call an uniform interface to
initialize some plarform specific data structures, and this uniform interface
is implemented in their own platform specific files.
This patch set makes it.

Hongbo Zhang (12):
  linux-generic: sysinfo: move cpu_arch_str to odp_system_info_t
  linux-generic: sysinfo: use uniform call odp_sysinfo_parser
  linux-generic: sysinfo: rename odp_cpu_hz_current with odp_ prefix
  linux-generic: sysinfo: move x86 system info codes to its plarform
file
  linux-generic: sysinfo: move MIPS system info codes to its plarform
file
  linux-generic: sysinfo: move ARM system info codes to default arch
file
  linux-generic: sysinfo: move PowerPC system info codes to its plarform
file
  api: cpu: make frequency API return 0 on failure
  linux-generic: sysinfo: set values for cpu_arch_str
  linux-generic: sysinfo: apply per-CPU implementation to MIPS
  linux-generic: sysinfo: apply per-CPU implementation to PowerPC
  linux-generic: sysinfo: rename variable cpu_hz to cpu_hz_max

 configure.ac   |   1 +
 include/odp/api/cpu.h  |   4 +
 platform/linux-generic/Makefile.am |  10 +-
 .../linux-generic/arch/linux/odp_sysinfo_parse.c   |  19 ++
 .../linux-generic/arch/mips64/odp_sysinfo_parse.c  |  64 ++
 platform/linux-generic/arch/powerpc/odp/cpu_arch.h |   1 +
 platform/linux-generic/arch/powerpc/odp_cpu_arch.c |   1 +
 .../linux-generic/arch/powerpc/odp_sysinfo_parse.c |  63 ++
 .../linux-generic/arch/x86/odp_sysinfo_parse.c |  73 +++
 platform/linux-generic/include/odp_internal.h  |   7 +-
 platform/linux-generic/odp_system_info.c   | 220 +
 11 files changed, 246 insertions(+), 217 deletions(-)
 create mode 100644 platform/linux-generic/arch/linux/odp_sysinfo_parse.c
 create mode 100644 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
 create mode 12 platform/linux-generic/arch/powerpc/odp/cpu_arch.h
 create mode 12 platform/linux-generic/arch/powerpc/odp_cpu_arch.c
 create mode 100644 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
 create mode 100644 platform/linux-generic/arch/x86/odp_sysinfo_parse.c

-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v7 API-NEXT 08/12] api: cpu: make frequency API return 0 on failure

2016-01-20 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

All the CPU frequency API return value type is uint64_t, this patch makes
them return 0 on failure instead of -1.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 include/odp/api/cpu.h   | 4 
 platform/linux-generic/arch/linux/odp_sysinfo_parse.c   | 2 +-
 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c  | 2 +-
 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c | 2 +-
 platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 2 +-
 platform/linux-generic/odp_system_info.c| 2 +-
 6 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
index 4cbaf58..eaee24b 100644
--- a/include/odp/api/cpu.h
+++ b/include/odp/api/cpu.h
@@ -71,6 +71,7 @@ const char *odp_cpu_model_str_id(int id);
  * Returns current frequency of this CPU
  *
  * @return CPU frequency in Hz
+ * @retval 0 on failure
  */
 uint64_t odp_cpu_hz(void);
 
@@ -82,6 +83,7 @@ uint64_t odp_cpu_hz(void);
  * @param idCPU ID
  *
  * @return CPU frequency in Hz
+ * @retval 0 on failure
  */
 uint64_t odp_cpu_hz_id(int id);
 
@@ -91,6 +93,7 @@ uint64_t odp_cpu_hz_id(int id);
  * Returns maximum frequency of this CPU
  *
  * @return CPU frequency in Hz
+ * @retval 0 on failure
  */
 uint64_t odp_cpu_hz_max(void);
 
@@ -102,6 +105,7 @@ uint64_t odp_cpu_hz_max(void);
  * @param idCPU ID
  *
  * @return CPU frequency in Hz
+ * @retval 0 on failure
  */
 uint64_t odp_cpu_hz_max_id(int id);
 
diff --git a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
index 881dd2d..8ff6f48 100644
--- a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
@@ -15,5 +15,5 @@ int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
 
 uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
-   return -1;
+   return 0;
 }
diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index 264ab28..b6e0e2c 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -49,5 +49,5 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 
 uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
-   return -1;
+   return 0;
 }
diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index fe13f40..83d88ca 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -48,5 +48,5 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 
 uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
-   return -1;
+   return 0;
 }
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
index e2931cb..831a53a 100644
--- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -68,5 +68,5 @@ uint64_t odp_cpu_hz_current(int id)
if (mhz)
return (uint64_t)(mhz * 100.0);
 
-   return -1;
+   return 0;
 }
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index e4992b5..de187a0 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -241,7 +241,7 @@ uint64_t odp_cpu_hz_max_id(int id)
if (id >= 0 && id < MAX_CPU_NUMBER)
return odp_global_data.system_info.cpu_hz[id];
else
-   return -1;
+   return 0;
 }
 
 uint64_t odp_sys_huge_page_size(void)
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v7 API-NEXT 06/12] linux-generic: sysinfo: move ARM system info codes to default arch file

2016-01-20 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This patch moves the ARM system info codes into the general arch file,
ARM sysinfo isn't implemented now and there is no need to create specific
arch file for it, but this can serve as the default implementaton instead.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/Makefile.am|  1 +
 platform/linux-generic/arch/linux/odp_sysinfo_parse.c | 19 +++
 platform/linux-generic/odp_system_info.c  | 15 +--
 3 files changed, 21 insertions(+), 14 deletions(-)
 create mode 100644 platform/linux-generic/arch/linux/odp_sysinfo_parse.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index d3802f8..b737135 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -164,6 +164,7 @@ __LIB__libodp_la_SOURCES = \
 
 EXTRA_DIST = \
 arch/linux/odp_cpu_arch.c \
+arch/linux/odp_sysinfo_parse.c \
 arch/mips64/odp_cpu_arch.c \
 arch/mips64/odp_sysinfo_parse.c \
 arch/x86/odp_cpu_arch.c \
diff --git a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
new file mode 100644
index 000..881dd2d
--- /dev/null
+++ b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
@@ -0,0 +1,19 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+
+int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
+  odp_system_info_t *sysinfo ODP_UNUSED)
+{
+   return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
+{
+   return -1;
+}
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 2b8e2b8..27dad03 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -108,20 +108,7 @@ static int huge_page_size(void)
 /*
  * HW specific /proc/cpuinfo file parsing
  */
-#if defined __arm__ || defined __aarch64__
-
-static int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
- odp_system_info_t *sysinfo ODP_UNUSED)
-{
-   return 0;
-}
-
-static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
-{
-   return -1;
-}
-
-#elif defined __powerpc__
+#if defined __powerpc__
 static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
char str[1024];
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v7 API-NEXT 05/12] linux-generic: sysinfo: move MIPS system info codes to its plarform file

2016-01-20 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This patch moves the MIPS system info codes into the newly added MIPS
specific platform file.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/Makefile.am |  1 +
 .../linux-generic/arch/mips64/odp_sysinfo_parse.c  | 53 ++
 platform/linux-generic/odp_system_info.c   | 47 ---
 3 files changed, 54 insertions(+), 47 deletions(-)
 create mode 100644 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index de43eff..d3802f8 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -165,6 +165,7 @@ __LIB__libodp_la_SOURCES = \
 EXTRA_DIST = \
 arch/linux/odp_cpu_arch.c \
 arch/mips64/odp_cpu_arch.c \
+arch/mips64/odp_sysinfo_parse.c \
 arch/x86/odp_cpu_arch.c \
 arch/x86/odp_sysinfo_parse.c
 
diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
new file mode 100644
index 000..264ab28
--- /dev/null
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -0,0 +1,53 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+
+int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
+{
+   char str[1024];
+   char *pos;
+   double mhz = 0.0;
+   int model = 0;
+   int count = 2;
+
+   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+   if (!mhz) {
+   pos = strstr(str, "BogoMIPS");
+
+   if (pos)
+   if (sscanf(pos, "BogoMIPS : %lf", ) == 1)
+   count--;
+   }
+
+   if (!model) {
+   pos = strstr(str, "cpu model");
+
+   if (pos) {
+   int len;
+
+   pos = strchr(str, ':');
+   strncpy(sysinfo->model_str[0], pos + 2,
+   sizeof(sysinfo->model_str[0]));
+   len = strlen(sysinfo->model_str[0]);
+   sysinfo->model_str[0][len - 1] = 0;
+   model = 1;
+   count--;
+   }
+   }
+   }
+
+   /* bogomips seems to be 2x freq */
+   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0 / 2.0);
+
+   return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
+{
+   return -1;
+}
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index d2b0a68..2b8e2b8 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -121,53 +121,6 @@ static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
return -1;
 }
 
-#elif defined __OCTEON__
-
-static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
-{
-   char str[1024];
-   char *pos;
-   double mhz = 0.0;
-   int model = 0;
-   int count = 2;
-
-   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
-   if (!mhz) {
-   pos = strstr(str, "BogoMIPS");
-
-   if (pos) {
-   sscanf(pos, "BogoMIPS : %lf", );
-   count--;
-   }
-   }
-
-   if (!model) {
-   pos = strstr(str, "cpu model");
-
-   if (pos) {
-   int len;
-   pos = strchr(str, ':');
-   strncpy(sysinfo->model_str[0], pos + 2,
-   sizeof(sysinfo->model_str[0]));
-   len = strlen(sysinfo->model_str[0]);
-   sysinfo->model_str[0][len - 1] = 0;
-   model = 1;
-   count--;
-   }
-   }
-   }
-
-   /* bogomips seems to be 2x freq */
-   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0 / 2.0);
-
-   return 0;
-}
-
-static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
-{
-   return -1;
-}
-
 #elif defined __powerpc__
 static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v7 API-NEXT 04/12] linux-generic: sysinfo: move x86 system info codes to its plarform file

2016-01-20 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This patch moves the x86 system info codes into the newly added x86
specific platform file.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/Makefile.am |  6 +-
 .../linux-generic/arch/x86/odp_sysinfo_parse.c | 72 ++
 platform/linux-generic/include/odp_internal.h  |  4 ++
 platform/linux-generic/odp_system_info.c   | 68 +---
 4 files changed, 81 insertions(+), 69 deletions(-)
 create mode 100644 platform/linux-generic/arch/x86/odp_sysinfo_parse.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 9fbb3bd..de43eff 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -159,12 +159,14 @@ __LIB__libodp_la_SOURCES = \
   odp_traffic_mngr.c \
   odp_version.c \
   odp_weak.c \
-  arch/@ARCH@/odp_cpu_arch.c
+  arch/@ARCH@/odp_cpu_arch.c \
+  arch/@ARCH@/odp_sysinfo_parse.c
 
 EXTRA_DIST = \
 arch/linux/odp_cpu_arch.c \
 arch/mips64/odp_cpu_arch.c \
-arch/x86/odp_cpu_arch.c
+arch/x86/odp_cpu_arch.c \
+arch/x86/odp_sysinfo_parse.c
 
 if HAVE_PCAP
 __LIB__libodp_la_SOURCES += pktio/pcap.c
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
new file mode 100644
index 000..e2931cb
--- /dev/null
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -0,0 +1,72 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+
+int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
+{
+   char str[1024];
+   char *pos;
+   double ghz = 0.0;
+   uint64_t hz;
+   int id = 0;
+
+   while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
+   pos = strstr(str, "model name");
+   if (pos) {
+   pos = strchr(str, ':');
+   strncpy(sysinfo->model_str[id], pos + 2,
+   sizeof(sysinfo->model_str[id]));
+
+   pos = strchr(sysinfo->model_str[id], '@');
+   *(pos - 1) = '\0';
+   if (sscanf(pos, "@ %lfGHz", ) == 1) {
+   hz = (uint64_t)(ghz * 10.0);
+   sysinfo->cpu_hz[id] = hz;
+   }
+   id++;
+   }
+   }
+
+   return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id)
+{
+   char str[1024];
+   FILE *file;
+   int cpu;
+   char *pos;
+   double mhz = 0.0;
+
+   file = fopen("/proc/cpuinfo", "rt");
+
+   /* find the correct processor instance */
+   while (fgets(str, sizeof(str), file) != NULL) {
+   pos = strstr(str, "processor");
+   if (pos) {
+   if (sscanf(pos, "processor : %d", ) == 1)
+   if (cpu == id)
+   break;
+   }
+   }
+
+   /* extract the cpu current speed */
+   while (fgets(str, sizeof(str), file) != NULL) {
+   pos = strstr(str, "cpu MHz");
+   if (pos) {
+   if (sscanf(pos, "cpu MHz : %lf", ) == 1)
+   break;
+   }
+   }
+
+   fclose(file);
+   if (mhz)
+   return (uint64_t)(mhz * 100.0);
+
+   return -1;
+}
diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index 39e6f78..b527438 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -20,6 +20,7 @@ extern "C" {
 
 #include 
 #include 
+#include 
 
 extern __thread int __odp_errno;
 
@@ -108,6 +109,9 @@ int odp_tm_init_global(void);
 
 void _odp_flush_caches(void);
 
+int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo);
+uint64_t odp_cpu_hz_current(int id);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index d05176c..d2b0a68 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -108,71 +108,7 @@ static int huge_page_size(void)
 /*
  * HW specific /proc/cpuinfo file parsing
  */
-#if defined __x86_64__ || defined __i386__
-
-static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
-{
-   char str[1024];
-   char *pos;
-   double ghz = 0.0;
-   int id = 0;
-
-   while (fgets(str, 

[lng-odp] [PATCH v7 API-NEXT 02/12] linux-generic: sysinfo: use uniform call odp_sysinfo_parser

2016-01-20 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

It is common way that the general top layer calls a uniform interface to
initialize data structrure for different plarform, this patch introduces
odp_sysinfo_parser() instead of using different interfaces for each
platform, and also removes using structure odp_compiler_info_t since both
members inside it become useless now.
This is still another pre-step for separating platform specific codes into
their own arch files.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/odp_system_info.c | 36 ++--
 1 file changed, 6 insertions(+), 30 deletions(-)

diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index f965023..b019f11 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -24,12 +24,6 @@
 #include 
 
 
-
-typedef struct {
-   int (*cpuinfo_parser)(FILE *file, odp_system_info_t *sysinfo);
-
-} odp_compiler_info_t;
-
 #define CACHE_LNSZ_FILE \
"/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size"
 
@@ -116,7 +110,7 @@ static int huge_page_size(void)
  */
 #if defined __x86_64__ || defined __i386__
 
-static int cpuinfo_x86(FILE *file, odp_system_info_t *sysinfo)
+static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
char str[1024];
char *pos;
@@ -180,8 +174,8 @@ static uint64_t arch_cpu_hz_current(int id)
 
 #elif defined __arm__ || defined __aarch64__
 
-static int cpuinfo_arm(FILE *file ODP_UNUSED,
-odp_system_info_t *sysinfo ODP_UNUSED)
+static int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
+ odp_system_info_t *sysinfo ODP_UNUSED)
 {
return 0;
 }
@@ -193,7 +187,7 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
 
 #elif defined __OCTEON__
 
-static int cpuinfo_octeon(FILE *file, odp_system_info_t *sysinfo)
+static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
char str[1024];
char *pos;
@@ -239,7 +233,7 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
 }
 
 #elif defined __powerpc__
-static int cpuinfo_powerpc(FILE *file, odp_system_info_t *sysinfo)
+static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
char str[1024];
char *pos;
@@ -288,24 +282,6 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
#error GCC target not found
 #endif
 
-static odp_compiler_info_t compiler_info = {
-   #if defined __x86_64__ || defined __i386__
-   .cpuinfo_parser = cpuinfo_x86
-
-   #elif defined __arm__ || defined __aarch64__
-   .cpuinfo_parser = cpuinfo_arm
-
-   #elif defined __OCTEON__
-   .cpuinfo_parser = cpuinfo_octeon
-
-   #elif defined __powerpc__
-   .cpuinfo_parser = cpuinfo_powerpc
-
-   #else
-   #error GCC target not found
-   #endif
-};
-
 
 #if defined __x86_64__ || defined __i386__ || defined __OCTEON__ || \
 defined __powerpc__
@@ -397,7 +373,7 @@ int odp_system_info_init(void)
return -1;
}
 
-   compiler_info.cpuinfo_parser(file, _global_data.system_info);
+   odp_cpuinfo_parser(file, _global_data.system_info);
 
fclose(file);
 
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v7 API-NEXT 03/12] linux-generic: sysinfo: rename odp_cpu_hz_current with odp_ prefix

2016-01-20 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This function will be moved to their own platform specific files too,
it is better to be named with a odp_ prefix.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/odp_system_info.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index b019f11..d05176c 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -136,7 +136,7 @@ static int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id)
+static uint64_t odp_cpu_hz_current(int id)
 {
char str[1024];
FILE *file;
@@ -180,7 +180,7 @@ static int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
+static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return -1;
 }
@@ -227,7 +227,7 @@ static int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
+static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return -1;
 }
@@ -273,7 +273,7 @@ static int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
+static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return -1;
 }
@@ -402,12 +402,12 @@ uint64_t odp_cpu_hz(void)
 {
int id = sched_getcpu();
 
-   return arch_cpu_hz_current(id);
+   return odp_cpu_hz_current(id);
 }
 
 uint64_t odp_cpu_hz_id(int id)
 {
-   return arch_cpu_hz_current(id);
+   return odp_cpu_hz_current(id);
 }
 
 uint64_t odp_cpu_hz_max(void)
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v7 API-NEXT 01/12] linux-generic: sysinfo: move cpu_arch_str to odp_system_info_t

2016-01-20 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This is a pre-step for separating platform specific codes into their own
arch files.
Value of cpu_arch_str will be set later in separate arch parser code.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/include/odp_internal.h | 1 +
 platform/linux-generic/odp_system_info.c  | 5 -
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index cdbed7d..39e6f78 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -31,6 +31,7 @@ typedef struct {
uint64_t page_size;
int  cache_line_size;
int  cpu_count;
+   char cpu_arch_str[128];
char model_str[MAX_CPU_NUMBER][128];
 } odp_system_info_t;
 
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index bab3f44..f965023 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -26,7 +26,6 @@
 
 
 typedef struct {
-   const char *cpu_arch_str;
int (*cpuinfo_parser)(FILE *file, odp_system_info_t *sysinfo);
 
 } odp_compiler_info_t;
@@ -291,19 +290,15 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
 
 static odp_compiler_info_t compiler_info = {
#if defined __x86_64__ || defined __i386__
-   .cpu_arch_str = "x86",
.cpuinfo_parser = cpuinfo_x86
 
#elif defined __arm__ || defined __aarch64__
-   .cpu_arch_str = "arm",
.cpuinfo_parser = cpuinfo_arm
 
#elif defined __OCTEON__
-   .cpu_arch_str = "octeon",
.cpuinfo_parser = cpuinfo_octeon
 
#elif defined __powerpc__
-   .cpu_arch_str = "powerpc",
.cpuinfo_parser = cpuinfo_powerpc
 
#else
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v7 API-NEXT 10/12] linux-generic: sysinfo: apply per-CPU implementation to MIPS

2016-01-20 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

When per-CPU framework was introduced, it was only implemented on x86,
for other platforms, only the model_str[0] and cpu_hz[0] are set to pass
compile, this patch set all values for model_str[] and cpu_hz[] on the
MIPS platform.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 .../linux-generic/arch/mips64/odp_sysinfo_parse.c  | 28 +++---
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index dcecbb9..64d65d2 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -12,17 +12,23 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
char str[1024];
char *pos;
double mhz = 0.0;
+   uint64_t hz;
int model = 0;
int count = 2;
+   int id = 0;
 
strcpy(sysinfo->cpu_arch_str, "mips64");
-   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+   while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
if (!mhz) {
pos = strstr(str, "BogoMIPS");
 
if (pos)
-   if (sscanf(pos, "BogoMIPS : %lf", ) == 1)
+   if (sscanf(pos, "BogoMIPS : %lf", ) == 1) {
+   /* bogomips seems to be 2x freq */
+   hz = (uint64_t)(mhz * 100.0 / 2.0);
+   sysinfo->cpu_hz[id] = hz;
count--;
+   }
}
 
if (!model) {
@@ -32,18 +38,22 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
int len;
 
pos = strchr(str, ':');
-   strncpy(sysinfo->model_str[0], pos + 2,
-   sizeof(sysinfo->model_str[0]));
-   len = strlen(sysinfo->model_str[0]);
-   sysinfo->model_str[0][len - 1] = 0;
+   strncpy(sysinfo->model_str[id], pos + 2,
+   sizeof(sysinfo->model_str[id]));
+   len = strlen(sysinfo->model_str[id]);
+   sysinfo->model_str[id][len - 1] = 0;
model = 1;
count--;
}
}
-   }
 
-   /* bogomips seems to be 2x freq */
-   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0 / 2.0);
+   if (count == 0) {
+   mhz = 0.0;
+   model = 0;
+   count = 2;
+   id++;
+   }
+   }
 
return 0;
 }
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v7 API-NEXT 07/12] linux-generic: sysinfo: move PowerPC system info codes to its plarform file

2016-01-20 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This patch moves the PowerPC system info codes into the newly added PowerPC
specific platform file.
This patch also creates syslink to arch/linux/odp_cpu_cycles.c for PowerPC.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 configure.ac   |  1 +
 platform/linux-generic/Makefile.am |  2 +
 platform/linux-generic/arch/powerpc/odp/cpu_arch.h |  1 +
 platform/linux-generic/arch/powerpc/odp_cpu_arch.c |  1 +
 .../linux-generic/arch/powerpc/odp_sysinfo_parse.c | 52 +
 platform/linux-generic/odp_system_info.c   | 53 --
 6 files changed, 57 insertions(+), 53 deletions(-)
 create mode 12 platform/linux-generic/arch/powerpc/odp/cpu_arch.h
 create mode 12 platform/linux-generic/arch/powerpc/odp_cpu_arch.c
 create mode 100644 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c

diff --git a/configure.ac b/configure.ac
index 7e1678a..962ce93 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,6 +55,7 @@ AX_VALGRIND_CHECK
 AS_CASE([$host],
   [x86*], [ARCH=x86],
   [mips64*], [ARCH=mips64],
+  [powerpc*], [ARCH=powerpc],
   [ARCH=linux]
 )
 AC_SUBST([ARCH])
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index b737135..21cde8a 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -167,6 +167,8 @@ EXTRA_DIST = \
 arch/linux/odp_sysinfo_parse.c \
 arch/mips64/odp_cpu_arch.c \
 arch/mips64/odp_sysinfo_parse.c \
+arch/powerpc/odp_cpu_cycles.c \
+arch/powerpc/odp_sysinfo_parse.c \
 arch/x86/odp_cpu_arch.c \
 arch/x86/odp_sysinfo_parse.c
 
diff --git a/platform/linux-generic/arch/powerpc/odp/cpu_arch.h 
b/platform/linux-generic/arch/powerpc/odp/cpu_arch.h
new file mode 12
index 000..0617d7f
--- /dev/null
+++ b/platform/linux-generic/arch/powerpc/odp/cpu_arch.h
@@ -0,0 +1 @@
+../../linux/odp/cpu_arch.h
\ No newline at end of file
diff --git a/platform/linux-generic/arch/powerpc/odp_cpu_arch.c 
b/platform/linux-generic/arch/powerpc/odp_cpu_arch.c
new file mode 12
index 000..c5fe400
--- /dev/null
+++ b/platform/linux-generic/arch/powerpc/odp_cpu_arch.c
@@ -0,0 +1 @@
+../linux/odp_cpu_arch.c
\ No newline at end of file
diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
new file mode 100644
index 000..fe13f40
--- /dev/null
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -0,0 +1,52 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+
+int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
+{
+   char str[1024];
+   char *pos;
+   double mhz = 0.0;
+   int model = 0;
+   int count = 2;
+
+   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+   if (!mhz) {
+   pos = strstr(str, "clock");
+
+   if (pos)
+   if (sscanf(pos, "clock : %lf", ) == 1)
+   count--;
+   }
+
+   if (!model) {
+   pos = strstr(str, "cpu");
+
+   if (pos) {
+   int len;
+
+   pos = strchr(str, ':');
+   strncpy(sysinfo->model_str[0], pos + 2,
+   sizeof(sysinfo->model_str[0]));
+   len = strlen(sysinfo->model_str[0]);
+   sysinfo->model_str[0][len - 1] = 0;
+   model = 1;
+   count--;
+   }
+   }
+
+   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0);
+   }
+
+   return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
+{
+   return -1;
+}
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 27dad03..e4992b5 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -104,59 +104,6 @@ static int huge_page_size(void)
 }
 
 
-
-/*
- * HW specific /proc/cpuinfo file parsing
- */
-#if defined __powerpc__
-static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
-{
-   char str[1024];
-   char *pos;
-   double mhz = 0.0;
-   int model = 0;
-   int count = 2;
-
-   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
-   if (!mhz) {
-   pos = strstr(str, "clock");
-
-   if (pos) {
- 

[lng-odp] [PATCH v7 API-NEXT 11/12] linux-generic: sysinfo: apply per-CPU implementation to PowerPC

2016-01-20 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

When per-CPU framework was introduced, it was only implemented on x86,
for other platforms, only the model_str[0] and cpu_hz[0] are set to pass
compile, this patch set all values for model_str[] and cpu_hz[] on the
PowerPC platform.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 .../linux-generic/arch/powerpc/odp_sysinfo_parse.c | 24 +++---
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index 1ed95ad..62c3ae3 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -12,17 +12,22 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
char str[1024];
char *pos;
double mhz = 0.0;
+   uint64_t hz;
int model = 0;
int count = 2;
+   int id = 0;
 
strcpy(sysinfo->cpu_arch_str, "powerpc");
-   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+   while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
if (!mhz) {
pos = strstr(str, "clock");
 
if (pos)
-   if (sscanf(pos, "clock : %lf", ) == 1)
+   if (sscanf(pos, "clock : %lf", ) == 1) {
+   hz = (uint64_t)(mhz * 100.0);
+   sysinfo->cpu_hz[id] = hz;
count--;
+   }
}
 
if (!model) {
@@ -32,16 +37,21 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
int len;
 
pos = strchr(str, ':');
-   strncpy(sysinfo->model_str[0], pos + 2,
-   sizeof(sysinfo->model_str[0]));
-   len = strlen(sysinfo->model_str[0]);
-   sysinfo->model_str[0][len - 1] = 0;
+   strncpy(sysinfo->model_str[id], pos + 2,
+   sizeof(sysinfo->model_str[id]));
+   len = strlen(sysinfo->model_str[id]);
+   sysinfo->model_str[id][len - 1] = 0;
model = 1;
count--;
}
}
 
-   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0);
+   if (count == 0) {
+   mhz = 0.0;
+   model = 0;
+   count = 2;
+   id++;
+   }
}
 
return 0;
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v7 API-NEXT 12/12] linux-generic: sysinfo: rename variable cpu_hz to cpu_hz_max

2016-01-20 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

The legacy variable cpu_hz holds the max frequency for odp_cpu_hz_max(),
so rename it to cpu_hz_max for better meaning.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c  | 2 +-
 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c | 2 +-
 platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 2 +-
 platform/linux-generic/include/odp_internal.h   | 2 +-
 platform/linux-generic/odp_system_info.c| 4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index 64d65d2..53074f7 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -26,7 +26,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
if (sscanf(pos, "BogoMIPS : %lf", ) == 1) {
/* bogomips seems to be 2x freq */
hz = (uint64_t)(mhz * 100.0 / 2.0);
-   sysinfo->cpu_hz[id] = hz;
+   sysinfo->cpu_hz_max[id] = hz;
count--;
}
}
diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index 62c3ae3..99457ce 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -25,7 +25,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
if (pos)
if (sscanf(pos, "clock : %lf", ) == 1) {
hz = (uint64_t)(mhz * 100.0);
-   sysinfo->cpu_hz[id] = hz;
+   sysinfo->cpu_hz_max[id] = hz;
count--;
}
}
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
index d2b3c80..816629d 100644
--- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -27,7 +27,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
*(pos - 1) = '\0';
if (sscanf(pos, "@ %lfGHz", ) == 1) {
hz = (uint64_t)(ghz * 10.0);
-   sysinfo->cpu_hz[id] = hz;
+   sysinfo->cpu_hz_max[id] = hz;
}
id++;
}
diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index b527438..aac2ba9 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -27,7 +27,7 @@ extern __thread int __odp_errno;
 #define MAX_CPU_NUMBER 128
 
 typedef struct {
-   uint64_t cpu_hz[MAX_CPU_NUMBER];
+   uint64_t cpu_hz_max[MAX_CPU_NUMBER];
uint64_t huge_page_size;
uint64_t page_size;
int  cache_line_size;
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index de187a0..2e602a3 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -168,7 +168,7 @@ static int systemcpu(odp_system_info_t *sysinfo)
ODP_DBG("Warning: use dummy values for freq and model string\n");
ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n;);
for (i = 0; i < MAX_CPU_NUMBER; i++) {
-   sysinfo->cpu_hz[i] = 14;
+   sysinfo->cpu_hz_max[i] = 14;
strcpy(sysinfo->model_str[i], "UNKNOWN");
}
 
@@ -239,7 +239,7 @@ uint64_t odp_cpu_hz_max(void)
 uint64_t odp_cpu_hz_max_id(int id)
 {
if (id >= 0 && id < MAX_CPU_NUMBER)
-   return odp_global_data.system_info.cpu_hz[id];
+   return odp_global_data.system_info.cpu_hz_max[id];
else
return 0;
 }
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v7 API-NEXT 00/12] Separate CPU info codes into their platform files

2016-01-20 Thread Hongbo Zhang
And if we run validation, there should be no failure of system test on
x86 and arm, but on mips and powerpc, there should be failures because
current frequency on those platforms are not implemented (max freq is
done), so failures can be expected.

On 20 January 2016 at 22:35, Hongbo Zhang <hongbo.zh...@linaro.org> wrote:
> add more details how I tested mips and ppc codes:
>
> on my x86 machine, ./configure --host=powerpc, then arch/powerpc/* are 
> compiled
> and create a pseudo /tmp/cpuinfo following the powerpc format, and let
> my code to parse this file instead of the /proc/cpuinfo on my x86
>
> for mips, I did the same thing to verify the code (only have to
> comment out some assembly code in odp_cpu_arch.c to pass compilation)
>
> by this way I tested my patches on my x86, it should work I think.
>
>
> On 20 January 2016 at 17:20,  <hongbo.zh...@linaro.org> wrote:
>> From: Hongbo Zhang <hongbo.zh...@linaro.org>
>>
>> v6->v7 changes:
>>  - update symlink in patch 7
>>
>> v5->v6 changes:
>>  - eliminate checkpatch.pl warnings
>>
>> v4->v5 changes:
>>  - rebase to latest api-next branch
>>
>> v3->v4 changes:
>>  - update patch 9 of platform naming
>>  - add new patch 12 to rename cpu_hz to cpu_hz_max
>>
>> v2->v3 changes:
>> use "api: cpu:" tag in patch 8/11 title instead of "linux-generic: sysinfo"
>>
>> v1->v2 changes:
>>  - don't create arch/arm/ since there isn't implementation now, use 
>> arch/linux
>> as default choice
>>  - create symlink to arch/linux/odp_cpu_cycles.c for powerpc, if absent this
>> arch cannot be compiled
>>  - add some clean-ups patches 8~11, these patches are against the previous 
>> ones
>> so send them together for better review and merge.
>>
>> v1 notes:
>> This patch set separates the CPU info codes into their own platform sepcific
>> files.
>> It is common sence that the top general layer call an uniform interface to
>> initialize some plarform specific data structures, and this uniform interface
>> is implemented in their own platform specific files.
>> This patch set makes it.
>>
>> Hongbo Zhang (12):
>>   linux-generic: sysinfo: move cpu_arch_str to odp_system_info_t
>>   linux-generic: sysinfo: use uniform call odp_sysinfo_parser
>>   linux-generic: sysinfo: rename odp_cpu_hz_current with odp_ prefix
>>   linux-generic: sysinfo: move x86 system info codes to its plarform
>> file
>>   linux-generic: sysinfo: move MIPS system info codes to its plarform
>> file
>>   linux-generic: sysinfo: move ARM system info codes to default arch
>> file
>>   linux-generic: sysinfo: move PowerPC system info codes to its plarform
>> file
>>   api: cpu: make frequency API return 0 on failure
>>   linux-generic: sysinfo: set values for cpu_arch_str
>>   linux-generic: sysinfo: apply per-CPU implementation to MIPS
>>   linux-generic: sysinfo: apply per-CPU implementation to PowerPC
>>   linux-generic: sysinfo: rename variable cpu_hz to cpu_hz_max
>>
>>  configure.ac   |   1 +
>>  include/odp/api/cpu.h  |   4 +
>>  platform/linux-generic/Makefile.am |  10 +-
>>  .../linux-generic/arch/linux/odp_sysinfo_parse.c   |  19 ++
>>  .../linux-generic/arch/mips64/odp_sysinfo_parse.c  |  64 ++
>>  platform/linux-generic/arch/powerpc/odp/cpu_arch.h |   1 +
>>  platform/linux-generic/arch/powerpc/odp_cpu_arch.c |   1 +
>>  .../linux-generic/arch/powerpc/odp_sysinfo_parse.c |  63 ++
>>  .../linux-generic/arch/x86/odp_sysinfo_parse.c |  73 +++
>>  platform/linux-generic/include/odp_internal.h  |   7 +-
>>  platform/linux-generic/odp_system_info.c   | 220 
>> +
>>  11 files changed, 246 insertions(+), 217 deletions(-)
>>  create mode 100644 platform/linux-generic/arch/linux/odp_sysinfo_parse.c
>>  create mode 100644 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
>>  create mode 12 platform/linux-generic/arch/powerpc/odp/cpu_arch.h
>>  create mode 12 platform/linux-generic/arch/powerpc/odp_cpu_arch.c
>>  create mode 100644 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
>>  create mode 100644 platform/linux-generic/arch/x86/odp_sysinfo_parse.c
>>
>> --
>> 2.1.4
>>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v7 API-NEXT 00/12] Separate CPU info codes into their platform files

2016-01-20 Thread Hongbo Zhang
add more details how I tested mips and ppc codes:

on my x86 machine, ./configure --host=powerpc, then arch/powerpc/* are compiled
and create a pseudo /tmp/cpuinfo following the powerpc format, and let
my code to parse this file instead of the /proc/cpuinfo on my x86

for mips, I did the same thing to verify the code (only have to
comment out some assembly code in odp_cpu_arch.c to pass compilation)

by this way I tested my patches on my x86, it should work I think.


On 20 January 2016 at 17:20,  <hongbo.zh...@linaro.org> wrote:
> From: Hongbo Zhang <hongbo.zh...@linaro.org>
>
> v6->v7 changes:
>  - update symlink in patch 7
>
> v5->v6 changes:
>  - eliminate checkpatch.pl warnings
>
> v4->v5 changes:
>  - rebase to latest api-next branch
>
> v3->v4 changes:
>  - update patch 9 of platform naming
>  - add new patch 12 to rename cpu_hz to cpu_hz_max
>
> v2->v3 changes:
> use "api: cpu:" tag in patch 8/11 title instead of "linux-generic: sysinfo"
>
> v1->v2 changes:
>  - don't create arch/arm/ since there isn't implementation now, use arch/linux
> as default choice
>  - create symlink to arch/linux/odp_cpu_cycles.c for powerpc, if absent this
> arch cannot be compiled
>  - add some clean-ups patches 8~11, these patches are against the previous 
> ones
> so send them together for better review and merge.
>
> v1 notes:
> This patch set separates the CPU info codes into their own platform sepcific
> files.
> It is common sence that the top general layer call an uniform interface to
> initialize some plarform specific data structures, and this uniform interface
> is implemented in their own platform specific files.
> This patch set makes it.
>
> Hongbo Zhang (12):
>   linux-generic: sysinfo: move cpu_arch_str to odp_system_info_t
>   linux-generic: sysinfo: use uniform call odp_sysinfo_parser
>   linux-generic: sysinfo: rename odp_cpu_hz_current with odp_ prefix
>   linux-generic: sysinfo: move x86 system info codes to its plarform
> file
>   linux-generic: sysinfo: move MIPS system info codes to its plarform
> file
>   linux-generic: sysinfo: move ARM system info codes to default arch
> file
>   linux-generic: sysinfo: move PowerPC system info codes to its plarform
> file
>   api: cpu: make frequency API return 0 on failure
>   linux-generic: sysinfo: set values for cpu_arch_str
>   linux-generic: sysinfo: apply per-CPU implementation to MIPS
>   linux-generic: sysinfo: apply per-CPU implementation to PowerPC
>   linux-generic: sysinfo: rename variable cpu_hz to cpu_hz_max
>
>  configure.ac   |   1 +
>  include/odp/api/cpu.h  |   4 +
>  platform/linux-generic/Makefile.am |  10 +-
>  .../linux-generic/arch/linux/odp_sysinfo_parse.c   |  19 ++
>  .../linux-generic/arch/mips64/odp_sysinfo_parse.c  |  64 ++
>  platform/linux-generic/arch/powerpc/odp/cpu_arch.h |   1 +
>  platform/linux-generic/arch/powerpc/odp_cpu_arch.c |   1 +
>  .../linux-generic/arch/powerpc/odp_sysinfo_parse.c |  63 ++
>  .../linux-generic/arch/x86/odp_sysinfo_parse.c |  73 +++
>  platform/linux-generic/include/odp_internal.h  |   7 +-
>  platform/linux-generic/odp_system_info.c   | 220 
> +
>  11 files changed, 246 insertions(+), 217 deletions(-)
>  create mode 100644 platform/linux-generic/arch/linux/odp_sysinfo_parse.c
>  create mode 100644 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
>  create mode 12 platform/linux-generic/arch/powerpc/odp/cpu_arch.h
>  create mode 12 platform/linux-generic/arch/powerpc/odp_cpu_arch.c
>  create mode 100644 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
>  create mode 100644 platform/linux-generic/arch/x86/odp_sysinfo_parse.c
>
> --
> 2.1.4
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v6 API-NEXT 01/12] linux-generic: sysinfo: move cpu_arch_str to odp_system_info_t

2016-01-19 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This is a pre-step for separating platform specific codes into their own
arch files.
Value of cpu_arch_str will be set later in separate arch parser code.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/include/odp_internal.h | 1 +
 platform/linux-generic/odp_system_info.c  | 5 -
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index cdbed7d..39e6f78 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -31,6 +31,7 @@ typedef struct {
uint64_t page_size;
int  cache_line_size;
int  cpu_count;
+   char cpu_arch_str[128];
char model_str[MAX_CPU_NUMBER][128];
 } odp_system_info_t;
 
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index bab3f44..f965023 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -26,7 +26,6 @@
 
 
 typedef struct {
-   const char *cpu_arch_str;
int (*cpuinfo_parser)(FILE *file, odp_system_info_t *sysinfo);
 
 } odp_compiler_info_t;
@@ -291,19 +290,15 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
 
 static odp_compiler_info_t compiler_info = {
#if defined __x86_64__ || defined __i386__
-   .cpu_arch_str = "x86",
.cpuinfo_parser = cpuinfo_x86
 
#elif defined __arm__ || defined __aarch64__
-   .cpu_arch_str = "arm",
.cpuinfo_parser = cpuinfo_arm
 
#elif defined __OCTEON__
-   .cpu_arch_str = "octeon",
.cpuinfo_parser = cpuinfo_octeon
 
#elif defined __powerpc__
-   .cpu_arch_str = "powerpc",
.cpuinfo_parser = cpuinfo_powerpc
 
#else
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v6 API-NEXT 03/12] linux-generic: sysinfo: rename odp_cpu_hz_current with odp_ prefix

2016-01-19 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This function will be moved to their own platform specific files too,
it is better to be named with a odp_ prefix.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/odp_system_info.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index b019f11..d05176c 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -136,7 +136,7 @@ static int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id)
+static uint64_t odp_cpu_hz_current(int id)
 {
char str[1024];
FILE *file;
@@ -180,7 +180,7 @@ static int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
+static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return -1;
 }
@@ -227,7 +227,7 @@ static int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
+static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return -1;
 }
@@ -273,7 +273,7 @@ static int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
+static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return -1;
 }
@@ -402,12 +402,12 @@ uint64_t odp_cpu_hz(void)
 {
int id = sched_getcpu();
 
-   return arch_cpu_hz_current(id);
+   return odp_cpu_hz_current(id);
 }
 
 uint64_t odp_cpu_hz_id(int id)
 {
-   return arch_cpu_hz_current(id);
+   return odp_cpu_hz_current(id);
 }
 
 uint64_t odp_cpu_hz_max(void)
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v6 API-NEXT 02/12] linux-generic: sysinfo: use uniform call odp_sysinfo_parser

2016-01-19 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

It is common way that the general top layer calls a uniform interface to
initialize data structrure for different plarform, this patch introduces
odp_sysinfo_parser() instead of using different interfaces for each
platform, and also removes using structure odp_compiler_info_t since both
members inside it become useless now.
This is still another pre-step for separating platform specific codes into
their own arch files.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/odp_system_info.c | 36 ++--
 1 file changed, 6 insertions(+), 30 deletions(-)

diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index f965023..b019f11 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -24,12 +24,6 @@
 #include 
 
 
-
-typedef struct {
-   int (*cpuinfo_parser)(FILE *file, odp_system_info_t *sysinfo);
-
-} odp_compiler_info_t;
-
 #define CACHE_LNSZ_FILE \
"/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size"
 
@@ -116,7 +110,7 @@ static int huge_page_size(void)
  */
 #if defined __x86_64__ || defined __i386__
 
-static int cpuinfo_x86(FILE *file, odp_system_info_t *sysinfo)
+static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
char str[1024];
char *pos;
@@ -180,8 +174,8 @@ static uint64_t arch_cpu_hz_current(int id)
 
 #elif defined __arm__ || defined __aarch64__
 
-static int cpuinfo_arm(FILE *file ODP_UNUSED,
-odp_system_info_t *sysinfo ODP_UNUSED)
+static int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
+ odp_system_info_t *sysinfo ODP_UNUSED)
 {
return 0;
 }
@@ -193,7 +187,7 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
 
 #elif defined __OCTEON__
 
-static int cpuinfo_octeon(FILE *file, odp_system_info_t *sysinfo)
+static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
char str[1024];
char *pos;
@@ -239,7 +233,7 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
 }
 
 #elif defined __powerpc__
-static int cpuinfo_powerpc(FILE *file, odp_system_info_t *sysinfo)
+static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
char str[1024];
char *pos;
@@ -288,24 +282,6 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
#error GCC target not found
 #endif
 
-static odp_compiler_info_t compiler_info = {
-   #if defined __x86_64__ || defined __i386__
-   .cpuinfo_parser = cpuinfo_x86
-
-   #elif defined __arm__ || defined __aarch64__
-   .cpuinfo_parser = cpuinfo_arm
-
-   #elif defined __OCTEON__
-   .cpuinfo_parser = cpuinfo_octeon
-
-   #elif defined __powerpc__
-   .cpuinfo_parser = cpuinfo_powerpc
-
-   #else
-   #error GCC target not found
-   #endif
-};
-
 
 #if defined __x86_64__ || defined __i386__ || defined __OCTEON__ || \
 defined __powerpc__
@@ -397,7 +373,7 @@ int odp_system_info_init(void)
return -1;
}
 
-   compiler_info.cpuinfo_parser(file, _global_data.system_info);
+   odp_cpuinfo_parser(file, _global_data.system_info);
 
fclose(file);
 
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v6 API-NEXT 00/12] Separate CPU info codes into their platform files

2016-01-19 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

v5->v6 changes:
 - eliminate checkpatch.pl warnings

v4->v5 changes:
 - rebase to latest api-next branch

v3->v4 changes:
 - update patch 9 of platform naming
 - add new patch 12 to rename cpu_hz to cpu_hz_max

v2->v3 changes:
use "api: cpu:" tag in patch 8/11 title instead of "linux-generic: sysinfo"

v1->v2 changes:
 - don't create arch/arm/ since there isn't implementation now, use arch/linux
as default choice
 - create symlink to arch/linux/odp_cpu_cycles.c for powerpc, if absent this
arch cannot be compiled
 - add some clean-ups patches 8~11, these patches are against the previous ones
so send them together for better review and merge.

v1 notes:
This patch set separates the CPU info codes into their own platform sepcific
files.
It is common sence that the top general layer call an uniform interface to
initialize some plarform specific data structures, and this uniform interface
is implemented in their own platform specific files.
This patch set makes it.

Hongbo Zhang (12):
  linux-generic: sysinfo: move cpu_arch_str to odp_system_info_t
  linux-generic: sysinfo: use uniform call odp_sysinfo_parser
  linux-generic: sysinfo: rename odp_cpu_hz_current with odp_ prefix
  linux-generic: sysinfo: move x86 system info codes to its plarform
file
  linux-generic: sysinfo: move MIPS system info codes to its plarform
file
  linux-generic: sysinfo: move ARM system info codes to default arch
file
  linux-generic: sysinfo: move PowerPC system info codes to its plarform
file
  api: cpu: make frequency API return 0 on failure
  linux-generic: sysinfo: set values for cpu_arch_str
  linux-generic: sysinfo: apply per-CPU implementation to MIPS
  linux-generic: sysinfo: apply per-CPU implementation to PowerPC
  linux-generic: sysinfo: rename variable cpu_hz to cpu_hz_max

 configure.ac   |   1 +
 include/odp/api/cpu.h  |   4 +
 platform/linux-generic/Makefile.am |  10 +-
 .../linux-generic/arch/linux/odp_sysinfo_parse.c   |  19 ++
 .../linux-generic/arch/mips64/odp_sysinfo_parse.c  |  64 ++
 platform/linux-generic/arch/powerpc/odp_cpu_arch.c |   1 +
 .../linux-generic/arch/powerpc/odp_sysinfo_parse.c |  63 ++
 .../linux-generic/arch/x86/odp_sysinfo_parse.c |  73 +++
 platform/linux-generic/include/odp_internal.h  |   7 +-
 platform/linux-generic/odp_system_info.c   | 220 +
 10 files changed, 245 insertions(+), 217 deletions(-)
 create mode 100644 platform/linux-generic/arch/linux/odp_sysinfo_parse.c
 create mode 100644 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
 create mode 12 platform/linux-generic/arch/powerpc/odp_cpu_arch.c
 create mode 100644 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
 create mode 100644 platform/linux-generic/arch/x86/odp_sysinfo_parse.c

-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v6 API-NEXT 04/12] linux-generic: sysinfo: move x86 system info codes to its plarform file

2016-01-19 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This patch moves the x86 system info codes into the newly added x86
specific platform file.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/Makefile.am |  6 +-
 .../linux-generic/arch/x86/odp_sysinfo_parse.c | 72 ++
 platform/linux-generic/include/odp_internal.h  |  4 ++
 platform/linux-generic/odp_system_info.c   | 68 +---
 4 files changed, 81 insertions(+), 69 deletions(-)
 create mode 100644 platform/linux-generic/arch/x86/odp_sysinfo_parse.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 9fbb3bd..de43eff 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -159,12 +159,14 @@ __LIB__libodp_la_SOURCES = \
   odp_traffic_mngr.c \
   odp_version.c \
   odp_weak.c \
-  arch/@ARCH@/odp_cpu_arch.c
+  arch/@ARCH@/odp_cpu_arch.c \
+  arch/@ARCH@/odp_sysinfo_parse.c
 
 EXTRA_DIST = \
 arch/linux/odp_cpu_arch.c \
 arch/mips64/odp_cpu_arch.c \
-arch/x86/odp_cpu_arch.c
+arch/x86/odp_cpu_arch.c \
+arch/x86/odp_sysinfo_parse.c
 
 if HAVE_PCAP
 __LIB__libodp_la_SOURCES += pktio/pcap.c
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
new file mode 100644
index 000..e2931cb
--- /dev/null
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -0,0 +1,72 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+
+int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
+{
+   char str[1024];
+   char *pos;
+   double ghz = 0.0;
+   uint64_t hz;
+   int id = 0;
+
+   while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
+   pos = strstr(str, "model name");
+   if (pos) {
+   pos = strchr(str, ':');
+   strncpy(sysinfo->model_str[id], pos + 2,
+   sizeof(sysinfo->model_str[id]));
+
+   pos = strchr(sysinfo->model_str[id], '@');
+   *(pos - 1) = '\0';
+   if (sscanf(pos, "@ %lfGHz", ) == 1) {
+   hz = (uint64_t)(ghz * 10.0);
+   sysinfo->cpu_hz[id] = hz;
+   }
+   id++;
+   }
+   }
+
+   return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id)
+{
+   char str[1024];
+   FILE *file;
+   int cpu;
+   char *pos;
+   double mhz = 0.0;
+
+   file = fopen("/proc/cpuinfo", "rt");
+
+   /* find the correct processor instance */
+   while (fgets(str, sizeof(str), file) != NULL) {
+   pos = strstr(str, "processor");
+   if (pos) {
+   if (sscanf(pos, "processor : %d", ) == 1)
+   if (cpu == id)
+   break;
+   }
+   }
+
+   /* extract the cpu current speed */
+   while (fgets(str, sizeof(str), file) != NULL) {
+   pos = strstr(str, "cpu MHz");
+   if (pos) {
+   if (sscanf(pos, "cpu MHz : %lf", ) == 1)
+   break;
+   }
+   }
+
+   fclose(file);
+   if (mhz)
+   return (uint64_t)(mhz * 100.0);
+
+   return -1;
+}
diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index 39e6f78..b527438 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -20,6 +20,7 @@ extern "C" {
 
 #include 
 #include 
+#include 
 
 extern __thread int __odp_errno;
 
@@ -108,6 +109,9 @@ int odp_tm_init_global(void);
 
 void _odp_flush_caches(void);
 
+int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo);
+uint64_t odp_cpu_hz_current(int id);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index d05176c..d2b0a68 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -108,71 +108,7 @@ static int huge_page_size(void)
 /*
  * HW specific /proc/cpuinfo file parsing
  */
-#if defined __x86_64__ || defined __i386__
-
-static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
-{
-   char str[1024];
-   char *pos;
-   double ghz = 0.0;
-   int id = 0;
-
-   while (fgets(str, 

[lng-odp] [PATCH v6 API-NEXT 07/12] linux-generic: sysinfo: move PowerPC system info codes to its plarform file

2016-01-19 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This patch moves the PowerPC system info codes into the newly added PowerPC
specific platform file.
This patch also creates syslink to arch/linux/odp_cpu_cycles.c for PowerPC.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 configure.ac   |  1 +
 platform/linux-generic/Makefile.am |  2 +
 platform/linux-generic/arch/powerpc/odp_cpu_arch.c |  1 +
 .../linux-generic/arch/powerpc/odp_sysinfo_parse.c | 52 +
 platform/linux-generic/odp_system_info.c   | 53 --
 5 files changed, 56 insertions(+), 53 deletions(-)
 create mode 12 platform/linux-generic/arch/powerpc/odp_cpu_arch.c
 create mode 100644 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c

diff --git a/configure.ac b/configure.ac
index 7e1678a..962ce93 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,6 +55,7 @@ AX_VALGRIND_CHECK
 AS_CASE([$host],
   [x86*], [ARCH=x86],
   [mips64*], [ARCH=mips64],
+  [powerpc*], [ARCH=powerpc],
   [ARCH=linux]
 )
 AC_SUBST([ARCH])
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index b737135..21cde8a 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -167,6 +167,8 @@ EXTRA_DIST = \
 arch/linux/odp_sysinfo_parse.c \
 arch/mips64/odp_cpu_arch.c \
 arch/mips64/odp_sysinfo_parse.c \
+arch/powerpc/odp_cpu_cycles.c \
+arch/powerpc/odp_sysinfo_parse.c \
 arch/x86/odp_cpu_arch.c \
 arch/x86/odp_sysinfo_parse.c
 
diff --git a/platform/linux-generic/arch/powerpc/odp_cpu_arch.c 
b/platform/linux-generic/arch/powerpc/odp_cpu_arch.c
new file mode 12
index 000..fddea05
--- /dev/null
+++ b/platform/linux-generic/arch/powerpc/odp_cpu_arch.c
@@ -0,0 +1 @@
+platform/linux-generic/arch/linux/odp_cpu_arch.c
\ No newline at end of file
diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
new file mode 100644
index 000..5a6063a
--- /dev/null
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -0,0 +1,52 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+
+int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
+{
+   char str[1024];
+   char *pos;
+   double mhz = 0.0;
+   int model = 0;
+   int count = 2;
+
+   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+   if (!mhz) {
+   pos = strstr(str, "clock");
+
+   if (pos)
+   if (sscanf(pos, "clock : %lf", ) == 1)
+   count--;
+   }
+
+   if (!model) {
+   pos = strstr(str, "cpu");
+
+   if (pos) {
+   int len;
+
+   pos = strchr(str, ':');
+   strncpy(sysinfo->model_str[0], pos + 2,
+   sizeof(sysinfo->model_str[0]));
+   len = strlen(sysinfo->model_str[0]);
+   sysinfo->model_str[0][len - 1] = 0;
+   model = 1;
+   count--;
+   }
+   }
+
+   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0);
+   }
+
+   return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
+{
+   return -1;
+}
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 27dad03..e4992b5 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -104,59 +104,6 @@ static int huge_page_size(void)
 }
 
 
-
-/*
- * HW specific /proc/cpuinfo file parsing
- */
-#if defined __powerpc__
-static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
-{
-   char str[1024];
-   char *pos;
-   double mhz = 0.0;
-   int model = 0;
-   int count = 2;
-
-   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
-   if (!mhz) {
-   pos = strstr(str, "clock");
-
-   if (pos) {
-   sscanf(pos, "clock : %lf", );
-   count--;
-   }
-   }
-
-   if (!model) {
-   pos = strstr(str, "cpu");
-
-   if (pos) {
-   int len;
-   pos = strchr(str, ':');
-   strncpy(sysinfo->model_str[0], pos + 2,
-

[lng-odp] [PATCH v6 API-NEXT 05/12] linux-generic: sysinfo: move MIPS system info codes to its plarform file

2016-01-19 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This patch moves the MIPS system info codes into the newly added MIPS
specific platform file.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/Makefile.am |  1 +
 .../linux-generic/arch/mips64/odp_sysinfo_parse.c  | 53 ++
 platform/linux-generic/odp_system_info.c   | 47 ---
 3 files changed, 54 insertions(+), 47 deletions(-)
 create mode 100644 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index de43eff..d3802f8 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -165,6 +165,7 @@ __LIB__libodp_la_SOURCES = \
 EXTRA_DIST = \
 arch/linux/odp_cpu_arch.c \
 arch/mips64/odp_cpu_arch.c \
+arch/mips64/odp_sysinfo_parse.c \
 arch/x86/odp_cpu_arch.c \
 arch/x86/odp_sysinfo_parse.c
 
diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
new file mode 100644
index 000..d855637
--- /dev/null
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -0,0 +1,53 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+
+int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
+{
+   char str[1024];
+   char *pos;
+   double mhz = 0.0;
+   int model = 0;
+   int count = 2;
+
+   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+   if (!mhz) {
+   pos = strstr(str, "BogoMIPS");
+
+   if (pos)
+   if (sscanf(pos, "BogoMIPS : %lf", ) == 1)
+   count--;
+   }
+
+   if (!model) {
+   pos = strstr(str, "cpu model");
+
+   if (pos) {
+   int len;
+
+   pos = strchr(str, ':');
+   strncpy(sysinfo->model_str[0], pos + 2,
+   sizeof(sysinfo->model_str[0]));
+   len = strlen(sysinfo->model_str[0]);
+   sysinfo->model_str[0][len - 1] = 0;
+   model = 1;
+   count--;
+   }
+   }
+   }
+
+   /* bogomips seems to be 2x freq */
+   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0 / 2.0);
+
+   return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
+{
+   return -1;
+}
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index d2b0a68..2b8e2b8 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -121,53 +121,6 @@ static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
return -1;
 }
 
-#elif defined __OCTEON__
-
-static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
-{
-   char str[1024];
-   char *pos;
-   double mhz = 0.0;
-   int model = 0;
-   int count = 2;
-
-   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
-   if (!mhz) {
-   pos = strstr(str, "BogoMIPS");
-
-   if (pos) {
-   sscanf(pos, "BogoMIPS : %lf", );
-   count--;
-   }
-   }
-
-   if (!model) {
-   pos = strstr(str, "cpu model");
-
-   if (pos) {
-   int len;
-   pos = strchr(str, ':');
-   strncpy(sysinfo->model_str[0], pos + 2,
-   sizeof(sysinfo->model_str[0]));
-   len = strlen(sysinfo->model_str[0]);
-   sysinfo->model_str[0][len - 1] = 0;
-   model = 1;
-   count--;
-   }
-   }
-   }
-
-   /* bogomips seems to be 2x freq */
-   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0 / 2.0);
-
-   return 0;
-}
-
-static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
-{
-   return -1;
-}
-
 #elif defined __powerpc__
 static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v6 API-NEXT 06/12] linux-generic: sysinfo: move ARM system info codes to default arch file

2016-01-19 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This patch moves the ARM system info codes into the general arch file,
ARM sysinfo isn't implemented now and there is no need to create specific
arch file for it, but this can serve as the default implementaton instead.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/Makefile.am|  1 +
 platform/linux-generic/arch/linux/odp_sysinfo_parse.c | 19 +++
 platform/linux-generic/odp_system_info.c  | 15 +--
 3 files changed, 21 insertions(+), 14 deletions(-)
 create mode 100644 platform/linux-generic/arch/linux/odp_sysinfo_parse.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index d3802f8..b737135 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -164,6 +164,7 @@ __LIB__libodp_la_SOURCES = \
 
 EXTRA_DIST = \
 arch/linux/odp_cpu_arch.c \
+arch/linux/odp_sysinfo_parse.c \
 arch/mips64/odp_cpu_arch.c \
 arch/mips64/odp_sysinfo_parse.c \
 arch/x86/odp_cpu_arch.c \
diff --git a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
new file mode 100644
index 000..881dd2d
--- /dev/null
+++ b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
@@ -0,0 +1,19 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+
+int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
+  odp_system_info_t *sysinfo ODP_UNUSED)
+{
+   return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
+{
+   return -1;
+}
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 2b8e2b8..27dad03 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -108,20 +108,7 @@ static int huge_page_size(void)
 /*
  * HW specific /proc/cpuinfo file parsing
  */
-#if defined __arm__ || defined __aarch64__
-
-static int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
- odp_system_info_t *sysinfo ODP_UNUSED)
-{
-   return 0;
-}
-
-static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
-{
-   return -1;
-}
-
-#elif defined __powerpc__
+#if defined __powerpc__
 static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
char str[1024];
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v6 API-NEXT 09/12] linux-generic: sysinfo: set values for cpu_arch_str

2016-01-19 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

The values of cpu_arch_str were deleted due to codes reorganization, this
patch adds values to them again.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c  | 1 +
 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c | 1 +
 platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index 8e8a9d0..eee29fd 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -15,6 +15,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
int model = 0;
int count = 2;
 
+   strcpy(sysinfo->cpu_arch_str, "mips64");
while (fgets(str, sizeof(str), file) != NULL && count > 0) {
if (!mhz) {
pos = strstr(str, "BogoMIPS");
diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index fadd1d1..d8bc5e7 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -15,6 +15,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
int model = 0;
int count = 2;
 
+   strcpy(sysinfo->cpu_arch_str, "powerpc");
while (fgets(str, sizeof(str), file) != NULL && count > 0) {
if (!mhz) {
pos = strstr(str, "clock");
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
index 831a53a..d2b3c80 100644
--- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -15,6 +15,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
uint64_t hz;
int id = 0;
 
+   strcpy(sysinfo->cpu_arch_str, "x86");
while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
pos = strstr(str, "model name");
if (pos) {
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v6 API-NEXT 08/12] api: cpu: make frequency API return 0 on failure

2016-01-19 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

All the CPU frequency API return value type is uint64_t, this patch makes
them return 0 on failure instead of -1.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 include/odp/api/cpu.h   | 4 
 platform/linux-generic/arch/linux/odp_sysinfo_parse.c   | 2 +-
 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c  | 2 +-
 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c | 2 +-
 platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 2 +-
 platform/linux-generic/odp_system_info.c| 2 +-
 6 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
index 4cbaf58..eaee24b 100644
--- a/include/odp/api/cpu.h
+++ b/include/odp/api/cpu.h
@@ -71,6 +71,7 @@ const char *odp_cpu_model_str_id(int id);
  * Returns current frequency of this CPU
  *
  * @return CPU frequency in Hz
+ * @retval 0 on failure
  */
 uint64_t odp_cpu_hz(void);
 
@@ -82,6 +83,7 @@ uint64_t odp_cpu_hz(void);
  * @param idCPU ID
  *
  * @return CPU frequency in Hz
+ * @retval 0 on failure
  */
 uint64_t odp_cpu_hz_id(int id);
 
@@ -91,6 +93,7 @@ uint64_t odp_cpu_hz_id(int id);
  * Returns maximum frequency of this CPU
  *
  * @return CPU frequency in Hz
+ * @retval 0 on failure
  */
 uint64_t odp_cpu_hz_max(void);
 
@@ -102,6 +105,7 @@ uint64_t odp_cpu_hz_max(void);
  * @param idCPU ID
  *
  * @return CPU frequency in Hz
+ * @retval 0 on failure
  */
 uint64_t odp_cpu_hz_max_id(int id);
 
diff --git a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
index 881dd2d..8ff6f48 100644
--- a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
@@ -15,5 +15,5 @@ int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
 
 uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
-   return -1;
+   return 0;
 }
diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index d855637..8e8a9d0 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -49,5 +49,5 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 
 uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
-   return -1;
+   return 0;
 }
diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index 5a6063a..fadd1d1 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -48,5 +48,5 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 
 uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
-   return -1;
+   return 0;
 }
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
index e2931cb..831a53a 100644
--- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -68,5 +68,5 @@ uint64_t odp_cpu_hz_current(int id)
if (mhz)
return (uint64_t)(mhz * 100.0);
 
-   return -1;
+   return 0;
 }
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index e4992b5..de187a0 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -241,7 +241,7 @@ uint64_t odp_cpu_hz_max_id(int id)
if (id >= 0 && id < MAX_CPU_NUMBER)
return odp_global_data.system_info.cpu_hz[id];
else
-   return -1;
+   return 0;
 }
 
 uint64_t odp_sys_huge_page_size(void)
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v6 API-NEXT 12/12] linux-generic: sysinfo: rename variable cpu_hz to cpu_hz_max

2016-01-19 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

The legacy variable cpu_hz holds the max frequency for odp_cpu_hz_max(),
so rename it to cpu_hz_max for better meaning.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c  | 2 +-
 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c | 2 +-
 platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 2 +-
 platform/linux-generic/include/odp_internal.h   | 2 +-
 platform/linux-generic/odp_system_info.c| 4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index c632352..5aec335 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -26,7 +26,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
if (sscanf(pos, "BogoMIPS : %lf", ) == 1) {
/* bogomips seems to be 2x freq */
hz = (uint64_t)(mhz * 100.0 / 2.0);
-   sysinfo->cpu_hz[id] = hz;
+   sysinfo->cpu_hz_max[id] = hz;
count--;
}
}
diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index a3734cf..82a5f05 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -25,7 +25,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
if (pos)
if (sscanf(pos, "clock : %lf", ) == 1) {
hz = (uint64_t)(mhz * 100.0);
-   sysinfo->cpu_hz[id] = hz;
+   sysinfo->cpu_hz_max[id] = hz;
count--;
}
}
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
index d2b3c80..816629d 100644
--- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -27,7 +27,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
*(pos - 1) = '\0';
if (sscanf(pos, "@ %lfGHz", ) == 1) {
hz = (uint64_t)(ghz * 10.0);
-   sysinfo->cpu_hz[id] = hz;
+   sysinfo->cpu_hz_max[id] = hz;
}
id++;
}
diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index b527438..aac2ba9 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -27,7 +27,7 @@ extern __thread int __odp_errno;
 #define MAX_CPU_NUMBER 128
 
 typedef struct {
-   uint64_t cpu_hz[MAX_CPU_NUMBER];
+   uint64_t cpu_hz_max[MAX_CPU_NUMBER];
uint64_t huge_page_size;
uint64_t page_size;
int  cache_line_size;
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index de187a0..2e602a3 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -168,7 +168,7 @@ static int systemcpu(odp_system_info_t *sysinfo)
ODP_DBG("Warning: use dummy values for freq and model string\n");
ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n;);
for (i = 0; i < MAX_CPU_NUMBER; i++) {
-   sysinfo->cpu_hz[i] = 14;
+   sysinfo->cpu_hz_max[i] = 14;
strcpy(sysinfo->model_str[i], "UNKNOWN");
}
 
@@ -239,7 +239,7 @@ uint64_t odp_cpu_hz_max(void)
 uint64_t odp_cpu_hz_max_id(int id)
 {
if (id >= 0 && id < MAX_CPU_NUMBER)
-   return odp_global_data.system_info.cpu_hz[id];
+   return odp_global_data.system_info.cpu_hz_max[id];
else
return 0;
 }
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v6 API-NEXT 11/12] linux-generic: sysinfo: apply per-CPU implementation to PowerPC

2016-01-19 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

When per-CPU framework was introduced, it was only implemented on x86,
for other platforms, only the model_str[0] and cpu_hz[0] are set to pass
compile, this patch set all values for model_str[] and cpu_hz[] on the
PowerPC platform.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 .../linux-generic/arch/powerpc/odp_sysinfo_parse.c | 24 +++---
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index d8bc5e7..a3734cf 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -12,17 +12,22 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
char str[1024];
char *pos;
double mhz = 0.0;
+   uint64_t hz;
int model = 0;
int count = 2;
+   int id = 0;
 
strcpy(sysinfo->cpu_arch_str, "powerpc");
-   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+   while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
if (!mhz) {
pos = strstr(str, "clock");
 
if (pos)
-   if (sscanf(pos, "clock : %lf", ) == 1)
+   if (sscanf(pos, "clock : %lf", ) == 1) {
+   hz = (uint64_t)(mhz * 100.0);
+   sysinfo->cpu_hz[id] = hz;
count--;
+   }
}
 
if (!model) {
@@ -32,16 +37,21 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
int len;
 
pos = strchr(str, ':');
-   strncpy(sysinfo->model_str[0], pos + 2,
-   sizeof(sysinfo->model_str[0]));
-   len = strlen(sysinfo->model_str[0]);
-   sysinfo->model_str[0][len - 1] = 0;
+   strncpy(sysinfo->model_str[id], pos + 2,
+   sizeof(sysinfo->model_str[id]));
+   len = strlen(sysinfo->model_str[id]);
+   sysinfo->model_str[id][len - 1] = 0;
model = 1;
count--;
}
}
 
-   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0);
+   if (count == 0) {
+   mhz = 0.0;
+   model = 0;
+   count = 2;
+   id++;
+   }
}
 
return 0;
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v6 API-NEXT 10/12] linux-generic: sysinfo: apply per-CPU implementation to MIPS

2016-01-19 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

When per-CPU framework was introduced, it was only implemented on x86,
for other platforms, only the model_str[0] and cpu_hz[0] are set to pass
compile, this patch set all values for model_str[] and cpu_hz[] on the
MIPS platform.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 .../linux-generic/arch/mips64/odp_sysinfo_parse.c  | 28 +++---
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index eee29fd..c632352 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -12,17 +12,23 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
char str[1024];
char *pos;
double mhz = 0.0;
+   uint64_t hz;
int model = 0;
int count = 2;
+   int id = 0;
 
strcpy(sysinfo->cpu_arch_str, "mips64");
-   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+   while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
if (!mhz) {
pos = strstr(str, "BogoMIPS");
 
if (pos)
-   if (sscanf(pos, "BogoMIPS : %lf", ) == 1)
+   if (sscanf(pos, "BogoMIPS : %lf", ) == 1) {
+   /* bogomips seems to be 2x freq */
+   hz = (uint64_t)(mhz * 100.0 / 2.0);
+   sysinfo->cpu_hz[id] = hz;
count--;
+   }
}
 
if (!model) {
@@ -32,18 +38,22 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
int len;
 
pos = strchr(str, ':');
-   strncpy(sysinfo->model_str[0], pos + 2,
-   sizeof(sysinfo->model_str[0]));
-   len = strlen(sysinfo->model_str[0]);
-   sysinfo->model_str[0][len - 1] = 0;
+   strncpy(sysinfo->model_str[id], pos + 2,
+   sizeof(sysinfo->model_str[id]));
+   len = strlen(sysinfo->model_str[id]);
+   sysinfo->model_str[id][len - 1] = 0;
model = 1;
count--;
}
}
-   }
 
-   /* bogomips seems to be 2x freq */
-   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0 / 2.0);
+   if (count == 0) {
+   mhz = 0.0;
+   model = 0;
+   count = 2;
+   id++;
+   }
+   }
 
return 0;
 }
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v5 API-NEXT 00/12] Separate CPU info codes into their platform files

2016-01-19 Thread Hongbo Zhang
I did checked this, most of the warnings lied in the legacy codes,
when I moved those codes, checkpatch warnings show up again, I assumed
these warnings acceptable, maybe we didn't use checkpatch at early
days.now will eliminate all of them anyway.

On 18 January 2016 at 20:43, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
> please run ./scripts/checkpatch.pl
> on patches, some of them have errors.
>
> Maxim.
>
>
> On 01/18/2016 13:09, hongbo.zh...@linaro.org wrote:
>>
>> From: Hongbo Zhang <hongbo.zh...@linaro.org>
>>
>> v4->v5 changes:
>>   - rebase to latest api-next branch
>>
>> v3->v4 changes:
>>   - update patch 9 of platform naming
>>   - add new patch 12 to rename cpu_hz to cpu_hz_max
>>
>> v2->v3 changes:
>> use "api: cpu:" tag in patch 8/11 title instead of "linux-generic:
>> sysinfo"
>>
>> v1->v2 changes:
>>   - don't create arch/arm/ since there isn't implementation now, use
>> arch/linux
>> as default choice
>>   - create symlink to arch/linux/odp_cpu_cycles.c for powerpc, if absent
>> this
>> arch cannot be compiled
>>   - add some clean-ups patches 8~11, these patches are against the
>> previous ones
>> so send them together for better review and merge.
>>
>> v1 notes:
>> This patch set separates the CPU info codes into their own platform
>> sepcific
>> files.
>> It is common sence that the top general layer call an uniform interface to
>> initialize some plarform specific data structures, and this uniform
>> interface
>> is implemented in their own platform specific files.
>> This patch set makes it.
>>
>> Hongbo Zhang (12):
>>linux-generic: sysinfo: move cpu_arch_str to odp_system_info_t
>>linux-generic: sysinfo: use uniform call odp_sysinfo_parser
>>linux-generic: sysinfo: rename odp_cpu_hz_current with odp_ prefix
>>linux-generic: sysinfo: move x86 system info codes to its plarform
>>  file
>>linux-generic: sysinfo: move MIPS system info codes to its plarform
>>  file
>>linux-generic: sysinfo: move ARM system info codes to default arch
>>  file
>>linux-generic: sysinfo: move PowerPC system info codes to its plarform
>>  file
>>api: cpu: make frequency API return 0 on failure
>>linux-generic: sysinfo: set values for cpu_arch_str
>>linux-generic: sysinfo: apply per-CPU implementation to MIPS
>>linux-generic: sysinfo: apply per-CPU implementation to PowerPC
>>linux-generic: sysinfo: rename variable cpu_hz to cpu_hz_max
>>
>>   configure.ac   |   1 +
>>   include/odp/api/cpu.h  |   4 +
>>   platform/linux-generic/Makefile.am |  10 +-
>>   .../linux-generic/arch/linux/odp_sysinfo_parse.c   |  19 ++
>>   .../linux-generic/arch/mips64/odp_sysinfo_parse.c  |  62 ++
>>   platform/linux-generic/arch/powerpc/odp_cpu_arch.c |   1 +
>>   .../linux-generic/arch/powerpc/odp_sysinfo_parse.c |  62 ++
>>   .../linux-generic/arch/x86/odp_sysinfo_parse.c |  72 +++
>>   platform/linux-generic/include/odp_internal.h  |   7 +-
>>   platform/linux-generic/odp_system_info.c   | 220
>> +
>>   10 files changed, 241 insertions(+), 217 deletions(-)
>>   create mode 100644 platform/linux-generic/arch/linux/odp_sysinfo_parse.c
>>   create mode 100644
>> platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
>>   create mode 12 platform/linux-generic/arch/powerpc/odp_cpu_arch.c
>>   create mode 100644
>> platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
>>   create mode 100644 platform/linux-generic/arch/x86/odp_sysinfo_parse.c
>>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v6 API-NEXT 00/12] Separate CPU info codes into their platform files

2016-01-19 Thread Hongbo Zhang
There are still some checkpatch warnings of patches 6 and 7, but they
should be due some defect of checkpatch.pl script and can be ignored I
think.

On 19 January 2016 at 18:17,  <hongbo.zh...@linaro.org> wrote:
> From: Hongbo Zhang <hongbo.zh...@linaro.org>
>
> v5->v6 changes:
>  - eliminate checkpatch.pl warnings
>
> v4->v5 changes:
>  - rebase to latest api-next branch
>
> v3->v4 changes:
>  - update patch 9 of platform naming
>  - add new patch 12 to rename cpu_hz to cpu_hz_max
>
> v2->v3 changes:
> use "api: cpu:" tag in patch 8/11 title instead of "linux-generic: sysinfo"
>
> v1->v2 changes:
>  - don't create arch/arm/ since there isn't implementation now, use arch/linux
> as default choice
>  - create symlink to arch/linux/odp_cpu_cycles.c for powerpc, if absent this
> arch cannot be compiled
>  - add some clean-ups patches 8~11, these patches are against the previous 
> ones
> so send them together for better review and merge.
>
> v1 notes:
> This patch set separates the CPU info codes into their own platform sepcific
> files.
> It is common sence that the top general layer call an uniform interface to
> initialize some plarform specific data structures, and this uniform interface
> is implemented in their own platform specific files.
> This patch set makes it.
>
> Hongbo Zhang (12):
>   linux-generic: sysinfo: move cpu_arch_str to odp_system_info_t
>   linux-generic: sysinfo: use uniform call odp_sysinfo_parser
>   linux-generic: sysinfo: rename odp_cpu_hz_current with odp_ prefix
>   linux-generic: sysinfo: move x86 system info codes to its plarform
> file
>   linux-generic: sysinfo: move MIPS system info codes to its plarform
> file
>   linux-generic: sysinfo: move ARM system info codes to default arch
> file
>   linux-generic: sysinfo: move PowerPC system info codes to its plarform
> file
>   api: cpu: make frequency API return 0 on failure
>   linux-generic: sysinfo: set values for cpu_arch_str
>   linux-generic: sysinfo: apply per-CPU implementation to MIPS
>   linux-generic: sysinfo: apply per-CPU implementation to PowerPC
>   linux-generic: sysinfo: rename variable cpu_hz to cpu_hz_max
>
>  configure.ac   |   1 +
>  include/odp/api/cpu.h  |   4 +
>  platform/linux-generic/Makefile.am |  10 +-
>  .../linux-generic/arch/linux/odp_sysinfo_parse.c   |  19 ++
>  .../linux-generic/arch/mips64/odp_sysinfo_parse.c  |  64 ++
>  platform/linux-generic/arch/powerpc/odp_cpu_arch.c |   1 +
>  .../linux-generic/arch/powerpc/odp_sysinfo_parse.c |  63 ++
>  .../linux-generic/arch/x86/odp_sysinfo_parse.c |  73 +++
>  platform/linux-generic/include/odp_internal.h  |   7 +-
>  platform/linux-generic/odp_system_info.c   | 220 
> +
>  10 files changed, 245 insertions(+), 217 deletions(-)
>  create mode 100644 platform/linux-generic/arch/linux/odp_sysinfo_parse.c
>  create mode 100644 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
>  create mode 12 platform/linux-generic/arch/powerpc/odp_cpu_arch.c
>  create mode 100644 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
>  create mode 100644 platform/linux-generic/arch/x86/odp_sysinfo_parse.c
>
> --
> 2.1.4
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v6 API-NEXT 00/12] Separate CPU info codes into their platform files

2016-01-19 Thread Hongbo Zhang
This "WARNING: adding a line without newline at end of file" comes from patch 7:

--- /dev/null
+++ b/platform/linux-generic/arch/powerpc/odp_cpu_arch.c
@@ -0,0 +1 @@
+platform/linux-generic/arch/linux/odp_cpu_arch.c
\ No newline at end of file

when adding new symlink in patch, there is such a warning, it is not
an effective warning I think.


Yes the symlink should be changed to ../linux/odp_cpu_arch.c


I don't have full environment to verify codes of mips and powerpc, so
I tested my odp_sysinfo_parse.c on my x86 platform this way:
replace arch/x86/odp_sysinfo_parse.c with mips/odp_sysinfo_parse.c or
powerpc/odp_sysinfo_parse.c, and let them to parse a fake /tmp/cpuinfo
instead of /proc/cpuinfo, so I verified logic of my codes, but symlink
compilation was missed.

Will correct the symlink.


On 19 January 2016 at 20:44, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
> did you compile it for powerpc?
>
> there is wrong symlink.
>
> And also checkpatch warns about empty line at the end of file.
>
> Maxim.
>
>
> On 01/19/2016 13:22, Hongbo Zhang wrote:
>>
>> There are still some checkpatch warnings of patches 6 and 7, but they
>> should be due some defect of checkpatch.pl script and can be ignored I
>> think.
>>
>> On 19 January 2016 at 18:17,  <hongbo.zh...@linaro.org> wrote:
>>>
>>> From: Hongbo Zhang <hongbo.zh...@linaro.org>
>>>
>>> v5->v6 changes:
>>>   - eliminate checkpatch.pl warnings
>>>
>>> v4->v5 changes:
>>>   - rebase to latest api-next branch
>>>
>>> v3->v4 changes:
>>>   - update patch 9 of platform naming
>>>   - add new patch 12 to rename cpu_hz to cpu_hz_max
>>>
>>> v2->v3 changes:
>>> use "api: cpu:" tag in patch 8/11 title instead of "linux-generic:
>>> sysinfo"
>>>
>>> v1->v2 changes:
>>>   - don't create arch/arm/ since there isn't implementation now, use
>>> arch/linux
>>> as default choice
>>>   - create symlink to arch/linux/odp_cpu_cycles.c for powerpc, if absent
>>> this
>>> arch cannot be compiled
>>>   - add some clean-ups patches 8~11, these patches are against the
>>> previous ones
>>> so send them together for better review and merge.
>>>
>>> v1 notes:
>>> This patch set separates the CPU info codes into their own platform
>>> sepcific
>>> files.
>>> It is common sence that the top general layer call an uniform interface
>>> to
>>> initialize some plarform specific data structures, and this uniform
>>> interface
>>> is implemented in their own platform specific files.
>>> This patch set makes it.
>>>
>>> Hongbo Zhang (12):
>>>linux-generic: sysinfo: move cpu_arch_str to odp_system_info_t
>>>linux-generic: sysinfo: use uniform call odp_sysinfo_parser
>>>linux-generic: sysinfo: rename odp_cpu_hz_current with odp_ prefix
>>>linux-generic: sysinfo: move x86 system info codes to its plarform
>>>  file
>>>linux-generic: sysinfo: move MIPS system info codes to its plarform
>>>  file
>>>linux-generic: sysinfo: move ARM system info codes to default arch
>>>  file
>>>linux-generic: sysinfo: move PowerPC system info codes to its plarform
>>>  file
>>>api: cpu: make frequency API return 0 on failure
>>>linux-generic: sysinfo: set values for cpu_arch_str
>>>linux-generic: sysinfo: apply per-CPU implementation to MIPS
>>>linux-generic: sysinfo: apply per-CPU implementation to PowerPC
>>>linux-generic: sysinfo: rename variable cpu_hz to cpu_hz_max
>>>
>>>   configure.ac   |   1 +
>>>   include/odp/api/cpu.h  |   4 +
>>>   platform/linux-generic/Makefile.am |  10 +-
>>>   .../linux-generic/arch/linux/odp_sysinfo_parse.c   |  19 ++
>>>   .../linux-generic/arch/mips64/odp_sysinfo_parse.c  |  64 ++
>>>   platform/linux-generic/arch/powerpc/odp_cpu_arch.c |   1 +
>>>   .../linux-generic/arch/powerpc/odp_sysinfo_parse.c |  63 ++
>>>   .../linux-generic/arch/x86/odp_sysinfo_parse.c |  73 +++
>>>   platform/linux-generic/include/odp_internal.h  |   7 +-
>>>   platform/linux-generic/odp_system_info.c   | 220
>>> +
>>>   10 files changed, 245 insertions(+), 217 deletions(-)
>>>   create mode 100644
>>> platform/linux-generic/arch/linux/odp_sysinf

[lng-odp] [PATCH v5 API-NEXT 12/12] linux-generic: sysinfo: rename variable cpu_hz to cpu_hz_max

2016-01-18 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

The legacy variable cpu_hz holds the max frequency for odp_cpu_hz_max(),
so rename it to cpu_hz_max for better meaning.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c  | 2 +-
 platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c | 2 +-
 platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 3 ++-
 platform/linux-generic/include/odp_internal.h   | 2 +-
 platform/linux-generic/odp_system_info.c| 4 ++--
 5 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index 88c2066..c83d1d1 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -24,7 +24,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
if (pos) {
sscanf(pos, "BogoMIPS : %lf", );
/* bogomips seems to be 2x freq */
-   sysinfo->cpu_hz[id] = \
+   sysinfo->cpu_hz_max[id] = \
(uint64_t)(mhz * 100.0 / 2.0);
count--;
}
diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index 1d122cc..9995b05 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -23,7 +23,7 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 
if (pos) {
sscanf(pos, "clock : %lf", );
-   sysinfo->cpu_hz[id] = \
+   sysinfo->cpu_hz_max[id] = \
(uint64_t)(mhz * 100.0);
count--;
}
diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
index aeb3d8f..e20ffcc 100644
--- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -25,7 +25,8 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
pos = strchr(sysinfo->model_str[id], '@');
*(pos - 1) = '\0';
if (sscanf(pos, "@ %lfGHz", ) == 1)
-   sysinfo->cpu_hz[id] = (uint64_t)(ghz * 
10.0);
+   sysinfo->cpu_hz_max[id] = \
+   (uint64_t)(ghz * 10.0);
 
id++;
}
diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index d3cde5f..b30c0b3 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -27,7 +27,7 @@ extern __thread int __odp_errno;
 #define MAX_CPU_NUMBER 128
 
 typedef struct {
-   uint64_t cpu_hz[MAX_CPU_NUMBER];
+   uint64_t cpu_hz_max[MAX_CPU_NUMBER];
uint64_t huge_page_size;
uint64_t page_size;
int  cache_line_size;
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index c9cdcb4..36c1a77 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -168,7 +168,7 @@ static int systemcpu(odp_system_info_t *sysinfo)
ODP_DBG("Warning: use dummy values for freq and model string\n");
ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n;);
for (i = 0; i < MAX_CPU_NUMBER; i++) {
-   sysinfo->cpu_hz[i] = 14;
+   sysinfo->cpu_hz_max[i] = 14;
strcpy(sysinfo->model_str[i], "UNKNOWN");
}
 
@@ -231,7 +231,7 @@ uint64_t odp_cpu_hz_max(void)
 uint64_t odp_cpu_hz_max_id(int id)
 {
if (id >= 0 && id < MAX_CPU_NUMBER)
-   return odp_global_data.system_info.cpu_hz[id];
+   return odp_global_data.system_info.cpu_hz_max[id];
else
return 0;
 }
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v5 API-NEXT 11/12] linux-generic: sysinfo: apply per-CPU implementation to PowerPC

2016-01-18 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

When per-CPU framework was introduced, it was only implemented on x86,
for other platforms, only the model_str[0] and cpu_hz[0] are set to pass
compile, this patch set all values for model_str[] and cpu_hz[] on the
PowerPC platform.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 .../linux-generic/arch/powerpc/odp_sysinfo_parse.c   | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
index e221f10..1d122cc 100644
--- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c
@@ -14,14 +14,17 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
double mhz = 0.0;
int model = 0;
int count = 2;
+   int id = 0;
 
strcpy(sysinfo->cpu_arch_str, "powerpc");
-   while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+   while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
if (!mhz) {
pos = strstr(str, "clock");
 
if (pos) {
sscanf(pos, "clock : %lf", );
+   sysinfo->cpu_hz[id] = \
+   (uint64_t)(mhz * 100.0);
count--;
}
}
@@ -33,16 +36,21 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
int len;
 
pos = strchr(str, ':');
-   strncpy(sysinfo->model_str[0], pos + 2,
-   sizeof(sysinfo->model_str[0]));
-   len = strlen(sysinfo->model_str[0]);
-   sysinfo->model_str[0][len - 1] = 0;
+   strncpy(sysinfo->model_str[id], pos + 2,
+   sizeof(sysinfo->model_str[id]));
+   len = strlen(sysinfo->model_str[id]);
+   sysinfo->model_str[id][len - 1] = 0;
model = 1;
count--;
}
}
 
-   sysinfo->cpu_hz[0] = (uint64_t)(mhz * 100.0);
+   if (count == 0) {
+   mhz = 0.0;
+   model = 0;
+   count = 2;
+   id++;
+   }
}
 
return 0;
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v5 API-NEXT 03/12] linux-generic: sysinfo: rename odp_cpu_hz_current with odp_ prefix

2016-01-18 Thread hongbo . zhang
From: Hongbo Zhang <hongbo.zh...@linaro.org>

This function will be moved to their own platform specific files too,
it is better to be named with a odp_ prefix.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/odp_system_info.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index a829b01..449e500 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -136,7 +136,7 @@ static int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id)
+static uint64_t odp_cpu_hz_current(int id)
 {
char str[1024];
FILE *file;
@@ -180,7 +180,7 @@ odp_system_info_t *sysinfo ODP_UNUSED)
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
+static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return -1;
 }
@@ -227,7 +227,7 @@ static int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
+static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return -1;
 }
@@ -273,7 +273,7 @@ static int odp_cpuinfo_parser(FILE *file, odp_system_info_t 
*sysinfo)
return 0;
 }
 
-static uint64_t arch_cpu_hz_current(int id ODP_UNUSED)
+static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
 {
return -1;
 }
@@ -394,12 +394,12 @@ uint64_t odp_cpu_hz(void)
 {
int id = sched_getcpu();
 
-   return arch_cpu_hz_current(id);
+   return odp_cpu_hz_current(id);
 }
 
 uint64_t odp_cpu_hz_id(int id)
 {
-   return arch_cpu_hz_current(id);
+   return odp_cpu_hz_current(id);
 }
 
 uint64_t odp_cpu_hz_max(void)
-- 
2.1.4

___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


  1   2   3   >