Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp851682lqt; Fri, 19 Apr 2024 12:18:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX33gTCqd+L4gUY24tIIHJITQUiQWqG+BcFOaty6ZV0RHuprkD3Cq94h8QpductoX0jbgh7LFfDlD+s67+NpwroVzocd76ZLLaso0q8yg== X-Google-Smtp-Source: AGHT+IEXgBaJcQgJN9c8RoIZnTeldujLVp7xnFBZTv6Alr4xuqy5fjngJFTaBFobSbAf65t7mZ6X X-Received: by 2002:a05:6808:1388:b0:3c7:5091:54e5 with SMTP id c8-20020a056808138800b003c7509154e5mr190280oiw.21.1713554293486; Fri, 19 Apr 2024 12:18:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713554293; cv=pass; d=google.com; s=arc-20160816; b=qj+9x/t2XGpIJPx+pnslBx8c8r7AtKyCBbYdVq9i8TIWlOp3tPFd+oRmk68786tBUl ndMIeKSka6EjMKzoQ/zwGYiW791K5JmHjEUk0ZwBRg6ySA2iwJ2fqb0COWPb/dfveggJ Lxj15T7uv3eP7ojz8H8kzkwIyyJj5R31M6kdPjlIHSAgQK5Z0JRn5nxpG9cEvrsi4qAX 7TL0Xh//jr+47JioT6GjJMSfbM2ZqRYbEJcqFUn/FU/bBc2BoiSbJW1CLJqaBQI44x0Q PFN3Bq+GdEnmnQqlZTk/rZ3MnEFIzsOp90JjN+J5SiF+2FDbj1pJbD1ZGjb+m1LfYjRV d3Og== 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=CqeuERh6V4rr5ntDPNCAzGl4ds7OLPgjLxMtgvSWblc=; fh=NWbihT0n2LVGI0eIabKMMzs0D4KhesRC0I1HJGdvI0I=; b=NtxpD9yQx6b3g40AqanXykDzdA63wkfPRbUTdXS+06fpYyayC4xnzQP6m1fPqjlkfs nmygLnVDt7oIlZDq1FBk8MkgVh3zbXf2lZYvD6BlxV2mIBtvEvNmb8azpsvzw5sEmRIA dXuew41fwAJfGlAwYjObv7v//GVhx75/MheLgFmDtDLQfTJRFeV4NMA+R/mdmN4uzjHr qN9jIgIzEggv743MRLeZ32R+kfQWUV+7Y6aMR5A8rhhsBHytTesvJl4RnZaiKGnFuAXM ZF2fZUb4Y/IT19aTzOYp/eINhp/qWQIbH3f1Zd5iROZZcZeQnqMfC1IaUiYhJw7mrrqC PRkA==; 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-151899-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151899-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id l20-20020a05622a051400b004346159624csi4523106qtx.795.2024.04.19.12.18.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 12:18:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151899-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; 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-151899-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151899-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 1A5BB1C20CDB for ; Fri, 19 Apr 2024 19:18:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E681413C909; Fri, 19 Apr 2024 19:18:05 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 04C1F2206C; Fri, 19 Apr 2024 19:18:03 +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=1713554285; cv=none; b=b6/WLz08R7kytawHwhos7NU0f4wN3FMUR0jQuVP9VXNQcXTfqvJWQb0Na6nbuEtB1FTbC+7x0xfYPClILPGezuSf8Gk16fEeXhNlI2/r2KNGxrH9VX+XwSPcREwMVoI7EoNR82ptRx8ialNXDEzcKHeWvmuSTXjx0desUjPYo5M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713554285; c=relaxed/simple; bh=xzQxhSH9/OrDnmdKGmSgHSgHQK2PE1bqC+dUsRCr7Nw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=P6dVNB++eqB3mOOkx1oyjRLhSNeom2Ywp+jIWUOvWFfKR3wdpxVKV7dOh3zn+tUGkC2ktEN+JUmwTItR121M7lDrBKgIYezwPxjjoyrx3KamuHAG9HGcawNMonPebSVWo9hT+//f+rNCooSMJEkl5At8CzbT3xBv5Ks8tAsAe2M= 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 A08D22F; Fri, 19 Apr 2024 12:18:30 -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 62D893F64C; Fri, 19 Apr 2024 12:18:01 -0700 (PDT) Message-ID: Date: Fri, 19 Apr 2024 20:18:08 +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 12/16] thermal: gov_fair_share: Use trip thresholds instead of trip temperatures To: "Rafael J. Wysocki" Cc: LKML , Linux PM , Daniel Lezcano , Srinivas Pandruvada References: <13515747.uLZWGnKmhe@kreacher> <5484095.Sb9uPGUboI@kreacher> Content-Language: en-US From: Lukasz Luba In-Reply-To: <5484095.Sb9uPGUboI@kreacher> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/10/24 17:58, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > In principle, the Fair Share governor should take trip hystereses s/hystereses/hysteresis/ > into 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 if the > zone temperature is in a hysteresis rage of one or more 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_fair_share.c | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) > > Index: linux-pm/drivers/thermal/gov_fair_share.c > =================================================================== > --- linux-pm.orig/drivers/thermal/gov_fair_share.c > +++ linux-pm/drivers/thermal/gov_fair_share.c > @@ -17,28 +17,26 @@ > > static int get_trip_level(struct thermal_zone_device *tz) > { > - const struct thermal_trip *level_trip = NULL; > + const struct thermal_trip_desc *level_td = NULL; > const struct thermal_trip_desc *td; > int trip_level = -1; > > for_each_trip_desc(tz, td) { > - const struct thermal_trip *trip = &td->trip; > - > - if (trip->temperature >= tz->temperature) > + if (td->threshold > tz->temperature) > continue; > > trip_level++; > > - if (!level_trip || trip->temperature > level_trip->temperature) > - level_trip = trip; > + if (!level_td || td->threshold > level_td->threshold) > + level_td = td; > } > > /* Bail out if the temperature is not greater than any trips. */ > if (trip_level < 0) > return 0; > > - trace_thermal_zone_trip(tz, thermal_zone_trip_id(tz, level_trip), > - level_trip->type); > + trace_thermal_zone_trip(tz, thermal_zone_trip_id(tz, &level_td->trip), > + level_td->trip.type); > > return trip_level; > } > > > LGTM w/ spelling fixed. Reviewed-by: Lukasz Luba