Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Aug 2002 12:56:51 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Poul-Henning Kamp <phk@freebsd.org>
Cc:        current@freebsd.org, hackers@freebsd.org
Subject:   Re: phk's JKH list
Message-ID:  <3D614D83.3B08815B@mindspring.com>
References:  <3592.1029771744@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
Poul-Henning Kamp wrote:
> I've started to type in my mental sticky notes, have at it:
> 
>         http://people.freebsd.org/~phk/TODO/

| Kernel stack depth warning. 
| 
| Write a function which checks the amount of kernel stack used and
| print a warning if it exceeds a sysctl-able limit.
| The inserted calls should compile to nothing unless the right kernel
| options is used.
| Instrument the kernel strategically and examine the result.


If this is just for testing purposes, then you probably want to
look at `-finstrument-functions'; by ensuring that stacks are
all aligned on an 8K or so boundary, you can write small assembly
functions named:

	void __cyg_profile_func_enter (void *this_fn, void *call_site);
	void __cyg_profile_func_exit  (void *this_fn, void *call_site);

And check the stack pointer against the previous alignment
address (example: stack address mod 8K := current stack depth).

I've used these for non-statistical profiling (e.g. recording
specific arc's in gprof-usable buckets for kernel profiling,
rather than relying on a statistics clock and the current PC),
but the principle should work the same for this purpose.

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3D614D83.3B08815B>