<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE rdf:RDF [
<!ENTITY % HTMLlat1 PUBLIC
 "-//W3C//ENTITIES Latin 1 for XHTML//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">
]>
<rdf:RDF
 xmlns="http://purl.org/rss/1.0/"
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns:content="http://purl.org/rss/1.0/modules/content/"
 xmlns:admin="http://webns.net/mvcb/"
>
<channel rdf:about="http://www.crisp.demon.co.uk/blog/index.xml">
<title>CRiSP Weblog</title>
<link>http://www.crisp.demon.co.uk/blog</link>
<description>news, diary, journal, whatever</description>
<dc:language>en-us</dc:language>
<dc:creator>Paul Fox</dc:creator>
<admin:generatorAgent rdf:resource="http://nanoblogger.sourceforge.net" />
<items>
<rdf:Seq>
<rdf:li rdf:resource="http://www.crisp.demon.co.uk/blog/archives/2008-08.html#e2008-08-01T21_18_31.txt" />
<rdf:li rdf:resource="http://www.crisp.demon.co.uk/blog/archives/2008-07.html#e2008-07-13T16_59_54.txt" />
<rdf:li rdf:resource="http://www.crisp.demon.co.uk/blog/archives/2008-07.html#e2008-07-05T09_27_41.txt" />
<rdf:li rdf:resource="http://www.crisp.demon.co.uk/blog/archives/2008-06.html#e2008-06-29T22_09_45.txt" />
<rdf:li rdf:resource="http://www.crisp.demon.co.uk/blog/archives/2008-06.html#e2008-06-22T21_57_04.txt" />
<rdf:li rdf:resource="http://www.crisp.demon.co.uk/blog/archives/2008-06.html#e2008-06-07T18_02_32.txt" />
<rdf:li rdf:resource="http://www.crisp.demon.co.uk/blog/archives/2008-05.html#e2008-05-31T00_04_13.txt" />
<rdf:li rdf:resource="http://www.crisp.demon.co.uk/blog/archives/2008-05.html#e2008-05-22T22_18_11.txt" />
<rdf:li rdf:resource="http://www.crisp.demon.co.uk/blog/archives/2008-05.html#e2008-05-19T22_37_21.txt" />
<rdf:li rdf:resource="http://www.crisp.demon.co.uk/blog/archives/2008-05.html#e2008-05-11T11_14_42.txt" />
</rdf:Seq>
</items>
</channel>
<item rdf:about="http://www.crisp.demon.co.uk/blog/archives/2008-08.html#e2008-08-01T21_18_31.txt">
<link>http://www.crisp.demon.co.uk/blog/archives/2008-08.html#e2008-08-01T21_18_31.txt</link>
<title>dtrace progress 20080801</title>
<dc:date>2008-08-01T21:18:31+01:00</dc:date>
<dc:creator>Paul Fox</dc:creator>

<description><![CDATA[The blog may have been quiet for a couple of weeks, but only
because I was on holiday.
<p>
On holiday, with a 32-bit Linux laptop - so I managed to clean
up and fix a number of 32-bit issues with dtrace. It now works
quite well on Ubuntu 8.
<p>
I have just put out a new release - and fixed the accidentally
broken 64-bit dtrace userland binary.
<p>
I have been working on getting the D functions: stack() and ustack()
to work. For 32-bit kernels, ustack seems to work - but I have a lot
of work to do to get the Psymtab.c code to lookup the symbol entries
and print them symbollically. I hit issues with libelf.so not seeming
to work properly for me, so need to investigate that issue.
<p>
The kernel stack is probably wrong and a pain due to -fomit-frame-pointer
use in the Ubuntu kernel - the goal is to achieve what a kernel stack 
trace can do, along with symbols. (dtrace reads /proc/kallsyms so we should
be able to see something).
<p>
The Sun code walks the stack looking at signals and interrupts - and
I ripped out that code to get it to work at all. I will need to spend
more effort here.
<p>
I need to get the 64-bit kernel and user stack dumps working, as that will
give a huge amount of functionality to probe the system.
If i can get the symtabs to work - that will be a great milestone.
<p>
Unfortunately, Unix has gotten itself in a mess with the ELF file format:
the simple libelf library has difficulty handling 32 or 64 bit
files given that the source process may be 32 or 64 bit itself, and
so libraries such as &lt;gelf.h> seem to exist to try and hide the
word size issue.
<p>
Given that Solaris is a pure ELF system, and much of the symtab
lookup on a Linux system is embedded in gdb (along with stack tracing),
means that we end up with a bit of an emulation on top of an emulation
in dtrace - but so far, no big issues (other than concern over the
multitudes of libelf.so variants in the wild).
<p>
dtrace is still not ready for a prime time production system - it
may work for you, it may not, but hopefully, over time, the port will become
more robust, and work in most areas.
<p>
I hit some issues with accessing /proc/PID/mem where we can't access
certain areas of memory - and I think this may be a bug in Linux kernels,
but I need to work out if its me at fault or Linux.]]></description>
</item>
<item rdf:about="http://www.crisp.demon.co.uk/blog/archives/2008-07.html#e2008-07-13T16_59_54.txt">
<link>http://www.crisp.demon.co.uk/blog/archives/2008-07.html#e2008-07-13T16_59_54.txt</link>
<title>dtrace progress 20080713</title>
<dc:date>2008-07-13T16:59:54+01:00</dc:date>
<dc:creator>Paul Fox</dc:creator>

