From e8b147c6e77e4568d3e7df74121a28e95ee8440a Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 15 Jun 2023 15:38:51 +0200 Subject: pkg/bisect: try to drop instrumentation Refactor Minimize(). As a part of Minimize(), attempt to drop all unnecessary instrumentation and test whether the kernel is still crashing. This should reduce the number of irrelevant crashes during bisection and thus increase bisection result quality. --- pkg/bisect/bisect.go | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'pkg/bisect/bisect.go') diff --git a/pkg/bisect/bisect.go b/pkg/bisect/bisect.go index 815d6ba72..3d3de92b6 100644 --- a/pkg/bisect/bisect.go +++ b/pkg/bisect/bisect.go @@ -260,14 +260,14 @@ func (env *env) bisect() (*Result, error) { } env.reportTypes = testRes.types - if len(cfg.Kernel.BaselineConfig) != 0 { - testRes1, err := env.minimizeConfig() - if err != nil { - return nil, err - } - if testRes1 != nil { - testRes = testRes1 - } + testRes1, err := env.minimizeConfig() + if err != nil { + return nil, fmt.Errorf("config minimization failed: %w", err) + } + if testRes1 != nil { + // If config minimization even partially succeeds, minimizeConfig() + // would return a non-nil value of a new report. + testRes = testRes1 } bad, good, results1, fatalResult, err := env.commitRange() @@ -372,11 +372,14 @@ func (env *env) minimizeConfig() (*testResult, error) { if err != nil { return 0, err } - testResults[hash.Hash(test)] = testRes + if testRes.verdict == vcs.BisectBad { + // Only remember crashes. + testResults[hash.Hash(test)] = testRes + } return testRes.verdict, err } minConfig, err := env.minimizer.Minimize(env.cfg.Manager.SysTarget, env.cfg.Kernel.Config, - env.cfg.Kernel.BaselineConfig, env.cfg.Trace, predMinimize) + env.cfg.Kernel.BaselineConfig, env.reportTypes, env.cfg.Trace, predMinimize) if err != nil { return nil, err } -- cgit mrf-deployment