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: <CAJZ5v0h=1yXYzS0LH6dVT1YCMqJ_rYeBJXCmkRsgZEyDK8QCpA@mail.gmail.com>
Date: Wed, 20 Dec 2023 15:57:06 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Lukasz Luba <lukasz.luba@....com>
Cc: linux-kernel@...r.kernel.org, daniel.lezcano@...aro.org, rafael@...nel.org, 
	linux-pm@...r.kernel.org, rui.zhang@...el.com
Subject: Re: [PATCH v2 7/8] thermal/sysfs: Update governors when the 'weight'
 has changed

On Tue, Dec 12, 2023 at 2:48 PM Lukasz Luba <lukasz.luba@....com> wrote:
>
> Support governors update when the thermal instance's weight has changed.
> This allows to adjust internal state for the governor.
>
> Signed-off-by: Lukasz Luba <lukasz.luba@....com>
> ---
>  drivers/thermal/thermal_sysfs.c | 9 +++++++++
>  include/linux/thermal.h         | 1 +
>  2 files changed, 10 insertions(+)
>
> diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
> index df85df7d4a88..9afa2e2b76b9 100644
> --- a/drivers/thermal/thermal_sysfs.c
> +++ b/drivers/thermal/thermal_sysfs.c
> @@ -957,6 +957,14 @@ weight_show(struct device *dev, struct device_attribute *attr, char *buf)
>         return sprintf(buf, "%d\n", instance->weight);
>  }
>
> +static void handle_weight_update(struct thermal_zone_device *tz)
> +{
> +       if (!tz->governor || !tz->governor->update_tz)
> +               return;
> +
> +       tz->governor->update_tz(tz, THERMAL_INSTANCE_WEIGHT_UPDATE);
> +}

So if you follow my advice from the comment on the first patch, you'll
be able to use the helper as is without introducing a new one.

> +
>  ssize_t weight_store(struct device *dev, struct device_attribute *attr,
>                      const char *buf, size_t count)
>  {
> @@ -974,6 +982,7 @@ ssize_t weight_store(struct device *dev, struct device_attribute *attr,
>         /* Don't race with governors using the 'weight' value */
>         mutex_lock(&tz->lock);
>         instance->weight = weight;
> +       handle_weight_update(tz);

So this will become

thermal_governor_update_tz(tz, THERMAL_INSTANCE_WEIGHT_UPDATE);

>         mutex_unlock(&tz->lock);
>
>         return count;
> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> index 9fd0d3fb234a..24176f075fbf 100644
> --- a/include/linux/thermal.h
> +++ b/include/linux/thermal.h
> @@ -52,6 +52,7 @@ enum thermal_notify_event {
>         THERMAL_TABLE_CHANGED, /* Thermal table(s) changed */
>         THERMAL_EVENT_KEEP_ALIVE, /* Request for user space handler to respond */
>         THERMAL_INSTANCE_LIST_UPDATE, /* List of thermal instances changed */
> +       THERMAL_INSTANCE_WEIGHT_UPDATE, /* Thermal instance weight changed */

And I'd slightly prefer THERMAL_INSTANCE_WEIGHT_CHANGE.

>  };
>
>  /**
> --

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