On 06.11.15 12:44, hongbo.zh...@freescale.com wrote:
From: Hongbo Zhang <hongbo.zh...@linaro.org>

In the default dummy function systemcpu(), only cpu_hz[0] and model_str[0]
are set to dummy values, then in the validation code if iterate each CPU,
cores other than core 0 report failure, this patchs pad all the arrays to
default values to pass validation.

For bug: https://bugs.linaro.org/show_bug.cgi?id=1870

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>


My opinion is to:
- deprecate odp_cpu_hz_max(), odp_cpu_hz_max_id(), odp_cpu_hz_id() calls.
- delete validation tests for them
- make odp_cpu_hz_max() to local for linux-generic cpu cycle API
- choose some approach to get freq close to max with existing approaches (w/o 
kernel modifiactons)
- for ARM this parameter is not needed as number of CPU cycles is get directly 
from register
(I will send patch soon, but access should be enabled by implementor,
if access is not enabled some general approach should be used, but we need to 
think how to check if access is enabled)
and cpu_freq_max is not used to figure out fake number of cpu cycles.


But as temp fix can be added. I will try eliminate this impact anyway.
So,
Reviewed-by: Ivan Khoronzhuk <ivan.khoronz...@linaro.org>

---
  platform/linux-generic/odp_system_info.c | 11 ++++++++---
  1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 8bd1584..944d29f 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -358,7 +358,7 @@ static int systemcpu(odp_system_info_t *sysinfo)

  static int systemcpu(odp_system_info_t *sysinfo)
  {
-       int ret;
+       int ret, i;

        ret = sysconf_cpu_count();
        if (ret == 0) {
@@ -371,10 +371,15 @@ static int systemcpu(odp_system_info_t *sysinfo)
        sysinfo->huge_page_size = huge_page_size();

        /* Dummy values */
-       sysinfo->cpu_hz[0]       = 1400000000;
        sysinfo->cache_line_size = 64;

-       strncpy(sysinfo->model_str[0], "UNKNOWN", sizeof(sysinfo->model_str));
+       for (i = 0; i < MAX_CPU_NUMBER; i++) {
+               sysinfo->cpu_hz[i] = 1400000000;
+               ODP_DBG("temporary dummy CPU frequency\n");
+
+               strcpy(sysinfo->model_str[i], "UNKNOWN");
+               ODP_DBG("temporary dummy CPU model string\n");
+       }

        return 0;
  }


--
Regards,
Ivan Khoronzhuk
_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to