[PATCH] smptests/smpcache01: Remove invalidation of data cache lines from test

Daniel Cederman cederman at gaisler.com
Wed Sep 10 13:12:16 UTC 2014


Invalidation of data cache lines might cause data written to the stack
to get lost.
---
 testsuites/smptests/smpcache01/init.c         | 45 +++++++++++++++------------
 testsuites/smptests/smpcache01/smpcache01.doc |  2 --
 testsuites/smptests/smpcache01/smpcache01.scn | 18 ++++-------
 3 files changed, 31 insertions(+), 34 deletions(-)

diff --git a/testsuites/smptests/smpcache01/init.c b/testsuites/smptests/smpcache01/init.c
index dd2f9f1..99df974 100644
--- a/testsuites/smptests/smpcache01/init.c
+++ b/testsuites/smptests/smpcache01/init.c
@@ -20,6 +20,8 @@
 
 const char rtems_test_name[] = "SMPCACHE 1";
 
+const char data_to_flush[1024];
+
 #define CPU_COUNT 32
 
 #define WORKER_PRIORITY 100
@@ -44,6 +46,11 @@ static test_context ctx = {
   .barrier = SMP_BARRIER_CONTROL_INITIALIZER,
 };
 
+static void function_to_flush( void )
+{
+  /* Does nothing. Used to give a pointer to instruction address space. */
+}
+
 static void test_cache_message( const void *d_addr, size_t n_bytes )
 {
   rtems_test_assert(n_bytes == 123);
@@ -52,22 +59,20 @@ static void test_cache_message( const void *d_addr, size_t n_bytes )
   ctx.count[rtems_get_current_processor()]++;
 }
 
-static void all_cache_manager_smp_functions( size_t set_size,
+static void cache_manager_smp_functions( size_t set_size,
     cpu_set_t *cpu_set )
 {
-  rtems_cache_flush_multiple_data_lines_processor_set( 0, 10, set_size,
-      cpu_set );
-  rtems_cache_invalidate_multiple_data_lines_processor_set( 0, 10, set_size,
-      cpu_set );
+  rtems_cache_flush_multiple_data_lines_processor_set( &data_to_flush,
+      sizeof(data_to_flush), set_size, cpu_set );
   rtems_cache_flush_entire_data_processor_set( set_size, cpu_set );
-  rtems_cache_invalidate_entire_data_processor_set( set_size, cpu_set );
   rtems_cache_invalidate_entire_instruction();
-  rtems_cache_invalidate_multiple_instruction_lines( 0, 10 );
+  rtems_cache_invalidate_multiple_instruction_lines( &function_to_flush,
+      4 /* arbitrary size */ );
 }
 
 static void standard_funcs_test( size_t set_size, cpu_set_t *cpu_set )
 {
-  all_cache_manager_smp_functions( set_size, cpu_set );
+  cache_manager_smp_functions( set_size, cpu_set );
 }
 
 static void standard_funcs_isrdisabled_test( size_t set_size,
@@ -79,7 +84,7 @@ static void standard_funcs_isrdisabled_test( size_t set_size,
 
   _SMP_barrier_Wait( &ctx.barrier, bs, rtems_get_processor_count() );
 
-  all_cache_manager_smp_functions( set_size, cpu_set );
+  cache_manager_smp_functions( set_size, cpu_set );
 
   _ISR_Enable_without_giant( isr_level );
 }
@@ -92,7 +97,7 @@ static void standard_funcs_giant_taken_test( size_t set_size,
 
   _SMP_barrier_Wait( &ctx.barrier, bs, rtems_get_processor_count() );
 
-  all_cache_manager_smp_functions( set_size, cpu_set );
+  cache_manager_smp_functions( set_size, cpu_set );
 
   if ( rtems_get_current_processor() == 0)
     _Giant_Release();
@@ -169,23 +174,23 @@ static void all_tests( void )
   /* Send message to all available CPUs */
   CPU_FILL_S( set_size, cpu_set );
 
-  /* Call all SMP cache manager functions */
-  cmlog( "Calling all standard SMP cache functions\n" );
+  /* Call SMP cache manager functions */
+  cmlog( "Calling standard SMP cache functions. " );
   _SMP_barrier_Wait( &ctx.barrier, &bs, cpu_count );
   standard_funcs_test( set_size, cpu_set );
   _SMP_barrier_Wait( &ctx.barrier, &bs, cpu_count );
   cmlog( "Done!\n");
 
-  /* Call all SMP cache manager functions with ISR disabled */
-  cmlog( "Calling all standard SMP cache functions. With ISR disabled\n" );
+  /* Call SMP cache manager functions with ISR disabled */
+  cmlog( "Calling standard SMP cache functions with ISR disabled. " );
   _SMP_barrier_Wait( &ctx.barrier, &bs, cpu_count );
   standard_funcs_isrdisabled_test( set_size, cpu_set, &bs );
   _SMP_barrier_Wait( &ctx.barrier, &bs, cpu_count );
   cmlog( "Done!\n" );
 
-  /* Call all SMP cache manager functions with core 0 holding the giant lock */
-  cmlog( "Calling all standard SMP cache functions. With CPU0 holding "
-      "the giant lock\n" );
+  /* Call SMP cache manager functions with core 0 holding the giant lock */
+  cmlog( "Calling standard SMP cache functions with CPU0 holding "
+      "the giant lock. " );
   _SMP_barrier_Wait( &ctx.barrier, &bs, cpu_count );
   standard_funcs_giant_taken_test( set_size, cpu_set, &bs );
   _SMP_barrier_Wait( &ctx.barrier, &bs, cpu_count );
@@ -194,7 +199,7 @@ static void all_tests( void )
   /* Call a test function using SMP cache manager and verify that all
    * cores invoke the function */
   cmlog( "Calling a test function using the SMP cache manager to "
-      "verify that all CPUs receive the SMP message\n" );
+      "verify that all CPUs receive the SMP message. " );
   _SMP_barrier_Wait( &ctx.barrier, &bs, cpu_count );
   test_func_test( set_size, cpu_set, &bs );
   _SMP_barrier_Wait( &ctx.barrier, &bs, cpu_count );
@@ -203,7 +208,7 @@ static void all_tests( void )
   /* Call a test function using SMP cache manager and verify that all
    * cores invoke the function. ISR disabled. */
   cmlog( "Calling a test function using the SMP cache manager to "
-      "verify that all CPUs receive the SMP message. With ISR disabled\n" );
+      "verify that all CPUs receive the SMP message. With ISR disabled. " );
   _SMP_barrier_Wait( &ctx.barrier, &bs, cpu_count );
   test_func_isrdisabled_test( set_size, cpu_set, &bs );
   _SMP_barrier_Wait( &ctx.barrier, &bs, cpu_count );
@@ -213,7 +218,7 @@ static void all_tests( void )
    * cores invoke the function. Core 0 holding giant lock. */
   cmlog( "Calling a test function using the SMP cache manager to "
       "verify that all CPUs receive the SMP message. With CPU0 "
-      "holding the giant lock\n" );
+      "holding the giant lock. " );
   _SMP_barrier_Wait( &ctx.barrier, &bs, cpu_count );
   test_func_giant_taken_test( set_size, cpu_set, &bs );
   _SMP_barrier_Wait( &ctx.barrier, &bs, cpu_count );
