diff mbox

[API-NEXT,6/7] linux-generic: sysinfo: move arm system info codes to its plarform file

Message ID 1451032201-19954-7-git-send-email-hongbo.zhang@linaro.org
State New
Headers show

Commit Message

Hongbo Zhang Dec. 25, 2015, 8:30 a.m. UTC
From: Hongbo Zhang <hongbo.zhang@linaro.org>

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

Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
---
 configure.ac                                        |  1 +
 platform/linux-generic/Makefile.am                  |  1 +
 platform/linux-generic/arch/arm/odp_sysinfo_parse.c | 20 ++++++++++++++++++++
 platform/linux-generic/odp_system_info.c            | 15 +--------------
 4 files changed, 23 insertions(+), 14 deletions(-)
 create mode 100644 platform/linux-generic/arch/arm/odp_sysinfo_parse.c

Comments

Hongbo Zhang Dec. 25, 2015, 8:50 a.m. UTC | #1
On 25 December 2015 at 16:30,  <hongbo.zhang@linaro.org> wrote:
> From: Hongbo Zhang <hongbo.zhang@linaro.org>
>
> This patch moves the arm system info codes into the newly added arm
> specific platform file.
>
> Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
> ---
>  configure.ac                                        |  1 +
>  platform/linux-generic/Makefile.am                  |  1 +
>  platform/linux-generic/arch/arm/odp_sysinfo_parse.c | 20 ++++++++++++++++++++
>  platform/linux-generic/odp_system_info.c            | 15 +--------------
>  4 files changed, 23 insertions(+), 14 deletions(-)
>  create mode 100644 platform/linux-generic/arch/arm/odp_sysinfo_parse.c
>
> diff --git a/configure.ac b/configure.ac
> index 4f89f03..c7115d4 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],
>    [ARCH=linux]
>  )
> diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
> index bb0faf0..0ddc9e3 100644
> --- a/platform/linux-generic/Makefile.am
> +++ b/platform/linux-generic/Makefile.am
> @@ -162,6 +162,7 @@ __LIB__libodp_la_SOURCES = \
>                            arch/@ARCH@/odp_sysinfo_parse.c
>
>  EXTRA_DIST = \
> +            arch/arm/odp_sysinfo_parse.c \
>              arch/linux/odp_cpu_cycles.c \
>              arch/mips64/odp_cpu_cycles.c \
>              arch/mips64/odp_sysinfo_parse.c \

After applying this patch set, the platform/linux-generic/Makefile.am
has such a section:

  odp_timer_wheel.c \
  odp_traffic_mngr.c \
  odp_version.c \
  odp_weak.c \
  arch/@ARCH@/odp_cpu_cycles.c \
  arch/@ARCH@/odp_sysinfo_parse.c

EXTRA_DIST = \
    arch/arm/odp_sysinfo_parse.c \
    arch/linux/odp_cpu_cycles.c \
    arch/mips64/odp_cpu_cycles.c \
    arch/mips64/odp_sysinfo_parse.c \
    arch/powerpc/odp_sysinfo_parse.c \
    arch/x86/odp_cpu_cycles.c \
    arch/x86/odp_sysinfo_parse.c

And the platform/linux-generic/arch/ architecture is like this:
platform/linux-generic/arch/
├── arm
│   └── odp_sysinfo_parse.c
├── linux
│   └── odp_cpu_cycles.c
├── mips64
│   ├── odp_cpu_cycles.c
│   └── odp_sysinfo_parse.c
├── powerpc
│   └── odp_sysinfo_parse.c
└── x86
    ├── odp_cpu_cycles.c
    └── odp_sysinfo_parse.c

When compile if ARM arch is selected, according to these two lines
  arch/@ARCH@/odp_cpu_cycles.c \
  arch/@ARCH@/odp_sysinfo_parse.c
both arch/arm/odp_cpu_cycles.c and arch/arm/odp_sysinfo_parse.c are
included in the Makefile to be compiled, but in fact there is no
arch/arm/odp_cpu_cycles.c at all, there are same issues with powerpc/
and linux/ too.

Then how to update the Makefile.am to fix this issue? anybody familiar
with such grammar in Makefile.am?

