First bad bad pass.
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Fri, 14 May 2010 01:59:19 +0000 (22:59 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Fri, 14 May 2010 01:59:19 +0000 (22:59 -0300)
There's a lot to go from here.

86 files changed:
00.rev/1.hw/text [new file with mode: 0644]
00.rev/2.os/text [new file with mode: 0644]
00.rev/3.gnu/text [new file with mode: 0644]
00.rev/4.sl/text [new file with mode: 0644]
01.intro/1.history/text [new file with mode: 0644]
01.intro/10.init/text [new file with mode: 0644]
01.intro/2.devmodel/text [new file with mode: 0644]
01.intro/3.tools/ex [new file with mode: 0644]
01.intro/3.tools/text [new file with mode: 0644]
01.intro/4.tree/text [new file with mode: 0644]
01.intro/5.browse/ex [new file with mode: 0644]
01.intro/5.browse/text [new file with mode: 0644]
01.intro/6.codestd/text [new file with mode: 0644]
01.intro/7.git/ex [new file with mode: 0644]
01.intro/7.git/text [new file with mode: 0644]
01.intro/8.config/ex [new file with mode: 0644]
01.intro/8.config/text [new file with mode: 0644]
01.intro/9.build/text [new file with mode: 0644]
02.module/ex [new file with mode: 0644]
02.module/text [new file with mode: 0644]
03.types/1.conv/text [new file with mode: 0644]
03.types/2.kref/ex [new file with mode: 0644]
03.types/2.kref/ref [new file with mode: 0644]
03.types/2.kref/req [new file with mode: 0644]
03.types/2.kref/text [new file with mode: 0644]
03.types/3.endian/text [new file with mode: 0644]
03.types/4.list/ex [new file with mode: 0644]
03.types/4.list/text [new file with mode: 0644]
03.types/5.tree/text [new file with mode: 0644]
03.types/6.others/ex [new file with mode: 0644]
03.types/6.others/text [new file with mode: 0644]
04.char/1.vfs/text [new file with mode: 0644]
04.char/2.mkdev/ex [new file with mode: 0644]
04.char/2.mkdev/text [new file with mode: 0644]
04.char/3.cdev/ex [new file with mode: 0644]
04.char/3.cdev/text [new file with mode: 0644]
04.char/4.fops/ex [new file with mode: 0644]
04.char/4.fops/text [new file with mode: 0644]
05.debug/1.printk/ex [new file with mode: 0644]
05.debug/1.printk/text [new file with mode: 0644]
05.debug/2.proc/ex [new file with mode: 0644]
05.debug/2.proc/text [new file with mode: 0644]
05.debug/3.others/text [new file with mode: 0644]
06.process/kthread [new file with mode: 0644]
06.process/text [new file with mode: 0644]
07.race/1.race/text [new file with mode: 0644]
07.race/2.sem_mutex/ex [new file with mode: 0644]
07.race/2.sem_mutex/text [new file with mode: 0644]
07.race/3.spinlocks/ex [new file with mode: 0644]
07.race/3.spinlocks/text [new file with mode: 0644]
07.race/4.atomic/ex [new file with mode: 0644]
07.race/4.atomic/text [new file with mode: 0644]
07.race/5.percpu/ex [new file with mode: 0644]
07.race/5.percpu/text [new file with mode: 0644]
07.race/6.rcu/ex [new file with mode: 0644]
07.race/6.rcu/text [new file with mode: 0644]
07.race/7.others/text [new file with mode: 0644]
08.time/1.jiffies_sched/text [new file with mode: 0644]
08.time/2.busy/text [new file with mode: 0644]
08.time/3.timers/text [new file with mode: 0644]
08.time/4.tasklets/text [new file with mode: 0644]
08.time/5.wq/ex [new file with mode: 0644]
08.time/5.wq/text [new file with mode: 0644]
08.time/6.hrtimers/text [new file with mode: 0644]
09.memory/1.intro/text [new file with mode: 0644]
09.memory/2.buddy/text [new file with mode: 0644]
09.memory/3.alloc/text [new file with mode: 0644]
09.memory/4.gfp/text [new file with mode: 0644]
09.memory/5.map/text [new file with mode: 0644]
09.memory/6.io/text [new file with mode: 0644]
09.memory/7.slab/text [new file with mode: 0644]
09.memory/8.boot/text [new file with mode: 0644]
09.memory/9.sg/text [new file with mode: 0644]
09.memory/text [new file with mode: 0644]
10.irqs/1.hw/text [new file with mode: 0644]
10.irqs/2.bh/text [new file with mode: 0644]
10.irqs/3.handlers/text [new file with mode: 0644]
10.irqs/4.wait/text [new file with mode: 0644]
11.dma_mmap/text [new file with mode: 0644]
12.dd/text [new file with mode: 0644]
13.hw/text [new file with mode: 0644]
14.pci/text [new file with mode: 0644]
15.usb/text [new file with mode: 0644]
16.block/text [new file with mode: 0644]
17.net/text [new file with mode: 0644]
18.proto/text [new file with mode: 0644]

diff --git a/00.rev/1.hw/text b/00.rev/1.hw/text
new file mode 100644 (file)
index 0000000..9d6aa96
--- /dev/null
@@ -0,0 +1,34 @@
+Máquinas:
+       * Von Neumman
+       * Acumulador
+       * Pilha
+       * Registradores
+       * ISA
+
+Hierarquia de memória:
+       * Memória Cache
+       * Memória Virtual
+
+Pilha
+
+Modo supervisor:
+       * Pilha
+       * Instruções protegidas
+       * Registradores protegidos
+
+Interrupções
+
+Sistemas Multi-processados:
+       * SMP
+       * NUMA
+
+I/O:
+       * I/O space
+       * I/O mapeado em memória
+       * Memória de dispositivo
+       * Memória compartilhada
+       * DMA
+
+Problemas:
+       * Coerência de memória
+       * Reordenações de operações
diff --git a/00.rev/2.os/text b/00.rev/2.os/text
new file mode 100644 (file)
index 0000000..dce530c
--- /dev/null
@@ -0,0 +1,25 @@
+Máquina extendia:
+       Uma abstração pro software. Como exemplo, o Linux permite que vários
+dispositivos diferentes ofereçam uma mesma interface. Outro exemplo é
+comunicação inter-processo e comunicação em rede.
+
+Gerenciador de recursos:
+       Permite que vários software compartilhem o processador, a memória.
+Retira do software a responsabilidade por gerenciar esses recursos.
+
+Gerenciamento de processos:
+       * Escalonamento
+       * Concorrência
+       * Comunicação inter-processo
+       * Isolamento de recursos
+
+Gerenciamento de memória:
+       * Memória virtual
+       * Alocação de memória
+       * Hierarquia de memória: memória "secundária" ou disco
+
+Dispositivos
+
+Rede
+
+Outros
diff --git a/00.rev/3.gnu/text b/00.rev/3.gnu/text
new file mode 100644 (file)
index 0000000..630cc2f
--- /dev/null
@@ -0,0 +1,40 @@
+História:
+       * MULTICS
+       * Ken Thompson e Unix
+       * Dennis Ritchie e C
+       * Berkeley Unix
+       * Unix Wars
+       * RMS e Projeto GNU
+       * Minix
+       * Linux e GNU
+
+Arquitetura:
+       * toolchain: GNU
+       * kernel: Linux
+       * libc: GNU libc
+       * loader: GNU
+       * shell: GNU bash
+       * utils: GNU coreutils
+       * Sistema GNU + Linux
+       * Outros sistemas: *BSD, OpenSolaris, etc
+
+Sistemas com Linux:
+       * toolchain é sempre GNU
+               - Intel CC e tcc compilam Linux, mas uso é desconhecido
+       * libc: uclibc, dietlibc, eglibc, outros...
+       * busybox
+
+Sistemas GNU:
+       * GNU Hurd
+       * Debian GNU/kFreeBSD
+
+Padrões:
+       * man standards
+       * Unix V7
+       * 4.[234]BSD
+       * System V
+       * SVr[234]
+       * C
+       * POSIX
+       * XPG
+       * SUS
diff --git a/00.rev/4.sl/text b/00.rev/4.sl/text
new file mode 100644 (file)
index 0000000..922ddf3
--- /dev/null
@@ -0,0 +1,10 @@
+Software Livre:
+
+* Direito Autoral
+* Outros direitos intelectuais
+* RMS e FSF
+* GPL
+* GPLv2
+* Linux e primeiras licenças
+* Linux e GPLv2 only
+* Copyleft e GPL
diff --git a/01.intro/1.history/text b/01.intro/1.history/text
new file mode 100644 (file)
index 0000000..8d7ebee
--- /dev/null
@@ -0,0 +1,13 @@
+Linux em 1991.
+Linux e i386.
+Linus e Tanenbaum.
+Linux 1.2 era portável.
+Linux 2.0 e SMP.
+Linux 2.2 abandonou algumas coisas de x86 na API.
+Linux 2.6 e seu crescimento.
+
+Mostrar gráfico com tamanho do código.
+
+Controle de versão: CVS, bitkeeper, git.
+
+Modelo 2.X, onde X ímpar significa desenvolvimento, X par significa estável.
diff --git a/01.intro/10.init/text b/01.intro/10.init/text
new file mode 100644 (file)
index 0000000..0f1cf25
--- /dev/null
@@ -0,0 +1,17 @@
+Documentation/kernel-parameters.txt
+
+init/*
+
+initrd vs initramfs
+extração de cpio
+
+/dev/console
+/dev/null
+
+devtmpfs
+
+initrc e etc.
+
+initramfs é necessário quando userspace precisa intervir para montar a
+raiz do sistema e partir daí em diante.
+
diff --git a/01.intro/2.devmodel/text b/01.intro/2.devmodel/text
new file mode 100644 (file)
index 0000000..d4768c8
--- /dev/null
@@ -0,0 +1,14 @@
+Linux estável e point releases.
+Release candidates.
+linux-next
+Subsistemas, mantenedores, merges, etc.
+
+git, quilt, git send-email.
+
+MAINTAINERS
+Documentation/SUBMITTING_PATCHES
+Documentation/...
+scripts/checkpatch.pl
+scripts/get_maintainer.pl
+
+Etc...
diff --git a/01.intro/3.tools/ex b/01.intro/3.tools/ex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/01.intro/3.tools/text b/01.intro/3.tools/text
new file mode 100644 (file)
index 0000000..2227892
--- /dev/null
@@ -0,0 +1,22 @@
+ketchup
+       reduz tempo de download
+       facilita obtendo os patches corretos
+       lembre-se de obter as chaves ou ignorar a verificação
+       tarballs, patches, subpatches
+
+diff
+       opções -u, -r, -N, -p
+
+patch
+       opção -pX
+
+quilt
+       QUILT_PATCHES
+       quilt new name.patch
+       quilt add src/file
+       quilt refresh
+       quile edit src/file
+       quilt top
+       quilt pop [-a]
+       quilt push [-a]
+       Nunca esqueça de fazer quilt add antes de editar o arquivo.
diff --git a/01.intro/4.tree/text b/01.intro/4.tree/text
new file mode 100644 (file)
index 0000000..b5f5015
--- /dev/null
@@ -0,0 +1,49 @@
+Onde cada subsistema se encontra.
+
+arch/XX/
+O suporte a arquiteturas e máquinas diferentes:
+arch/XX/include/asm/
+arch/XX/mach-XX/
+
+kernel/
+o núcleo do sistema:
+arch/XX/kernel/
+
+mm/
+o gerenciamento de memória:
+arch/XX/mm/
+
+lib/
+as bibliotecas utilitárias utilizadas;
+
+drivers/
+os drivers de dispositivos, barramentos e outros:
+drivers/pci/
+arch/XX/.../pci/
+
+fs/
+os sistemas de arquivos;
+
+include/
+os cabeçalhos:
+include/linux/
+arch/XX/include/asm/
+include/*/
+
+net/
+subsistema de rede e protocolos;
+
+crypto/
+algoritmos de criptografia;
+
+security/
+sistemas de segurança;
+
+scripts/
+ferramentas para compilação e manipulação de código;
+
+usr/
+software de user space;
+
+entre outros:
+firmware/
diff --git a/01.intro/5.browse/ex b/01.intro/5.browse/ex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/01.intro/5.browse/text b/01.intro/5.browse/text
new file mode 100644 (file)
index 0000000..e5f90b1
--- /dev/null
@@ -0,0 +1,9 @@
+tags
+ctags
+etags
+cscope
+cbrowser
+vim
+emacs
+EXPERIMENTAR cgvg
+lxr: USAR alguma URL
diff --git a/01.intro/6.codestd/text b/01.intro/6.codestd/text
new file mode 100644 (file)
index 0000000..2c6b508
--- /dev/null
@@ -0,0 +1,4 @@
+scripts/checkpatch.pl
+ident
+Documentation/CodingStyle
+apresentação do Greg
diff --git a/01.intro/7.git/ex b/01.intro/7.git/ex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/01.intro/7.git/text b/01.intro/7.git/text
new file mode 100644 (file)
index 0000000..945f7e8
--- /dev/null
@@ -0,0 +1,5 @@
+Minha tradução do tutorial de git.
+
+Eu fiz alguma apresentação? Creio que não!
+
+Um tutorial próprio, talvez?
diff --git a/01.intro/8.config/ex b/01.intro/8.config/ex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/01.intro/8.config/text b/01.intro/8.config/text
new file mode 100644 (file)
index 0000000..55163aa
--- /dev/null
@@ -0,0 +1,24 @@
+make menuconfig
+
+Buscando configurações com /texto:
+       mostra as configurações com o tal texto
+       FIXME: fazer mais
+
+Help mostra dependências
+
+Ler Kconfig e buscar com find e grep funciona muito bem
+
+ARCH=arch make menuconfig
+
+make XXX_defconfig
+make help
+       mostra algumas configurações padrão
+
+arch/XXX/configs/
+
+make oldconfig
+       reaproveita a configuração antiga
+
+NEW (parser)
+EXPERIMENTAL (símbolo)
+BROKEN (símbolo)
diff --git a/01.intro/9.build/text b/01.intro/9.build/text
new file mode 100644 (file)
index 0000000..e6e1ddc
--- /dev/null
@@ -0,0 +1,17 @@
+make
+make all
+make XXXimage
+make modules
+make modules_install
+make install
+
+/lib/modules/VERSION/kernel/XXXX
+       XXXX é o mesmo layout da árvore
+
+make V=X
+
+make deb-pkg
+make rpm-pkg
+make binrpm-pkg
+make tar-pkg
+make targz-pkg
diff --git a/02.module/ex b/02.module/ex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/02.module/text b/02.module/text
new file mode 100644 (file)
index 0000000..375eb5d
--- /dev/null
@@ -0,0 +1,32 @@
+lsmod
+rmmod
+modprobe
+modinfo
+/proc/modules
+parâmetros
+/sys/module/
+
+#include <linux/module.h>
+#include <linux/init.h>
+
+MODULE_AUTHOR
+MODULE_LICENSE
+MODULE_DESCRIPTION
+MODULE_INFO
+MODULE_ALIAS
+MODULE_VERSION
+
+module_init
+module_exit
+
+Parâmetros
+
+MODULE_PARM_DESC
+
+
+Makefile simples
+obj-m := mymodule.o
+
+Makefile out-of-tree
+
+printk
diff --git a/03.types/1.conv/text b/03.types/1.conv/text
new file mode 100644 (file)
index 0000000..9f62f49
--- /dev/null
@@ -0,0 +1,32 @@
+include/linux/kernel.h
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
+
+#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
+
+define ALIGN(x,a)              __ALIGN_MASK(x,(typeof(x))(a)-1)
+#define __ALIGN_MASK(x,mask)    (((x)+(mask))&~(mask))
+#define PTR_ALIGN(p, a)         ((typeof(p))ALIGN((unsigned long)(p), (a)))
+#define IS_ALIGNED(x, a)                (((x) & ((typeof(x))(a) - 1)) == 0)
+
+
+/**
+ * container_of - cast a member of a structure out to the containing structure
+ * @ptr:        the pointer to the member.
+ * @type:       the type of the container struct this is embedded in.
+ * @member:     the name of the member within the struct.
+ *
+ */
+#define container_of(ptr, type, member) ({                      \
+        const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
+        (type *)( (char *)__mptr - offsetof(type,member) );})
+
+include/linux/stddef.h
+
+#undef offsetof
+#ifdef __compiler_offsetof
+#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
+#else
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
+#endif /* __KERNEL__ */
diff --git a/03.types/2.kref/ex b/03.types/2.kref/ex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/03.types/2.kref/ref b/03.types/2.kref/ref
new file mode 100644 (file)
index 0000000..b51c69d
--- /dev/null
@@ -0,0 +1 @@
+Documentation/kref.txt
diff --git a/03.types/2.kref/req b/03.types/2.kref/req
new file mode 100644 (file)
index 0000000..6a6c28c
--- /dev/null
@@ -0,0 +1,2 @@
+kmalloc/kfree
+container_of
diff --git a/03.types/2.kref/text b/03.types/2.kref/text
new file mode 100644 (file)
index 0000000..85b07b5
--- /dev/null
@@ -0,0 +1,18 @@
+struct data {
+       ...
+       struct kref ref;
+       ...
+};
+
+kref_init(&data->kref);
+kref_get(&data->kref);
+kref_put(&data->kref, data_release);
+
+void data_release(struct kref *ref)
+{
+       struct data *data = container_of(ref, struct data, ref);
+       kfree(data);
+}
+
+
+TODO: kobject e kset
diff --git a/03.types/3.endian/text b/03.types/3.endian/text
new file mode 100644 (file)
index 0000000..79a5cd0
--- /dev/null
@@ -0,0 +1,22 @@
+Little Endian vs Big Endian
+Exemplos de arquiteturas e arquiteturas com mais de um endianness.
+
+#include <asm/byteorder.h>
+include/linux/byteorder/
+
+From include/linux/bytorder/generic.h
+ * Conversion of XX-bit integers (16- 32- or 64-)
+ * between native CPU format and little/big endian format
+ * 64-bit stuff only defined for proper architectures
+ *      cpu_to_[bl]eXX(__uXX x)
+ *      [bl]eXX_to_cpu(__uXX x)
+ *
+ * The same, but takes a pointer to the value to convert
+ *      cpu_to_[bl]eXXp(__uXX x)
+ *      [bl]eXX_to_cpup(__uXX x)
+ *
+ * The same, but change in situ
+ *      cpu_to_[bl]eXXs(__uXX x)
+ *      [bl]eXX_to_cpus(__uXX x)
+
+TODO: alignment issues!?! from generic.h
diff --git a/03.types/4.list/ex b/03.types/4.list/ex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/03.types/4.list/text b/03.types/4.list/text
new file mode 100644 (file)
index 0000000..70ed3cc
--- /dev/null
@@ -0,0 +1,41 @@
+#include <linux/list.h>
+
+Lista duplamente encadeada: next e prev.
+Apontando sempre pra uma list_head.
+Uso de container_of. Evita o uso de um ponteiro. Facilita a alocação.
+Uma lista vazia tem um head apontando pra si mesmo.
+
+Declaração de head:
+LIST_HEAD(head);
+
+struct data {
+       ...
+       struct list_head l;
+       ...
+};
+
+INIT_LIST_HEAD(&data->l);
+
+list_add(&data->l, &head);
+list_add_tail(&data->l, &head);
+list_del(&data->l);
+
+list_empty(&head);
+
+struct list_head *e;
+list_entry(entry, struct data, l);
+list_first_entry(&head, struct data, l);
+
+Macros para iteração:
+
+struct list_head *e;
+list_for_each(e, &head) {
+       struct data *data = list_entry(e, struct data, l);
+}
+
+struct data *data;
+list_for_each_entry(data, &head, l) {
+}
+
+list_for_each_safe (uso de list_delete)
+construção while (list_empty) list_delete
diff --git a/03.types/5.tree/text b/03.types/5.tree/text
new file mode 100644 (file)
index 0000000..59fefb8
--- /dev/null
@@ -0,0 +1,19 @@
+rbtree
+lib/rbtree.c
+
+outras árvores balanceadas?!?
+lib/radix-tree.c
+lib/prio_tree.c
+lib/btree.c
+
+
+
+hash (pid, tcp/ip, etc)
+
+include/linux/hash.h
+uXX hash_long(uXX val, bits);
+
+Sistemas de arquivos e net hashs.
+include/net/inet_hashtables.h
+fs/*/*hash*
+net/ipv4/fib_hash.c
diff --git a/03.types/6.others/ex b/03.types/6.others/ex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/03.types/6.others/text b/03.types/6.others/text
new file mode 100644 (file)
index 0000000..fc88411
--- /dev/null
@@ -0,0 +1,3 @@
+TODO.
+
+Eu gosto de IDR.
diff --git a/04.char/1.vfs/text b/04.char/1.vfs/text
new file mode 100644 (file)
index 0000000..a344805
--- /dev/null
@@ -0,0 +1,32 @@
+#include <linux/fs.h>
+
+LDD3 chapter 3
+
+struct file_operations
+       owner = THIS_MODULE
+       read
+       write
+       ioctl vs unlocked_ioctl vs compat_ioctl
+
+       unlocked_ioctl does not grab the kernel lock
+       unlocked_ioctl and compat_ioctl does not receive the inode structure
+       compat_ioctl (32bit vs 64bit)
+
+       open
+       release
+       flush
+       mmap
+       poll
+       llseek
+
+struct file
+       f_op
+       f_flags
+       f_pos
+       private_data
+
+we will not mess with inode
+struct inode
+
+iminor
+imajor
diff --git a/04.char/2.mkdev/ex b/04.char/2.mkdev/ex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/04.char/2.mkdev/text b/04.char/2.mkdev/text
new file mode 100644 (file)
index 0000000..10f8c4e
--- /dev/null
@@ -0,0 +1,12 @@
+#include <linux/types.h>
+#include <linux/kdev_t.h>
+Hoje: 12 bits major, 20 bits minor
+
+MAJOR(dev_t)
+MINOR(dev_t)
+MKDEV(major, minor)
+register_chrdev_region(dev_t f, unsigned int n, char *name);
+alloc_chrdev_region(dev_t *d, unsigned int fm, unsigned int n, char *name);
+unregister_chrdev_region(dev_t f, int n);
+
+
diff --git a/04.char/3.cdev/ex b/04.char/3.cdev/ex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/04.char/3.cdev/text b/04.char/3.cdev/text
new file mode 100644 (file)
index 0000000..db1a3cc
--- /dev/null
@@ -0,0 +1,13 @@
+#include <linux/cdev.h>
+
+struct cdev
+cdev_init(cdev, fops)
+cdev * cdev_alloc()
+cdev->fops = fops
+cdev_add(cdev, dev_t, unsigned n) (n is 1 most of the time)
+cdev_del(cdev)
+
+
+older way!?!
+register_chrdev/unregister_chrdev
+propose new way!?!
diff --git a/04.char/4.fops/ex b/04.char/4.fops/ex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/04.char/4.fops/text b/04.char/4.fops/text
new file mode 100644 (file)
index 0000000..3691dfd
--- /dev/null
@@ -0,0 +1,21 @@
+struct file_operations
+       owner = THIS_MODULE
+       read
+       write
+       ioctl vs unlocked_ioctl vs compat_ioctl
+
+       unlocked_ioctl does not grab the kernel lock
+       unlocked_ioctl and compat_ioctl does not receive the inode structure
+       compat_ioctl (32bit vs 64bit)
+
+       open
+       release
+       flush
+       mmap
+       poll
+       llseek
+
+Dicas pra implementar cada um. Regras pra implementar cada um.
+
+NOTA: Temos que apresentar como copiar dados de e para userspace. O
+lugar é aqui e o tempo é agora.
diff --git a/05.debug/1.printk/ex b/05.debug/1.printk/ex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/05.debug/1.printk/text b/05.debug/1.printk/text
new file mode 100644 (file)
index 0000000..48bfdbd
--- /dev/null
@@ -0,0 +1,64 @@
+printk(KERN_XXX "message");
+Notar a falta de vírgula. A macro expande para <X>, onde X é um número.
+Isso é interpretado por klogd (ou libc - man klogctl).
+
+Da mesma manpage, também em include/linux/kernel.h:
+       #define KERN_EMERG    "<0>"  /* system is unusable               */
+       #define KERN_ALERT    "<1>"  /* action must be taken immediately */
+       #define KERN_CRIT     "<2>"  /* critical conditions              */
+       #define KERN_ERR      "<3>"  /* error conditions                 */
+       #define KERN_WARNING  "<4>"  /* warning conditions               */
+       #define KERN_NOTICE   "<5>"  /* normal but significant condition */
+       #define KERN_INFO     "<6>"  /* informational                    */
+       #define KERN_DEBUG    "<7>"  /* debug-level messages             */
+
+printk_once - macro que imprime apenas uma vez
+printk_ratelimit - if (printk_ratelimit()) { } - limite por função
+imprime no máximo 10 vezes em 5 segundos, parâmetros configuráveis
+/proc/sys/kernel/printk_ratelimit{,_burst}
+
+printk_ratelimited(fmt, ...) - valores padrões apenas
+
+--
+
+Ainda em include/linux/kernel.h
+
+pr_emerg
+pr_alert
+pr_crit
+pr_err
+pr_warning
+pr_notice
+pr_info
+pr_devel -- apenas se macro DEBUG definida
+pr_debug -- apenas se macro DEBUG definida, ou com dynamic_debug
+
+--
+
+#include <linux/device.h>
+dev_printk(level, device, fmt, ...);
+dev_emerg(device, fmt, ...);
+dev_alert
+dev_crit
+dev_err
+dev_warn
+dev_notice
+dev_info
+dev_dbg -- apenas se macro DEBUG definida, ou com dynamic_debug
+
+--
+
+dynamic_debug - precisa de DEBUG_FS
+ver em lib/Kconfig.debug e Documentation/dynamic-debug-howto.txt
+
+--
+
+Definição de DEBUG condicionada ao Kconfig.
+drivers/usb/core/Kconfig
+drivers/usb/core/Makefile
+
+ifeq ($(CONFIG_USB_DEBUG),y)
+EXTRA_CFLAGS += -DDEBUG
+endif
+
+Se aplica apenas ao makefile em que é definido.
diff --git a/05.debug/2.proc/ex b/05.debug/2.proc/ex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/05.debug/2.proc/text b/05.debug/2.proc/text
new file mode 100644 (file)
index 0000000..b289347
--- /dev/null
@@ -0,0 +1,64 @@
+-- proc
+
+fs/proc/ (implementações de alguns arquivos também)
+Documentation/filesystem/proc.txt (apenas descrição de alguns arquivos)
+
+struct file_operations (já visto em char device)
+#include <linux/proc_fs.h>
+PDE (proc dir entry) - detalhe de implementação
+
+pde = create_proc_entry(name, mode, parent);
+pde->proc_fops = &fops;
+Propenso a corrida.
+
+remove_proc_entry(name, parent);
+proc_mkdir(name, parent);
+proc_mkdir_mode(name, mode, parent);
+proc_create(name, mode, parent, fops);
+
+proc_net_mkdir(net, name, parent);
+proc_net_remove(net, name);
+proc_net_fops_create(net, name, mode, fops);
+
+struct net * serve para limitar a um net_namespace apenas.
+
+-- seq_file
+
+fs/seq_file.c
+
+#include <linux/seq_file.h>
+Documentation/filesystems/seq_file.txt
+
+struct seq_operations ops = {
+       .start,
+       .next,
+       .stop,
+       .show,
+};
+
+void * start(struct seq_file *, loff_t *pos);
+void * next(struct seq_file *, void *, loff_t *pos);
+void stop(struct seq_file *, void *);
+int show(struct seq_file *, void *v);
+
+int seq_printf(struct seq_file *, fmt, ...);
+
+int open(struct inode *inode, struct file *fp)
+{
+       return seq_open(fp, &seq_ops);
+}
+
+.read = seq_read,
+.llseek = seq_lseek,
+.release = seq_release,
+
+--
+
+seq_list_start
+seq_list_start_head
+
+int single_open(struct file *, show, void *data);
+single_release
+int show(struct seq_file *, void *);
+
+seq_list_next
diff --git a/05.debug/3.others/text b/05.debug/3.others/text
new file mode 100644 (file)
index 0000000..7cf923f
--- /dev/null
@@ -0,0 +1,15 @@
+tracers
+Documentation/trace/
+Uso de mmiotrace, por exemplo, para fazer engenharia reversa.
+
+kprobes
+Documentation/kprobes.txt
+Documentation/trace/kprobetrace.txt
+
+kgdb
+Documentation/DocBook/kgdb.tmpl
+Compilar com símbolos de depuração toma muito tempo e espaço em disco.
+
+kdump/crash
+
+UML - User Mode Linux
diff --git a/06.process/kthread b/06.process/kthread
new file mode 100644 (file)
index 0000000..fcb8057
--- /dev/null
@@ -0,0 +1,10 @@
+Brincando com kthreads:
+
+#include <linux/kthread.h>
+kernel/kthread.c
+
+struct task_struct * kthread_create(fn, data, fmt, ...);
+kthread_stop(tsk);
+kthread_bind(tsk, cpu);
+
+kthread_run - macro que chama kthread_create e wake_up_process
diff --git a/06.process/text b/06.process/text
new file mode 100644 (file)
index 0000000..cfa1ef7
--- /dev/null
@@ -0,0 +1,103 @@
+Process context:
+Pode fazer:
+       current
+       copy_to_user
+       copy_from_user
+       GFP_KERNEL
+Onde:
+       contexto de processo (chamada de sistema)
+       workqueue
+
+NOTA: work da wq executa em uma kthread e pode fazer copy_to_user e
+copy_from_user, segundo esse comentário em kernel/kmod.c:
+                /*
+                 * Normally it is bogus to call wait4() from in-kernel because
+                 * wait4() wants to write the exit code to a userspace address.
+                 * But wait_for_helper() always runs as keventd, and put_user()
+                 * to a kernel address works OK for kernel threads, due to their
+                 * having an mm_segment_t which spans the entire address space.
+                 *
+                 * Thus the __user pointer cast is valid here.
+                 */
+
+Atomic context:
+Pode fazer:
+       GFP_ATOMIC
+Não pode fazer:
+       copy_{to,from}_user
+       GFP_KERNEL
+       "dormir"
+       schedule
+       mutex
+       wait
+Onde:
+       interrupção
+       spinlock
+       timers
+       tasklet
+
+
+
+NOTES:
+scalable SMP: that's what's important (for most people, anyway)
+BKL: not scalable
+Bottom Half: after handling interrupts, Linux executes the bottom half
+       (TODO: Check this)
+       Bottom Halves were "single-threaded": only one bottom half could
+       execute at a time (only one or only one NET_BH?).
+               UPDATE: only one. tasklets allow a single tasklet to run
+               on only one CPU at a time. But other tasklets may run on
+               other CPUs.
+       Bottom Half now is softirq and tasklet (which is a softirq
+       itself).
+spin_lock_irqsave
+       Disables interrupts in the local CPU
+       Why? Explanation: CPU 1 grabs spinlock, CPU 1 is interrupted and
+               handler grabs same spinlock: spins forever (code will not
+               migrate? TODO). Second scenario: CPU 2 is interrupted and
+               grabs the same lock, CPU 1 has the chance to release the
+               lock and CPU 2 will go on.
+spin_lock_bh
+       If used only in process context and BHs
+local_irq_disable() or local_irq_save(flags)
+       It's enough when data is per-CPU. That is, there will not be
+       concurrency between CPUs, but only between interrupt handler
+       and process code.
+CPU affinity: softirq runs on the same CPU it was raised on.
+
+
+
+--
+
+CONFIG_DEBUG_PREEMPT
+Preemption.
+
+preempt_disable - disable preemption in current CPU TODO: check "current"
+preempt_enable - enable preemption in current CPU
+
+
+--
+SMP
+
+Trabalhando com CPUs.
+smp_processor_id() retorna ID do processador corrente: só pode ser utilizado se
+       a tarefa estiver amarrada a um processador ou em um contexto não
+       preemptível (preempt off)
+get_cpu - desabilita preempção e retorna ID da CPU
+put_cpu - reabilita preempção
+
+
+Referências:
+"I'll Do It Later: Softirqs, Tasklets, Bottom Halves, Task Queues, Work Queues
+and Timers" by Matthew Wilcox
+
+
+TODO:
+Zoombie
+Defunct
+Uninterruptible
+Unkillable
+
+
+
+
diff --git a/07.race/1.race/text b/07.race/1.race/text
new file mode 100644 (file)
index 0000000..39608bb
--- /dev/null
@@ -0,0 +1,51 @@
+BKL:
+
+Código de 2.0, quando SMP foi introduzido: artigo do Alan Cox sobre SMP
+no 2.0.
+
+Existe deste então. No entanto, sua característica é permitir que apenas
+um processador execute código de kernel space. Por isso, foram criados
+os demais mecanismos para evitar concorrência, como spinlock. TODO:
+verificar de quando é spinlock e referenciar texto do Linus em
+Documentation/.
+
+O BKL ainda se encontra hoje no código do Linux e muitos tem tentado
+removê-lo. Um dos maiores obstáculos é o subsistema de tty, que ainda é
+um código bem antigo.
+
+--
+
+Condições de corrida: exemplos clássicos!?!
+
+Clássico exemplo do incremento.
+Sessão crítica.
+
+Uma interrupção pode acontecer, e o código de interrupção geralmente é uma
+sessão crítica.
+Em sistemas SMP, outro processador pode executar a mesma sessão crítica.
+O escalonador pode executar (provavelmente, ocorreu uma interrupção, como o
+timer) e executar outro processo que executará a mesma sessão crítica.
+
+Para tanto, desabilitar interrupções é uma opção. Mas, muitas vezes, não é a
+melhor. Em sistemas SMP, pode não ser suficiente.
+
+Com a preempção suportada (escalonador pode ser executado em uma CPU
+mesmo quando ela executa código em kernel space) (TODO: estudar melhor
+as três opções atuais de preempção), outros problemas, antes não
+existentes aparecem. (TODO: quais? exemplos!)
+
+
+smp_processor_id: o escalonador pode executar e trocar o processo de CPU.
+Desabilitar preempção basta.
+
+
+TODO:
+Mais referências
+Exemplos
+Mais e melhores descrições dos problemas e das soluções
+
+
+Referências:
+Livros acadêmicos sobre sistemas operacionais
+Documentação histórica do Linux sobre as soluções que foram surgindo
+Código de preempção, interrupção global, softirq/BH.
diff --git a/07.race/2.sem_mutex/ex b/07.race/2.sem_mutex/ex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/07.race/2.sem_mutex/text b/07.race/2.sem_mutex/text
new file mode 100644 (file)
index 0000000..d1fb58a
--- /dev/null
@@ -0,0 +1,30 @@
+#include <linux/semaphore.h>
+kernel/semaphore.c
+
+down(struct *semaphore);
+up(struct *semaphore);
+sema_init(sem, val);
+init_MUTEX(sem);
+init_MUTEX_LOCKED(sem);
+DECLARE_MUTEX(varname);
+down_interruptible(sem);
+
+#include <linux/mutex.h>
+kernel/mutex.c
+Documentation/mutex-design.txt
+
+Implementação nova.
+Quando? 9 Jan 2006, f3f54ffa703c6298240ffd69616451d645bae4d5
+Rationale em Documentation/mutex-design.txt
+Enfim, pq usar? Pq "Mingo" says so!
+
+struct mutex
+mutex_init(struct mutex *);
+DEFINE_MUTEX(varname);
+mutex_lock(mutex);
+mutex_unlock(mutex);
+
+
+--
+
+Ambos dormem. Portanto, cuidado com o contexo onde usá-los.
diff --git a/07.race/3.spinlocks/ex b/07.race/3.spinlocks/ex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/07.race/3.spinlocks/text b/07.race/3.spinlocks/text
new file mode 100644 (file)
index 0000000..f0956cf
--- /dev/null
@@ -0,0 +1,15 @@
+#include <linux/spinlock.h>
+
+Documentation/spinlocks.txt
+
+Atenção! Ao tomar um spinlock, encontra-se em contexto atômico.
+Portanto, GFP_ATOMIC ao invés de GFP_KERNEL (se possível, aloque antes
+ou depois), entre tantos outros. Enfim, não durma com um spin travado.
+
+spin_lock
+spin_lock_irqsave
+spin_lock_bh
+
+TODO: descrever as diferenças e mostrar exemplos de caso pra cada um
+TODO: pegar mais da API do LDD3 e da documentação
+TODO: mostrar histórico da documentação (versões anteriores)
diff --git a/07.race/4.atomic/ex b/07.race/4.atomic/ex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/07.race/4.atomic/text b/07.race/4.atomic/text
new file mode 100644 (file)
index 0000000..acdd501
--- /dev/null
@@ -0,0 +1,14 @@
+Notas:
+Implementações bem dependentes de arquitetura.
+Enviar mensagem aos demais processadores, por exemplo.
+
+Exemplos de uso:
+kref
+
+Referências:
+LDD3
+Documentation/atomic_ops.txt
+TODO: ler também Documentation/volatile-considered-harmful.txt
+
+TODO:
+Descrever a API
diff --git a/07.race/5.percpu/ex b/07.race/5.percpu/ex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/07.race/5.percpu/text b/07.race/5.percpu/text
new file mode 100644 (file)
index 0000000..3053ef8
--- /dev/null
@@ -0,0 +1,19 @@
+Per-CPU
+
+#include <linux/percpu.h>
+
+get/put TODO
+alloc TODO
+for_each_cpu TODO
+
+Mostrar exemplos:
+Bom exemplo é o código de estatísticas do loopback: drivers/net/loopback.c
+
+TODO:
+       investigar percpu_counters.h
+
+Notas:
+Existe um tamanho limitado para variáveis per-CPU. (TODO: verificar)
+
+Referências:
+LDD3
diff --git a/07.race/6.rcu/ex b/07.race/6.rcu/ex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/07.race/6.rcu/text b/07.race/6.rcu/text
new file mode 100644 (file)
index 0000000..34aab80
--- /dev/null
@@ -0,0 +1,13 @@
+Referências:
+Artigos do Paul McKenney
+Documentation/RCU/
+       whatisRCU.txt
+       rcu.txt
+       ... e muitos outros
+
+Ainda nesse diretório, especialização para arranjos e listas.
+
+TODO: Muita coisa pra ler. Mostrar exemplos no sistema de redes e em
+outros sistemas.
+
+Site do Josh Triplett sobre programação XXX.
diff --git a/07.race/7.others/text b/07.race/7.others/text
new file mode 100644 (file)
index 0000000..fb32e18
--- /dev/null
@@ -0,0 +1,5 @@
+seqlocks
+rwlocks
+etc
+
+Pegar lista em LDD3 e Documentation/
diff --git a/08.time/1.jiffies_sched/text b/08.time/1.jiffies_sched/text
new file mode 100644 (file)
index 0000000..d7fe952
--- /dev/null
@@ -0,0 +1,16 @@
+Linux mede tempo em jiffies, ticks.
+Mencionar tickless kernel (CONFIG_NO_HZ).
+
+#include <linux/sched.h> TODO
+
+jiffies
+wrapping around... jiffies64 ou coisa assim TODO
+timer_after, time_before e etc
+HZ - jiffies em um segundo
+
+schedule
+schedule_interruptible
+etc. TODO
+
+msleep
+msleep_interruptible
diff --git a/08.time/2.busy/text b/08.time/2.busy/text
new file mode 100644 (file)
index 0000000..c2b0c34
--- /dev/null
@@ -0,0 +1,8 @@
+#include <asm/processor.h>
+cpu_relax: use em um loop
+
+udelay: implementado como loop
+curiosidades: loops_per_jiffies, BogoMIPS
+XXXdelay TODO
+
+algum outro busy waiting?!?
diff --git a/08.time/3.timers/text b/08.time/3.timers/text
new file mode 100644 (file)
index 0000000..bf55d95
--- /dev/null
@@ -0,0 +1,11 @@
+#include <linux/timer.h>
+
+struct timer_list
+
+add_timer
+mod_timer
+del_timer
+
+Referências:
+LDD3
+curiosidade kernel/timer.c
diff --git a/08.time/4.tasklets/text b/08.time/4.tasklets/text
new file mode 100644 (file)
index 0000000..12d6351
--- /dev/null
@@ -0,0 +1,5 @@
+Usados para interrupções...
+
+Implementados como softirqs
+high_tasklet
+low_tasklet
diff --git a/08.time/5.wq/ex b/08.time/5.wq/ex
new file mode 100644 (file)
index 0000000..9bbbe85
--- /dev/null
@@ -0,0 +1,5 @@
+Sample:
+
+ * This code demonstrates why a work should not block for too long.
+ * This is worse in the case that the work is scheduled in keventd.
diff --git a/08.time/5.wq/text b/08.time/5.wq/text
new file mode 100644 (file)
index 0000000..a77b54f
--- /dev/null
@@ -0,0 +1,16 @@
+#include <linux/workqueue.h>
+
+Work queue:
+
+struct workqueue_struct * create_workqueue(name);
+void destroy_workqueue(struct workqueue_struct *);
+/* A função acima aguarda tarefas na fila. */
+
+Works:
+
+Declaração estática:
+
+struct work_struct *;
+DECLARE_WORK(varname, function);
+void function(struct work_struct *work);
+int queue_work(wq, work); /* Queue work on the current CPU */
diff --git a/08.time/6.hrtimers/text b/08.time/6.hrtimers/text
new file mode 100644 (file)
index 0000000..5895323
--- /dev/null
@@ -0,0 +1,6 @@
+Emulam ticks.
+Usados em poucos drivers no momento.
+Usados principalmente para nanosleep, itimers, POSIX timers.
+       man nanosleep
+       man getitimer/setitimer
+       man timer_create
diff --git a/09.memory/1.intro/text b/09.memory/1.intro/text
new file mode 100644 (file)
index 0000000..9ffcf07
--- /dev/null
@@ -0,0 +1,30 @@
+Acesso do Hardware à Memória Física: Barramentos, pinos de endereço,
+pinos de dados. Arquitetura da máquina: orientada a bytes ou palavras.
+Exemplo de máquina com acesso a palavra: Alpha. TODO: verificar.
+
+Memória Virtual. Um pouco de história sobre segmentação (mencionar
+MULTICS?). Paginação e proteção de memória. Diferenças entre MPU e MMU.
+uClinux e os ports do Linux para arquiteturas sem MMU. TODO: estudar
+diferenças, como a exigências de não utilizar vfork, porque glibc não
+funciona (além do fato de m68k não ter bom suporte a TLS).
+
+Acesso à memória por dispositivos. Endereço no barramento. DMA. IO-MMU.
+Diferenças entre IO mapeado em memória (registros), memória de
+dispositivo e memória compartilhada.
+
+Zonas de Memória: conceitos do Linux, de acordo com algumas
+características descritas acima e segundo a sua arquitetura:
+
+* Zona de DMA, já que alguns dispositivos só são capazes de utilizar
+essa zona. No PC, por exemplo, alguns dispositivos só são capazes de
+usar memória abaixo de 1MiB (20 bits) ou 16MiB (24 bits). TODO: ISA!?!
+
+* Memória Alta. Intel PAE. Associação linear que o Linux faz de endereço
+virtual com endereço físico.
+
+* Memória Baixa. Layout de memória no Linux. vmalloc e outros (TODO: o
+que é cada um desses outros?) ocupam parte do 1GiB (dependendo de
+configuração) que serve à memória baixa. Portanto, mesmo uma máquina com
+1GiB de memória, pode ter um limite inferior para memória baixa.
+
+/proc/meminfo
diff --git a/09.memory/2.buddy/text b/09.memory/2.buddy/text
new file mode 100644 (file)
index 0000000..7f7e4f6
--- /dev/null
@@ -0,0 +1,13 @@
+Hierarquia de alocação de memória.
+
+early_early_res -> early_res -> bootmem -> buddy -> gfp -> slab
+TODO: verificar
+
+CONFIG_NO_BOOTMEM
+
+buddy (dividir para conquistar!?! TODO)
+       espaços contíguos de memória com certo número de páginas (uma
+       potência de dois)
+       order
+
+/proc/buddyinfo
diff --git a/09.memory/3.alloc/text b/09.memory/3.alloc/text
new file mode 100644 (file)
index 0000000..97347e7
--- /dev/null
@@ -0,0 +1,11 @@
+kmalloc/kfree
+
+Use kzalloc instead of using kmalloc followed by memset. kzalloc adds
+the flag __GFP_ZERO, which requests a zeroed memory area.
+
+
+
+GFP_XXX
+vmalloc/vfree (diferenças de layout, endereços, mecanismo, etc)
+
+Capítulo 8 do LDD3
diff --git a/09.memory/4.gfp/text b/09.memory/4.gfp/text
new file mode 100644 (file)
index 0000000..f846caf
--- /dev/null
@@ -0,0 +1,5 @@
+Cap. 8 LDD3
+get_free_pages
+alloc_pages
+struct page
+etc
diff --git a/09.memory/5.map/text b/09.memory/5.map/text
new file mode 100644 (file)
index 0000000..d2ee038
--- /dev/null
@@ -0,0 +1,4 @@
+kmap
+kunmap
+kmap_atomic
+como fazer com memória alta? os limites desse mapeamento?
diff --git a/09.memory/6.io/text b/09.memory/6.io/text
new file mode 100644 (file)
index 0000000..bc62874
--- /dev/null
@@ -0,0 +1,3 @@
+ioremap
+vmap!?!
+vumap!?!
diff --git a/09.memory/7.slab/text b/09.memory/7.slab/text
new file mode 100644 (file)
index 0000000..ff82ff3
--- /dev/null
@@ -0,0 +1,8 @@
+kmem_cache
+diferenças de slab/slob
+
+mempool - mecanismo de alocação (reserva de memória - que usa kmem_cache
+ou outro mecanismo por baixo)
+
+Referências:
+LDD3 - Cap. 8
diff --git a/09.memory/8.boot/text b/09.memory/8.boot/text
new file mode 100644 (file)
index 0000000..88aee07
--- /dev/null
@@ -0,0 +1 @@
+bootmem
diff --git a/09.memory/9.sg/text b/09.memory/9.sg/text
new file mode 100644 (file)
index 0000000..7bd8a73
--- /dev/null
@@ -0,0 +1 @@
+scatter-gather lists
diff --git a/09.memory/text b/09.memory/text
new file mode 100644 (file)
index 0000000..89e33de
--- /dev/null
@@ -0,0 +1,15 @@
+Ler UTLK e fazer verificações, correções, melhorias e notas
+Ler capítulo 2.5 de Understanding the Linux Kernel
+TODO: tópicos pouco esclarecidos
+Per CPU-caches and TLB Control (UTLK - 2.5.7) Fala pouco de cache
+Virtual Process Address Space (Understanding the Linux Kernel - Ch. 9)
+
+Layout de um processo na memória (UTLK - Ch. 20)
+Copy-on-Write (mesmo mais sobre mm)
+
+Falar mais sobre MM (capítulo 15 do LDD3)
+
+flat mem
+sparse mem
+contiguous mem
+nommu
diff --git a/10.irqs/1.hw/text b/10.irqs/1.hw/text
new file mode 100644 (file)
index 0000000..bd1d4d9
--- /dev/null
@@ -0,0 +1,7 @@
+Hardware Exceptions and Interrupts
+Interrupts Lines
+PIC
+IO-APIC
+
+Referências:
+UTLK
diff --git a/10.irqs/2.bh/text b/10.irqs/2.bh/text
new file mode 100644 (file)
index 0000000..18b6d6b
--- /dev/null
@@ -0,0 +1,3 @@
+O que era o BH?
+O que são softirqs?
+Interrupt handlers são os "top halves".
diff --git a/10.irqs/3.handlers/text b/10.irqs/3.handlers/text
new file mode 100644 (file)
index 0000000..70daf1a
--- /dev/null
@@ -0,0 +1,7 @@
+Escrevendo handlers de interrupção.
+Contexto.
+Cuidados.
+
+Registrando handlers (request_irq) e removendo handlers.
+       Mostrar código de led gpio trigger e mostrar cuidado com
+       profundidade de requisições.
diff --git a/10.irqs/4.wait/text b/10.irqs/4.wait/text
new file mode 100644 (file)
index 0000000..da11d90
--- /dev/null
@@ -0,0 +1,8 @@
+wait queues
+wait queue heads
+wake/wait/etc
+
+prepare_to_wait/schedule/finish_wait
+
+completions
+wait_for_completion/complete
diff --git a/11.dma_mmap/text b/11.dma_mmap/text
new file mode 100644 (file)
index 0000000..1ae06df
--- /dev/null
@@ -0,0 +1,10 @@
+GFP_DMA
+request_dma TODO: FIXME
+scatter gather
+
+mmap:
+get_page
+open/close/etc
+
+Referências:
+LDD3 cap. 15
diff --git a/12.dd/text b/12.dd/text
new file mode 100644 (file)
index 0000000..7915c1b
--- /dev/null
@@ -0,0 +1,26 @@
+Modelo:
+include/linux/device/
+drivers/base/
+
+device_create
+device_destroy
+device_init
+device_add
+device_del
+put_device
+device_register
+device_unregister
+
+O problema com o nome. Nada de bus_id. device_set_name aloca memória.
+
+drivers e buses - TODO
+
+kobject
+kset
+NO simple_class anymore... class is simple
+
+sysfs (create_file) TODO
+
+
+Referências:
+LDD3 Cap. 14 (DESATUALIZADO)
diff --git a/13.hw/text b/13.hw/text
new file mode 100644 (file)
index 0000000..daae410
--- /dev/null
@@ -0,0 +1,18 @@
+Reordenação de acesso à memória e barreiras de memória
+
+Comunicação portável ioread* iowrite*
+Falar sobre o Alpha e o barramento de memória.
+
+Requisição de recursos.
+include/linux/ioport.h
+request_resource TODO
+request_region
+request_mem_region
+release_region
+release_mem_region
+
+check_region deprecated
+
+Referência:
+LDD3 Cap. 9
+Sobre reordenação de acesso à memória, documentação da AMD.
diff --git a/14.pci/text b/14.pci/text
new file mode 100644 (file)
index 0000000..7dcc11f
--- /dev/null
@@ -0,0 +1,14 @@
+pci_driver
+
+probe function
+       resume/suspend/PM
+       pci_enable
+       pci.*state
+       Mostrar exemplo que liga e desliga PCI (D3)
+
+configuração PCI
+
+pci_request_region/etc TODO
+
+Referência:
+LDD3
diff --git a/15.usb/text b/15.usb/text
new file mode 100644 (file)
index 0000000..4ed7a79
--- /dev/null
@@ -0,0 +1,17 @@
+Deveria ser maior esse capítulo. Talvez pegar horas do capítulo de
+hardware.
+
+HCD!?! Falar o quê sobre HCD? TODO
+
+usb_driver
+probe
+disconnect
+
+URB... alocação de URB, membros do URB, ISO URB (Argh!)
+Mostrar driver stk-webcam.
+Control URB.
+
+Referências:
+LDD3
+Apresentação do Greg
+Driver exemplo (skeleton)
diff --git a/16.block/text b/16.block/text
new file mode 100644 (file)
index 0000000..55e59ed
--- /dev/null
@@ -0,0 +1,2 @@
+A API mudou desde o LDD3. A mudança foi recente, lá pelo 2.6.29.
+Tejun Heo me fudeu! TODO
diff --git a/17.net/text b/17.net/text
new file mode 100644 (file)
index 0000000..c829df6
--- /dev/null
@@ -0,0 +1,7 @@
+Nova interface... o que mudou?
+Exemplo simples do loopback.
+
+SKBs... push, pull, etc, etc.
+
+Experimentar capítulo do LDD3.
+Livro Linux Network Internals!?! TODO
diff --git a/18.proto/text b/18.proto/text
new file mode 100644 (file)
index 0000000..8cf1ee4
--- /dev/null
@@ -0,0 +1,5 @@
+IRDA
+Bluetooth
+CAN
+Nokia Phonet
+Unix socket