On 5/28/2014 10:22 AM, Gedare Bloom wrote: > On Wed, May 28, 2014 at 11:05 AM, Joel Sherrill > <joel.sherr...@oarcorp.com> wrote: >> On 5/28/2014 7:39 AM, Gedare Bloom wrote: >>> On Wed, May 28, 2014 at 5:00 AM, Sebastian Huber >>> <sebastian.hu...@embedded-brains.de> wrote: >>>> On 2014-05-28 00:16, Joel Sherrill wrote: >>>>> - rtems/score/threadimpl.h: _Thread_Start_multitasking does return >>>>> on Scheduler Simulator. Initializing RTEMS returns to the command >>>>> interpreter. >>>>> >>>>> - rtems/score/smpimpl.h: _SMP_Start_multitasking_on_secondary_processor() >>>>> is not applicable on the Scheduler Simulator and the no return >>>>> attribute >>>>> gives a warning. >>>>> >>>>> - rtems/score/assert.h: Scheduler Simulator uses glibc assert.h on >>>>> GNU/Linux. >>>>> This will likely need to be adjusted more for other host compilers and >>>>> C libraries >>>>> >>>>> - threadrestart.c: Disable assert on Scheduler Simulator. Restarting self >>>>> returns to the command interpreter. >>>> I would define RTEMS_COMPILER_NO_RETURN_ATTRIBUTE and _Assert() to nothing >>>> in case RTEMS_SCHEDSIM is defined. Do you really need this debugging stuff >>>> for the scheduler simulator? I don't think we should propagate oddities of >>>> the scheduler simulator throughout the code base. >>>> >>> Yes, this was my initial reaction as well. Probably at least you could >>> make Assert_Not_reached() a nop, or write a wrapper for assert that >>> depends on schedsim. Can schedsim work more like a real target for >>> this case of not returning? I guess usually the system ends up in a >>> fatal or halt state? Maybe you can interpose on that state to return >>> to the command interpreter. >> Schedsim does not really context switch so the paths that assume a task >> switches >> out and never returns are reachable paths. It is logically a single >> thread of control >> with the underlying RTEMS code thinking that a thread is "executing" on >> the various >> cores. When a thread blocks, control returns to the script with a new >> executing >> thread. In an SMP configuration, the scripts can also change CPU focus >> and execute >> commands in the context of the executing thread on that core. >> >> I can live with disabling the noreturn checks and turning off that >> warning. I think >> that will eliminate the first two of the four spots touched above. >> >> But I don't want to disable the asserts. Right now, we can run with >> --enable-rtems-debug >> and not get any asserts. The consistency checks are really handy and >> they found >> bugs in the Affinity Scheduler. So I really do not want to disable >> them. So killing >> assertions is undesirable. >> >> I could try to move all of the alternative assert logic under an >> RTEMS_SCHEDSIM. >> That would make it clearer what it is for and harder to trip. >> >> For know, making Assert_Not_reached() nothing on Schedsim would be >> acceptable >> for the _Thread_Restart() assertion. >> >> I think this would restrict the patch to the rtems assert.h. Is that >> acceptable? >> > Yes, that would be better. I can't turn off the no return warning via the command line. That touches basedefs.h.
So basedefs.h and assert.h are the reduced set of files touched. New version attached. > -Gedare > >> FWIW I have been using the native gcov to get coverage reports on the >> various schedulers. >> For the parts of RTEMS that are in the scheduler simulator, the coverage >> is actually >> pretty high without focusing on more than schedulers. And the affinity >> scheduler >> is the only one I have paid attention to coverage on. The Affinity >> scheduler reports >> near 100% and the two places not reported as covered can be broken on in >> gdb. I >> can't explain the discrepancy. Overall, we are getting 65.78% coverage >> of 191 files >> (4 schedsim specific included). >> >>> -Gedare >>> >>>> -- >>>> Sebastian Huber, embedded brains GmbH >>>> >>>> Address : Dornierstr. 4, D-82178 Puchheim, Germany >>>> Phone : +49 89 189 47 41-16 >>>> Fax : +49 89 189 47 41-09 >>>> E-Mail : sebastian.hu...@embedded-brains.de >>>> PGP : Public key available on request. >>>> >>>> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG. >>>> >>>> _______________________________________________ >>>> rtems-devel mailing list >>>> rtems-devel@rtems.org >>>> http://www.rtems.org/mailman/listinfo/rtems-devel >>> _______________________________________________ >>> rtems-devel mailing list >>> rtems-devel@rtems.org >>> http://www.rtems.org/mailman/listinfo/rtems-devel >> -- >> Joel Sherrill, Ph.D. Director of Research & Development >> joel.sherr...@oarcorp.com On-Line Applications Research >> Ask me about RTEMS: a free RTOS Huntsville AL 35805 >> Support Available (256) 722-9985 >> -- Joel Sherrill, Ph.D. Director of Research & Development joel.sherr...@oarcorp.com On-Line Applications Research Ask me about RTEMS: a free RTOS Huntsville AL 35805 Support Available (256) 722-9985
>From edd7159c7c783be9826a25b1f77ef08fb61a8cbc Mon Sep 17 00:00:00 2001 From: Joel Sherrill <joel.sherr...@oarcorp.com> Date: Mon, 14 Apr 2014 16:05:04 -0500 Subject: [PATCH 1/4] Minor conditionals to enable building Scheduler Simulator on GNU/Linux - rtems/score/assert.h: Scheduler Simulator uses glibc assert.h on GNU/Linux. This will likely need to be adjusted more for other host compilers and C libraries. Also disable _Assert_Not_reached() because some of these paths do actually return to the called on the Scheduler Simulator. - basedefs.h: Do not use noreturn attribute when on Scheduler Simulator. Paths which context switch can return to the command interpreter on the Scheduler Simulator. --- cpukit/score/include/rtems/score/assert.h | 26 ++++++++++++++++++++++---- cpukit/score/include/rtems/score/basedefs.h | 4 +++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/cpukit/score/include/rtems/score/assert.h b/cpukit/score/include/rtems/score/assert.h index 41ef1ae..5e9c4df 100644 --- a/cpukit/score/include/rtems/score/assert.h +++ b/cpukit/score/include/rtems/score/assert.h @@ -30,10 +30,24 @@ extern "C" { * NDEBUG. */ #if defined( RTEMS_DEBUG ) - #define _Assert( _e ) \ - ( ( _e ) ? \ - ( void ) 0 : \ - __assert_func( __FILE__, __LINE__, __ASSERT_FUNC, #_e ) ) + #if !defined(RTEMS_SCHEDSIM) + /* __ASSERT_FUNC is newlib. */ + #define _Assert( _e ) \ + ( ( _e ) ? \ + ( void ) 0 : \ + __assert_func( __FILE__, __LINE__, __ASSERT_FUNC, #_e ) ) + #else + /* __ASSERT_FUNCTION is glibc. */ + #if defined(__ASSERT_FUNCTION) + #define _Assert( _e ) \ + ( ( _e ) ? \ + ( void ) 0 : \ + __assert_fail( #_e, __FILE__, __LINE__, __ASSERT_FUNCTION ) ) + #else + #error "What does assert.h use?" + #endif + #endif + #else #define _Assert( _e ) ( ( void ) 0 ) #endif @@ -70,7 +84,11 @@ extern "C" { /** * @brief Asserts that this point is not reached during run-time. */ +#if RTEMS_SCHEDSIM +#define _Assert_Not_reached() +#else #define _Assert_Not_reached() _Assert( 0 ) +#endif #ifdef __cplusplus } diff --git a/cpukit/score/include/rtems/score/basedefs.h b/cpukit/score/include/rtems/score/basedefs.h index a0bebdd..67ab90a 100644 --- a/cpukit/score/include/rtems/score/basedefs.h +++ b/cpukit/score/include/rtems/score/basedefs.h @@ -153,7 +153,9 @@ * can impact the code generated following calls to * rtems_fatal_error_occurred and _Terminate. */ -#ifdef __GNUC__ +#if RTEMS_SCHEDSIM + #define RTEMS_COMPILER_NO_RETURN_ATTRIBUTE +#elif defined(__GNUC__) #define RTEMS_COMPILER_NO_RETURN_ATTRIBUTE \ __attribute__ ((noreturn)) #else -- 1.7.1
_______________________________________________ rtems-devel mailing list rtems-devel@rtems.org http://www.rtems.org/mailman/listinfo/rtems-devel