diff --git a/testsuites/smptests/smpcache01/smpcache01.doc b/testsuites/smptests/smpcache01/smpcache01.doc
index f6041b2..0e3cbc3 100644
--- a/testsuites/smptests/smpcache01/smpcache01.doc
+++ b/testsuites/smptests/smpcache01/smpcache01.doc
@@ -5,9 +5,7 @@ test set name: smpcache01
 directives:
 
   - rtems_cache_flush_multiple_data_lines_processor_set
-  - rtems_cache_invalidate_multiple_data_lines_processor_set
   - rtems_cache_flush_entire_data_processor_set
-  - rtems_cache_invalidate_entire_data_processor_set
   - rtems_cache_invalidate_entire_instruction
   - rtems_cache_invalidate_multiple_instruction_lines
 
diff --git a/testsuites/smptests/smpcache01/smpcache01.scn b/testsuites/smptests/smpcache01/smpcache01.scn
index 5964d3e..c93e2c5 100644
--- a/testsuites/smptests/smpcache01/smpcache01.scn
+++ b/testsuites/smptests/smpcache01/smpcache01.scn
@@ -1,14 +1,8 @@
 *** BEGIN OF TEST SMPCACHE 1 ***
-Calling all standard SMP cache functions
-Done!
-Calling all standard SMP cache functions. With ISR disabled
-Done!
-Calling all standard SMP cache functions. With CPU0 holding the giant lock
-Done!
-Calling a test function using the SMP cache manager to verify that all CPUs receive the SMP message
-Done!
-Calling a test function using the SMP cache manager to verify that all CPUs receive the SMP message. With ISR disabled
-Done!
-Calling a test function using the SMP cache manager to verify that all CPUs receive the SMP message. With CPU0 holding the giant lock
-Done!
+Calling standard SMP cache functions. Done!
+Calling standard SMP cache functions with ISR disabled. Done!
+Calling standard SMP cache functions with CPU0 holding the giant lock. Done!
+Calling a test function using the SMP cache manager to verify that all CPUs receive the SMP message. Done!
+Calling a test function using the SMP cache manager to verify that all CPUs receive the SMP message. With ISR disabled. Done!
+Calling a test function using the SMP cache manager to verify that all CPUs receive the SMP message. With CPU0 holding the giant lock. Done!
 *** END OF TEST SMPCACHE 1 ***
-- 
2.1.0



More information about the devel mailing list