xv6-riscv/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
buf.h
console.c
date.h
defs.h try to continue from walk() failing to allocate a page-table page 2019-07-02 11:45:06 -04:00
elf.h
entry.S
exec.c Checkpoint switching to per-process locks, in attempt clarify xv6's 2019-07-02 09:14:47 -04:00
fcntl.h
file.c
file.h
fs.c Checkpoint switching to per-process locks, in attempt clarify xv6's 2019-07-02 09:14:47 -04:00
fs.h
kalloc.c
kernel.ld
kernelvec.S timer interrupt in the kernel -> yield 2019-07-01 13:46:11 -04:00
log.c
main.c
memlayout.h
param.h
pipe.c Checkpoint switching to per-process locks, in attempt clarify xv6's 2019-07-02 09:14:47 -04:00
plic.c
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
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
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
stat.h
string.c
swtch.S
syscall.c Merge branch 'riscv' into riscv-proc 2019-07-02 14:19:31 -04:00
syscall.h
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
trap.c Merge branch 'riscv' into riscv-proc 2019-07-02 14:19:31 -04:00
types.h
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