Hi list,

I'm simultaneously happy and embarrassed to present a possible fix, which I have tested about 3 times only.

My suspicions are one of the following is true (certainly the last):
- thread 2's stack isn't being allocated correctly somehow

Yep, thread 2's stack was being allocated to 16k, same as RTAI, but when hit with the great (as in size) glibc, it broke. I upped the stack to 4MB and latency-test runs perfectly. This should be tuned down of course, and there's an option in configure.in to use dietlibc that will allow it to be tuned down even further.

Suggestions for how to go about tuning?

- I'm still clueless and need to do a bunch more reading.  :P

Yep. Embarrassing that it took breaking out all the heavy tools to find what should've been obvious. At least the hit in my pride is greatly outweighed by my new huge tool belt!

If this fix is confirmed to work, then I'll make good on the bounty!

        John
commit 4c0e4ddef8337c47ab998257e98260204f2340ac
Author: John Morris <j...@zultron.com>
Date:   Fri May 4 15:57:16 2012 -0500

    Increase HAL_STACKSIZE (thread stacksize) for PREEMPT_RT to stop segfaults
    
    The previous 16k stacksize is fine for kernel modules, but much too small
    for PREEMPT_RT, which uses libc.
    
    This number, 4MB, is probably way too large, and should be tuned.  There's
    also the possibility for using dietlibc in configure.in, which may allow
    the number to be reduced even further.
    
    For now, I'm just happy the thing runs!

diff --git a/src/hal/hal_priv.h b/src/hal/hal_priv.h
index 1ef1f74..686d781 100644
--- a/src/hal/hal_priv.h
+++ b/src/hal/hal_priv.h
@@ -287,7 +287,11 @@ typedef struct {
     int funct_ptr;		/* pointer to function */
 } hal_funct_entry_t;
 
-#define HAL_STACKSIZE 16384	/* realtime task stacksize */
+#ifdef RTAPI_LINUX
+#define HAL_STACKSIZE 4194304	/* realtime task stacksize for PREEMPT_RT */
+#else
+#define HAL_STACKSIZE 16384	/* realtime task stacksize for RTAI (RT-Linux?) */
+#endif
 
 typedef struct {
     int next_ptr;		/* next thread in linked list */
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to