Thanks.

> 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 0000000..ba792b2
> --- /dev/null
> +++ b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
> @@ -0,0 +1,20 @@
> +/* Copyright (c) 2015, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:     BSD-3-Clause
> + */
> +
> +#include <odp_internal.h>
> +#include <odp_cpu_internal.h>
> +#include <string.h>
> +
> +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 8a151eb..158a6b9 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
>
Maxim Uvarov Dec. 25, 2015, 9:09 a.m. UTC | #2
On 12/25/2015 11:50, Hongbo Zhang wrote:
> On 25 December 2015 at 16:30,  <hongbo.zhang@linaro.org> wrote:
>> From: Hongbo Zhang <hongbo.zhang@linaro.org>
>>
>> This patch moves the arm system info codes into the newly added arm
>> specific platform file.
>>
>> Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
>> ---
>>   configure.ac                                        |  1 +
>>   platform/linux-generic/Makefile.am                  |  1 +
>>   platform/linux-generic/arch/arm/odp_sysinfo_parse.c | 20 ++++++++++++++++++++
>>   platform/linux-generic/odp_system_info.c            | 15 +--------------
>>   4 files changed, 23 insertions(+), 14 deletions(-)
>>   create mode 100644 platform/linux-generic/arch/arm/odp_sysinfo_parse.c
>>
>> diff --git a/configure.ac b/configure.ac
>> index 4f89f03..c7115d4 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],
>>     [ARCH=linux]
>>   )
>> diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
>> index bb0faf0..0ddc9e3 100644
>> --- a/platform/linux-generic/Makefile.am
>> +++ b/platform/linux-generic/Makefile.am
>> @@ -162,6 +162,7 @@ __LIB__libodp_la_SOURCES = \
>>                             arch/@ARCH@/odp_sysinfo_parse.c
>>
>>   EXTRA_DIST = \
>> +            arch/arm/odp_sysinfo_parse.c \
>>               arch/linux/odp_cpu_cycles.c \
>>               arch/mips64/odp_cpu_cycles.c \
>>               arch/mips64/odp_sysinfo_parse.c \
> After applying this patch set, the platform/linux-generic/Makefile.am
> has such a section:
>
>    odp_timer_wheel.c \
>    odp_traffic_mngr.c \
>    odp_version.c \
>    odp_weak.c \
>    arch/@ARCH@/odp_cpu_cycles.c \
>    arch/@ARCH@/odp_sysinfo_parse.c
>
> EXTRA_DIST = \
>      arch/arm/odp_sysinfo_parse.c \
>      arch/linux/odp_cpu_cycles.c \
>      arch/mips64/odp_cpu_cycles.c \
>      arch/mips64/odp_sysinfo_parse.c \
>      arch/powerpc/odp_sysinfo_parse.c \
>      arch/x86/odp_cpu_cycles.c \
>      arch/x86/odp_sysinfo_parse.c
>
> And the platform/linux-generic/arch/ architecture is like this:
> platform/linux-generic/arch/
> ├── arm
> │   └── odp_sysinfo_parse.c
> ├── linux
> │   └── odp_cpu_cycles.c
> ├── mips64
> │   ├── odp_cpu_cycles.c
> │   └── odp_sysinfo_parse.c
> ├── powerpc
> │   └── odp_sysinfo_parse.c
> └── x86
>      ├── odp_cpu_cycles.c
>      └── odp_sysinfo_parse.c
>
> When compile if ARM arch is selected, according to these two lines
>    arch/@ARCH@/odp_cpu_cycles.c \
>    arch/@ARCH@/odp_sysinfo_parse.c
> both arch/arm/odp_cpu_cycles.c and arch/arm/odp_sysinfo_parse.c are
> included in the Makefile to be compiled, but in fact there is no
> arch/arm/odp_cpu_cycles.c at all, there are same issues with powerpc/
> and linux/ too.
>
> Then how to update the Makefile.am to fix this issue? anybody familiar
> with such grammar in Makefile.am?
>
> Thanks.

I think you see that because you added that line:

+  [arm*], [ARCH=arm],


I.e. without about  "arm" was "linux" and you used default code.

