lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0ht1Z0dDxW1hfDUBoQOWXRBD+XHTph0juRhRCAvy=Z61Q@mail.gmail.com>
Date: Fri, 22 Aug 2025 14:50:50 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
Cc: rafael@...nel.org, daniel.lezcano@...aro.org, lukasz.luba@....com, 
	linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/5] thermal: intel: int340x: Add module parameter for
 balanced Slider

On Wed, Aug 13, 2025 at 8:55 PM Srinivas Pandruvada
<srinivas.pandruvada@...ux.intel.com> wrote:
>
> By default, the SoC slider value for the "balanced" platform profile is
> set to 3. A new module parameter is introduced to allow users to change
> this default value. After modifying the module parameter, users must call
> an update to the "profile" sysfs attribute for the change to take effect.

This last bit is slightly confusing.  What exactly do they need to do
for this purpose?

> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
> ---
>  .../processor_thermal_soc_slider.c            | 41 +++++++++++++++++++
>  1 file changed, 41 insertions(+)
>
> diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c
> index c492ee937dc7..ffc538c9b9e3 100644
> --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c
> +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c
> @@ -50,6 +50,43 @@ static u8 slider_values[] = {
>         [SOC_POWER_SLIDER_POWERSAVE] = SOC_SLIDER_VALUE_MAXIMUM,
>  };
>
> +/* Lock to protect module param updates */
> +static DEFINE_MUTEX(slider_param_lock);
> +
> +static int slider_balanced_param = SOC_SLIDER_VALUE_BALANCE;
> +
> +static int slider_def_balance_set(const char *arg, const struct kernel_param *kp)
> +{
> +       u8 slider_val;
> +       int ret;
> +
> +       guard(mutex)(&slider_param_lock);
> +
> +       ret = kstrtou8(arg, 16, &slider_val);
> +       if (!ret) {
> +               if (slider_val > SOC_SLIDER_VALUE_MAXIMUM)
> +                       return -EINVAL;
> +
> +               slider_balanced_param = slider_val;
> +       }
> +
> +       return ret;
> +}
> +
> +static int slider_def_balance_get(char *buf, const struct kernel_param *kp)
> +{
> +       guard(mutex)(&slider_param_lock);
> +       return sysfs_emit(buf, "%02x\n", slider_values[SOC_POWER_SLIDER_BALANCE]);
> +}
> +
> +static const struct kernel_param_ops slider_def_balance_ops = {
> +       .set = slider_def_balance_set,
> +       .get = slider_def_balance_get,
> +};
> +
> +module_param_cb(slider_balance, &slider_def_balance_ops, NULL, 0644);
> +MODULE_PARM_DESC(slider_balance, "Set slider default value for balance.");
> +
>  /* Convert from platform power profile option to SoC slider value */
>  static int convert_profile_to_power_slider(enum platform_profile_option profile)
>  {
> @@ -106,6 +143,10 @@ static int power_slider_platform_profile_set(struct device *dev,
>         if (!proc_priv)
>                 return -EOPNOTSUPP;
>
> +       guard(mutex)(&slider_param_lock);
> +
> +       slider_values[SOC_POWER_SLIDER_BALANCE] = slider_balanced_param;
> +
>         slider = convert_profile_to_power_slider(profile);
>         if (slider < 0)
>                 return slider;
> --
> 2.43.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