Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp848625lqt; Fri, 19 Apr 2024 12:11:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUIEvAWuEpEn2NID3KpLDizR4gX4OzE1Zo3EfAZpgq1gCL/BDemM8f92MRRFXlOj3ZslJTc9548I1NT4Xnaz/pBjP/k7IV/Pn4iXD45Zg== X-Google-Smtp-Source: AGHT+IFtZC4U0u8E3cif9Fq/arqJgIh2CWNRTv5GrJVVBsiuJvYfgwoY5sQHv4zE5qWC3QOpaZ+Z X-Received: by 2002:a17:906:903:b0:a51:ee80:bae9 with SMTP id i3-20020a170906090300b00a51ee80bae9mr5736960ejd.17.1713553918177; Fri, 19 Apr 2024 12:11:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713553918; cv=pass; d=google.com; s=arc-20160816; b=e4TPV38JdvGF3Geh0gSby8AR0dwoYkP8rBi69X0BgUagZgZ/Nrt7H7rGzS9lVHGO7s oMwuqQMJl0PQqF40E+VXI0DIIVwCr++vBhr0f8Tj9jiQjwZ95flspksNhjxYsKdJRlXk cQbm4H5FAIpGSb0Vt0jyPx3pxsETi+6MmI1qSK3t+ePpRirAXP0J+VKjgZksbTW036Mm 1gcIlfL/b0UsiyXHkBBscfOyf+lTZLkglayniI1vwhfs+zm37VcBfXMXXLFtkccNU314 YXyOvRm45H+1rcmZ4sUdjtYThXhseZcz+ciPF1DlMkg+5s7Q/xhNhku7o2RUlsOnUIm/ QBIw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=NdOZXJi6uIzoaDrRlH4yjbsbJ5Kf1XaFupEXdEqd4VU=; fh=NWbihT0n2LVGI0eIabKMMzs0D4KhesRC0I1HJGdvI0I=; b=FST53cz1pKqf6kJerPSdIZKuiaGsDJn0xxZtDokIaK/c1GE6RYuC7kWkpX3UFaIkK2 cOwoKNOFlqP2kChPlaeE1gZd/140wBexBvu6a/zHE8sihUf/VEUUuXammTU5kUzXqs9M SmP2V7usMO+jidzT/jT9Z8Nty+W+c4RUXYLabEuRAxsl4X/GWJDwipBQsC1iAtWtHy/m EbxYan/OrxQ4qr/7qNO7kaVGWB0SxpeN0b/szxHaU129R5ZAXuEtfAfg/UacPQ7P7BXT G26NA/mTFs6R4JUnDMC8CbW9c2AxZ2KopnDEXgbIsoJNI5AtgucJa7PMXYRbuDu3Ngrd ds4g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-151894-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151894-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id z91-20020a509e64000000b00570242da2c2si2455433ede.535.2024.04.19.12.11.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 12:11:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151894-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-151894-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151894-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B3FFD1F2223C for ; Fri, 19 Apr 2024 19:11:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C37C313C80A; Fri, 19 Apr 2024 19:11:48 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C3AA13B284; Fri, 19 Apr 2024 19:11:45 +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=1713553908; cv=none; b=FghEoVn6mOs7wOAkA5uHwKV3XnaFykbwApJs61WJSArVtqEOfCnPABOpgUbzAoXMzgdbEJ+f5UCnx+eCNnPOqoV++ZuUfO5fovyZbArhqurLMuvgiCQnByrXE8pp+cH+R1NO1jDSRo91U1DvaXYT0Lt6FaEyJsLRbZCTvQNdUC8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713553908; c=relaxed/simple; bh=kqMCpndmWFZjXsjIShMKBOUoUhJZZSYr8ABoLqLSEH8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TK/RV4nrtpZAWITITJUGIEytbqcDlyNPMsLnrvrYEKb99v+VH9GqOi+Jn2PFMoyT6kQi2WYiBm8iZs6SfC1VIyzcwg3vnPsp8o6r1XL8n5efTbBmmIE34Cdp8AjWpVYcUXypFNKEAxxSnrZiOw3X9uZeMqmIOCQ2WOlYs27DdaQ= 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 0A0F62F; Fri, 19 Apr 2024 12:12:14 -0700 (PDT) Received: from [10.57.77.69] (unknown [10.57.77.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BC5893F64C; Fri, 19 Apr 2024 12:11:44 -0700 (PDT) Message-ID: <111aa494-124c-4236-a5f2-29cb1cb0fb56@arm.com> Date: Fri, 19 Apr 2024 20:11:51 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 09/16] thermal: gov_step_wise: Use trip thresholds instead of trip temperatures To: "Rafael J. Wysocki" Cc: LKML , Linux PM , Daniel Lezcano , Srinivas Pandruvada References: <13515747.uLZWGnKmhe@kreacher> <3769085.MHq7AAxBmi@kreacher> Content-Language: en-US From: Lukasz Luba In-Reply-To: <3769085.MHq7AAxBmi@kreacher> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/10/24 17:43, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > In principle, the Step-Wise governor should take trip hystereses into s/hystereses/hysteresis/ > account. After all, once a trip has been crossed on the way up, > mitigation is still needed until it is crossed on the way down. > > For this reason, make it use trip thresholds that are computed by > the core when trips are crossed, so as to apply mitigations in the > hysteresis rages of trips that were crossed on the way up, but have > not been crossed on the way down yet. > > Signed-off-by: Rafael J. Wysocki > --- > drivers/thermal/gov_step_wise.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > Index: linux-pm/drivers/thermal/gov_step_wise.c > =================================================================== > --- linux-pm.orig/drivers/thermal/gov_step_wise.c > +++ linux-pm/drivers/thermal/gov_step_wise.c > @@ -62,7 +62,8 @@ static unsigned long get_target_state(st > } > > static void thermal_zone_trip_update(struct thermal_zone_device *tz, > - const struct thermal_trip *trip) > + const struct thermal_trip *trip, > + int trip_threshold) > { > int trip_id = thermal_zone_trip_id(tz, trip); > enum thermal_trend trend; > @@ -72,13 +73,13 @@ static void thermal_zone_trip_update(str > > trend = get_tz_trend(tz, trip); > > - if (tz->temperature >= trip->temperature) { > + if (tz->temperature >= trip_threshold) { So this value in 'trip_threshold' might be lower than older 'trip->temperature', but not necessarily. Anyway, all good here. > throttle = true; > trace_thermal_zone_trip(tz, trip_id, trip->type); > } > > dev_dbg(&tz->device, "Trip%d[type=%d,temp=%d]:trend=%d,throttle=%d\n", > - trip_id, trip->type, trip->temperature, trend, throttle); > + trip_id, trip->type, trip_threshold, trend, throttle); > > list_for_each_entry(instance, &tz->thermal_instances, tz_node) { > if (instance->trip != trip) > @@ -131,7 +132,7 @@ static void step_wise_manage(struct ther > trip->type == THERMAL_TRIP_HOT) > continue; > > - thermal_zone_trip_update(tz, trip); > + thermal_zone_trip_update(tz, trip, td->threshold); > } > > list_for_each_entry(instance, &tz->thermal_instances, tz_node) > > > LGTM w/ spelling fixed. Reviewed-by: Lukasz Luba