My talk at SCALE 10x (Jan 2012) presenting some topics about developing (and debugging) for illumos -- especially for folks working with kernel software and subsystems unique to illumos
& “real” UNIX derived Distros add other bits (OpenIndiana, NexentaStor, StormOS, etc.) illumos is the OS core - kernel, drivers, core libraries, key system utilities Friday, March 16, 12
differently ... e.g. 1m instead of 8 for admin pages Google! A lot of printed matter Sadly, docs.sun.com is gone now. :-( We need help documenting more! Friday, March 16, 12
standard for UNIX like operating systems Linux tries to be POSIX, but beware of “embrace and extend” Portable applications stick to POSIX Latest POSIX not fully supported Friday, March 16, 12
But only if documented “stable” interfaces are used Google for PSARC cases can help “Bundled” code can use more interfaces (“Consolidation Private” in PSARC speak.) Friday, March 16, 12
tools to build, incl. env. cmd - commands uts - kernel & drivers (“UNIX time share”) common - shared bits intel - intel x86 bits i86pc - specific PC hardware support lib - ludicrous indigo bits Friday, March 16, 12
binary stability as well as source stability But, many useful things have no DDI :-( We are working to fix this. Wanna help? Threaded through-out Friday, March 16, 12
you allocated Everything is a thread! (almost) Device tree and auto-configuration Portable DMA interfaces (ala NetBSD) ddi_put() & ddi_get() access device memory & registers - no endianness hacks! 32-bit processes with 64-bit kernels Friday, March 16, 12
the tree Use prtconf -vp to see the “hardware” tree from “PROM” (BIOS/ACPI) Each node also can have properties Both nodes and properties can originate from hardware or software Friday, March 16, 12
order - ‘compat’ property in the tree Typically e.g. pci8086,1000 Only one driver name for a given alias - no dynamic probing! Well, there are exceptions (ISA, *cough!*) A nexus can supply a node name with an implicit alias Friday, March 16, 12
devices (usually) Nexus drivers don’t need (but often have) /devices ... links put into /dev by devfsadm Drivers can have 0, 1, or many minor nodes Backed in driver by cb_ops entry points Typically created in attach and destroyed in detach Friday, March 16, 12
Example: # add_drv -i’”pciex1077,8000”’ qlge rem_drv to remove a driver Usually only done once, for testing use modload and modunload Friday, March 16, 12
should return DDI_FAILURE if instance is in use _fini() called before unloading ELF module calls moduninstall(), which will also call detach() for all conf’d instances should free up globals, etc. Friday, March 16, 12
called as a result of a system call from userland Kernel context: like user context, can sleep, etc., but no user process associated (so e.g. copyout() is not possible) Interrupt context: running in an interrupt thread High level interrupt context: running on a very high priority interrupt - special, and rare. Friday, March 16, 12
nightly Recommend doing a full build first Otherwise you must do “make setup” cd usr/src/uts/intel/afe dmake install Modules live in obj64, obj32, debug64, debug32 Friday, March 16, 12
trying to bind it ddi_dma_alloc_handle() ddi_dma_mem_alloc() ddi_dma_addr_bind_handle() Access via ddi_putXX/ddi_getXX will handle endianness for you (e.g. for descriptor rings) Friday, March 16, 12
sensitive structures ddi_model_convert_from() Look for _MULTI_DATAMODEL for examples Strategy is to copy between 32-bit specific structure and native structure Friday, March 16, 12
typed (strings, numbers, etc.) User access via kstat(1M), or libkstat Kernel API: kstat_create() et. al. basis for iostat, netstat, vmstat, etc. good for aggregate data only Friday, March 16, 12
and type-aware debugging Same debugger can debug both kernel and user space Extensible via “modules” - subsystem authors can supply their own modules Not a source level debugger! Friday, March 16, 12
(kernel only) Static probes give us other events D language makes powerful constructs possible Useful as base for other things e.g. lockstat Friday, March 16, 12