<description><![CDATA[dtrace quality is improving, but more things need to be done.
I realised much of libproc.a wasnt being linked in due to the
order of link libraries.
This was fixed, but caused me a torrent of new compilation fixes
to be exercised. libproc.a links in but using much of the
Solaris /procfs code, so this needs work.
<p>
I first noticed this in trying to get the:
<pre>
ustack();
</pre>
<p>
function to do something sane.
<p>
Fixed an issue with syscall tracing being too raw - the return of a syscall
ideally needs to be -1 (arg0) and arg1 can be used to access the raw
return value. This avoids differences among the platforms.
<p>
Trying to work through my own bug list and tests, so I can start
looking at fasttrap.
<p>
A goal of fasttrap will be to put some dtrace probes into CRiSP
(why? because I can!), which will let me better understand 
dtrace and userland probings.
There may be a lot of things that could be done here, but I need to
understand how it all fits together first.
<p>
There are still reliability issues with the port, but syscall tracing
works - quite well, but havent validated every syscall. (We still
know that tracing read may cause issues).]]></description>
</item>
<item rdf:about="http://www.crisp.demon.co.uk/blog/archives/2008-07.html#e2008-07-05T09_27_41.txt">
<link>http://www.crisp.demon.co.uk/blog/archives/2008-07.html#e2008-07-05T09_27_41.txt</link>
<title>Dtrace for Linux - Sun has spilled the beans !</title>
<dc:date>2008-07-05T09:27:41+01:00</dc:date>
<dc:creator>Paul Fox</dc:creator>

<description><![CDATA[Bryan Cantrill at Sun has talked about the dtrace project.
References 
<a href="http://redmonk.com/sogrady/2008/07/01/dtrace-vs-systemtap-redux/">here</a>
and 
<a href="http://blogs.sun.com/bmc/entry/dtrace_on_linux">here</a>.
<p>
I guess I need to watch my inbox now :-)
<p>
A lot of debate surrounds GPL vs CDDL and why dtrace cannot be done.
I dont believe thats the case - and I am not asserting anything good
or bad about either license, just trying to live within the realms
of what each group believes in.
<p>
Back to the plot...
<p>
Dtrace on 64 + 32 bit platforms works well for the basics. I fixed the
cyclic timer stuff (sort of) - so that now we dont put undue stress on
the system being monitored (e.g. /var/log/messages isnt filling up
with debug statements quite so much).
<p>
I have slightly reorganised the tree and removed the need to manually
locate libgcc.a (needed for the 64-bit mod/div stuff). A perl script
will now locate it for you.
<p>
The profile (profile + ticks) probe code is now linked in but I need
to work out what the omni timer stuff is doing.
<p>
Mojmir Svoboda gave a couple of better Linux calls to use - but
kernel 2.6.24 doesnt compile whereas 2.6.24.4 and above does.
(Strange because it compiles on 2.6.23.1). I need to clean up the
calling sequence to kmem_cache_create() to resolve this.
<p>
Lex/yacc hit me again. I wrote a script (make test) which runs all
the demo D scripts and validates for syntax errors, and thats kicking
up lexer issues in the way predicates are parsed. My fight with
flex should be over and if it happens again, out goes dt_lex.l and a
plain portable C version will be written to get rid of the confusion of
input(), unpuc() and YY_INPUT.
<p>
I found the PID provider (didnt notice it was even missing, since
I am not a dtrace expert!). Its hiding in fasttrap (ah! now I know
what it does). This wants hooks into the kernel. Watch this space
for a solution which doesnt break the GPL or require a kernel
recompile.
<p>
I looked at ON Solaris 20060823 and found a later version of dtrace.
Not much changed (I think) in that release but have started upgrading
the sources and comments to match. Sun will have made fixes for
good reason, so better to grab them ASAP and get the diff/merge pain
over with.
<p>
I am still trying to make daily updates or updates when I feel the release
'works' vs having uncovered issues in porting/compiling, so keep an eye
on the download area and grab sources if you want to play.
<p>
It should be a matter of 'make all; make load'.
<p>
Heres some music for you to listen to ...
<pre>
/home/fox/src/dtrace@vmubuntu: dtrace -f open
dtrace: description 'open' matched 2 probes
CPU     ID                    FUNCTION:NAME
  0     21                       open:entry
  0     22                      open:return
  0     21                       open:entry
</pre>]]></description>
</item>
<item rdf:about="http://www.crisp.demon.co.uk/blog/archives/2008-06.html#e2008-06-29T22_09_45.txt">
<link>http://www.crisp.demon.co.uk/blog/archives/2008-06.html#e2008-06-29T22_09_45.txt</link>
<title>dtrace progress 20080629</title>
<dc:date>2008-06-29T22:09:45+01:00</dc:date>
<dc:creator>Paul Fox</dc:creator>

