aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2015-12-28 15:50:58 +0100
committerDmitry Vyukov <dvyukov@google.com>2015-12-28 15:53:51 +0100
commit0451ffa50aaf44ea28bfe729c6080b6ec97f7bb5 (patch)
tree04d1b77f21c07c0c1f442227fff8a818b31ae765
parenteef80b3d764f2f108d48da55ca71477c427ea7e3 (diff)
qemu/kvm: improve output buffering
There seems to be some missed pieces in output.
-rw-r--r--vm/kvm/kvm.go6
-rw-r--r--vm/qemu/qemu.go6
2 files changed, 10 insertions, 2 deletions
diff --git a/vm/kvm/kvm.go b/vm/kvm/kvm.go
index b9185d91f..819008b74 100644
--- a/vm/kvm/kvm.go
+++ b/vm/kvm/kvm.go
@@ -12,6 +12,7 @@ import (
"runtime"
"strconv"
"sync"
+ "syscall"
"time"
"github.com/google/syzkaller/fileutil"
@@ -68,6 +69,9 @@ func ctor(cfg *vm.Config) (vm.Instance, error) {
if err != nil {
return nil, fmt.Errorf("failed to create pipe: %v", err)
}
+ for sz := 128 << 10; sz <= 2<<20; sz *= 2 {
+ syscall.Syscall(syscall.SYS_FCNTL, wpipe.Fd(), syscall.F_SETPIPE_SZ, uintptr(sz))
+ }
inst.lkvm = exec.Command("taskset", "-c", strconv.Itoa(inst.cfg.Index%runtime.NumCPU()),
inst.cfg.Bin, "sandbox",
@@ -108,7 +112,7 @@ func ctor(cfg *vm.Config) (vm.Instance, error) {
}
}
inst.mu.Unlock()
- time.Sleep(time.Second)
+ time.Sleep(time.Millisecond)
}
if err != nil {
rpipe.Close()
diff --git a/vm/qemu/qemu.go b/vm/qemu/qemu.go
index a02a762dc..8a9399b89 100644
--- a/vm/qemu/qemu.go
+++ b/vm/qemu/qemu.go
@@ -13,6 +13,7 @@ import (
"strconv"
"strings"
"sync"
+ "syscall"
"time"
"github.com/google/syzkaller/fileutil"
@@ -76,6 +77,9 @@ func ctorImpl(cfg *vm.Config) (vm.Instance, error) {
if err != nil {
return nil, fmt.Errorf("failed to create pipe: %v", err)
}
+ for sz := 128 << 10; sz <= 2<<20; sz *= 2 {
+ syscall.Syscall(syscall.SYS_FCNTL, inst.wpipe.Fd(), syscall.F_SETPIPE_SZ, uintptr(sz))
+ }
if err := inst.Boot(); err != nil {
return nil, err
@@ -185,7 +189,7 @@ func (inst *instance) Boot() error {
}
}
inst.mu.Unlock()
- time.Sleep(time.Second)
+ time.Sleep(time.Millisecond)
}
if err != nil {
rpipe.Close()