Skip to content

Commit

Permalink
kvm: ignore EAGAIN & EINTR
Browse files Browse the repository at this point in the history
I did it! With the fixes I've made so far, I can now boot on multi-core.

/ # dmesg | grep -i smp:
[    0.649012][    T1] smp: Bringing up secondary CPUs ...
[    0.674250][    T1] smp: Brought up 1 node, 2 CPUs

/ # cat /proc/cpuinfo  | grep -i processor
processor       : 0
processor       : 1

Signed-off-by: Nobuhiro MIKI <[email protected]>
  • Loading branch information
bobuhiro11 committed Nov 20, 2021
1 parent a5f9915 commit 9a53099
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kvm/kvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ func CreateVCPU(vmFd uintptr, vcpuID int) (uintptr, error) {

func Run(vcpuFd uintptr) error {
_, err := ioctl(vcpuFd, uintptr(kvmRun), uintptr(0))
if err != nil {
// refs: https://github.com/kvmtool/kvmtool/blob/415f92c33a227c02f6719d4594af6fad10f07abf/kvm-cpu.c#L44
if errors.Is(err, syscall.EAGAIN) || errors.Is(err, syscall.EINTR) {
return nil
}
}

return err
}
Expand Down

0 comments on commit 9a53099

Please sign in to comment.