<description><![CDATA[It works...again!
<p>
Spent last couple of weeks trying to get 32-bit dtrace
to work and after a lot of mishaps and sillynesses, it
works on Ubuntu 8 kernel (untouched by human hand).
<p>
A new release is available and I can go back to validating
the 64-bit port, but also testing/checking out functionality.
<p>
Still lots of things to do to dtrace - I fixed the eat cpu
as fast as possible issue, but need to get the cyclic timers
emulation working else dtrace will give up after 30s or so
as it things the system will have lost responsiveness.
<p>]]></description>
</item>
<item rdf:about="http://www.crisp.demon.co.uk/blog/archives/2008-06.html#e2008-06-22T21_57_04.txt">
<link>http://www.crisp.demon.co.uk/blog/archives/2008-06.html#e2008-06-22T21_57_04.txt</link>
<title>dtrace progress 20080622</title>
<dc:date>2008-06-22T21:57:04+01:00</dc:date>
<dc:creator>dtrace progress 20080622</dc:creator>

<description><![CDATA[I havent updated the blog in a while, but thought it worth
putting out a brief update.
<p>
dtrace for 64b Linux works (sort of). Theres still some rough
edges, and am trying to get the clock (cyclic.c) to work, otherwise
dtrace will give up after 30s thinking we have hung the system.
<p>
I am taking a diversion to get the 32b version working - this has been
a trying experience (deficiencies in Linux + VMware). E.g.
at present 64-bit divide/module in the kernel is a pain, as the
way the kernel is compiled precludes use of these functions in the
kernel.
<p>
I can do dtrace -l on a 32b kernel, and off to fix the next set of
'things'.
<p>
The 32b port is delaying making further progress, but at least
various portability issues have now been resolved.]]></description>
</item>
<item rdf:about="http://www.crisp.demon.co.uk/blog/archives/2008-06.html#e2008-06-07T18_02_32.txt">
<link>http://www.crisp.demon.co.uk/blog/archives/2008-06.html#e2008-06-07T18_02_32.txt</link>
<title>dtrace for linux progress</title>
<dc:date>2008-06-07T18:02:32+01:00</dc:date>
<dc:creator>Paul Fox</dc:creator>

<description><![CDATA[Progress has again been slightly slow - i realised that i was missing
system call tracing, which isnt in the /dev/sdt driver, but scattered
around the FreeBSD and Solaris kernels, fairly obviously.
<p>
Linux kernel 2.6 tries to protect the system call table from patching
by marking the syscall table as read only and protected. I need
to write the code to unprotect this (I have some sample code which
modifies the CPUs CR3 register, but i would like to use the kernel
routines to unprotect the page - when I find them).
<p>
I have added a new driver to the kit -- /dev/syscall, although I dont
think its for userland consumption. This will drop the dtrace
probes for all listed system calls, although I note the new kernels
allow custom syscalls to be installed, so i will have to trawl
these data structures.
<p>
Am just trying to debug some instability - even with the syscall
driver disabled. Hopefully soon, we will have something decent
to play with.
<p>
Stay tuned...]]></description>
</item>
<item rdf:about="http://www.crisp.demon.co.uk/blog/archives/2008-05.html#e2008-05-31T00_04_13.txt">
<link>http://www.crisp.demon.co.uk/blog/archives/2008-05.html#e2008-05-31T00_04_13.txt</link>
<title>dtrace progress 20080530 .. so close !</title>
<dc:date>2008-05-31T00:04:13+01:00</dc:date>
<dc:creator>Paul Fox</dc:creator>

