Platform Profile Selection (e.g. /sys/firmware/acpi/platform_profile)

On modern systems the platform performance, temperature, fan and otherhardware related characteristics are often dynamically configurable. Theplatform configuration is often automatically adjusted to the currentconditions by some automatic mechanism (which may very well live outsidethe kernel).

These auto platform adjustment mechanisms often can be configured withone of several platform profiles, with either a bias towards low poweroperation or towards performance.

The purpose of the platform_profile attribute is to offer a generic sysfsAPI for selecting the platform profile of these automatic mechanisms.

Note that this API is only for selecting the platform profile, it isNOT a goal of this API to allow monitoring the resulting performancecharacteristics. Monitoring performance is best done with device/vendorspecific tools, e.g. turbostat.

Specifically, when selecting a high performance profile the actual achievedperformance may be limited by various factors such as: the heat generatedby other components, room temperature, free air flow at the bottom of alaptop, etc. It is explicitly NOT a goal of this API to let userspace knowabout any sub-optimal conditions which are impeding reaching the requestedperformance level.

Since numbers on their own cannot represent the multiple variables that aprofile will adjust (power consumption, heat generation, etc) this APIuses strings to describe the various profiles. To make sure that userspacegets a consistent experience the sysfs-platform_profile ABI document definesa fixed set of profile names. Driversmust map their internal profilerepresentation onto this fixed set.

If there is no good match when mapping then a new profile name may beadded. Drivers which wish to introduce new profile names must:

  1. Explain why the existing profile names cannot be used.

  2. Add the new profile name, along with a clear description of theexpected behaviour, to the sysfs-platform_profile ABI documentation.

“Custom” profile support

The platform_profile class also supports profiles advertising a “custom”profile. This is intended to be set by drivers when the settings in thedriver have been modified in a way that a standard profile doesn’t representthe current state.

Multiple driver support

When multiple drivers on a system advertise a platform profile handler, theplatform profile handler core will only advertise the profiles that arecommon between all drivers to the/sys/firmware/acpi interfaces.

This is to ensure there is no ambiguity on what the profile names mean whenall handlers don’t support a profile.

Individual drivers will register a ‘platform_profile’ class device that hassimilar semantics as the/sys/firmware/acpi/platform_profile interface.

To discover which driver is associated with a platform profile handler theuser can read thename attribute of the class device.

To discover available profiles from the class interface the user can read thechoices attribute.

If a user wants to select a profile for a specific driver, they can do soby writing to theprofile attribute of the driver’s class device.

This will allow users to set different profiles for different drivers on thesame system. If the selected profile by individual drivers differs theplatform profile handler core will display the profile ‘custom’ to indicatethat the profiles are not the same.

While theplatform_profile attribute has the valuecustom, writing acommon profile fromplatform_profile_choices to the platform_profileattribute of the platform profile handler core will set the profile for alldrivers.