diff mbox

linux-generic: arch: add missing cache line size definition for linux

Message ID 1462380444-11992-1-git-send-email-bill.fischofer@linaro.org
State Accepted
Commit f0ffb68eff2b2ec858b80e809e1766e2081e541a
Headers show

Commit Message

Bill Fischofer May 4, 2016, 4:47 p.m. UTC
Use a default cache line size of 64 for otherwise unrecognized linux
platforms. This resolves bug https://bugs.linaro.org/show_bug.cgi?id=2218

Reported-by: Matias Elo <matias.elo@nokia.com>
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 platform/linux-generic/arch/linux/odp/api/cpu_arch.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Mike Holmes May 4, 2016, 7:35 p.m. UTC | #1
On 4 May 2016 at 12:47, Bill Fischofer <bill.fischofer@linaro.org> wrote:

> Use a default cache line size of 64 for otherwise unrecognized linux

> platforms. This resolves bug https://bugs.linaro.org/show_bug.cgi?id=2218

>

> Reported-by: Matias Elo <matias.elo@nokia.com>

> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

> ---

>  platform/linux-generic/arch/linux/odp/api/cpu_arch.h | 10 ++++++++++

>  1 file changed, 10 insertions(+)

>

> diff --git a/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

> b/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

> index 1c79f87..29f8889 100644

> --- a/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

> +++ b/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

> @@ -11,6 +11,16 @@