If you introduced new arch for configure.ac you also need to create symlink
fo odp_cpu_cycles.c and package all arm files to EXTRA target in 
Makefile.am.

Maxim.

>> 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 0000000..ba792b2
>> --- /dev/null
>> +++ b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
>> @@ -0,0 +1,20 @@
>> +/* Copyright (c) 2015, Linaro Limited
>> + * All rights reserved.
>> + *
>> + * SPDX-License-Identifier:     BSD-3-Clause
>> + */
>> +
>> +#include <odp_internal.h>
>> +#include <odp_cpu_internal.h>
>> +#include <string.h>
>> +
>> +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 8a151eb..158a6b9 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
Hongbo Zhang Dec. 25, 2015, 9:39 a.m. UTC | #3
On 25 December 2015 at 17:09, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
> On 12/25/2015 11:50, Hongbo Zhang wrote:
>>
>> On 25 December 2015 at 16:30,  <hongbo.zhang@linaro.org> wrote:
>>>
>>> From: Hongbo Zhang <hongbo.zhang@linaro.org>
>>>
>>> This patch moves the arm system info codes into the newly added arm
>>> specific platform file.
>>>
>>> Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
>>> ---
>>>   configure.ac                                        |  1 +
>>>   platform/linux-generic/Makefile.am                  |  1 +
>>>   platform/linux-generic/arch/arm/odp_sysinfo_parse.c | 20
>>> ++++++++++++++++++++
>>>   platform/linux-generic/odp_system_info.c            | 15
>>> +--------------
>>>   4 files changed, 23 insertions(+), 14 deletions(-)
>>>   create mode 100644 platform/linux-generic/arch/arm/odp_sysinfo_parse.c
>>>
>>> diff --git a/configure.ac b/configure.ac
>>> index 4f89f03..c7115d4 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],
>>>     [ARCH=linux]
>>>   )
>>> diff --git a/platform/linux-generic/Makefile.am
>>> b/platform/linux-generic/Makefile.am
>>> index bb0faf0..0ddc9e3 100644
>>> --- a/platform/linux-generic/Makefile.am
>>> +++ b/platform/linux-generic/Makefile.am
>>> @@ -162,6 +162,7 @@ __LIB__libodp_la_SOURCES = \
>>>                             arch/@ARCH@/odp_sysinfo_parse.c
>>>
>>>   EXTRA_DIST = \
>>> +            arch/arm/odp_sysinfo_parse.c \
>>>               arch/linux/odp_cpu_cycles.c \
>>>               arch/mips64/odp_cpu_cycles.c \
>>>               arch/mips64/odp_sysinfo_parse.c \
>>
>> After applying this patch set, the platform/linux-generic/Makefile.am
>> has such a section:
>>
>>    odp_timer_wheel.c \
>>    odp_traffic_mngr.c \
>>    odp_version.c \
>>    odp_weak.c \
>>    arch/@ARCH@/odp_cpu_cycles.c \
>>    arch/@ARCH@/odp_sysinfo_parse.c
>>
>> EXTRA_DIST = \
>>      arch/arm/odp_sysinfo_parse.c \
>>      arch/linux/odp_cpu_cycles.c \
>>      arch/mips64/odp_cpu_cycles.c \
>>      arch/mips64/odp_sysinfo_parse.c \
>>      arch/powerpc/odp_sysinfo_parse.c \
>>      arch/x86/odp_cpu_cycles.c \
>>      arch/x86/odp_sysinfo_parse.c
>>
>> And the platform/linux-generic/arch/ architecture is like this:
>> platform/linux-generic/arch/
>> ├── arm
>> │   └── odp_sysinfo_parse.c
>> ├── linux
>> │   └── odp_cpu_cycles.c
>> ├── mips64
>> │   ├── odp_cpu_cycles.c
>> │   └── odp_sysinfo_parse.c
>> ├── powerpc
>> │   └── odp_sysinfo_parse.c
>> └── x86
>>      ├── odp_cpu_cycles.c
>>      └── odp_sysinfo_parse.c
>>
>> When compile if ARM arch is selected, according to these two lines
>>    arch/@ARCH@/odp_cpu_cycles.c \
>>    arch/@ARCH@/odp_sysinfo_parse.c
>> both arch/arm/odp_cpu_cycles.c and arch/arm/odp_sysinfo_parse.c are
>> included in the Makefile to be compiled, but in fact there is no
>> arch/arm/odp_cpu_cycles.c at all, there are same issues with powerpc/
>> and linux/ too.
>>
>> Then how to update the Makefile.am to fix this issue? anybody familiar
>> with such grammar in Makefile.am?
>>
>> Thanks.
>
>
> I think you see that because you added that line:
>
> +  [arm*], [ARCH=arm],
>
>
> I.e. without about  "arm" was "linux" and you used default code.
>
> If you introduced new arch for configure.ac you also need to create symlink
> fo odp_cpu_cycles.c and package all arm files to EXTRA target in
> Makefile.am.
>

