buildlet, dashboard: add min CPU platform knob, require Skylake for OpenBSD

I thought this would be enough for OpenBSD to select the TSC on its own without
being forced to (as in CL 160319), but apparently it is not:

    https://github.com/golang/go/issues/29223#issuecomment-459035482

So it seems like we want both this CL and CL 160319.

Updates golang/go#29223

Change-Id: I0a092d62881d8dcce0ef1129d8d32d8f4025b6ac
Reviewed-on: https://go-review.googlesource.com/c/160457
Reviewed-by: Andrew Bonventre <andybons@golang.org>
diff --git a/buildlet/gce.go b/buildlet/gce.go
index a410bd1..1a1c0a0 100644
--- a/buildlet/gce.go
+++ b/buildlet/gce.go
@@ -151,9 +151,10 @@
 	}
 
 	instance := &compute.Instance{
-		Name:        instName,
-		Description: opts.Description,
-		MachineType: machType,
+		Name:           instName,
+		Description:    opts.Description,
+		MachineType:    machType,
+		MinCpuPlatform: hconf.MinCPUPlatform,
 		Disks: []*compute.AttachedDisk{
 			{
 				AutoDelete: true,
diff --git a/cmd/debugnewvm/debugnewvm.go b/cmd/debugnewvm/debugnewvm.go
index 3b343eb..8075ed2 100644
--- a/cmd/debugnewvm/debugnewvm.go
+++ b/cmd/debugnewvm/debugnewvm.go
@@ -30,6 +30,7 @@
 	overrideImage = flag.String("override-image", "", "if non-empty, an alternate GCE VM image or container image to use, depending on the host type")
 	serial        = flag.Bool("serial", true, "watch serial")
 	pauseAfterUp  = flag.Duration("pause-after-up", 0, "pause for this duration before buildlet is destroyed")
+	sleepSec      = flag.Int("sleep-test-secs", 0, "number of seconds to sleep when buildlet comes up, to test time source; OpenBSD only for now")
 
 	runBuild = flag.String("run-build", "", "optional builder name to run all.bash or make.bash for")
 	makeOnly = flag.Bool("make-only", false, "if a --run-build builder name is given, this controls whether make.bash or all.bash is run")
@@ -60,6 +61,9 @@
 	if *hostType == "" {
 		log.Fatalf("missing --host (or --run-build)")
 	}
+	if *sleepSec != 0 && !strings.Contains(*hostType, "openbsd") {
+		log.Fatalf("The --sleep-test-secs is currently only supported for openbsd hosts.")
+	}
 
 	hconf, ok := dashboard.Hosts[*hostType]
 	if !ok {
@@ -119,6 +123,19 @@
 	dir, err := bc.WorkDir()
 	log.Printf("WorkDir: %v, %v", dir, err)
 
+	if *sleepSec > 0 {
+		bc.Exec("sysctl", buildlet.ExecOpts{
+			Output:      os.Stdout,
+			SystemLevel: true,
+			Args:        []string{"kern.timecounter.hardware"},
+		})
+		bc.Exec("bash", buildlet.ExecOpts{
+			Output:      os.Stdout,
+			SystemLevel: true,
+			Args:        []string{"-c", "rdate -p -v time.nist.gov; sleep " + fmt.Sprint(*sleepSec) + "; rdate -p -v time.nist.gov"},
+		})
+	}
+
 	var buildFailed bool
 	if *runBuild != "" {
 		// Push GOROOT_BOOTSTRAP, if needed.
diff --git a/dashboard/builders.go b/dashboard/builders.go
index 54475ed..17bd58d 100644
--- a/dashboard/builders.go
+++ b/dashboard/builders.go
@@ -149,6 +149,7 @@
 	},
 	"host-openbsd-amd64-64": &HostConfig{
 		VMImage:            "openbsd-amd64-64-190129a",
+		MinCPUPlatform:     "Intel Skylake", // for better TSC? Maybe? see Issue 29223. builds faster at least.
 		machineType:        "n1-highcpu-4",
 		buildletURLTmpl:    "https://storage.googleapis.com/$BUCKET/buildlet.openbsd-amd64-64",
 		goBootstrapURLTmpl: "https://storage.googleapis.com/$BUCKET/gobootstrap-openbsd-amd64-64.tar.gz",
@@ -566,8 +567,9 @@
 	IsReverse      bool   // if true, only use the reverse buildlet pool
 
 	// GCE options, if VMImage != ""
-	machineType string // optional GCE instance type
-	RegularDisk bool   // if true, use spinning disk instead of SSD
+	machineType    string // optional GCE instance type
+	RegularDisk    bool   // if true, use spinning disk instead of SSD
+	MinCPUPlatform string // optional; https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform
 
 	// ReverseOptions:
 	ExpectNum       int  // expected number of reverse buildlets of this type