[dpdk-dev,14/15] app/test: turn off cpu flag checks for tile architecture

Message ID 1418029178-25162-15-git-send-email-zlu@ezchip.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Zhigang Lu Dec. 8, 2014, 8:59 a.m. UTC
  Tile processor doesn't have CPU flag hardware registers, so this patch
turns off cpu flag checks for tile.

Signed-off-by: Zhigang Lu <zlu@ezchip.com>
Signed-off-by: Cyril Chemparathy <cchemparathy@ezchip.com>
---
 app/test/test_cpuflags.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Neil Horman Dec. 9, 2014, 3:03 p.m. UTC | #1
On Mon, Dec 08, 2014 at 04:59:37PM +0800, Zhigang Lu wrote:
> Tile processor doesn't have CPU flag hardware registers, so this patch
> turns off cpu flag checks for tile.
> 
> Signed-off-by: Zhigang Lu <zlu@ezchip.com>
> Signed-off-by: Cyril Chemparathy <cchemparathy@ezchip.com>
> ---
>  app/test/test_cpuflags.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test/test_cpuflags.c b/app/test/test_cpuflags.c
> index 5aeba5d..da93af5 100644
> --- a/app/test/test_cpuflags.c
> +++ b/app/test/test_cpuflags.c
> @@ -113,7 +113,7 @@ test_cpuflags(void)
>  
>  	printf("Check for ICACHE_SNOOP:\t\t");
>  	CHECK_FOR_FLAG(RTE_CPUFLAG_ICACHE_SNOOP);
> -#else
> +#elif !defined(RTE_ARCH_TILE)
>  	printf("Check for SSE:\t\t");
>  	CHECK_FOR_FLAG(RTE_CPUFLAG_SSE);
>  
Please stop this.  It doesn't make sense for a library that supports multiple
arches, we need some way to generically test for flags that doesn't involve
forcing applications to do ton's of ifdeffing.  Perhaps rte_cpu_get_flag_enabled
needs to do a flag table lookup based on the detected arch at run time, and
return the appropriate response.  In the case of tile, it can just be an empty
table, so 0 is always returned.  But making an application responsible for doing
arch checks is a guarantee to write non-portable applications

Neil

> -- 
> 2.1.2
> 
>
  

Patch

diff --git a/app/test/test_cpuflags.c b/app/test/test_cpuflags.c
index 5aeba5d..da93af5 100644
--- a/app/test/test_cpuflags.c
+++ b/app/test/test_cpuflags.c
@@ -113,7 +113,7 @@  test_cpuflags(void)
 
 	printf("Check for ICACHE_SNOOP:\t\t");
 	CHECK_FOR_FLAG(RTE_CPUFLAG_ICACHE_SNOOP);
-#else
+#elif !defined(RTE_ARCH_TILE)
 	printf("Check for SSE:\t\t");
 	CHECK_FOR_FLAG(RTE_CPUFLAG_SSE);