"create symlink for odp_cpu_cycles.c" it seems OK. Then how to handle
the linux/ directory, odp_cpu_cycles.c is lack here and no default
file fits this general purpose.

But this remind me another solution:
Move arm/odp_sysinfo_parse.c to linux/odp_sysinfo_parse.c, since
currently it isn't implemented for arm too, it simply returns 0, this
can be served as a general default implementation in linux/.
And also create symlink of odp_cpu_cycles for powerpc/

Then we have arch like this:
platform/linux-generic/arch/
 ├── linux
 │   └── odp_cpu_cycles.c
 │   └── odp_sysinfo_parse.c (no implementation in fact)
 ├── mips64
 │   ├── odp_cpu_cycles.c
 │   └── odp_sysinfo_parse.c
 ├── powerpc
 │   ├── odp_cpu_cycles.c (symlink)
 │   └── odp_sysinfo_parse.c
 └── x86
      ├── odp_cpu_cycles.c
      └── odp_sysinfo_parse.c

Is it good idea?

> Maxim.
>
>>> 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 0000000..ba792b2
>>> --- /dev/null
>>> +++ b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
>>> @@ -0,0 +1,20 @@
>>> +/* Copyright (c) 2015, Linaro Limited
>>> + * All rights reserved.
>>> + *
>>> + * SPDX-License-Identifier:     BSD-3-Clause
>>> + */
>>> +
>>> +#include <odp_internal.h>
>>> +#include <odp_cpu_internal.h>
>>> +#include <string.h>
>>> +
>>> +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 8a151eb..158a6b9 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 mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
Maxim Uvarov Dec. 25, 2015, 10:19 a.m. UTC | #4
On 12/25/2015 12:39, Hongbo Zhang wrote:
> On 25 December 2015 at 17:09, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
>> On 12/25/2015 11:50, Hongbo Zhang wrote:
>>> On 25 December 2015 at 16:30,  <hongbo.zhang@linaro.org> wrote:
>>>> From: Hongbo Zhang <hongbo.zhang@linaro.org>
>>>>
>>>> This patch moves the arm system info codes into the newly added arm
>>>> specific platform file.
>>>>
>>>> Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
>>>> ---
>>>>    configure.ac                                        |  1 +
>>>>    platform/linux-generic/Makefile.am                  |  1 +
>>>>    platform/linux-generic/arch/arm/odp_sysinfo_parse.c | 20
>>>> ++++++++++++++++++++
>>>>    platform/linux-generic/odp_system_info.c            | 15
>>>> +--------------
>>>>    4 files changed, 23 insertions(+), 14 deletions(-)
>>>>    create mode 100644 platform/linux-generic/arch/arm/odp_sysinfo_parse.c
>>>>
>>>> diff --git a/configure.ac b/configure.ac
>>>> index 4f89f03..c7115d4 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],
>>>>      [ARCH=linux]
>>>>    )
>>>> diff --git a/platform/linux-generic/Makefile.am
>>>> b/platform/linux-generic/Makefile.am
>>>> index bb0faf0..0ddc9e3 100644
>>>> --- a/platform/linux-generic/Makefile.am
>>>> +++ b/platform/linux-generic/Makefile.am
>>>> @@ -162,6 +162,7 @@ __LIB__libodp_la_SOURCES = \
>>>>                              arch/@ARCH@/odp_sysinfo_parse.c
>>>>
>>>>    EXTRA_DIST = \
>>>> +            arch/arm/odp_sysinfo_parse.c \
>>>>                arch/linux/odp_cpu_cycles.c \
>>>>                arch/mips64/odp_cpu_cycles.c \
>>>>                arch/mips64/odp_sysinfo_parse.c \
>>> After applying this patch set, the platform/linux-generic/Makefile.am
>>> has such a section:
>>>
>>>     odp_timer_wheel.c \
>>>     odp_traffic_mngr.c \
>>>     odp_version.c \
>>>     odp_weak.c \
>>>     arch/@ARCH@/odp_cpu_cycles.c \
>>>     arch/@ARCH@/odp_sysinfo_parse.c
>>>
>>> EXTRA_DIST = \
>>>       arch/arm/odp_sysinfo_parse.c \
>>>       arch/linux/odp_cpu_cycles.c \
>>>       arch/mips64/odp_cpu_cycles.c \
>>>       arch/mips64/odp_sysinfo_parse.c \
>>>       arch/powerpc/odp_sysinfo_parse.c \
>>>       arch/x86/odp_cpu_cycles.c \
>>>       arch/x86/odp_sysinfo_parse.c
>>>
>>> And the platform/linux-generic/arch/ architecture is like this:
>>> platform/linux-generic/arch/
>>> ├── arm
>>> │   └── odp_sysinfo_parse.c
>>> ├── linux
>>> │   └── odp_cpu_cycles.c
>>> ├── mips64
>>> │   ├── odp_cpu_cycles.c
>>> │   └── odp_sysinfo_parse.c
>>> ├── powerpc
>>> │   └── odp_sysinfo_parse.c
>>> └── x86
>>>       ├── odp_cpu_cycles.c
>>>       └── odp_sysinfo_parse.c
>>>
>>> When compile if ARM arch is selected, according to these two lines
>>>     arch/@ARCH@/odp_cpu_cycles.c \
>>>     arch/@ARCH@/odp_sysinfo_parse.c
>>> both arch/arm/odp_cpu_cycles.c and arch/arm/odp_sysinfo_parse.c are
>>> included in the Makefile to be compiled, but in fact there is no
>>> arch/arm/odp_cpu_cycles.c at all, there are same issues with powerpc/
>>> and linux/ too.
>>>
>>> Then how to update the Makefile.am to fix this issue? anybody familiar
>>> with such grammar in Makefile.am?
>>>
>>> Thanks.
>>
>> I think you see that because you added that line:
>>
>> +  [arm*], [ARCH=arm],
>>
>>
>> I.e. without about  "arm" was "linux" and you used default code.
>>
>> If you introduced new arch for configure.ac you also need to create symlink
>> fo odp_cpu_cycles.c and package all arm files to EXTRA target in
>> Makefile.am.
>>
> "create symlink for odp_cpu_cycles.c" it seems OK. Then how to handle
> the linux/ directory, odp_cpu_cycles.c is lack here and no default
> file fits this general purpose.
>
> But this remind me another solution:
> Move arm/odp_sysinfo_parse.c to linux/odp_sysinfo_parse.c, since
> currently it isn't implemented for arm too, it simply returns 0, this
> can be served as a general default implementation in linux/.
> And also create symlink of odp_cpu_cycles for powerpc/
>
> Then we have arch like this:
> platform/linux-generic/arch/
>   ├── linux
>   │   └── odp_cpu_cycles.c
>   │   └── odp_sysinfo_parse.c (no implementation in fact)
>   ├── mips64
>   │   ├── odp_cpu_cycles.c
>   │   └── odp_sysinfo_parse.c
>   ├── powerpc
>   │   ├── odp_cpu_cycles.c (symlink)
>   │   └── odp_sysinfo_parse.c
>   └── x86
>        ├── odp_cpu_cycles.c
>        └── odp_sysinfo_parse.c
>
> Is it good idea?

