This is the mail archive of the systemtap@sources.redhat.com mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

SystemTap Kernel Runtime Library


SystemTap Kernel Runtime Library

The kernel runtime library provides all the functions that might need to
be linked into the SystemTap kernel module.

This includes:

* Associative Arrays
* Statistics variables

* Copy_From_User functions

* I/O functions to write data using printk, procfs, and/or netlink.

* time functions

* stack backtrace
* memory dump

* module framework 

* lots of other things that will be needed or useful as we
discover them

----

DETAILS

Associative Arrays are implemented as hash tables with linked lists.  
They take a key and return a value.  For example:
name[pid] = "bash"
pid["foo"] = current->pid;

Initially I plan to support only the following key types:
long
string
long,string (for pid-local variables)
long,long   (for pid-local variables)

The values stored in the arrays can be the following:
64-bit int
string
stats

There will be functions to lookup a value, change a value, clear an
array, print an array, and walk an array. 

Thread-local (or pid-local) variables will be implemented as an array.

These arrays need to be resident in kernel memory.  This means we need 
to be careful how many we allocate.  Allocation can be done at runtime,
but if we run out of empty array members, we will need to kmalloc()
more, truncate, or fail.  We can create some tuning parameters to
control this.

Strings present a special challenge because if we preallocate space at 
runtime, we have to assume a maximum string size and we risk wasting
memory if we set it too high.  Using kmalloc to allocate space for
strings as they are created should work (the reserved pool is small, but
we are  asking for a small amount and the pool gets replenished) but
needs testing.





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]