From: lng-odp [mailto:[email protected]] On Behalf Of Bill 
Fischofer
Sent: Thursday, May 05, 2016 1:38 AM
To: Mike Holmes <[email protected]>
Cc: lng-odp <[email protected]>
Subject: Re: [lng-odp] [PATCH] linux-generic: arch: add missing cache line size 
definition for linux



On Wed, May 4, 2016 at 2:53 PM, Mike Holmes 
<[email protected]<mailto:[email protected]>> wrote:


On 4 May 2016 at 15:40, Bill Fischofer 
<[email protected]<mailto:[email protected]>> wrote:


On Wed, May 4, 2016 at 2:35 PM, Mike Holmes 
<[email protected]<mailto:[email protected]>> wrote:


On 4 May 2016 at 12:47, Bill Fischofer 
<[email protected]<mailto:[email protected]>> 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 <[email protected]<mailto:[email protected]>>
Signed-off-by: Bill Fischofer 
<[email protected]<mailto:[email protected]>>
---
 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.



CPU’s ISA and cache architecture are two different things. Most CPUs today have 
64 byte cache line size and it does not have anything to with if the CPU 
supports 32 or 64 bit addresses.

I think 64 byte cache line size is a good default for now. The proper way would 
be to find out the target system cache line size in the configure script and 
create the define in config time. Cache line size is typically used for 
performance optimization and a wrong value should not break functionality.

-Petri






_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to