From 137fdde817df60cccfeb9a40237533e48bc143ec Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 1 Jul 2024 14:26:06 +0200 Subject: executor: restart procs more deterministically Currently we force restart in rpcserver, but this has 2 problems: 1. It does not know the proc where the requets will land. 2. It does not take into account if the proc has already restarted recently for other reasons. Restart procs in executor only if they haven't restarted recenlty. Also make it deterministic. Given all other randomess we have, there does not seem to be a reason to use randomized restarts and restart after fewer/more runs. Also restart only after corpus triage. Corpus triage is slow already and there does not seem to be enough benefit to restart during corpus triage. Also restart at most 1 proc at a time, since there are lots of serial work in the kernel. --- pkg/rpcserver/rpcserver.go | 3 --- pkg/rpcserver/runner.go | 8 -------- 2 files changed, 11 deletions(-) (limited to 'pkg/rpcserver') diff --git a/pkg/rpcserver/rpcserver.go b/pkg/rpcserver/rpcserver.go index da3a0f076..dd11fe0f8 100644 --- a/pkg/rpcserver/rpcserver.go +++ b/pkg/rpcserver/rpcserver.go @@ -8,13 +8,11 @@ import ( "context" "errors" "fmt" - "math/rand" "slices" "sort" "strings" "sync" "sync/atomic" - "time" "github.com/google/syzkaller/pkg/cover" "github.com/google/syzkaller/pkg/cover/backend" @@ -404,7 +402,6 @@ func (serv *Server) CreateInstance(name string, injectExec chan<- bool, updInfo requests: make(map[int64]*queue.Request), executing: make(map[int64]bool), lastExec: MakeLastExecuting(serv.cfg.Procs, 6), - rnd: rand.New(rand.NewSource(time.Now().UnixNano())), stats: serv.runnerStats, procs: serv.cfg.Procs, updInfo: updInfo, diff --git a/pkg/rpcserver/runner.go b/pkg/rpcserver/runner.go index f14a2ec29..6100c94f7 100644 --- a/pkg/rpcserver/runner.go +++ b/pkg/rpcserver/runner.go @@ -7,7 +7,6 @@ import ( "bytes" "errors" "fmt" - "math/rand" "os" "slices" "sync" @@ -43,7 +42,6 @@ type Runner struct { requests map[int64]*queue.Request executing map[int64]bool lastExec *LastExecuting - rnd *rand.Rand updInfo dispatcher.UpdateInfo resultCh chan error @@ -287,13 +285,7 @@ func (runner *Runner) sendRequest(req *queue.Request) error { for i, call := range req.ReturnAllSignal { allSignal[i] = int32(call) } - // Do not let too much state accumulate. - const restartIn = 600 - resetFlags := flatrpc.ExecFlagCollectSignal | flatrpc.ExecFlagCollectCover | flatrpc.ExecFlagCollectComps opts := req.ExecOpts - if req.ExecOpts.ExecFlags&resetFlags != 0 && runner.rnd.Intn(restartIn) == 0 { - opts.EnvFlags |= flatrpc.ExecEnvResetState - } if runner.debug { opts.EnvFlags |= flatrpc.ExecEnvDebug } -- cgit mrf-deployment