I think yes, it's good.

Maxim.

>
>> Maxim.
>>
>>>> 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 0000000..ba792b2
>>>> --- /dev/null
>>>> +++ b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
>>>> @@ -0,0 +1,20 @@
>>>> +/* Copyright (c) 2015, Linaro Limited
>>>> + * All rights reserved.
>>>> + *
>>>> + * SPDX-License-Identifier:     BSD-3-Clause
>>>> + */
>>>> +
>>>> +#include <odp_internal.h>
>>>> +#include <odp_cpu_internal.h>
>>>> +#include <string.h>
>>>> +
>>>> +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 8a151eb..158a6b9 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 mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
Hongbo Zhang Dec. 25, 2015, 10:21 a.m. UTC | #5
On 25 December 2015 at 18:19, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
> On 12/25/2015 12:39, Hongbo Zhang wrote:
>>
>> On 25 December 2015 at 17:09, Maxim Uvarov <maxim.uvarov@linaro.org>
>> wrote:
>>>
>>> On 12/25/2015 11:50, Hongbo Zhang wrote:
>>>>
>>>> On 25 December 2015 at 16:30,  <hongbo.zhang@linaro.org> wrote:
>>>>>
>>>>> From: Hongbo Zhang <hongbo.zhang@linaro.org>
>>>>>
>>>>> This patch moves the arm system info codes into the newly added arm
>>>>> specific platform file.
>>>>>
>>>>> Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
>>>>> ---
>>>>>    configure.ac                                        |  1 +
>>>>>    platform/linux-generic/Makefile.am                  |  1 +
>>>>>    platform/linux-generic/arch/arm/odp_sysinfo_parse.c | 20
>>>>> ++++++++++++++++++++
>>>>>    platform/linux-generic/odp_system_info.c            | 15
>>>>> +--------------
>>>>>    4 files changed, 23 insertions(+), 14 deletions(-)
>>>>>    create mode 100644
>>>>> platform/linux-generic/arch/arm/odp_sysinfo_parse.c
>>>>>
>>>>> diff --git a/configure.ac b/configure.ac
>>>>> index 4f89f03..c7115d4 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],
>>>>>      [ARCH=linux]
>>>>>    )
>>>>> diff --git a/platform/linux-generic/Makefile.am
>>>>> b/platform/linux-generic/Makefile.am
>>>>> index bb0faf0..0ddc9e3 100644
>>>>> --- a/platform/linux-generic/Makefile.am
>>>>> +++ b/platform/linux-generic/Makefile.am
>>>>> @@ -162,6 +162,7 @@ __LIB__libodp_la_SOURCES = \
>>>>>                              arch/@ARCH@/odp_sysinfo_parse.c
>>>>>
>>>>>    EXTRA_DIST = \
>>>>> +            arch/arm/odp_sysinfo_parse.c \
>>>>>                arch/linux/odp_cpu_cycles.c \
>>>>>                arch/mips64/odp_cpu_cycles.c \
>>>>>                arch/mips64/odp_sysinfo_parse.c \
>>>>
>>>> After applying this patch set, the platform/linux-generic/Makefile.am
>>>> has such a section:
>>>>
>>>>     odp_timer_wheel.c \
>>>>     odp_traffic_mngr.c \
>>>>     odp_version.c \
>>>>     odp_weak.c \
>>>>     arch/@ARCH@/odp_cpu_cycles.c \
>>>>     arch/@ARCH@/odp_sysinfo_parse.c
>>>>
>>>> EXTRA_DIST = \
>>>>       arch/arm/odp_sysinfo_parse.c \
>>>>       arch/linux/odp_cpu_cycles.c \
>>>>       arch/mips64/odp_cpu_cycles.c \
>>>>       arch/mips64/odp_sysinfo_parse.c \
>>>>       arch/powerpc/odp_sysinfo_parse.c \
>>>>       arch/x86/odp_cpu_cycles.c \
>>>>       arch/x86/odp_sysinfo_parse.c
>>>>
>>>> And the platform/linux-generic/arch/ architecture is like this:
>>>> platform/linux-generic/arch/
>>>> ├── arm
>>>> │   └── odp_sysinfo_parse.c
>>>> ├── linux
>>>> │   └── odp_cpu_cycles.c
>>>> ├── mips64
>>>> │   ├── odp_cpu_cycles.c
>>>> │   └── odp_sysinfo_parse.c
>>>> ├── powerpc
>>>> │   └── odp_sysinfo_parse.c
>>>> └── x86
>>>>       ├── odp_cpu_cycles.c
>>>>       └── odp_sysinfo_parse.c
>>>>
>>>> When compile if ARM arch is selected, according to these two lines
>>>>     arch/@ARCH@/odp_cpu_cycles.c \
>>>>     arch/@ARCH@/odp_sysinfo_parse.c
>>>> both arch/arm/odp_cpu_cycles.c and arch/arm/odp_sysinfo_parse.c are
>>>> included in the Makefile to be compiled, but in fact there is no
>>>> arch/arm/odp_cpu_cycles.c at all, there are same issues with powerpc/
>>>> and linux/ too.
>>>>
>>>> Then how to update the Makefile.am to fix this issue? anybody familiar
>>>> with such grammar in Makefile.am?
>>>>
>>>> Thanks.
>>>
>>>
>>> I think you see that because you added that line:
>>>
>>> +  [arm*], [ARCH=arm],
>>>
>>>
>>> I.e. without about  "arm" was "linux" and you used default code.
>>>
>>> If you introduced new arch for configure.ac you also need to create
>>> symlink
>>> fo odp_cpu_cycles.c and package all arm files to EXTRA target in
>>> Makefile.am.
>>>
>> "create symlink for odp_cpu_cycles.c" it seems OK. Then how to handle
>> the linux/ directory, odp_cpu_cycles.c is lack here and no default
>> file fits this general purpose.
>>
>> But this remind me another solution:
>> Move arm/odp_sysinfo_parse.c to linux/odp_sysinfo_parse.c, since
>> currently it isn't implemented for arm too, it simply returns 0, this
>> can be served as a general default implementation in linux/.
>> And also create symlink of odp_cpu_cycles for powerpc/
>>
>> Then we have arch like this:
>> platform/linux-generic/arch/
>>   ├── linux
>>   │   └── odp_cpu_cycles.c
>>   │   └── odp_sysinfo_parse.c (no implementation in fact)
>>   ├── mips64
>>   │   ├── odp_cpu_cycles.c
>>   │   └── odp_sysinfo_parse.c
>>   ├── powerpc
>>   │   ├── odp_cpu_cycles.c (symlink)
>>   │   └── odp_sysinfo_parse.c
>>   └── x86
>>        ├── odp_cpu_cycles.c
>>        └── odp_sysinfo_parse.c
>>
>> Is it good idea?
>
>
> I think yes, it's good.
>

