public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] dhcp_mgt_stack isn't configurable
@ 2006-12-28 15:09 Øyvind Harboe
  2007-01-07 14:47 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Øyvind Harboe @ 2006-12-28 15:09 UTC (permalink / raw)
  To: eCos Discussion

Shouldn't this stack size be configurable?

With CYGDBG_IO_ETH_DRIVERS_DEBUG_VERBOSITY=10, diag_printf() makes it
overflow on my rocket(AT91EB40a w/ethermac) so I increased it by
0x1000 and things work fine + eCos no longer detects stack problems
via it's diagnostic code.



### Eclipse Workspace Patch 1.0
#P ecos
Index: packages/net/common/current/src/dhcp_support.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/src/dhcp_support.c,v
retrieving revision 1.2
diff -u -r1.2 dhcp_support.c
--- packages/net/common/current/src/dhcp_support.c	12 Jan 2003
04:53:28 -0000	1.2
+++ packages/net/common/current/src/dhcp_support.c	28 Dec 2006 15:05:41 -0000
@@ -222,7 +222,9 @@
 cyg_handle_t dhcp_mgt_thread_h = 0;
 cyg_thread   dhcp_mgt_thread;

-#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + sizeof(struct bootp))
+// FIX!!!! why isn't this configureable??? The amount of stack
+// depends on whether diag_printf() is used or not.
+#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + sizeof(struct
bootp)+0x1000)
 static cyg_uint8 dhcp_mgt_stack[ STACK_SIZE ];

 void dhcp_start_dhcp_mgt_thread( void )



-- 
Øyvind Harboe
http://www.zylin.com

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] dhcp_mgt_stack isn't configurable
  2006-12-28 15:09 [ECOS] dhcp_mgt_stack isn't configurable Øyvind Harboe
@ 2007-01-07 14:47 ` Andrew Lunn
  2007-01-07 15:00   ` Øyvind Harboe
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2007-01-07 14:47 UTC (permalink / raw)
  To: ?yvind Harboe; +Cc: eCos Discussion

