aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/instance
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-01-11 15:25:12 +0100
committerAleksandr Nogikh <wp32pw@gmail.com>2023-01-19 11:26:54 +0100
commit7338ad6e0b83c4ba1607090846e0b663861929a1 (patch)
treee8d1c5b1816b7476e9c836d6638e6134e1bac328 /pkg/instance
parent8b4e854864883d790497e7c4cc302f819b6e2bce (diff)
syz-ci: gate concurrent env.Test executions
This will help reduce the number of overcommitted VMs.
Diffstat (limited to 'pkg/instance')
-rw-r--r--pkg/instance/instance.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkg/instance/instance.go b/pkg/instance/instance.go
index 1a504fdd7..31f75e21c 100644
--- a/pkg/instance/instance.go
+++ b/pkg/instance/instance.go
@@ -37,6 +37,7 @@ type env struct {
cfg *mgrconfig.Config
optionalFlags bool
buildSem *Semaphore
+ testSem *Semaphore
}
type BuildKernelConfig struct {
@@ -49,7 +50,7 @@ type BuildKernelConfig struct {
KernelConfig []byte
}
-func NewEnv(cfg *mgrconfig.Config, buildSem *Semaphore) (Env, error) {
+func NewEnv(cfg *mgrconfig.Config, buildSem, testSem *Semaphore) (Env, error) {
if !vm.AllowsOvercommit(cfg.Type) {
return nil, fmt.Errorf("test instances are not supported for %v VMs", cfg.Type)
}
@@ -69,6 +70,7 @@ func NewEnv(cfg *mgrconfig.Config, buildSem *Semaphore) (Env, error) {
cfg: cfg,
optionalFlags: true,
buildSem: buildSem,
+ testSem: testSem,
}
return env, nil
}
@@ -235,6 +237,10 @@ func (err *CrashError) Error() string {
// TestError is returned if there is a problem with kernel/image (crash, reboot loop, etc).
// CrashError is returned if the reproducer crashes kernel.
func (env *env) Test(numVMs int, reproSyz, reproOpts, reproC []byte) ([]EnvTestResult, error) {
+ if env.testSem != nil {
+ env.testSem.Wait()
+ defer env.testSem.Signal()
+ }
if err := mgrconfig.Complete(env.cfg); err != nil {
return nil, err
}