env/openbsd-amd64: enable SMT on OpenBSD 6.4

Disable Spectre/Meltdown mitigations and enable simultaneous
multithreading (SMT) on the OpenBSD 6.4 builder image.

This was done by setting hw.smt=1 in /etc/sysctl.conf when building
the image.

I considered an alternative approach of doing this at runtime via
a cmd/buildlet special case for OpenBSD. It would've likely been
faster to implement if I had the idea at the beginning. However,
by the time I saw it, I had already started to build a new OpenBSD 6.4
image with the /etc/sysctl.conf file, then tested it via debugnewvm.

At this point, there's no longer a time saving advantage, so I decided
to prefer the v2 image because it keeps OpenBSD-specific configuration
more contained in env/openbsd-* directory, rather than spreading it out
between there and the cmd/buildlet runtime code. It seems to be a
slightly better option.

The times to do a full build, as measured via cmd/debugnewvm, were:

	6.2               = 19m25.218s
	6.4               = 28m49.565s
	6.4 with hw.smt=1 = 22m55.909s

That should translate to faster trybot runs, which is important
for open source project health.

The 386 environment doesn't need to be updated because it doesn't
support hw.smt:

	sysctl: hw.smt: value is not available

Attempting to set it anyway should be harmless and okay to do,
in case it happens to get supported in the future.

We're only using amd64 environment for trybots, so it's okay
for the purposes of golang/go#28403.

Reference: https://man.openbsd.org/sysctl.2#HW_SMT_2

Fixes golang/go#28403

Change-Id: I7bc4cbf83ccbdb3aa9dd19eeabd88feb1c425811
Reviewed-on: https://go-review.googlesource.com/c/145022
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/dashboard/builders.go b/dashboard/builders.go
index 1816f36..903df08 100644
--- a/dashboard/builders.go
+++ b/dashboard/builders.go
@@ -147,11 +147,11 @@
 		SSHUsername:        "gopher",
 	},
 	"host-openbsd-amd64-64": &HostConfig{
-		VMImage:            "openbsd-amd64-64",
+		VMImage:            "openbsd-amd64-64-v2",
 		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",
-		Notes:              "OpenBSD 6.4; GCE VM is built from script in build/env/openbsd-amd64",
+		Notes:              "OpenBSD 6.4 with hw.smt=1; GCE VM is built from script in build/env/openbsd-amd64",
 		SSHUsername:        "gopher",
 	},
 	"host-openbsd-386-64": &HostConfig{
diff --git a/env/openbsd-amd64/make.bash b/env/openbsd-amd64/make.bash
index 86a3caf..c65ab5b 100755
--- a/env/openbsd-amd64/make.bash
+++ b/env/openbsd-amd64/make.bash
@@ -37,7 +37,7 @@
 	rm -f boot.conf
 	rm -f disk.raw
 	rm -f disklabel.template
-	rm -f etc/{installurl,rc.local}
+	rm -f etc/{installurl,rc.local,sysctl.conf}
 	rm -f install.site
 	rm -f random.seed
 	rm -f site${RELNO}.tgz
@@ -91,8 +91,11 @@
   )&
 )
 EOF
+cat >etc/sysctl.conf <<EOF
+hw.smt=1
+EOF
 chmod +x install.site
-tar -zcvf site${RELNO}.tgz install.site etc/{installurl,rc.local}
+tar -zcvf site${RELNO}.tgz install.site etc/{installurl,rc.local,sysctl.conf}
 
 # Autoinstall script.
 cat >auto_install.conf <<EOF