<description><![CDATA[Progress on dtrace is coming in waves now.
<p>
I had issues getting to the DTRACEIOC_ENABLE ioctl - after a bit
of head scratching, this was resolved, and now we get to DTRACEIOC_GO.
<p>
Even better, we get past DTRACEIOC_GO.
<p>
What does this mean?
<p>
It means the dtrace binary talks to the kernel, can pass any D script
in, and then wait for the buffered information to be made
available. 
<p>
I found out again, my dtrace.c kernel code was outdated, so spent some
time merging the latest OpenSolaris code in - still some stuff to merge,
but lots of useful things in there, such as 128-bit arithmetic for tracking
big counters, and some validation checks on the way memory is accessed.
(Validating memory doesnt help me, because i default to enabling
probing to anywhere - need to fix this at some point so that hackers
and accidents can't bring the system down).
<p>
Now we are past the DTRACEIOC_GO, i found some issues with userland
dtrace - stubs i hadnt coded. Thats partially done (gethrtime() and
a partial pthread cond wait function).
<p>
Heres an example 'session':
<pre>
/home/fox/src/dtrace/drivers/dtrace@vmubuntu: dtrace -v -f journal_invalidatepage
dtrace: description 'journal_invalidatepage' matched 6 probes]]></description>
</item>
<item rdf:about="http://www.crisp.demon.co.uk/blog/archives/2008-05.html#e2008-05-22T22_18_11.txt">
<link>http://www.crisp.demon.co.uk/blog/archives/2008-05.html#e2008-05-22T22_18_11.txt</link>
<title>Dtrace for Linux .. Progress</title>
<dc:date>2008-05-22T22:18:11+01:00</dc:date>
<dc:creator>Paul Fox</dc:creator>

<description><![CDATA[Slowly getting there. Last week was near zero progress as I attempt
to do some CRiSP catch up work, and track a near impossible bug
to find. (CRiSP is valgrind pure - no detectable memory corruptions
of significance, yet people are reporting strange bugs. Armed with logs,
they dont help - Whoof! Out of nowhere - a GPF/Core dump; oh well).
<p>
Anyway, back at the dtrace camp - some progress. The startup code
is wrong in the kernel - my driver was missing some of the subtlety of
the dtrace_attach()/dtrace_open() code, so by the time cmd/dtrace tries
to do an ioctl(DTRACE_ENABLE), we hit some null pointers.
<p>
I've now protected myself against this. (Such a kernel panic causes
a reboot to be required); I know what i need to debug, just some more
linux kernel searching to validate I am calling the correct api
(dev_set_drvdata).
<p>
Had a near panic last night when my vmware/ubuntu refused to boot.
I think ubuntu screwed up the /boot/grub/menu.lst - so i was booting
a virgin kernel without an initrd ram disk. Fortunately, one of the many
menu items was available, so i have been able to make more progress.]]></description>
</item>
<item rdf:about="http://www.crisp.demon.co.uk/blog/archives/2008-05.html#e2008-05-19T22_37_21.txt">
<link>http://www.crisp.demon.co.uk/blog/archives/2008-05.html#e2008-05-19T22_37_21.txt</link>
<title>dtrace progress 20080519</title>
<dc:date>2008-05-19T22:37:21+01:00</dc:date>
<dc:creator>Paul Fox</dc:creator>

<description><![CDATA[Progress slow last week - had to do some CRiSP work....
<p>
Am spending (too much) time investigating why Ubuntu bison/flex
combination doesnt work compared to Fedora 8 bison/flex.
<p>
Unfortunately, these tools shoot themselves in the foot - they
try to be compatible with old yacc/lex, but are just sufficiently
different that a trivial issue becomes very difficult to debug.
<p>
Have always disliked lex since it provides so little utility,
and debugging it - especially when the lex definition 'just works'.
<p>
I can see Apple, in the Darwin code, have hit the same issue, but somehow
my issue is very subtle.
<p>
Oh well.
<p>
Once the portability issue is resolved, I can go back to the
driver and just move things along, before I forget how this all
works.]]></description>
</item>
<item rdf:about="http://www.crisp.demon.co.uk/blog/archives/2008-05.html#e2008-05-11T11_14_42.txt">
<link>http://www.crisp.demon.co.uk/blog/archives/2008-05.html#e2008-05-11T11_14_42.txt</link>
<title>dtrace progress</title>
<dc:date>2008-05-11T11:14:42+01:00</dc:date>
<dc:creator>Paul Fox</dc:creator>

