intro linux version history/evolution/compatibility DO A LITTLE constant change, book is already outdated current versioning/development model modules build dependencies running new/bleeding-edge kernels concepts kernel/user space rings/levels/modes memory protection/segmentation/pagination library calls allowed uses (floating point forbidden) concurrency small stack libc/system calls operating system functions process management concurrency communication/IPC, scheduling memory management address space virtual memory filesystems networking device, I/O robustness/security error checking kernel space code programming errors and bugs restrict some operations to privileged users do not send unzeored data (information leak) do not trust received data (malformed data) (exploit) risks for the machine/system/data basics Makefile Kconfig DO? building linux DO? build init/exit module macros module parameters config/build time options/parameters sysfs interface for modules DO? printk module loading/unloading/handling VFS center/hub/interface char/block/procfs/sysfs: all go through VFS to device fops is the main structure in linux FS on top of block devices block layer exception: some on top of MTD devices device driver subsystem buses device classes interfaces dev file sysfs procfs sysctl DO? netlink DO? char device procfs sysfs block device DO? STUDY network device DO? STUDY terminal/serial device DO? STUDY debugging techniques printk/procfs debugfs DO? STUDY kgdb DO? trace DO? kprobe DO? C basics container_of (struct embedding) fops/*ops (function pointers) IS_ERR (pointers and error values) data structures list_head bitmap trees DO? STUDY rbtree idr DO? any hash implementation DO? STUDY contexts user context (current, copy_from_user, schedule) STUDY schedule interrupt context workqueue is user context sleep == schedule concurrency SMP systems locking spinlock: disable scheduler semaphore/mutex sleeps per-cpu variables STUDY atomic RCU DO? memory allocation kobject refcount MENTION slab STUDY multiple implementations space efficient (tables for different object sizes) concurrency efficient (per-cpu tables) kmalloc uses slab STUDY vmalloc linux memory layout scheduling/timing schedule{,_timeout} timer workqueue completion/wait_head tasklets DO? STUDY portability readl/writel/etc be16_to_cpu/etc interrupt {request,free}_irq interrupt context tasklet/workqueue/postpone buses PCI bus DO? USB bus DO? some bus: SPI, I2C, parport DO? device classes some class: cdrom, backlight, input, misc DO? kobject DO? advanced refcounting STUDY: module owner, concurrency, reference counting