CONFIG_THERMAL_GOV_BANG_BANG causes undefined error

Hi,
Enabling CONFIG_THERMAL_GOV_BANG_BANG causes the compilation error. This is due to the unavailability of the member variable “throttle” in the structure thermal_governor. The Rocky 9.7 structure is changed by referring the latest kernel. But the relevant code changes are not updated properly. In the next version, team should update the function accordingly. Currently, i have disabled the CONFIG_THERMAL_GOV_BANG_BANG and proceeding.

Reference error logs:

drivers/thermal/gov_bang_bang.c:113:10: error: ‘struct thermal_governor’ has no member named ‘throttle’
113 | .throttle = bang_bang_control,
| ^~~~~~~~
drivers/thermal/gov_bang_bang.c:113:27: error: initialization of ‘int (*)(struct thermal_zone_device )’ from incompatible pointer type ‘int ()(struct thermal_zone_device *, const struct thermal_trip *)’ [-Werror=incompatible-pointer-types]
113 | .throttle = bang_bang_control,
| ^~~~~~~~~~~~~~~~~
drivers/thermal/gov_bang_bang.c:113:27: note: (near initialization for ‘thermal_gov_bang_bang.bind_to_tz’)

Rocky Linux is taking the kernel config from upstream RedHat, so the kernel tends to support only the features that RedHat Enterprise Linux supports, and make no effort to maintain code beyond those features when they do (very heavy) kernel backport work. In this case, RHEL doesn’t set CONFIG_THERMAL_GOV_BANG_BANG, so the kernel code that is conditional on this setting is not expected to build properly.

You may choose to fix this yourself and rebuild a custom kernel from srpm, but you’d be swimming against the current - any large kernel rework with subsequent versions may require you to adapt your patch. We had a similar problem with some kernel functionality we needed not being officially supported by RHEL/Rocky, and ended up with (then) a latest released Fedora kernel, which minimally diverges from the vanilla linux kernel of the same version. But we needed to add missing user-space pieces and had rigorous testing to ensure that the rest of Rocky’s userspace plays along well (which it usually does, because of the Linus’ “no breaking userspace” edict).

You may want to give ELRepo’s kernels a try. Both kernel-ml and kernel-lt have CONFIG_THERMAL_GOV_BANG_BANG enabled.

1 Like