From: daniel.neri@sigicom.com (Daniel Néri)
To: ecos-discuss@sources.redhat.com
Subject: [ECOS] Re: Debug eCos kernel
Date: Wed, 11 Feb 2009 10:38:00 -0000 [thread overview]
Message-ID: <87hc31z2aq.fsf@dual.hq.sigicom.net> (raw)
In-Reply-To: <20090211100916.GE32351@lunn.ch>
[-- Attachment #1: Type: text/plain, Size: 360 bytes --]
Andrew Lunn <andrew@lunn.ch> writes:
> You are going to have to work on it before it will be
> usable. Hopefully you can see the idea what it is trying to do.
I did some of that work a while ago, but ended up not using it. I'm
attaching a patch with the changes I made to make the code compile
without errors (but no promises beyond that).
Regards,
Daniel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: trace-splx-fix.patch --]
[-- Type: text/x-patch, Size: 6017 bytes --]
diff --git a/net/bsd_tcpip/current/include/sys/param.h b/net/bsd_tcpip/current/include/sys/param.h
--- a/net/bsd_tcpip/current/include/sys/param.h
+++ b/net/bsd_tcpip/current/include/sys/param.h
@@ -815,9 +815,11 @@
#define splclock() cyg_splclock(__FUNCTION__, __LINE__)
#define splsoftnet() cyg_splsoftnet(__FUNCTION__, __LINE__)
#define splx(x) cyg_splx(x, __FUNCTION__, __LINE__)
+#if 0
#define cyg_scheduler_lock() _cyg_scheduler_lock(__FUNCTION__, __LINE__)
#define cyg_scheduler_safe_lock() _cyg_scheduler_safe_lock(__FUNCTION__, __LINE__)
#define cyg_scheduler_unlock() _cyg_scheduler_unlock(__FUNCTION__, __LINE__)
+#endif
#else
extern cyg_uint32 cyg_splimp(void);
extern cyg_uint32 cyg_splnet(void);
diff --git a/net/bsd_tcpip/current/src/ecos/synch.c b/net/bsd_tcpip/current/src/ecos/synch.c
--- a/net/bsd_tcpip/current/src/ecos/synch.c
+++ b/net/bsd_tcpip/current/src/ecos/synch.c
@@ -115,9 +115,10 @@
#ifdef CYGIMPL_TRACE_SPLX
+static void do_sched_event(const char *, const char *, int, void *, cyg_uint32);
#define SPLXARGS const char *file, const int line
-#define SPLXMOREARGS , const char *file, const int line
-#define SPLXTRACE do_sched_event(__FUNCTION__, file, line, spl_state)
+#define SPLXMOREARGS , SPLXARGS
+#define SPLXTRACE do_sched_event(__FUNCTION__, file, line, __builtin_return_address(0), spl_state)
#else
#define SPLXARGS void
#define SPLXMOREARGS
@@ -357,13 +358,15 @@
#define MAX_SCHED_EVENTS 256
static struct _sched_event {
char *fun, *file;
- int line, lock;
+ int line;
+ cyg_uint32 lock;
+ void *ret;
} sched_event[MAX_SCHED_EVENTS];
static int next_sched_event = 0;
static int total_sched_events = 0;
static void
-do_sched_event(char *fun, char *file, int line, int lock)
+do_sched_event(const char *fun, const char *file, int line, void *ret, cyg_uint32 lock)
{
struct _sched_event *se = &sched_event[next_sched_event];
if (++next_sched_event == MAX_SCHED_EVENTS) {
@@ -373,6 +376,7 @@
se->file = file;
se->line = line;
se->lock = lock;
+ se->ret = ret;
total_sched_events++;
}
@@ -390,7 +394,7 @@
diag_printf("%d total scheduler events\n", total_sched_events);
while (i != next_sched_event) {
se = &sched_event[i];
- diag_printf("%s - lock: %d, called from %s.%d\n", se->fun, se->lock, se->file, se->line);
+ diag_printf("%s - lock: %d, called from %s:%d @ %p\n", se->fun, se->lock, se->file, se->line, se->ret);
if (++i == MAX_SCHED_EVENTS) i = 0;
}
}
@@ -401,21 +405,21 @@
_cyg_scheduler_lock(char *file, int line)
{
cyg_scheduler_lock();
- do_sched_event(__FUNCTION__, file, line, SPLX_TRACE_DATA());
+ do_sched_event(__FUNCTION__, file, line, __builtin_return_address(0), SPLX_TRACE_DATA());
}
void
_cyg_scheduler_safe_lock(char *file, int line)
{
cyg_scheduler_safe_lock();
- do_sched_event(__FUNCTION__, file, line, SPLX_TRACE_DATA());
+ do_sched_event(__FUNCTION__, file, line, __builtin_return_address(0), SPLX_TRACE_DATA());
}
void
_cyg_scheduler_unlock(char *file, int line)
{
cyg_scheduler_unlock();
- do_sched_event(__FUNCTION__, file, line, SPLX_TRACE_DATA());
+ do_sched_event(__FUNCTION__, file, line, __builtin_return_address(0), SPLX_TRACE_DATA());
}
#endif // CYGIMPL_TRACE_SPLX
diff --git a/net/bsd_tcpip/current/src/ecos/timeout.c b/net/bsd_tcpip/current/src/ecos/timeout.c
--- a/net/bsd_tcpip/current/src/ecos/timeout.c
+++ b/net/bsd_tcpip/current/src/ecos/timeout.c
@@ -74,7 +74,13 @@
// ------------------------------------------------------------------------
// This routine exists so that this module can synchronize:
+#ifdef CYGIMPL_TRACE_SPLX
+extern cyg_uint32 cyg_splinternal(const char *, int);
+#define splinternal() cyg_splinternal(__FUNCTION__, __LINE__)
+#else
extern cyg_uint32 cyg_splinternal(void);
+#define splinternal() cyg_splinternal()
+#endif
#ifdef TIMEOUT_DEBUG
static void
@@ -213,7 +219,7 @@
#endif // CYGPKG_NET_FAST_THREAD_TICKLE_DEVS
CYG_ASSERT( !((~3) & x), "Extra bits" );
- spl = cyg_splinternal();
+ spl = splinternal();
CYG_ASSERT( 0 == spl, "spl nonzero" );
@@ -230,7 +236,7 @@
if ( 1 & x )
do_timeout();
- cyg_splx(spl);
+ splx(spl);
}
}
@@ -272,7 +278,7 @@
// this needs to be atomic - recursive calls from the alarm
// handler thread itself are allowed:
- int spl = cyg_splinternal();
+ int spl = splinternal();
stamp = 0; // Assume no slots available
for (e = _timeouts, i = 0; i < NTIMEOUTS; i++, e++) {
@@ -285,7 +291,7 @@
break;
}
}
- cyg_splx(spl);
+ splx(spl);
return stamp;
}
@@ -298,7 +304,7 @@
{
int i;
timeout_entry *e;
- int spl = cyg_splinternal();
+ int spl = splinternal();
for (e = _timeouts, i = 0; i < NTIMEOUTS; i++, e++) {
if (e->delta && (e->fun == fun) && (e->arg == arg)) {
@@ -306,7 +312,7 @@
break;
}
}
- cyg_splx(spl);
+ splx(spl);
}
void
@@ -318,7 +324,7 @@
void
callout_reset(struct callout *c, int delta, timeout_fun *f, void *p)
{
- int spl = cyg_splinternal();
+ int spl = splinternal();
CYG_ASSERT( 0 < delta, "delta is right now, or even sooner!" );
@@ -431,20 +437,20 @@
CYG_ASSERT( delta >= last_delta, "We didn't pick the smallest delta!" );
}
#endif
- cyg_splx(spl);
+ splx(spl);
}
void
callout_stop(struct callout *c)
{
- int spl = cyg_splinternal();
+ int spl = splinternal();
#ifdef TIMEOUT_DEBUG
diag_printf("%s(%p) = %x\n", __FUNCTION__, c, c->flags);
#endif
if ((c->flags & CALLOUT_PENDING) == 0) {
c->flags &= ~CALLOUT_ACTIVE;
- cyg_splx(spl);
+ splx(spl);
return;
}
c->flags &= ~(CALLOUT_PENDING | CALLOUT_ACTIVE);
@@ -456,7 +462,7 @@
} else {
timeouts = c->next;
}
- cyg_splx(spl);
+ splx(spl);
}
int
[-- Attachment #3: Type: text/plain, Size: 75 bytes --]
--
Daniel Néri <daniel.neri@sigicom.com>
Sigicom AB, Stockholm, Sweden
[-- Attachment #4: 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
next prev parent reply other threads:[~2009-02-11 10:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-19 15:05 [ECOS] Re: cyg_selwakeup and performance impact? Tom Anderson
2009-02-08 14:17 ` Zhichao Hong
2009-02-09 16:05 ` [ECOS] Debug eCos kernel Deroo Stijn
2009-02-09 16:40 ` Gary Thomas
2009-02-09 18:02 ` Andrew Lunn
2009-02-10 7:19 ` Deroo Stijn
2009-02-10 7:37 ` Andrew Lunn
2009-02-10 15:43 ` Deroo Stijn
2009-02-10 16:15 ` Andrew Lunn
2009-02-11 9:55 ` Deroo Stijn
2009-02-11 10:09 ` Andrew Lunn
2009-02-11 10:38 ` Daniel Néri [this message]
2009-02-11 10:44 ` [ECOS] " Daniel Néri
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87hc31z2aq.fsf@dual.hq.sigicom.net \
--to=daniel.neri@sigicom.com \
--cc=ecos-discuss@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).