kvm: wake up all waiter of vCPU.state

Now we call FUTEX_WAKE with ^uintptr(0) of waiters, but in this case only one
waiter will be waked up. If we want to wake up all of them, the number of
waiters has to be set to math.MaxInt32.

PiperOrigin-RevId: 258285286
This commit is contained in:
Andrei Vagin 2019-07-15 19:26:16 -07:00 committed by gVisor bot
parent 3d78baf06d
commit 6a8ff6daef
1 changed files with 2 additions and 1 deletions

View File

@ -21,6 +21,7 @@ package kvm
import ( import (
"fmt" "fmt"
"math"
"sync/atomic" "sync/atomic"
"syscall" "syscall"
"unsafe" "unsafe"
@ -134,7 +135,7 @@ func (c *vCPU) notify() {
syscall.SYS_FUTEX, syscall.SYS_FUTEX,
uintptr(unsafe.Pointer(&c.state)), uintptr(unsafe.Pointer(&c.state)),
linux.FUTEX_WAKE|linux.FUTEX_PRIVATE_FLAG, linux.FUTEX_WAKE|linux.FUTEX_PRIVATE_FLAG,
^uintptr(0), // Number of waiters. math.MaxInt32, // Number of waiters.
0, 0, 0) 0, 0, 0)
if errno != 0 { if errno != 0 {
throw("futex wake error") throw("futex wake error")