OK, will send v2 next Monday including this change.
Thanks.

> Maxim.
>
>
>>
>>> Maxim.
>>>
>>>>> 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 0000000..ba792b2
>>>>> --- /dev/null
>>>>> +++ b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
>>>>> @@ -0,0 +1,20 @@
>>>>> +/* Copyright (c) 2015, Linaro Limited
>>>>> + * All rights reserved.
>>>>> + *
>>>>> + * SPDX-License-Identifier:     BSD-3-Clause
>>>>> + */
>>>>> +
>>>>> +#include <odp_internal.h>
>>>>> +#include <odp_cpu_internal.h>
>>>>> +#include <string.h>
>>>>> +
>>>>> +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 8a151eb..158a6b9 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 mailing list
>>> lng-odp@lists.linaro.org
>>> https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index 4f89f03..c7115d4 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],
   [ARCH=linux]
 )
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index bb0faf0..0ddc9e3 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -162,6 +162,7 @@  __LIB__libodp_la_SOURCES = \
 			   arch/@ARCH@/odp_sysinfo_parse.c
 
 EXTRA_DIST = \
+	     arch/arm/odp_sysinfo_parse.c \
 	     arch/linux/odp_cpu_cycles.c \
 	     arch/mips64/odp_cpu_cycles.c \
 	     arch/mips64/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
new file mode 100644
index 0000000..ba792b2
--- /dev/null
+++ b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
@@ -0,0 +1,20 @@ 
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp_internal.h>
+#include <odp_cpu_internal.h>
+#include <string.h>
+
+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 8a151eb..158a6b9 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];