This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
RE: CPU Stack Overflow In BSD Network Stack
- From: Jay Foster <jay at systech dot com>
- To: 'Andrew Lunn' <andrew dot lunn at ascom dot ch>
- Cc: "'ecos-discuss at sources dot redhat dot com'" <ecos-discuss at sources dot redhat dot com>
- Date: Mon, 23 Jun 2003 09:52:18 -0700
- Subject: RE: [ECOS] CPU Stack Overflow In BSD Network Stack
Looks good to me. Thanks for your assistance.
Jay
-----Original Message-----
From: Andrew Lunn [mailto:andrew.lunn@ascom.ch]
Sent: Monday, June 23, 2003 2:43 AM
To: Jay Foster
Cc: 'Andrew Lunn'; 'ecos-discuss@sources.redhat.com'
Subject: Re: [ECOS] CPU Stack Overflow In BSD Network Stack
On Fri, Jun 20, 2003 at 10:05:34AM -0700, Jay Foster wrote:
> Sorry for all the noise.
>
> I added quotes around the default_value expression values, making the C
> preprocessor perform the evaluation, rather than CDL, and this seems to
> work.
>
> default_value { (CYGPKG_NET_INET6 == 1) ?
> ("(CYGNUM_HAL_STACK_SIZE_TYPICAL) + 2048") :
> "CYGNUM_HAL_STACK_SIZE_TYPICAL" }
>
> Is this proper use of a default_value?
>
> Also, would it be better to put such a CDL option in the freebsd_net.cdl,
> rather than the net.cdl file? The reason I bring this up is that the
> CYGPKG_NET_THREAD_PRIORITY is configured in the freebsd_net.cdl, and it
> seems to me that the thread stack size and priority should be configured
in
> the same general place. This also applies to the openbsd_net.cdl file
too.
>
> Jay
That i was thinking was:
Index: freebsd_net.cdl
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/bsd_tcpip/current/cdl/freebsd_net.cdl,v
retrieving revision 1.5
diff -u -r1.5 freebsd_net.cdl
--- freebsd_net.cdl 4 May 2003 17:37:28 -0000 1.5
+++ freebsd_net.cdl 23 Jun 2003 09:30:32 -0000
@@ -120,6 +120,8 @@
active_if CYGPKG_NET_INET6
flavor bool
default_value 1
+ requires { CYGPKG_NET_THREAD_STACKSIZE >
+ ( CYGNUM_HAL_STACK_SIZE_TYPICAL + 1024 ) }
description "
This option enables support for new IPv6."
# These files were derived from FreeBSD and carry their
copyright
@@ -246,6 +248,16 @@
high enough that sufficient CPU resources are available to
process network data, but may be adjusted so that application
threads can have precedence over network processing."
+ }
+
+ cdl_option CYGPKG_NET_THREAD_STACKSIZE {
+ display "Stack size for the background network thread"
+ flavor data
+ default_value CYGNUM_HAL_STACK_SIZE_TYPICAL
+ description "
+ This option controls the size of the stack the background
+ network stack thread uses. It has to be sufficient to allow the
+ stack to send/receive packets and to deal with timers etc."
}
cdl_option CYGPKG_NET_FAST_THREAD_PRIORITY {
ie, the default value would be the typical stack size. But if INET6 is
active, the requires statement would cause the cdl inference engine to
increase the stack size.
But....
When i suggested using CDL, i assumed that
CYGNUM_HAL_STACK_SIZE_TYPICAL was available in CDL. I was wrong. It
was only defined in the hal_arch.h file. This makes the CDL messy and
i think i now prefer plain #ifdef in the C code. Sorry for messing you
around. If nothing else i hoped you learnt some more about CDL.
Here is what im going to commit:
lunn@cobra:~/lhome/anoncvs/packages$ cvs diff net/bsd_tcpip/current/
Index: net/bsd_tcpip/current//ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/bsd_tcpip/current/ChangeLog,v
retrieving revision 1.24
diff -u -r1.24 ChangeLog
--- net/bsd_tcpip/current//ChangeLog 12 May 2003 11:03:05 -0000 1.24
+++ net/bsd_tcpip/current//ChangeLog 23 Jun 2003 09:42:34 -0000
@@ -1,3 +1,8 @@
+2003-06-23 Jay Foster <jay@systech.com>
+
+ * src/ecos/support.c: Increase the stack size for the background
+ thread when IPv6 is enabled otherwise the stack overflows.
+
2003-05-12 Motoya Kurotsu <kurotsu@allied-telesis.co.jp>
* src/ecos/timeout.c (do_timeout): The head of the linked list of
Index: net/bsd_tcpip/current//src/ecos/support.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/bsd_tcpip/current/src/ecos/support.c,v
retrieving revision 1.8
diff -u -r1.8 support.c
--- net/bsd_tcpip/current//src/ecos/support.c 12 May 2003 10:09:06 -0000
1.8
+++ net/bsd_tcpip/current//src/ecos/support.c 23 Jun 2003 09:42:34 -0000
@@ -104,7 +104,11 @@
int cyg_net_log_mask = CYGPKG_NET_FREEBSD_LOGGING;
#endif
+#ifdef CYGPKG_NET_INET6
+#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL+2048)
+#else
#define STACK_SIZE CYGNUM_HAL_STACK_SIZE_TYPICAL
+#endif
static char netint_stack[STACK_SIZE];
static cyg_thread netint_thread_data;
static cyg_handle_t netint_thread_handle;
Andrew
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss