Check for EINTR from KVM_CREATE_VM
The kernel may return EINTR from: kvm_create_vm kvm_init_mmu_notifier mmu_notifier_register do_mmu_notifier_register mm_take_all_locks Go 1.14's preemptive scheduling signals make hitting this much more likely. PiperOrigin-RevId: 291212669
This commit is contained in:
parent
98e83c444f
commit
7a79715504
|
@ -62,9 +62,19 @@ func New(deviceFile *os.File) (*KVM, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new VM fd.
|
// Create a new VM fd.
|
||||||
vm, _, errno := syscall.RawSyscall(syscall.SYS_IOCTL, fd, _KVM_CREATE_VM, 0)
|
var (
|
||||||
if errno != 0 {
|
vm uintptr
|
||||||
return nil, fmt.Errorf("creating VM: %v", errno)
|
errno syscall.Errno
|
||||||
|
)
|
||||||
|
for {
|
||||||
|
vm, _, errno = syscall.Syscall(syscall.SYS_IOCTL, fd, _KVM_CREATE_VM, 0)
|
||||||
|
if errno == syscall.EINTR {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if errno != 0 {
|
||||||
|
return nil, fmt.Errorf("creating VM: %v", errno)
|
||||||
|
}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
// We are done with the device file.
|
// We are done with the device file.
|
||||||
deviceFile.Close()
|
deviceFile.Close()
|
||||||
|
|
Loading…
Reference in New Issue