<description><![CDATA[Look at the output below. Real dtrace, real symbols!
<p>
Finally able to access the modules and kallsyms to find /dev/fbt
entry points to patch in the kernel. This is definitely a milestone -
as now, in theory, dtrace can start patching the kernel to insert
probes. I have yet to try this - next on my list, to see what actually
happens.
<p>
Note that we only seem to have a subset of available kernel probes
because -- I dont know! Maybe these are the only modules I am loading,
and appear to be missing the kernel syms (maybe I need to modify
the fbt driver to not just enumerate every module, but to enumerate
every kernel/kallsyms entry).
<p>
But this gives a huge blast to move forward and start debugging D scripts.
<p>
I have truncated the output below - its showing 515 probe points in the
kernel (a stripped down linux 2.6.24-4 kernel).
<p>
<pre>
   ID   PROVIDER            MODULE                          FUNCTION NAME
    1     dtrace                                                     BEGIN
    2     dtrace                                                     END
    3     dtrace                                                     ERROR
    4        fbt         dtracedrv                         ctf_close entry
    5        fbt         dtracedrv                         ctf_close return
    6        fbt         dtracedrv                     ctf_func_args entry
    7        fbt         dtracedrv                     ctf_func_args return
    8        fbt        freq_table    cpufreq_frequency_table_target entry
    9        fbt        freq_table    cpufreq_frequency_table_target return
   10        fbt              dock      register_hotplug_dock_device entry
   11        fbt              dock      register_hotplug_dock_device return
   12        fbt              dock    unregister_hotplug_dock_device entry
   13        fbt              dock    unregister_hotplug_dock_device return
   14        fbt        parport_pc        parport_pc_unregister_port entry
   15        fbt        parport_pc             parport_pc_probe_port entry
   16        fbt        parport_pc             parport_pc_probe_port return
   17        fbt           parport    parport_ieee1284_ecp_read_data entry
   18        fbt           parport    parport_ieee1284_ecp_read_data return
   19        fbt           parport    parport_ieee1284_epp_read_data entry
   20        fbt           parport    parport_ieee1284_epp_read_data return
   21        fbt           parport      parport_ieee1284_read_nibble entry
   22        fbt           parport      parport_ieee1284_read_nibble return
   23        fbt           parport        parport_ieee1284_read_byte entry
   24        fbt           parport        parport_ieee1284_read_byte return
   25        fbt           parport                parport_wait_event entry
   26        fbt           parport                parport_wait_event return
   27        fbt           parport           parport_register_driver entry
   28        fbt           parport           parport_register_driver return
   29        fbt           parport    parport_ieee1284_epp_read_addr entry
   30        fbt           parport    parport_ieee1284_epp_read_addr return
   31        fbt           parport                   parport_release entry
   32        fbt           parport             parport_announce_port entry
   33        fbt           parport         parport_unregister_device entry
   34        fbt           parport     parport_ieee1284_write_compat entry
   35        fbt           parport     parport_ieee1284_write_compat return
   36        fbt           parport   parport_ieee1284_epp_write_data entry
   37        fbt           parport         parport_unregister_driver entry
   38        fbt           parport                  parport_put_port entry
   39        fbt           parport                  parport_put_port return
   40        fbt           parport   parport_ieee1284_epp_write_addr entry
   41        fbt           parport               parport_remove_port entry
   42        fbt           parport               parport_remove_port return
   43        fbt           parport             parport_register_port entry
   44        fbt           parport             parport_register_port return
   45        fbt           parport   parport_ieee1284_ecp_write_addr entry
   46        fbt           parport   parport_ieee1284_ecp_write_addr return
   47        fbt           parport   parport_ieee1284_ecp_write_data entry
   48        fbt           parport   parport_ieee1284_ecp_write_data return
   49        fbt          i2c_core                    i2c_new_device entry
   50        fbt          i2c_core                    i2c_new_device return
   51        fbt          i2c_core                         i2c_probe entry
   52        fbt          i2c_core                         i2c_probe return
   53        fbt          i2c_core          i2c_add_numbered_adapter entry
   54        fbt          i2c_core          i2c_add_numbered_adapter return
...
</pre>]]></description>
</item>
</rdf:RDF>
