Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp3107154lqt; Tue, 23 Apr 2024 10:25:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUmGBi8D9gtTf7EQSP8+5Pxqs08ndUboHbCe/02yfgwX0LBkcrMzY+fX8oGIqwfHHXmh3Qx0SmV9ORjw2ilwCW791EWtSLRI/JJHiwMOw== X-Google-Smtp-Source: AGHT+IFzvhazxYeK4D5gIKe6SvkTpE0YwzmeR5ymGPgxXhkLrtVCKF+OLNliZAHB5nb+5kp+Ccyi X-Received: by 2002:a0c:fdca:0:b0:6a0:7d91:1adf with SMTP id g10-20020a0cfdca000000b006a07d911adfmr28995qvs.35.1713893130664; Tue, 23 Apr 2024 10:25:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713893130; cv=pass; d=google.com; s=arc-20160816; b=w0lCbWfPQdlBC8WuVg43KzVITRlqS7sB8RRdn5QCMr3mww1qvjdT7LsYMjsa8NbNow K7GAMDfws8z4/mZU44hGNWhf26jH4Bu+qMvcMMttRZz3gFerGQsf6PBZxcFxdEX45+0/ 0Xh/COKOx0Ybhh8Zp/fhdla84WZjC6b+4n9us+XerDe2q6M/JWIegzs1cuBte1p17L1x mVFzULG5iasqdpmLbQt6SjBQ9QJrwDG+VFkGeH3658disXCWzr4MWYgcb4RNNA/nfoA7 dwnSb8GD6O9t7vhDJG7P5ja7oSMiWlUP9L4kDvdY0U1CF4Aufy3nnjR6YI0/Mq4yIopt +Xaw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=lb9aCmOkllNLaG7bvtWMafS+sZJlihilmQAh/TlF7XQ=; fh=NVNVhBHAicjzafDVxRdlYA6/2Etzs8sUjd59Hw1UOm8=; b=dJjXxEa17heI8XdSyOzgxNLn7fIyQPyN10WL1YYOyqBKHaMRTJhAIGwyldUXc+EuIo WGmn6mQVhuZ23aO/9qjzIR+CjYT1sfKs5hNP91PNgLHQ8mkN1pQ43+lWw7aiynlmBxO/ c+jeXXlpkT+4IDzeRGTrHuX0c9zYBiVFyA5/fcq4j5g8SpZ/drbLUtNiNMth6J+SE+VW gj46NRvU56ZBvzqmLzZZBbmi8E7IfDJYIjq0p63OMvq9qT30WFRmthsOe7tZ0lJAvF7l 1TCmA7UQTU0qMGmOgrKEGGaeEfFAyNVE8fUaBQ+vh+/Aa7qkt5Mto/WfW4TvxYWev84Y hTfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k22lnWvI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-155672-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155672-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id iu6-20020ad45cc6000000b0069b69c9ade3si13031271qvb.115.2024.04.23.10.25.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 10:25:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155672-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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k22lnWvI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-155672-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155672-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 5F4AD1C23E59 for ; Tue, 23 Apr 2024 17:25:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3E7F13D8BE; Tue, 23 Apr 2024 17:25:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="k22lnWvI" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C38A1BC23; Tue, 23 Apr 2024 17:25:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713893126; cv=none; b=o/h0lIUiurRp/fGSPVm1b++Ms+HZV8UFLWfjYie3ViHifPEncVUm/OK3svFvkFPzK0yQ6T6oXSpd5JTbCkgsWhozpTjBgL0jE0obBrWtmo0ccOT6Ml6cN2NSyZe5oaOVyhgnDiMo/+2q//TnMYDtzEgLmLF8RIZHQCa933wIOzY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713893126; c=relaxed/simple; bh=EGjmphNer7Ut89RHQco8gQbleBGKa1F+SeEnuAdzC24=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=dbirrtKdXhjaiolWHSYB+NM5MVFr/9C/9MV3ge2nYBEWal39fOlalseB6Jtnx8LFA08bAQEV+ykJj9175m2LMTVzKX2pxwrJHBGnA2MYUmTdIdveVntCCoE7O6sm+MdGt4Iwkdq7Mm98JNiBAIauGM9K+lzYB1IV2IYBmNvSLNw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=k22lnWvI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F332C2BD10; Tue, 23 Apr 2024 17:25:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713893125; bh=EGjmphNer7Ut89RHQco8gQbleBGKa1F+SeEnuAdzC24=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=k22lnWvIHWfC5t8/0g/3eAEkJcSNnmFt1OpkOvuimGoblpA3kch0W+g6RzLrpg8Jp IHwtEnzpvB9eytvhS1Ks+pLqm9CAXX9aSdpVPdBCXCffw3yxXpg7Sj/9BYAA9Puaau acqj8jnQ4cD5IVYwNu5CMnF8CwWnEQWUQRWYcQ3ODHcNDn5P9JVhaCed6/hu4j+GV4 lE9JzMXgAqHl7Ar1P7Y7kS8Q5Ju19GSVBXlZczAKqNRW/WhRoeu9xZVy3judeUwKkq tVgHdouctS30RMO9L7+BgT3Zc0Wc5+5QqNomwRc2mDnXtTvnMHI2/+tmtllsC6loB2 H/ccHATd9rwmQ== Received: by mail-oo1-f46.google.com with SMTP id 006d021491bc7-5ac4470de3bso391192eaf.0; Tue, 23 Apr 2024 10:25:25 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCWq9v0B36wTDjs8BU2admfzYfoLynN0IxF8SW20v7RYVQyLqdRk22wUkyho2TgJuNQBzrE1ANJ5jQt1QCRQvhDZL3DGMWt+FyhRwUIufPId7+HyVPxhf3Rc8oikQvj0vn37bDgy8m4= X-Gm-Message-State: AOJu0YzbBYig3ENeZHk1ROC4N2RUIkk9gU1O0mzwLfXT+C/C1futHwyh fi2+qTxS1Pt8Q+rYSpRy9mZDrdrG9lqKmJR6HDRBxPvkMXkzQddmrEm21mwOdi7Ys4bg5xr4OAS dCgEhHClJSZXmXpFiHXVAL0uTRSI= X-Received: by 2002:a05:6870:d68c:b0:22e:77b6:4f9d with SMTP id z12-20020a056870d68c00b0022e77b64f9dmr17161055oap.3.1713893124960; Tue, 23 Apr 2024 10:25:24 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <13515747.uLZWGnKmhe@kreacher> <2009494.usQuhbGJ8B@kreacher> <9f45fd2d-f1de-437f-ae8a-75ad51a5c061@linaro.org> In-Reply-To: <9f45fd2d-f1de-437f-ae8a-75ad51a5c061@linaro.org> From: "Rafael J. Wysocki" Date: Tue, 23 Apr 2024 19:25:13 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 01/16] thermal: core: Introduce .trip_crossed() callback for thermal governors To: Daniel Lezcano Cc: "Rafael J. Wysocki" , Linux PM , LKML , Lukasz Luba , Srinivas Pandruvada Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 23, 2024 at 7:14=E2=80=AFPM Daniel Lezcano wrote: > > On 10/04/2024 18:10, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > > > Introduce a new thermal governor callback called .trip_crossed() > > that will be invoked whenever a trip point is crossed by the zone > > temperature, either on the way up or on the way down. > > > > The trip crossing direction information will be passed to it and if > > multiple trips are crossed in the same direction during one thermal zon= e > > update, the new callback will be invoked for them in temperature order, > > either ascending or descending, depending on the trip crossing > > direction. > > > > Signed-off-by: Rafael J. Wysocki > > --- > > drivers/thermal/thermal_core.c | 19 +++++++++++++++++-- > > drivers/thermal/thermal_core.h | 4 ++++ > > 2 files changed, 21 insertions(+), 2 deletions(-) > > > > Index: linux-pm/drivers/thermal/thermal_core.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- linux-pm.orig/drivers/thermal/thermal_core.c > > +++ linux-pm/drivers/thermal/thermal_core.c > > @@ -302,11 +302,21 @@ static void monitor_thermal_zone(struct > > thermal_zone_device_set_polling(tz, tz->polling_delay_jif= fies); > > } > > > > +static struct thermal_governor *thermal_get_tz_governor(struct thermal= _zone_device *tz) > > +{ > > + if (tz->governor) > > + return tz->governor; > > + > > + return def_governor; > > +} > > + > > static void handle_non_critical_trips(struct thermal_zone_device *tz, > > const struct thermal_trip *trip) > > { > > - tz->governor ? tz->governor->throttle(tz, trip) : > > - def_governor->throttle(tz, trip); > > + struct thermal_governor *governor =3D thermal_get_tz_governor(tz)= ; > > + > > + if (governor->throttle) > > + governor->throttle(tz, trip); > > } > > > > void thermal_governor_update_tz(struct thermal_zone_device *tz, > > @@ -470,6 +480,7 @@ static int thermal_trip_notify_cmp(void > > void __thermal_zone_device_update(struct thermal_zone_device *tz, > > enum thermal_notify_event event) > > { > > + struct thermal_governor *governor =3D thermal_get_tz_governor(tz)= ; > > struct thermal_trip_desc *td; > > LIST_HEAD(way_down_list); > > LIST_HEAD(way_up_list); > > @@ -493,12 +504,16 @@ void __thermal_zone_device_update(struct > > list_for_each_entry(td, &way_up_list, notify_list_node) { > > thermal_notify_tz_trip_up(tz, &td->trip); > > thermal_debug_tz_trip_up(tz, &td->trip); > > + if (governor->trip_crossed) > > + governor->trip_crossed(tz, &td->trip, true); > > Is it possible to wrap this into a function ? So we keep the calls at > the same level in this block I can send a separate patch for this if you want me to. Thanks!