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: <8594c611-4eac-45b1-9ab1-bd54c9642bf1@arm.com>
Date: Tue, 22 Oct 2024 22:48:22 +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 07/11] thermal: core: Introduce
 thermal_instance_delete()



On 10/10/24 23:15, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> 
> It is not necessary to walk the thermal_instances list in a trip
> descriptor under a cooling device lock, so acquire that lock only
> for deleting the given thermal instance from the list of thermal
> instances in the given cdev.
> 
> Moreover, in analogy with the previous change that introduced
> thermal_instance_add(), put the code deleting the given thermal
> instance from the lists it is on into a separate new function
> called thermal_instance_delete().

make sense

> 
> 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/2224279.Mh6RI2rZIc@rjwysocki.net/
> 
> ---
>   drivers/thermal/thermal_core.c |   17 ++++++++++++-----
>   1 file changed, 12 insertions(+), 5 deletions(-)
> 
> Index: linux-pm/drivers/thermal/thermal_core.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_core.c
> +++ linux-pm/drivers/thermal/thermal_core.c
> @@ -866,6 +866,17 @@ free_mem:
>   	return result;
>   }
>   
> +static void thermal_instance_delete(struct thermal_instance *instance)
> +{
> +	list_del(&instance->trip_node);
> +
> +	mutex_lock(&instance->cdev->lock);
> +
> +	list_del(&instance->cdev_node);
> +
> +	mutex_unlock(&instance->cdev->lock);
> +}
> +
>   /**
>    * thermal_unbind_cdev_from_trip - unbind a cooling device from a thermal zone.
>    * @tz:		pointer to a struct thermal_zone_device.
> @@ -882,16 +893,12 @@ static void thermal_unbind_cdev_from_tri
>   {
>   	struct thermal_instance *pos, *next;
>   
> -	mutex_lock(&cdev->lock);
>   	list_for_each_entry_safe(pos, next, &td->thermal_instances, trip_node) {
>   		if (pos->cdev == cdev) {
> -			list_del(&pos->trip_node);
> -			list_del(&pos->cdev_node);
> -			mutex_unlock(&cdev->lock);
> +			thermal_instance_delete(pos);
>   			goto unbind;
>   		}
>   	}
> -	mutex_unlock(&cdev->lock);
>   
>   	return;
>   
> 
> 
> 


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