From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4CCEA82D90; Thu, 4 Apr 2024 22:14:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712268889; cv=none; b=bhrl8k4JY/q3dlODo2igab/LtjNISWPLLauVTybgqJwPC4sPMZyFvku+gyqNxWDyzPPGjV5bpF7Y+JE5iTRzGeDxAKmU0QouBSg77YCXH2kvIGLqYA20lui5hmff52ehez/Uxi+9bxE1gyuTkKfJnSdCwDHM4GjXWuoGxdndS3M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712268889; c=relaxed/simple; bh=sqwEMUA1os7FpliAUQKZwHxa5Em6p+iIL1ahkh4NK78=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TuSCiDSpL/5hMRdVAUlZ55cH0SAt4QQojcmcvp3IbZHtT5hoj1WmBQw/u8gkzgpjGW0SaCVB2GNJzZEFXudUEnY1U+6xw6rQUG8zV7RKQx+cCb5CliKYaXiqkI0tpHqbTU2kV62X6P6QEIWMlxs8bcIgpzW3qPsndn4Uiuq4HSs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 360F8FEC; Thu, 4 Apr 2024 15:15:17 -0700 (PDT) Received: from [10.57.73.43] (unknown [10.57.73.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6F6BE3F64C; Thu, 4 Apr 2024 15:14:45 -0700 (PDT) Message-ID: <20cf2a27-9a54-4bbb-bf5f-6a0b82a2a05f@arm.com> Date: Thu, 4 Apr 2024 23:14:48 +0100 Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 3/6] thermal: core: Rewrite comments in handle_thermal_trip() Content-Language: en-US To: "Rafael J. Wysocki" Cc: LKML , Linux PM , Srinivas Pandruvada , Daniel Lezcano , AngeloGioacchino Del Regno References: <4558251.LvFx2qVVIh@kreacher> <3284691.aeNJFYEL58@kreacher> From: Lukasz Luba In-Reply-To: <3284691.aeNJFYEL58@kreacher> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/2/24 19:59, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Make the comments regarding trip crossing and threshold updates in > handle_thermal_trip() slightly more clear. > > No functional impact. > > Signed-off-by: Rafael J. Wysocki > --- > > v2 -> v3: New patch > > --- > drivers/thermal/thermal_core.c | 26 +++++++++++++------------- > 1 file changed, 13 insertions(+), 13 deletions(-) > > Index: linux-pm/drivers/thermal/thermal_core.c > =================================================================== > --- linux-pm.orig/drivers/thermal/thermal_core.c > +++ linux-pm/drivers/thermal/thermal_core.c > @@ -368,6 +368,13 @@ static void handle_thermal_trip(struct t > if (trip->temperature == THERMAL_TEMP_INVALID) > return; > > + /* > + * If the trip temperature or hysteresis has been updated recently, > + * the threshold needs to be computed again using the new values. > + * However, its initial value still reflects the old ones and that > + * is what needs to be compared with the previous zone temperature > + * to decide which action to take. > + */ > if (tz->last_temperature == THERMAL_TEMP_INVALID) { > /* Initialization. */ > td->threshold = trip->temperature; > @@ -375,11 +382,9 @@ static void handle_thermal_trip(struct t > td->threshold -= trip->hysteresis; > } else if (tz->last_temperature < td->threshold) { > /* > - * The trip threshold is equal to the trip temperature, unless > - * the latter has changed in the meantime. In either case, > - * the trip is crossed if the current zone temperature is at > - * least equal to its temperature, but otherwise ensure that > - * the threshold and the trip temperature will be equal. > + * There is no mitigation under way, so it needs to be started > + * if the zone temperature exceeds the trip one. The new > + * threshold is then set to the low temperature of the trip. > */ > if (tz->temperature >= trip->temperature) { > thermal_notify_tz_trip_up(tz, trip); > @@ -390,14 +395,9 @@ static void handle_thermal_trip(struct t > } > } else { > /* > - * The previous zone temperature was above or equal to the trip > - * threshold, which would be equal to the "low temperature" of > - * the trip (its temperature minus its hysteresis), unless the > - * trip temperature or hysteresis had changed. In either case, > - * the trip is crossed if the current zone temperature is below > - * the low temperature of the trip, but otherwise ensure that > - * the trip threshold will be equal to the low temperature of > - * the trip. > + * Mitigation is under way, so it needs to stop if the zone > + * temperature falls below the low temperature of the trip. > + * In that case, the trip temperature becomes the new threshold. > */ > if (tz->temperature < trip->temperature - trip->hysteresis) { > thermal_notify_tz_trip_down(tz, trip); > > > Reviewed-by: Lukasz Luba