Closed hamo closed 9 months ago
On my computer, novm still can not work with go 1.4. When trying to debug this issue, go race detector found 2 race conditions.
The first one is Ram struct. And is fixed by commit 6f665f4. This is the output of go race detector:
WARNING: DATA RACE Read by goroutine 16: novmm/machine.(_MsiXDevice).ClearPending() /home/hamo/workspace/novm/src/novmm/machine/msix.go:137 +0xa8 novmm/machine.(_MsiXDevice).SendInterrupt() /home/hamo/workspace/novm/src/novmm/machine/msix.go:355 +0x1b0 novmm/machine.(_VirtioChannel).Interrupt() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:353 +0xe0 novmm/machine.(_VirtioChannel).ProcessOutgoing() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:328 +0x3a5 Previous write by goroutine 18: novmm/machine.(_MsiXDevice).ClearPending() /home/hamo/workspace/novm/src/novmm/machine/msix.go:138 +0x1a3 novmm/machine.(_MsiXDevice).SendInterrupt() /home/hamo/workspace/novm/src/novmm/machine/msix.go:355 +0x1b0 novmm/machine.(_VirtioChannel).Interrupt() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:353 +0xe0 novmm/machine.(_VirtioChannel).ProcessOutgoing() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:328 +0x3a5 Goroutine 16 (running) created at: novmm/machine.(_VirtioChannel).start() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:669 +0xed novmm/machine.(_VirtioDevice).Attach() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:829 +0x261 novmm/machine.(_VirtioConsoleDevice).Attach() /home/hamo/workspace/novm/src/novmm/machine/virtio_console.go:187 +0x6c novmm/machine.(_Model).CreateDevices() /home/hamo/workspace/novm/src/novmm/machine/state.go:105 +0x1f5 main.main() /home/hamo/workspace/novm/src/novmm/main.go:188 +0x90e Goroutine 18 (running) created at: novmm/machine.(_VirtioChannel).start() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:669 +0xed novmm/machine.(_VirtioDevice).Attach() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:829 +0x261 novmm/machine.(_VirtioConsoleDevice).Attach() /home/hamo/workspace/novm/src/novmm/machine/virtio_console.go:187 +0x6c novmm/machine.(_Model).CreateDevices() /home/hamo/workspace/novm/src/novmm/machine/state.go:105 +0x1f5 main.main() /home/hamo/workspace/novm/src/novmm/main.go:188 +0x90e
WARNING: DATA RACE Read by goroutine 16: novmm/machine.(_MsiXDevice).ClearPending() /home/hamo/workspace/novm/src/novmm/machine/msix.go:137 +0xa8 novmm/machine.(_MsiXDevice).SendInterrupt() /home/hamo/workspace/novm/src/novmm/machine/msix.go:355 +0x1b0 novmm/machine.(_VirtioChannel).Interrupt() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:353 +0xe0 novmm/machine.(_VirtioChannel).ProcessOutgoing() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:328 +0x3a5
Previous write by goroutine 18: novmm/machine.(_MsiXDevice).ClearPending() /home/hamo/workspace/novm/src/novmm/machine/msix.go:138 +0x1a3 novmm/machine.(_MsiXDevice).SendInterrupt() /home/hamo/workspace/novm/src/novmm/machine/msix.go:355 +0x1b0 novmm/machine.(_VirtioChannel).Interrupt() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:353 +0xe0 novmm/machine.(_VirtioChannel).ProcessOutgoing() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:328 +0x3a5
Goroutine 16 (running) created at: novmm/machine.(_VirtioChannel).start() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:669 +0xed novmm/machine.(_VirtioDevice).Attach() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:829 +0x261 novmm/machine.(_VirtioConsoleDevice).Attach() /home/hamo/workspace/novm/src/novmm/machine/virtio_console.go:187 +0x6c novmm/machine.(_Model).CreateDevices() /home/hamo/workspace/novm/src/novmm/machine/state.go:105 +0x1f5 main.main() /home/hamo/workspace/novm/src/novmm/main.go:188 +0x90e
Goroutine 18 (running) created at: novmm/machine.(_VirtioChannel).start() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:669 +0xed novmm/machine.(_VirtioDevice).Attach() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:829 +0x261 novmm/machine.(_VirtioConsoleDevice).Attach() /home/hamo/workspace/novm/src/novmm/machine/virtio_console.go:187 +0x6c novmm/machine.(_Model).CreateDevices() /home/hamo/workspace/novm/src/novmm/machine/state.go:105 +0x1f5 main.main() /home/hamo/workspace/novm/src/novmm/main.go:188 +0x90e
The second one is VirtioBufferSet map, and it is fixed by commit 7c7595d. Output of go race detector:
WARNING: DATA RACE Write by goroutine 19: runtime.mapassign1() /build/go/src/go-1.4.1/src/runtime/hashmap.go:383 +0x0 novmm/machine.(_VirtioChannel).processOne() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:209 +0x78b novmm/machine.(_VirtioChannel).consumeOne() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:249 +0x10d novmm/machine.(*VirtioChannel).ProcessIncoming() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:287 +0x10f Previous write by goroutine 18: runtime.mapdelete() /build/go/src/go-1.4.1/src/runtime/hashmap.go:495 +0x0 novmm/machine.(*VirtioChannel).ProcessOutgoing() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:339 +0x408 Goroutine 19 (running) created at: novmm/machine.(_VirtioChannel).start() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:670 +0x107 novmm/machine.(_VirtioDevice).Attach() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:829 +0x261 novmm/machine.(_VirtioConsoleDevice).Attach() /home/hamo/workspace/novm/src/novmm/machine/virtio_console.go:187 +0x6c novmm/machine.(_Model).CreateDevices() /home/hamo/workspace/novm/src/novmm/machine/state.go:105 +0x1f5 main.main() /home/hamo/workspace/novm/src/novmm/main.go:188 +0x90e Goroutine 18 (running) created at: novmm/machine.(_VirtioChannel).start() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:669 +0xed novmm/machine.(_VirtioDevice).Attach() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:829 +0x261 novmm/machine.(_VirtioConsoleDevice).Attach() /home/hamo/workspace/novm/src/novmm/machine/virtio_console.go:187 +0x6c novmm/machine.(_Model).CreateDevices() /home/hamo/workspace/novm/src/novmm/machine/state.go:105 +0x1f5 main.main() /home/hamo/workspace/novm/src/novmm/main.go:188 +0x90e
WARNING: DATA RACE Write by goroutine 19: runtime.mapassign1() /build/go/src/go-1.4.1/src/runtime/hashmap.go:383 +0x0 novmm/machine.(_VirtioChannel).processOne() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:209 +0x78b novmm/machine.(_VirtioChannel).consumeOne() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:249 +0x10d novmm/machine.(*VirtioChannel).ProcessIncoming() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:287 +0x10f
Previous write by goroutine 18: runtime.mapdelete() /build/go/src/go-1.4.1/src/runtime/hashmap.go:495 +0x0 novmm/machine.(*VirtioChannel).ProcessOutgoing() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:339 +0x408
Goroutine 19 (running) created at: novmm/machine.(_VirtioChannel).start() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:670 +0x107 novmm/machine.(_VirtioDevice).Attach() /home/hamo/workspace/novm/src/novmm/machine/virtio.go:829 +0x261 novmm/machine.(_VirtioConsoleDevice).Attach() /home/hamo/workspace/novm/src/novmm/machine/virtio_console.go:187 +0x6c novmm/machine.(_Model).CreateDevices() /home/hamo/workspace/novm/src/novmm/machine/state.go:105 +0x1f5 main.main() /home/hamo/workspace/novm/src/novmm/main.go:188 +0x90e
Good catch! I need to remember the intent regarding the virtio outstanding map. I'll update shortly.
On my computer, novm still can not work with go 1.4. When trying to debug this issue, go race detector found 2 race conditions.
The first one is Ram struct. And is fixed by commit 6f665f4. This is the output of go race detector:
The second one is VirtioBufferSet map, and it is fixed by commit 7c7595d. Output of go race detector: