xv6-65oo2/kernel
Frans Kaashoek 26f306113a Fix a lost wakeup bug: the disk driver's wakeup() can run after the
reading process acquired p->lock and released virtio lock in sleep(),
but before the process had set p->status to SLEEPING, because the
wakeup tested p->status without holding p's lock.  Thus, wakeup can
complete without seeing any process SLEEPING and then p sets p->status
to SLEEPING.

Fix some other issues:

- Don't initialize proc lock in allocproc(), because freeproc() sets
np->state = UNUSED and allocproc() can choose np and calls initlock()
on the process's lock, releasing np's lock accidentally.  Move
initializing proc's lock to init.

- Protect nextpid using ptable.lock (and move into its own function)

Some clean up:
- Don't acquire p->lock when it p is used in a private way (e.g., exit()/grow()).
- Move find_runnable() back into scheduler().
2019-07-02 19:29:14 -04:00
..
bio.c eliminate ramdisk 2019-06-13 06:57:38 -04:00
buf.h separate source into kernel/ user/ mkfs/ 2019-06-11 09:57:14 -04:00
console.c FD_DEVICE 2019-06-13 10:29:27 -04:00
date.h separate source into kernel/ user/ mkfs/ 2019-06-11 09:57:14 -04:00
defs.h try to continue from walk() failing to allocate a page-table page 2019-07-02 11:45:06 -04:00
elf.h separate source into kernel/ user/ mkfs/ 2019-06-11 09:57:14 -04:00
entry.S separate source into kernel/ user/ mkfs/ 2019-06-11 09:57:14 -04:00
exec.c Checkpoint switching to per-process locks, in attempt clarify xv6's 2019-07-02 09:14:47 -04:00
fcntl.h separate source into kernel/ user/ mkfs/ 2019-06-11 09:57:14 -04:00
file.c FD_DEVICE 2019-06-13 10:29:27 -04:00
file.h FD_DEVICE 2019-06-13 10:29:27 -04:00
fs.c Checkpoint switching to per-process locks, in attempt clarify xv6's 2019-07-02 09:14:47 -04:00
fs.h FD_DEVICE 2019-06-13 10:29:27 -04:00
kalloc.c virtio disk driver 2019-06-13 06:49:02 -04:00
kernel.ld virtio disk driver 2019-06-13 06:49:02 -04:00
kernelvec.S timer interrupt in the kernel -> yield 2019-07-01 13:46:11 -04:00
log.c separate source into kernel/ user/ mkfs/ 2019-06-11 09:57:14 -04:00
main.c eliminate ramdisk 2019-06-13 06:57:38 -04:00
memlayout.h clean up virtio code 2019-06-13 09:40:17 -04:00
param.h separate source into kernel/ user/ mkfs/ 2019-06-11 09:57:14 -04:00
pipe.c Checkpoint switching to per-process locks, in attempt clarify xv6's 2019-07-02 09:14:47 -04:00
plic.c clean up virtio code 2019-06-13 09:40:17 -04:00
proc.c Fix a lost wakeup bug: the disk driver's wakeup() can run after the 2019-07-02 19:29:14 -04:00
proc.h Checkpoint switching to per-process locks, in attempt clarify xv6's 2019-07-02 09:14:47 -04:00
ramdisk.c separate source into kernel/ user/ mkfs/ 2019-06-11 09:57:14 -04:00
riscv.h Avoid two cores selecting the same process to run 2019-07-02 13:40:33 -04:00
sleeplock.c Checkpoint switching to per-process locks, in attempt clarify xv6's 2019-07-02 09:14:47 -04:00
sleeplock.h separate source into kernel/ user/ mkfs/ 2019-06-11 09:57:14 -04:00
spinlock.c Avoid two cores selecting the same process to run 2019-07-02 13:40:33 -04:00
spinlock.h Avoid two cores selecting the same process to run 2019-07-02 13:40:33 -04:00
start.c separate source into kernel/ user/ mkfs/ 2019-06-11 09:57:14 -04:00
stat.h FD_DEVICE 2019-06-13 10:29:27 -04:00
string.c separate source into kernel/ user/ mkfs/ 2019-06-11 09:57:14 -04:00
swtch.S separate source into kernel/ user/ mkfs/ 2019-06-11 09:57:14 -04:00
syscall.c Merge branch 'riscv' into riscv-proc 2019-07-02 14:19:31 -04:00
syscall.h separate source into kernel/ user/ mkfs/ 2019-06-11 09:57:14 -04:00
sysfile.c Merge branch 'riscv' into riscv-proc 2019-07-02 14:19:31 -04:00
sysproc.c Merge branch 'riscv' into riscv-proc 2019-07-02 14:19:31 -04:00
trampoline.S separate source into kernel/ user/ mkfs/ 2019-06-11 09:57:14 -04:00
trap.c Merge branch 'riscv' into riscv-proc 2019-07-02 14:19:31 -04:00
types.h separate source into kernel/ user/ mkfs/ 2019-06-11 09:57:14 -04:00
uart.c Checkpoint switching to per-process locks, in attempt clarify xv6's 2019-07-02 09:14:47 -04:00
virtio.h Introduce alloc3_desc and UsedArea to make code easier to read 2019-07-01 08:20:35 -04:00
virtio_disk.c x 2019-07-01 08:28:14 -04:00
vm.c try to continue from walk() failing to allocate a page-table page 2019-07-02 11:45:06 -04:00