[-- Attachment #1: Type: text/plain, Size: 408 bytes --]

On Thu, Dec 28, 2006 at 04:09:43PM +0100, ?yvind Harboe wrote:
> Shouldn't this stack size be configurable?
> 
> With CYGDBG_IO_ETH_DRIVERS_DEBUG_VERBOSITY=10, diag_printf() makes it
> overflow on my rocket(AT91EB40a w/ethermac) so I increased it by
> 0x1000 and things work fine + eCos no longer detects stack problems
> via it's diagnostic code.

This patch makes the stack size configurable.

     Andrew

[-- Attachment #2: dhcp_stack_size.diff --]
[-- Type: text/x-diff, Size: 3742 bytes --]

Index: net/common/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/ChangeLog,v
retrieving revision 1.78
diff -u -r1.78 ChangeLog
--- net/common/current/ChangeLog	19 Dec 2006 01:45:30 -0000	1.78
+++ net/common/current/ChangeLog	7 Jan 2007 14:46:30 -0000
@@ -1,3 +1,10 @@
+2007-01-07  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* src/dhcp_support.c: 
+	* cdl/net.cdl:
+	Added CDL to control the size of the stack used by
+	the DHCP management thread.
+
 2006-12-18  Sergei Gavrikov  <sg@sgs.gomel.by>
 
 	* tests/ga_server_test.c: Updated flags argument in call of
Index: net/common/current/cdl/net.cdl
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/cdl/net.cdl,v
retrieving revision 1.16
diff -u -r1.16 net.cdl
--- net/common/current/cdl/net.cdl	17 Jun 2006 20:11:06 -0000	1.16
+++ net/common/current/cdl/net.cdl	7 Jan 2007 14:46:30 -0000
@@ -271,6 +271,17 @@
             network thread itself."
         }
 
+        cdl_option CYGPKG_NET_DHCP_THREAD_STACK_SIZE {
+            display "Stack size for DHCP management threads."
+            flavor  data
+            default_value { "(CYGNUM_HAL_STACK_SIZE_TYPICAL+sizeof(struct bootp))" }
+            description   "
+               This option controls the size of the stack used for the
+               DHCP mamagement thread. The default should be
+               sufficient for most cases but some applications my
+               require bigger stacks when using for example diag_printf."
+        }
+
         cdl_option CYGOPT_NET_DHCP_PARM_REQ_LIST_REPLACE {
             display "Replace DHCP request options"
             flavor  booldata
Index: net/common/current/src/dhcp_support.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/src/dhcp_support.c,v
retrieving revision 1.2
diff -u -r1.2 dhcp_support.c
--- net/common/current/src/dhcp_support.c	12 Jan 2003 04:53:28 -0000	1.2
+++ net/common/current/src/dhcp_support.c	7 Jan 2007 14:46:31 -0000
@@ -222,22 +222,21 @@
 cyg_handle_t dhcp_mgt_thread_h = 0;
 cyg_thread   dhcp_mgt_thread;
 
-#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + sizeof(struct bootp))
-static cyg_uint8 dhcp_mgt_stack[ STACK_SIZE ];
+static cyg_uint8 dhcp_mgt_stack[ CYGPKG_NET_DHCP_THREAD_STACK_SIZE ];
 
 void dhcp_start_dhcp_mgt_thread( void )
 {
     if ( ! dhcp_mgt_thread_h ) {
         cyg_semaphore_init( &dhcp_needs_attention, 0 );
         cyg_thread_create(
-            CYGPKG_NET_DHCP_THREAD_PRIORITY, /* scheduling info (eg pri) */
-            dhcp_mgt_entry,             /* entry point function */
+            CYGPKG_NET_DHCP_THREAD_PRIORITY,   /* scheduling info (eg pri) */
+            dhcp_mgt_entry,                    /* entry point function */
             CYGOPT_NET_DHCP_DHCP_THREAD_PARAM, /* entry data */
-            "DHCP lease mgt",           /* optional thread name */
-            dhcp_mgt_stack,             /* stack base, NULL = alloc */
-            STACK_SIZE,                 /* stack size, 0 = default */
-            &dhcp_mgt_thread_h,         /* returned thread handle */
-            &dhcp_mgt_thread           /* put thread here */
+            "DHCP lease mgt",                  /* optional thread name */
+            dhcp_mgt_stack,                    /* stack base, NULL = alloc */
+            CYGPKG_NET_DHCP_THREAD_STACK_SIZE, /* stack size, 0 = default */
+            &dhcp_mgt_thread_h,                /* returned thread handle */
+            &dhcp_mgt_thread                   /* put thread here */
             );
 
         cyg_thread_resume(dhcp_mgt_thread_h);


[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] dhcp_mgt_stack isn't configurable
  2007-01-07 14:47 ` Andrew Lunn
@ 2007-01-07 15:00   ` Øyvind Harboe
  0 siblings, 0 replies; 3+ messages in thread
From: Øyvind Harboe @ 2007-01-07 15:00 UTC (permalink / raw)
  To: eCos Discussion

On 1/7/07, Andrew Lunn <andrew@lunn.ch> wrote:
> On Thu, Dec 28, 2006 at 04:09:43PM +0100, ?yvind Harboe wrote:
> > Shouldn't this stack size be configurable?
> >
> > With CYGDBG_IO_ETH_DRIVERS_DEBUG_VERBOSITY=10, diag_printf() makes it
> > overflow on my rocket(AT91EB40a w/ethermac) so I increased it by
> > 0x1000 and things work fine + eCos no longer detects stack problems
> > via it's diagnostic code.
>
> This patch makes the stack size configurable.

Thanks!

I'm not sure but I believe there is another thread for networking that
needs the same patch.

Hmmm....

How about making the default stack size value add some extra
diag_printf() safety margin if ethernet verbose is >0?

Or perhaps a new option to increase stack sizes for *all* threads in
the system to include enough for diag_printf()/other debug code?

Or rewrite diag_printf() not to  use the thread stack...

Hmmm... diag_printf() can be called from ISR/DSRs also so considering
thread stack sizes is not sufficient...

-- 
Øyvind Harboe
http://www.zylin.com

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-01-07 15:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-28 15:09 [ECOS] dhcp_mgt_stack isn't configurable Øyvind Harboe
2007-01-07 14:47 ` Andrew Lunn
2007-01-07 15:00   ` Øyvind Harboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).