@@ -15,5 +15,6 @@ SRC_URI += "\
file://0008-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch \
file://0009-go-Filter-build-paths-on-staticly-linked-arches.patch \
file://0010-cmd-go-clear-GOROOT-for-func-ldShared-when-trimpath-.patch \
+ file://0011-internal-cgrouptest-skip-when-cpu.max-is-not-availab.patch \
"
SRC_URI[main.sha256sum] = "4e408abae126d916b6164627193f2c54f0e3ca1312d693b86db45f862ab238b1"
new file mode 100644
@@ -0,0 +1,39 @@
+From 3335a08288a68ebce5f3e99745186ded36c564c9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <khem.raj@oss.qualcomm.com>
+Date: Thu, 24 Sep 2026 10:22:23 -0700
+Subject: [PATCH] internal/cgrouptest: skip when cpu.max is not available
+
+The cpu.max interface file is only present in cgroup v2 when the kernel
+is built with CONFIG_CFS_BANDWIDTH, even if the cpu controller is enabled
+in the parent's cgroup.subtree_control. Without it, SetCPUMax tries to
+create the file, which cgroupfs rejects with EACCES, and TestInCgroupV2
+fails with:
+
+ Erroring setting cpu.max: open /sys/fs/cgroup/go-cgrouptestNNN/cpu.max: permission denied
+
+Skip, like the other best-effort checks in InCgroupV2, when the new
+cgroup does not have cpu.max.
+
+Upstream-Status: Submitted [https://github.com/golang/go/pull/81745]
+Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
+---
+ src/internal/cgrouptest/cgrouptest_linux.go | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/internal/cgrouptest/cgrouptest_linux.go b/src/internal/cgrouptest/cgrouptest_linux.go
+index ad9599c..a4b9b52 100644
+--- a/src/internal/cgrouptest/cgrouptest_linux.go
++++ b/src/internal/cgrouptest/cgrouptest_linux.go
+@@ -82,6 +82,12 @@ func InCgroupV2(t *testing.T, fn func(*CgroupV2)) {
+ }
+ }()
+
++ // cpu.max only exists when the kernel supports CPU bandwidth control
++ // (CONFIG_CFS_BANDWIDTH), even if the cpu controller is enabled.
++ if _, err := os.Stat(filepath.Join(path, "cpu.max")); err != nil {
++ t.Skipf("cgroup %s does not support cpu.max: %v", path, err)
++ }
++
+ migrateTo(t, path)
+ defer migrateTo(t, orig)
+
The internal/cgrouptest ptest fails on qemux86-64: Erroring setting cpu.max: open /sys/fs/cgroup/go-cgrouptestNNN/cpu.max: permission denied cpu.max is only present in cgroup v2 when the kernel is built with CONFIG_CFS_BANDWIDTH, which the linux-yocto qemu configuration does not enable, even though the cpu controller is available. Writing the missing file makes cgroupfs return EACCES. Add a patch so that InCgroupV2 skips the test when the new cgroup has no cpu.max, consistent with its other best-effort checks. Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com> --- meta/recipes-devtools/go/go-1.27.1.inc | 1 + ...est-skip-when-cpu.max-is-not-availab.patch | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 meta/recipes-devtools/go/go/0011-internal-cgrouptest-skip-when-cpu.max-is-not-availab.patch