>  extern "C" {

>  #endif

>

> +/** @ingroup odp_compiler_optim

> + *  @{

> + */

> +

> +#define ODP_CACHE_LINE_SIZE 64

>


Is this a good number on a 16 bit linux system how about 32 ?


> +

> +/**

> + * @}

> + */

> +

>  static inline void odp_cpu_pause(void)

>  {

>  }

> --

> 2.5.0

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>




-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"
Bill Fischofer May 4, 2016, 7:40 p.m. UTC | #2
On Wed, May 4, 2016 at 2:35 PM, Mike Holmes <mike.holmes@linaro.org> wrote:

>

>

> On 4 May 2016 at 12:47, Bill Fischofer <bill.fischofer@linaro.org> wrote:

>

>> Use a default cache line size of 64 for otherwise unrecognized linux

>> platforms. This resolves bug https://bugs.linaro.org/show_bug.cgi?id=2218

>>

>> Reported-by: Matias Elo <matias.elo@nokia.com>

>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

>> ---

>>  platform/linux-generic/arch/linux/odp/api/cpu_arch.h | 10 ++++++++++

>>  1 file changed, 10 insertions(+)

>>

>> diff --git a/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

>> b/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

>> index 1c79f87..29f8889 100644

>> --- a/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

>> +++ b/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

>> @@ -11,6 +11,16 @@

>>  extern "C" {

>>  #endif

>>

>> +/** @ingroup odp_compiler_optim

>> + *  @{

>> + */

>> +

>> +#define ODP_CACHE_LINE_SIZE 64

>>

>

> Is this a good number on a 16 bit linux system how about 32 ?

>


We don't support 16-bit linux.  32-bit is the minimum for ODP.  Also, for
cache alignment overaligned is better than underaligned, so if the actual
cache line size is 32 then using 64-byte alignment does no harm since a
64-byte aligned address is also 32-byte aligned.


>

>

>> +

>> +/**

>> + * @}

>> + */

>> +

>>  static inline void odp_cpu_pause(void)

>>  {

>>  }

>> --

>> 2.5.0

>>

>> _______________________________________________

>> lng-odp mailing list

>> lng-odp@lists.linaro.org

>> https://lists.linaro.org/mailman/listinfo/lng-odp

>>

>

>

>

> --

> Mike Holmes

> Technical Manager - Linaro Networking Group

> Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs

> "Work should be fun and collaborative, the rest follows"

>

>

>
Mike Holmes May 4, 2016, 7:53 p.m. UTC | #3
On 4 May 2016 at 15:40, Bill Fischofer <bill.fischofer@linaro.org> wrote:

>

>

> On Wed, May 4, 2016 at 2:35 PM, Mike Holmes <mike.holmes@linaro.org>

> wrote:

>

>>

>>

>> On 4 May 2016 at 12:47, Bill Fischofer <bill.fischofer@linaro.org> wrote:

>>

>>> Use a default cache line size of 64 for otherwise unrecognized linux

>>> platforms. This resolves bug

>>> https://bugs.linaro.org/show_bug.cgi?id=2218

>>>

>>> Reported-by: Matias Elo <matias.elo@nokia.com>

>>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

>>> ---

>>>  platform/linux-generic/arch/linux/odp/api/cpu_arch.h | 10 ++++++++++

>>>  1 file changed, 10 insertions(+)

>>>

>>> diff --git a/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

>>> b/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

>>> index 1c79f87..29f8889 100644

>>> --- a/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

>>> +++ b/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

>>> @@ -11,6 +11,16 @@

>>>  extern "C" {

>>>  #endif

>>>

>>> +/** @ingroup odp_compiler_optim

>>> + *  @{

>>> + */

>>> +

>>> +#define ODP_CACHE_LINE_SIZE 64

>>>

>>

>> Is this a good number on a 16 bit linux system how about 32 ?

>>

>

> We don't support 16-bit linux.

>


Yes we do, at least we have to assume so :) - it is called linux-generic it
is based on any place linux can run, if some mad Eastern European drinking
a gallon of Vodka makes linux run on a 3 and 1/2 bit CPU we currently
support it by the default ARCH=linux

Additionally nowhere can I find that we state we dont support 16 bit linux.


>  32-bit is the minimum for ODP.

>


This needs to be prominently added to the docs, and then I can agree.


> Also, for cache alignment overaligned is better than underaligned, so if

> the actual cache line size is 32 then using 64-byte alignment does no harm

> since a 64-byte aligned address is also 32-byte aligned.

>


This gets you a silent degradation in the amount of memory you use on a
linux system that happens to be less than 64bits, and also silently an
enforced under alignment on a 128 bit system, the very thing you wanted to
avoid.

I am being nit picky to really get it well defined, I think we assume too
much  that really ODP is run with the OS=linux, on a 64Bit CPU with posix
threading.


>

>

>>

>>

>>> +

>>> +/**

>>> + * @}

>>> + */

>>> +

>>>  static inline void odp_cpu_pause(void)

>>>  {

>>>  }

>>> --

>>> 2.5.0

>>>

>>> _______________________________________________

>>> lng-odp mailing list

>>> lng-odp@lists.linaro.org

>>> https://lists.linaro.org/mailman/listinfo/lng-odp

>>>

>>

>>

>>

>> --

>> Mike Holmes

>> Technical Manager - Linaro Networking Group

>> Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs

>> "Work should be fun and collaborative, the rest follows"

>>

>>

>>

>



-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"
Bill Fischofer May 4, 2016, 10:38 p.m. UTC | #4
On Wed, May 4, 2016 at 2:53 PM, Mike Holmes <mike.holmes@linaro.org> wrote:

>

>

> On 4 May 2016 at 15:40, Bill Fischofer <bill.fischofer@linaro.org> wrote:

>

>>

>>

>> On Wed, May 4, 2016 at 2:35 PM, Mike Holmes <mike.holmes@linaro.org>

>> wrote:

>>

>>>

>>>

>>> On 4 May 2016 at 12:47, Bill Fischofer <bill.fischofer@linaro.org>

>>> wrote:

>>>

>>>> Use a default cache line size of 64 for otherwise unrecognized linux

>>>> platforms. This resolves bug

>>>> https://bugs.linaro.org/show_bug.cgi?id=2218

>>>>

>>>> Reported-by: Matias Elo <matias.elo@nokia.com>

>>>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

>>>> ---

>>>>  platform/linux-generic/arch/linux/odp/api/cpu_arch.h | 10 ++++++++++

>>>>  1 file changed, 10 insertions(+)

>>>>

>>>> diff --git a/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

>>>> b/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

>>>> index 1c79f87..29f8889 100644

>>>> --- a/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

>>>> +++ b/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

>>>> @@ -11,6 +11,16 @@

>>>>  extern "C" {

>>>>  #endif

>>>>

>>>> +/** @ingroup odp_compiler_optim

>>>> + *  @{

>>>> + */

>>>> +

>>>> +#define ODP_CACHE_LINE_SIZE 64

>>>>

>>>

>>> Is this a good number on a 16 bit linux system how about 32 ?

>>>

>>

>> We don't support 16-bit linux.

>>

>

> Yes we do, at least we have to assume so :) - it is called linux-generic

> it is based on any place linux can run, if some mad Eastern European

> drinking a gallon of Vodka makes linux run on a 3 and 1/2 bit CPU we

> currently support it by the default ARCH=linux

>

> Additionally nowhere can I find that we state we dont support 16 bit linux.

>


I can't find an explicit reference to this in the ODP archives but I recall
very early in the project we decided to restrict ODP to a minimum of 32-bit
support because (a) none of our members had 16-bit HW and (b) we didn't
have any tools or systems to test ODP in 16-bit linux environments. If we
wanted to add such support it would be a major effort for little return.
The current linux-generic implementation, for example, assumes a minimum of
32-bit addressing in many places.

We can certainly add a documentation note to the Implementer's Guide that
ODP is designed for systems that use 32-bit or 64-bit addressing.


>

>

>>  32-bit is the minimum for ODP.

>>

>

> This needs to be prominently added to the docs, and then I can agree.

>

>

>> Also, for cache alignment overaligned is better than underaligned, so if

>> the actual cache line size is 32 then using 64-byte alignment does no harm

>> since a 64-byte aligned address is also 32-byte aligned.

>>

>

> This gets you a silent degradation in the amount of memory you use on a

> linux system that happens to be less than 64bits, and also silently an

> enforced under alignment on a 128 bit system, the very thing you wanted to

> avoid.

>

> I am being nit picky to really get it well defined, I think we assume too

> much  that really ODP is run with the OS=linux, on a 64Bit CPU with posix

> threading.

>


I think you're trying to turn a bug-fix into an architecture discussion. If
someone has a better "guess" as to what cache line size to use for an
unknown and unspecified architecture I'm happy to change this.  But the
issue is that the #define is missing, which causes the compile error Matias
reported.


>

>

>>

>>

>>>

>>>

>>>> +

>>>> +/**

>>>> + * @}

>>>> + */

>>>> +

>>>>  static inline void odp_cpu_pause(void)

>>>>  {

>>>>  }

>>>> --

>>>> 2.5.0

>>>>

>>>> _______________________________________________

>>>> lng-odp mailing list

>>>> lng-odp@lists.linaro.org

>>>> https://lists.linaro.org/mailman/listinfo/lng-odp

>>>>

>>>

>>>

>>>

>>> --

>>> Mike Holmes

>>> Technical Manager - Linaro Networking Group

>>> Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM

>>> SoCs

>>> "Work should be fun and collaborative, the rest follows"

>>>

>>>

>>>

>>

>

>

> --

> Mike Holmes

> Technical Manager - Linaro Networking Group

> Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs

> "Work should be fun and collaborative, the rest follows"

>

>

>
Mike Holmes May 10, 2016, 9:01 a.m. UTC | #5
On 4 May 2016 at 12:47, Bill Fischofer <bill.fischofer@linaro.org> wrote:

> Use a default cache line size of 64 for otherwise unrecognized linux

> platforms. This resolves bug https://bugs.linaro.org/show_bug.cgi?id=2218

>

> Reported-by: Matias Elo <matias.elo@nokia.com>

> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

>


Reviewed-by: Mike Holmes <mike.holmes@linaro.org>


This combined with the patch to remove the case this exposes where we set
ARCH=OS makes sense to me.


> ---

>  platform/linux-generic/arch/linux/odp/api/cpu_arch.h | 10 ++++++++++

>  1 file changed, 10 insertions(+)

>

> diff --git a/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

> b/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

> index 1c79f87..29f8889 100644

> --- a/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

> +++ b/platform/linux-generic/arch/linux/odp/api/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)

>  {

>  }

> --

> 2.5.0

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>




-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"
Mike Holmes May 10, 2016, 10:26 a.m. UTC | #6
On 10 May 2016 at 05:01, Mike Holmes <mike.holmes@linaro.org> wrote:

>

>

> On 4 May 2016 at 12:47, Bill Fischofer <bill.fischofer@linaro.org> wrote:

>

>> Use a default cache line size of 64 for otherwise unrecognized linux

>> platforms. This resolves bug https://bugs.linaro.org/show_bug.cgi?id=2218

>>

>> Reported-by: Matias Elo <matias.elo@nokia.com>

>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

>>

>

> Reviewed-by: Mike Holmes <mike.holmes@linaro.org>

>

> This combined with the patch to remove the case this exposes where we set

> ARCH=OS makes sense to me.

>


merged


>

>

>> ---

>>  platform/linux-generic/arch/linux/odp/api/cpu_arch.h | 10 ++++++++++

>>  1 file changed, 10 insertions(+)

>>

>> diff --git a/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

>> b/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

>> index 1c79f87..29f8889 100644

>> --- a/platform/linux-generic/arch/linux/odp/api/cpu_arch.h

>> +++ b/platform/linux-generic/arch/linux/odp/api/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)

>>  {

>>  }

>> --

>> 2.5.0

>>

>> _______________________________________________

>> lng-odp mailing list

>> lng-odp@lists.linaro.org

>> https://lists.linaro.org/mailman/listinfo/lng-odp

>>

>

>

>

> --

> Mike Holmes

> Technical Manager - Linaro Networking Group

> Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs

> "Work should be fun and collaborative, the rest follows"

>

>

>



-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"
diff mbox

Patch

diff --git a/platform/linux-generic/arch/linux/odp/api/cpu_arch.h b/platform/linux-generic/arch/linux/odp/api/cpu_arch.h
index 1c79f87..29f8889 100644
--- a/platform/linux-generic/arch/linux/odp/api/cpu_arch.h
+++ b/platform/linux-generic/arch/linux/odp/api/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)
 {
 }