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: <a67fe4fe-d4a8-4659-802f-8c7da4aa555b@arm.com>
Date: Tue, 22 Oct 2024 23:32:05 +0100
From: Lukasz Luba <lukasz.luba@....com>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>
Cc: LKML <linux-kernel@...r.kernel.org>, Linux PM <linux-pm@...r.kernel.org>,
 Daniel Lezcano <daniel.lezcano@...aro.org>, Zhang Rui <rui.zhang@...el.com>,
 Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
Subject: Re: [PATCH v2 10/11] thermal: core: Separate thermal zone governor
 initialization



On 10/10/24 23:20, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> 
> In preparation for a subsequent change that will switch over the thermal
> core to using a mutex guard for managing thermal_governor_lock, move
> the code running in thermal_zone_device_register_with_trips() under that
> lock into a separate function called thermal_zone_init_governor().
> 
> While at it, drop a useless comment.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
> 
> This is a resend of
> 
> https://lore.kernel.org/linux-pm/2495577.jE0xQCEvom@rjwysocki.net/
> 
> ---
>   drivers/thermal/thermal_core.c |   36 +++++++++++++++++++++---------------
>   1 file changed, 21 insertions(+), 15 deletions(-)
> 
> Index: linux-pm/drivers/thermal/thermal_core.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_core.c
> +++ linux-pm/drivers/thermal/thermal_core.c
> @@ -1343,6 +1343,25 @@ int thermal_zone_get_crit_temp(struct th
>   }
>   EXPORT_SYMBOL_GPL(thermal_zone_get_crit_temp);
>   
> +static int thermal_zone_init_governor(struct thermal_zone_device *tz)
> +{
> +	struct thermal_governor *governor;
> +	int ret;
> +
> +	mutex_lock(&thermal_governor_lock);
> +
> +	if (tz->tzp)
> +		governor = __find_governor(tz->tzp->governor_name);
> +	else
> +		governor = def_governor;
> +
> +	ret = thermal_set_governor(tz, governor);
> +
> +	mutex_unlock(&thermal_governor_lock);
> +
> +	return ret;
> +}
> +
>   static void thermal_zone_init_complete(struct thermal_zone_device *tz)
>   {
>   	struct thermal_cooling_device *cdev;
> @@ -1407,7 +1426,6 @@ thermal_zone_device_register_with_trips(
>   	struct thermal_trip_desc *td;
>   	int id;
>   	int result;
> -	struct thermal_governor *governor;
>   
>   	if (!type || strlen(type) == 0) {
>   		pr_err("No thermal zone type defined\n");
> @@ -1505,21 +1523,9 @@ thermal_zone_device_register_with_trips(
>   	if (result)
>   		goto release_device;
>   
> -	/* Update 'this' zone's governor information */
> -	mutex_lock(&thermal_governor_lock);
> -
> -	if (tz->tzp)
> -		governor = __find_governor(tz->tzp->governor_name);
> -	else
> -		governor = def_governor;
> -
> -	result = thermal_set_governor(tz, governor);
> -	if (result) {
> -		mutex_unlock(&thermal_governor_lock);
> +	result = thermal_zone_init_governor(tz);
> +	if (result)
>   		goto unregister;
> -	}
> -
> -	mutex_unlock(&thermal_governor_lock);
>   
>   	if (!tz->tzp || !tz->tzp->no_hwmon) {
>   		result = thermal_add_hwmon_sysfs(tz);
> 
> 
> 


Reviewed-by: Lukasz Luba <lukasz.luba@....com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