Message ID | 1427927394-15702-1-git-send-email-mike.holmes@linaro.org |
---|---|
State | Accepted |
Commit | 0e30b67b45792daa36d3d1d6de1bb4de84b9c64f |
Headers | show |
ping - this consolidates the global data making the helper and other platform specific clean up easier. On 1 April 2015 at 18:29, Mike Holmes <mike.holmes@linaro.org> wrote: > Don't store ODP global data in multiple locations, gather global data > into odp_global_data. > Move the static odp_system_info into odp_global_data > > Signed-off-by: Mike Holmes <mike.holmes@linaro.org> > --- > platform/linux-generic/include/odp_internal.h | 11 +++++++++ > platform/linux-generic/odp_system_info.c | 33 > +++++++++------------------ > 2 files changed, 22 insertions(+), 22 deletions(-) > > diff --git a/platform/linux-generic/include/odp_internal.h > b/platform/linux-generic/include/odp_internal.h > index 0961cce..64dee42 100644 > --- a/platform/linux-generic/include/odp_internal.h > +++ b/platform/linux-generic/include/odp_internal.h > @@ -22,9 +22,20 @@ extern "C" { > > extern __thread int __odp_errno; > > +typedef struct { > + uint64_t cpu_hz; > + uint64_t huge_page_size; > + uint64_t page_size; > + int cache_line_size; > + int cpu_count; > + char model_str[128]; > + > +} odp_system_info_t; > + > struct odp_global_data_s { > odp_log_func_t log_fn; > odp_abort_func_t abort_fn; > + odp_system_info_t odp_system_info; > }; > > extern struct odp_global_data_s odp_global_data; > diff --git a/platform/linux-generic/odp_system_info.c > b/platform/linux-generic/odp_system_info.c > index 6b6c723..cae310f 100644 > --- a/platform/linux-generic/odp_system_info.c > +++ b/platform/linux-generic/odp_system_info.c > @@ -20,15 +20,7 @@ > #include <sys/types.h> > #include <dirent.h> > > -typedef struct { > - uint64_t cpu_hz; > - uint64_t huge_page_size; > - uint64_t page_size; > - int cache_line_size; > - int cpu_count; > - char model_str[128]; > > -} odp_system_info_t; > > typedef struct { > const char *cpu_arch_str; > @@ -36,9 +28,6 @@ typedef struct { > > } odp_compiler_info_t; > > -static odp_system_info_t odp_system_info; > - > - > #define CACHE_LNSZ_FILE \ > "/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size" > > @@ -310,7 +299,7 @@ static int systemcpu(odp_system_info_t *sysinfo) > return -1; > } > > - odp_system_info.huge_page_size = huge_page_size(); > + odp_global_data.odp_system_info.huge_page_size = huge_page_size(); > > return 0; > } > @@ -354,9 +343,9 @@ int odp_system_info_init(void) > { > FILE *file; > > - memset(&odp_system_info, 0, sizeof(odp_system_info_t)); > + memset(&odp_global_data.odp_system_info, 0, > sizeof(odp_system_info_t)); > > - odp_system_info.page_size = ODP_PAGE_SIZE; > + odp_global_data.odp_system_info.page_size = ODP_PAGE_SIZE; > > file = fopen("/proc/cpuinfo", "rt"); > if (file == NULL) { > @@ -364,11 +353,11 @@ int odp_system_info_init(void) > return -1; > } > > - compiler_info.cpuinfo_parser(file, &odp_system_info); > + compiler_info.cpuinfo_parser(file, > &odp_global_data.odp_system_info); > > fclose(file); > > - if (systemcpu(&odp_system_info)) { > + if (systemcpu(&odp_global_data.odp_system_info)) { > ODP_ERR("systemcpu failed\n"); > return -1; > } > @@ -383,30 +372,30 @@ int odp_system_info_init(void) > */ > uint64_t odp_sys_cpu_hz(void) > { > - return odp_system_info.cpu_hz; > + return odp_global_data.odp_system_info.cpu_hz; > } > > uint64_t odp_sys_huge_page_size(void) > { > - return odp_system_info.huge_page_size; > + return odp_global_data.odp_system_info.huge_page_size; > } > > uint64_t odp_sys_page_size(void) > { > - return odp_system_info.page_size; > + return odp_global_data.odp_system_info.page_size; > } > > const char *odp_sys_cpu_model_str(void) > { > - return odp_system_info.model_str; > + return odp_global_data.odp_system_info.model_str; > } > > int odp_sys_cache_line_size(void) > { > - return odp_system_info.cache_line_size; > + return odp_global_data.odp_system_info.cache_line_size; > } > > int odp_cpu_count(void) > { > - return odp_system_info.cpu_count; > + return odp_global_data.odp_system_info.cpu_count; > } > -- > 2.1.0 > >
On 04/07/15 18:24, Mike Holmes wrote: > ping - this consolidates the global data making the helper and other > platform specific clean up easier. > If it was one patch, not 2 it will be absolutely the same number of changes. I would merge that to 1 on applying. Maxim. > On 1 April 2015 at 18:29, Mike Holmes <mike.holmes@linaro.org > <mailto:mike.holmes@linaro.org>> wrote: > > Don't store ODP global data in multiple locations, gather global data > into odp_global_data. > Move the static odp_system_info into odp_global_data > > Signed-off-by: Mike Holmes <mike.holmes@linaro.org > <mailto:mike.holmes@linaro.org>> > --- > platform/linux-generic/include/odp_internal.h | 11 +++++++++ > platform/linux-generic/odp_system_info.c | 33 > +++++++++------------------ > 2 files changed, 22 insertions(+), 22 deletions(-) > > diff --git a/platform/linux-generic/include/odp_internal.h > b/platform/linux-generic/include/odp_internal.h > index 0961cce..64dee42 100644 > --- a/platform/linux-generic/include/odp_internal.h > +++ b/platform/linux-generic/include/odp_internal.h > @@ -22,9 +22,20 @@ extern "C" { > > extern __thread int __odp_errno; > > +typedef struct { > + uint64_t cpu_hz; > + uint64_t huge_page_size; > + uint64_t page_size; > + int cache_line_size; > + int cpu_count; > + char model_str[128]; > + > +} odp_system_info_t; > + > struct odp_global_data_s { > odp_log_func_t log_fn; > odp_abort_func_t abort_fn; > + odp_system_info_t odp_system_info; > }; > > extern struct odp_global_data_s odp_global_data; > diff --git a/platform/linux-generic/odp_system_info.c > b/platform/linux-generic/odp_system_info.c > index 6b6c723..cae310f 100644 > --- a/platform/linux-generic/odp_system_info.c > +++ b/platform/linux-generic/odp_system_info.c > @@ -20,15 +20,7 @@ > #include <sys/types.h> > #include <dirent.h> > > -typedef struct { > - uint64_t cpu_hz; > - uint64_t huge_page_size; > - uint64_t page_size; > - int cache_line_size; > - int cpu_count; > - char model_str[128]; > > -} odp_system_info_t; > > typedef struct { > const char *cpu_arch_str; > @@ -36,9 +28,6 @@ typedef struct { > > } odp_compiler_info_t; > > -static odp_system_info_t odp_system_info; > - > - > #define CACHE_LNSZ_FILE \ > "/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size" > > @@ -310,7 +299,7 @@ static int systemcpu(odp_system_info_t *sysinfo) > return -1; > } > > - odp_system_info.huge_page_size = huge_page_size(); > + odp_global_data.odp_system_info.huge_page_size = > huge_page_size(); > > return 0; > } > @@ -354,9 +343,9 @@ int odp_system_info_init(void) > { > FILE *file; > > - memset(&odp_system_info, 0, sizeof(odp_system_info_t)); > + memset(&odp_global_data.odp_system_info, 0, > sizeof(odp_system_info_t)); > > - odp_system_info.page_size = ODP_PAGE_SIZE; > + odp_global_data.odp_system_info.page_size = ODP_PAGE_SIZE; > > file = fopen("/proc/cpuinfo", "rt"); > if (file == NULL) { > @@ -364,11 +353,11 @@ int odp_system_info_init(void) > return -1; > } > > - compiler_info.cpuinfo_parser(file, &odp_system_info); > + compiler_info.cpuinfo_parser(file, > &odp_global_data.odp_system_info); > > fclose(file); > > - if (systemcpu(&odp_system_info)) { > + if (systemcpu(&odp_global_data.odp_system_info)) { > ODP_ERR("systemcpu failed\n"); > return -1; > } > @@ -383,30 +372,30 @@ int odp_system_info_init(void) > */ > uint64_t odp_sys_cpu_hz(void) > { > - return odp_system_info.cpu_hz; > + return odp_global_data.odp_system_info.cpu_hz; > } > > uint64_t odp_sys_huge_page_size(void) > { > - return odp_system_info.huge_page_size; > + return odp_global_data.odp_system_info.huge_page_size; > } > > uint64_t odp_sys_page_size(void) > { > - return odp_system_info.page_size; > + return odp_global_data.odp_system_info.page_size; > } > > const char *odp_sys_cpu_model_str(void) > { > - return odp_system_info.model_str; > + return odp_global_data.odp_system_info.model_str; > } > > int odp_sys_cache_line_size(void) > { > - return odp_system_info.cache_line_size; > + return odp_global_data.odp_system_info.cache_line_size; > } > > int odp_cpu_count(void) > { > - return odp_system_info.cpu_count; > + return odp_global_data.odp_system_info.cpu_count; > } > -- > 2.1.0 > > > > > -- > Mike Holmes > Technical Manager - Linaro Networking Group > Linaro.org <http://www.linaro.org/>***│ *Open source software for ARM SoCs > > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp
On 04/02/2015 01:29 AM, Mike Holmes wrote: > Don't store ODP global data in multiple locations, gather global data > into odp_global_data. > Move the static odp_system_info into odp_global_data > > Signed-off-by: Mike Holmes <mike.holmes@linaro.org> > --- > platform/linux-generic/include/odp_internal.h | 11 +++++++++ > platform/linux-generic/odp_system_info.c | 33 +++++++++------------------ > 2 files changed, 22 insertions(+), 22 deletions(-) If two patches merged together Reviewed-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
Merged, Maxim. On 04/08/15 11:43, Taras Kondratiuk wrote: > On 04/02/2015 01:29 AM, Mike Holmes wrote: >> Don't store ODP global data in multiple locations, gather global data >> into odp_global_data. >> Move the static odp_system_info into odp_global_data >> >> Signed-off-by: Mike Holmes <mike.holmes@linaro.org> >> --- >> platform/linux-generic/include/odp_internal.h | 11 +++++++++ >> platform/linux-generic/odp_system_info.c | 33 >> +++++++++------------------ >> 2 files changed, 22 insertions(+), 22 deletions(-) > > If two patches merged together > Reviewed-by: Taras Kondratiuk <taras.kondratiuk@linaro.org> > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp
diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index 0961cce..64dee42 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -22,9 +22,20 @@ extern "C" { extern __thread int __odp_errno; +typedef struct { + uint64_t cpu_hz; + uint64_t huge_page_size; + uint64_t page_size; + int cache_line_size; + int cpu_count; + char model_str[128]; + +} odp_system_info_t; + struct odp_global_data_s { odp_log_func_t log_fn; odp_abort_func_t abort_fn; + odp_system_info_t odp_system_info; }; extern struct odp_global_data_s odp_global_data; diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index 6b6c723..cae310f 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -20,15 +20,7 @@ #include <sys/types.h> #include <dirent.h> -typedef struct { - uint64_t cpu_hz; - uint64_t huge_page_size; - uint64_t page_size; - int cache_line_size; - int cpu_count; - char model_str[128]; -} odp_system_info_t; typedef struct { const char *cpu_arch_str; @@ -36,9 +28,6 @@ typedef struct { } odp_compiler_info_t; -static odp_system_info_t odp_system_info; - - #define CACHE_LNSZ_FILE \ "/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size" @@ -310,7 +299,7 @@ static int systemcpu(odp_system_info_t *sysinfo) return -1; } - odp_system_info.huge_page_size = huge_page_size(); + odp_global_data.odp_system_info.huge_page_size = huge_page_size(); return 0; } @@ -354,9 +343,9 @@ int odp_system_info_init(void) { FILE *file; - memset(&odp_system_info, 0, sizeof(odp_system_info_t)); + memset(&odp_global_data.odp_system_info, 0, sizeof(odp_system_info_t)); - odp_system_info.page_size = ODP_PAGE_SIZE; + odp_global_data.odp_system_info.page_size = ODP_PAGE_SIZE; file = fopen("/proc/cpuinfo", "rt"); if (file == NULL) { @@ -364,11 +353,11 @@ int odp_system_info_init(void) return -1; } - compiler_info.cpuinfo_parser(file, &odp_system_info); + compiler_info.cpuinfo_parser(file, &odp_global_data.odp_system_info); fclose(file); - if (systemcpu(&odp_system_info)) { + if (systemcpu(&odp_global_data.odp_system_info)) { ODP_ERR("systemcpu failed\n"); return -1; } @@ -383,30 +372,30 @@ int odp_system_info_init(void) */ uint64_t odp_sys_cpu_hz(void) { - return odp_system_info.cpu_hz; + return odp_global_data.odp_system_info.cpu_hz; } uint64_t odp_sys_huge_page_size(void) { - return odp_system_info.huge_page_size; + return odp_global_data.odp_system_info.huge_page_size; } uint64_t odp_sys_page_size(void) { - return odp_system_info.page_size; + return odp_global_data.odp_system_info.page_size; } const char *odp_sys_cpu_model_str(void) { - return odp_system_info.model_str; + return odp_global_data.odp_system_info.model_str; } int odp_sys_cache_line_size(void) { - return odp_system_info.cache_line_size; + return odp_global_data.odp_system_info.cache_line_size; } int odp_cpu_count(void) { - return odp_system_info.cpu_count; + return odp_global_data.odp_system_info.cpu_count; }
Don't store ODP global data in multiple locations, gather global data into odp_global_data. Move the static odp_system_info into odp_global_data Signed-off-by: Mike Holmes <mike.holmes@linaro.org> --- platform/linux-generic/include/odp_internal.h | 11 +++++++++ platform/linux-generic/odp_system_info.c | 33 +++++++++------------------ 2 files changed, 22 insertions(+), 22 deletions(-)