Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp516934lqt; Fri, 19 Apr 2024 02:44:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVzWK7/5gEkBxSrxGrQRUd4QTfnjFE1NDLnemzsssCCF09Ga5fX8s6842TrFC95DFlDmEjfMfDCEY8TaSItdwky+QLG+10d2Am/DxKPHA== X-Google-Smtp-Source: AGHT+IEIhj9ulNryXQxU4Cb8Kq0v0oImvnFuXNRQ97qCdOB5/hGYCpMvmu4MYyjBZ8tJJMNGANP9 X-Received: by 2002:a0c:ec01:0:b0:6a0:43c3:944c with SMTP id y1-20020a0cec01000000b006a043c3944cmr1705596qvo.15.1713519851163; Fri, 19 Apr 2024 02:44:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713519851; cv=pass; d=google.com; s=arc-20160816; b=k8uth3+vsppcgB9+uCrcLiXC2oE3GtuaEluNQ3zyobiFrNanIU7dGMPa0D5E3+LfDV CPA9vow1MBh8t9tlu3O0faj4UFH+3GtNLCtqJpgu8EpyP+sM79OJ2xc5gks57wGq+oAG aVAFJJtBhCh7op7Kw1JLwZBez54my8CiqNXNShc+pHb2gXjKOE0n0+FRux6RsCql8cVd NkMBMC7I+XkQLQ2UOINvrms1rDJlQ1LqObHBAAdsNs/m9reiNirWAdVop3nLA4b6Ruyp 3EOD3AxeaoaGOrTOhdZN9Si/PZLywQyN9NU1Hc4SIWdo7c8ab8Laub6d1hKzzArPEIC3 0KfQ== 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=blCd/miZNmc1BwuAVRJelZWpem2TYl3QmG6Hmu4V35Q=; fh=NWbihT0n2LVGI0eIabKMMzs0D4KhesRC0I1HJGdvI0I=; b=fbaG4YN/0SOnLmxpZTI0Em5D21XDZP7H80JNvvIDySm4SY61w2rlcOcF0Q+IX8gd4V vJw5k8LojyLSQWKRcxFXO7fitViYJEMyiPCF8BYPfse7vC3BnssgVMPstTtkhfGqq+9A CmeBRyz3rdjggyXKKVyxkVuLzLW3gF2AbJctgPkohouFy2TuiaTH4/ooZTwXm77ZKi3t xsSsMWKkO0JymH9by3bhlnKtP8U5JyZE8zJRghiz9CRc9Cj8cYhWB19EVTjdgt5kVX2C jZ5KhMCHnMKhGZklRu6hOtJRQyj7z2GuzHpb28Iikl8j5ze/QvrWvM4NZ9onYVWE2gtY wEoQ==; 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-151244-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151244-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. [147.75.199.223]) by mx.google.com with ESMTPS id u8-20020ad45aa8000000b006a048f27d9asi3621141qvg.506.2024.04.19.02.44.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:44:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151244-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; 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-151244-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151244-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 DE7901C20F02 for ; Fri, 19 Apr 2024 09:44:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B8FA87BB07; Fri, 19 Apr 2024 09:44:04 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E7C63768EA; Fri, 19 Apr 2024 09:44:02 +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=1713519844; cv=none; b=ET0hpzlrAsdSn1T7bPUzxtliVd+S5sE4Pnyp6GC3NJ+LAAV5dAV4E5VLQeXhZYXD1gu+pvaNLn03LIEkyHxPDfysRFXt0zY00pRjQcVBqB7VcHmKl7Omuc2m1vTe2IwUMLJIflVDuR2EMi/ADqrCztP+B1t/sy47WByOGQWCSV0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713519844; c=relaxed/simple; bh=BJFS29e56mow5kaa0ewq08lqx6I1KrgW0SO4p5o7cOU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JCmudpIThtDZDXqE9eVkag3JmKKfJ24cJK3xXpCsAW87l8JBjiyHY808eDWG2UptFAhcYUTIWW1jmogRoVpAhDgnWOSFSit7V7t3550+m+aWzPbjI3vazHvos9daFr8Fj1GBhbCE0vH7ifE/rfWvfMKzkEpneXGDAOn8uAK1M3o= 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 C731E2F; Fri, 19 Apr 2024 02:44: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 97FD83F792; Fri, 19 Apr 2024 02:44:01 -0700 (PDT) Message-ID: Date: Fri, 19 Apr 2024 10:44:09 +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 05/16] thermal: core: Introduce .manage() callback for thermal governors To: "Rafael J. Wysocki" Cc: LKML , Linux PM , Daniel Lezcano , Srinivas Pandruvada References: <13515747.uLZWGnKmhe@kreacher> <3242862.5fSG56mABF@kreacher> Content-Language: en-US From: Lukasz Luba In-Reply-To: <3242862.5fSG56mABF@kreacher> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/10/24 17:08, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Introduce a new thermal governor callback called .manage() that will be > invoked once per thermal zone update after processing all of the trip > points in the core. > > This will allow governors that look at multiple trip points together > to check all of them in a consistent configuration, so they don't need > to play tricks with skipping .throttle() invocations that they are not > interested in and they can avoid carrying out the same computations for > multiple times in one cycle. > > Signed-off-by: Rafael J. Wysocki > --- > drivers/thermal/thermal_core.c | 3 +++ > drivers/thermal/thermal_core.h | 2 ++ > 2 files changed, 5 insertions(+) > > Index: linux-pm/drivers/thermal/thermal_core.c > =================================================================== > --- linux-pm.orig/drivers/thermal/thermal_core.c > +++ linux-pm/drivers/thermal/thermal_core.c > @@ -516,6 +516,9 @@ void __thermal_zone_device_update(struct > governor->trip_crossed(tz, &td->trip, false); > } > > + if (governor->manage) > + governor->manage(tz); > + > monitor_thermal_zone(tz); > } > > Index: linux-pm/drivers/thermal/thermal_core.h > =================================================================== > --- linux-pm.orig/drivers/thermal/thermal_core.h > +++ linux-pm/drivers/thermal/thermal_core.h > @@ -31,6 +31,7 @@ struct thermal_trip_desc { > * @unbind_from_tz: callback called when a governor is unbound from a > * thermal zone. > * @trip_crossed: called for trip points that have just been crossed > + * @manage: called on thermal zone temperature updates > * @throttle: callback called for every trip point even if temperature is > * below the trip point temperature > * @update_tz: callback called when thermal zone internals have changed, e.g. > @@ -44,6 +45,7 @@ struct thermal_governor { > void (*trip_crossed)(struct thermal_zone_device *tz, > const struct thermal_trip *trip, > bool crossed_up); > + void (*manage)(struct thermal_zone_device *tz); > int (*throttle)(struct thermal_zone_device *tz, > const struct thermal_trip *trip); > void (*update_tz)(struct thermal_zone_device *tz, > > > LGTM Reviewed-by: Lukasz Luba