Message ID | 20230113180235.1604526-1-daniel.lezcano@linaro.org |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp412006wrt; Fri, 13 Jan 2023 10:10:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXv1zwqvoF9JtJfP3e7+FgWWsI0qtirZpiALPCPz/b9mHC6SINEA56sub+pCEYXT/6CNtyoM X-Received: by 2002:a17:906:dff5:b0:7ef:b60e:cb02 with SMTP id lc21-20020a170906dff500b007efb60ecb02mr70328717ejc.48.1673633428993; Fri, 13 Jan 2023 10:10:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673633428; cv=none; d=google.com; s=arc-20160816; b=NkihPIihxVrIHyv+Ib6Mm3X88G4N8xM4xDnAHL3aERxOGqG48v7hYBsXKinRh4s4fq TGgCKxobJPuS4xV7r4WkBOjR2ARyHYqJwH6vrJ0JffK3CyWMqH0H7h/BszPce9lzDWPK xWnnITud0peliQSe7yyOngombRn7Nu/hYv9YFw3dAGL2gGelEl+hg44F3zv0eILJCQ0u Pm66QfoSAzcJjNqnUzLPZDtZKt7+XfFUA2HbVE5b0aFdSpkKaQ72oEkw4ik3ugyJIzG+ 5DrtpbBQ32h35wtfd1O/DaHf/j8pq4KcOjAcsxR3319dGZxJq8rQYXHKZTNfPkGliyds YFWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Az+ftUwxnjeSykCqxp/VBoimqkVshao7VEmsaRnDBos=; b=ylyaLmC3M8N4sdeU/6g6x8OWulTZ8Dm2v472aq1K9U5x7Q+NUM1z7ehI/Vilrf7g+w xpabzMXMpm/vxjEVmdi3SsO9OQWvt+2a7u3+JV+fqc4968x9ibkIOIbkaeT44Hp5CWtw TXvOfjFdA9900G92rIkrunTLdzu2uIGeYfHbiN5HgN8fVOjU2Aa9iVDgqlRyYMIWrLrY MM6o0LNR5yYcsZ2AkayP9Y9km7uODgpLnOtDEHSBih+XecZcl5yEEwgDYLRQVDVk6jAP NyjHXmH9itaCLnwxSDae3kxqa8jrmVmYcSpQLTY/17rA2KZfRyXTemoTVwXGLHmkNhtO Jz8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R7p79Bk1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa39-20020a1709076d2700b00782627f37d6si24516298ejc.778.2023.01.13.10.10.04; Fri, 13 Jan 2023 10:10:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R7p79Bk1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229450AbjAMSIU (ORCPT <rfc822;callmefire3@gmail.com> + 99 others); Fri, 13 Jan 2023 13:08:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229989AbjAMSHx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 13 Jan 2023 13:07:53 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50DCF7CBC8 for <linux-kernel@vger.kernel.org>; Fri, 13 Jan 2023 10:02:42 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id ay40so15802482wmb.2 for <linux-kernel@vger.kernel.org>; Fri, 13 Jan 2023 10:02:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Az+ftUwxnjeSykCqxp/VBoimqkVshao7VEmsaRnDBos=; b=R7p79Bk11Gk/HhYTyPPHIVL9WhxNrq0sN+BJePVa6RdwAPIK7pJ5nmN1IlC0y7hnjy S2/y5ULj3sX9kjS+f4+7V+ak5n5fhcuEKScimD+HK5/YA+OiUExUnelLlU1C5lD2WETJ S6BahYB7+yaWJ4rmeYPo2FeHz45ZS54+TE4YTKY1G4w5ifXQfM8lAMcPHGu4Ph3k0nN8 RW8n/nnTu6jlgqnezzKQdC3SsglKdORhGn65EBopu3udZ5fmHtyjMSFOcOpfRCDKCG9P LxAIfCOpMjfj7L+YRfydVExFCW7YPn7VkyfTnBm1QdpLmIQ2kifRwZduOIcsDK2TP9VF 0aqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Az+ftUwxnjeSykCqxp/VBoimqkVshao7VEmsaRnDBos=; b=Qq3mqbjLzQ4IphUCbWsszLvUD/uBqFSx9pmqZzMa3o2vyHtfh+7ugeSyCFaTz1nKWt KNs8uw7nnelyszMnDAZ56cgC669t9EkUY8AZkhtkuo5fDyyLHKwlnfxM6vGHe/+ZDbAp Y4lBcOe+TudomoeNxP3pl2eJSKDwuZ2dHh+hO0ALkK4ElkcRQkiSTpp/eur99lOYov/V g9rCl1rJ2kGs7piG8S5Zi/uwa8fOYu+PdU5BTMywoSo2GKFgJTSHmI7zt5Cv6OUEDbNf u8BSafWBD34AacJ3m4/3y3fU0JeTVe/DNfPVUSjzuBKIjcQzLWMwy/5tODQOh/6Xeic5 jwqg== X-Gm-Message-State: AFqh2koGJX9cSbnt2ggcfvOQNbu2ymq3uI/mZUVHc5AY5Q0MHcR9B8Xe lmF1sG0Bb5KYFkoMiT6D/RbfYg== X-Received: by 2002:a05:600c:18a3:b0:3d1:fcac:3c95 with SMTP id x35-20020a05600c18a300b003d1fcac3c95mr59660292wmp.34.1673632960467; Fri, 13 Jan 2023 10:02:40 -0800 (PST) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id d18-20020adfe852000000b002426d0a4048sm20057227wrn.49.2023.01.13.10.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 10:02:39 -0800 (PST) From: Daniel Lezcano <daniel.lezcano@linaro.org> To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: srinivas.pandruvada@linux.intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, rui.zhang@intel.com, christophe.jaillet@wanadoo.fr Subject: [PATCH v5 0/3] Thermal ACPI APIs for generic trip points Date: Fri, 13 Jan 2023 19:02:32 +0100 Message-Id: <20230113180235.1604526-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754931845984767347?= X-GMAIL-MSGID: =?utf-8?q?1754931845984767347?= |
Series |
Thermal ACPI APIs for generic trip points
|
|
Message
Daniel Lezcano
Jan. 13, 2023, 6:02 p.m. UTC
Recently sent as a RFC, the thermal ACPI for generic trip points is a set of functions to fill the generic trip points structure which will become the standard structure for the thermal framework and its users. Different Intel drivers and the ACPI thermal driver are using the ACPI tables to get the thermal zone information. As those are getting the same information, providing this set of ACPI function with the generic trip points will consolidate the code. Also, the Intel PCH and the Intel 34xx drivers are converted to use the generic trip points relying on the ACPI generic trip point parsing functions. These changes have been tested on a Thinkpad Lenovo x280 with the PCH and INT34xx drivers. No regression have been observed, the trip points remain the same for what is described on this system. Changelog: - V5: - Fixed GTSH unit conversion, deciK -> milli C - V4: - Fixed Kconfig option dependency, select THERMAL_ACPI if ACPI is set only for the PCH driver - V3: - Took into account Rafael's comments - Used a silence option THERMAL_ACPI in order to stay consistent with THERMAL_OF. It is up to the API user to select the option. - V2: - Fix the thermal ACPI patch where the thermal_acpi.c was not included in the series - Provide a couple of users of this API which could have been tested on a real system Daniel Lezcano (3): thermal/acpi: Add ACPI trip point routines thermal/drivers/intel: Use generic trip points for intel_pch thermal/drivers/intel: Use generic trip points int340x drivers/thermal/Kconfig | 4 + drivers/thermal/Makefile | 1 + drivers/thermal/intel/Kconfig | 1 + drivers/thermal/intel/int340x_thermal/Kconfig | 1 + .../int340x_thermal/int340x_thermal_zone.c | 177 ++++----------- .../int340x_thermal/int340x_thermal_zone.h | 10 +- drivers/thermal/intel/intel_pch_thermal.c | 88 ++------ drivers/thermal/thermal_acpi.c | 210 ++++++++++++++++++ include/linux/thermal.h | 8 + 9 files changed, 286 insertions(+), 214 deletions(-) create mode 100644 drivers/thermal/thermal_acpi.c
Comments
Hi, On 13/01/2023 19:02, Daniel Lezcano wrote: > Recently sent as a RFC, the thermal ACPI for generic trip points is a set of > functions to fill the generic trip points structure which will become the > standard structure for the thermal framework and its users. > > Different Intel drivers and the ACPI thermal driver are using the ACPI tables to > get the thermal zone information. As those are getting the same information, > providing this set of ACPI function with the generic trip points will > consolidate the code. > > Also, the Intel PCH and the Intel 34xx drivers are converted to use the generic > trip points relying on the ACPI generic trip point parsing functions. > > These changes have been tested on a Thinkpad Lenovo x280 with the PCH and > INT34xx drivers. No regression have been observed, the trip points remain the > same for what is described on this system. Are we ok with this series ? Sorry for insisting but I would like to go forward with the generic thermal trip work. There are more patches pending depending on this series. Thanks -- Daniel > Changelog: > - V5: > - Fixed GTSH unit conversion, deciK -> milli C > > - V4: > - Fixed Kconfig option dependency, select THERMAL_ACPI if ACPI is set > only for the PCH driver > > - V3: > - Took into account Rafael's comments > - Used a silence option THERMAL_ACPI in order to stay consistent > with THERMAL_OF. It is up to the API user to select the option. > > - V2: > - Fix the thermal ACPI patch where the thermal_acpi.c was not included in > the series > - Provide a couple of users of this API which could have been tested on a > real system > > Daniel Lezcano (3): > thermal/acpi: Add ACPI trip point routines > thermal/drivers/intel: Use generic trip points for intel_pch > thermal/drivers/intel: Use generic trip points int340x > > drivers/thermal/Kconfig | 4 + > drivers/thermal/Makefile | 1 + > drivers/thermal/intel/Kconfig | 1 + > drivers/thermal/intel/int340x_thermal/Kconfig | 1 + > .../int340x_thermal/int340x_thermal_zone.c | 177 ++++----------- > .../int340x_thermal/int340x_thermal_zone.h | 10 +- > drivers/thermal/intel/intel_pch_thermal.c | 88 ++------ > drivers/thermal/thermal_acpi.c | 210 ++++++++++++++++++ > include/linux/thermal.h | 8 + > 9 files changed, 286 insertions(+), 214 deletions(-) > create mode 100644 drivers/thermal/thermal_acpi.c >
On Wed, 2023-01-18 at 10:53 +0100, Daniel Lezcano wrote: > Hi, > > On 13/01/2023 19:02, Daniel Lezcano wrote: > > Recently sent as a RFC, the thermal ACPI for generic trip points is > > a set of > > functions to fill the generic trip points structure which will > > become the > > standard structure for the thermal framework and its users. > > > > Different Intel drivers and the ACPI thermal driver are using the > > ACPI tables to > > get the thermal zone information. As those are getting the same > > information, > > providing this set of ACPI function with the generic trip points > > will > > consolidate the code. > > > > Also, the Intel PCH and the Intel 34xx drivers are converted to use > > the generic > > trip points relying on the ACPI generic trip point parsing > > functions. > > > > These changes have been tested on a Thinkpad Lenovo x280 with the > > PCH and > > INT34xx drivers. No regression have been observed, the trip points > > remain the > > same for what is described on this system. > > Are we ok with this series ? > > Sorry for insisting but I would like to go forward with the generic > thermal trip work. There are more patches pending depending on this > series. The whole series looks good to me. Reviwed-by: Zhang Rui <rui.zhang@intel.com> But we'd better wait for the thermald test result from Srinvias. thanks, rui > > Thanks > -- Daniel > > > Changelog: > > - V5: > > - Fixed GTSH unit conversion, deciK -> milli C > > > > - V4: > > - Fixed Kconfig option dependency, select THERMAL_ACPI if ACPI > > is set > > only for the PCH driver > > > > - V3: > > - Took into account Rafael's comments > > - Used a silence option THERMAL_ACPI in order to stay > > consistent > > with THERMAL_OF. It is up to the API user to select the > > option. > > > > - V2: > > - Fix the thermal ACPI patch where the thermal_acpi.c was not > > included in > > the series > > - Provide a couple of users of this API which could have been > > tested on a > > real system > > > > Daniel Lezcano (3): > > thermal/acpi: Add ACPI trip point routines > > thermal/drivers/intel: Use generic trip points for intel_pch > > thermal/drivers/intel: Use generic trip points int340x > > > > drivers/thermal/Kconfig | 4 + > > drivers/thermal/Makefile | 1 + > > drivers/thermal/intel/Kconfig | 1 + > > drivers/thermal/intel/int340x_thermal/Kconfig | 1 + > > .../int340x_thermal/int340x_thermal_zone.c | 177 ++++--------- > > -- > > .../int340x_thermal/int340x_thermal_zone.h | 10 +- > > drivers/thermal/intel/intel_pch_thermal.c | 88 ++------ > > drivers/thermal/thermal_acpi.c | 210 > > ++++++++++++++++++ > > include/linux/thermal.h | 8 + > > 9 files changed, 286 insertions(+), 214 deletions(-) > > create mode 100644 drivers/thermal/thermal_acpi.c > >
On 18/01/2023 14:48, Zhang, Rui wrote: > On Wed, 2023-01-18 at 10:53 +0100, Daniel Lezcano wrote: >> Hi, >> >> On 13/01/2023 19:02, Daniel Lezcano wrote: >>> Recently sent as a RFC, the thermal ACPI for generic trip points is >>> a set of >>> functions to fill the generic trip points structure which will >>> become the >>> standard structure for the thermal framework and its users. >>> >>> Different Intel drivers and the ACPI thermal driver are using the >>> ACPI tables to >>> get the thermal zone information. As those are getting the same >>> information, >>> providing this set of ACPI function with the generic trip points >>> will >>> consolidate the code. >>> >>> Also, the Intel PCH and the Intel 34xx drivers are converted to use >>> the generic >>> trip points relying on the ACPI generic trip point parsing >>> functions. >>> >>> These changes have been tested on a Thinkpad Lenovo x280 with the >>> PCH and >>> INT34xx drivers. No regression have been observed, the trip points >>> remain the >>> same for what is described on this system. >> >> Are we ok with this series ? >> >> Sorry for insisting but I would like to go forward with the generic >> thermal trip work. There are more patches pending depending on this >> series. > > The whole series looks good to me. > > Reviwed-by: Zhang Rui <rui.zhang@intel.com> > > But we'd better wait for the thermald test result from Srinvias. Sure, thanks for the review !
On Wed, 2023-01-18 at 13:48 +0000, Zhang, Rui wrote: > On Wed, 2023-01-18 at 10:53 +0100, Daniel Lezcano wrote: > > Hi, > > > > On 13/01/2023 19:02, Daniel Lezcano wrote: > > > Recently sent as a RFC, the thermal ACPI for generic trip points > > > is > > > a set of > > > functions to fill the generic trip points structure which will > > > become the > > > standard structure for the thermal framework and its users. > > > > > > Different Intel drivers and the ACPI thermal driver are using the > > > ACPI tables to > > > get the thermal zone information. As those are getting the same > > > information, > > > providing this set of ACPI function with the generic trip points > > > will > > > consolidate the code. > > > > > > Also, the Intel PCH and the Intel 34xx drivers are converted to > > > use > > > the generic > > > trip points relying on the ACPI generic trip point parsing > > > functions. > > > > > > These changes have been tested on a Thinkpad Lenovo x280 with the > > > PCH and > > > INT34xx drivers. No regression have been observed, the trip > > > points > > > remain the > > > same for what is described on this system. > > > > Are we ok with this series ? > > > > Sorry for insisting but I would like to go forward with the generic > > thermal trip work. There are more patches pending depending on this > > series. > > The whole series looks good to me. > > Reviwed-by: Zhang Rui <rui.zhang@intel.com> > > But we'd better wait for the thermald test result from Srinvias. A quick test show that things still work with thermald and these changes. Thanks, Srinivas > > thanks, > rui > > > > Thanks > > -- Daniel > > > > > Changelog: > > > - V5: > > > - Fixed GTSH unit conversion, deciK -> milli C > > > > > > - V4: > > > - Fixed Kconfig option dependency, select THERMAL_ACPI if > > > ACPI > > > is set > > > only for the PCH driver > > > > > > - V3: > > > - Took into account Rafael's comments > > > - Used a silence option THERMAL_ACPI in order to stay > > > consistent > > > with THERMAL_OF. It is up to the API user to select the > > > option. > > > > > > - V2: > > > - Fix the thermal ACPI patch where the thermal_acpi.c was not > > > included in > > > the series > > > - Provide a couple of users of this API which could have been > > > tested on a > > > real system > > > > > > Daniel Lezcano (3): > > > thermal/acpi: Add ACPI trip point routines > > > thermal/drivers/intel: Use generic trip points for intel_pch > > > thermal/drivers/intel: Use generic trip points int340x > > > > > > drivers/thermal/Kconfig | 4 + > > > drivers/thermal/Makefile | 1 + > > > drivers/thermal/intel/Kconfig | 1 + > > > drivers/thermal/intel/int340x_thermal/Kconfig | 1 + > > > .../int340x_thermal/int340x_thermal_zone.c | 177 ++++------- > > > -- > > > -- > > > .../int340x_thermal/int340x_thermal_zone.h | 10 +- > > > drivers/thermal/intel/intel_pch_thermal.c | 88 ++------ > > > drivers/thermal/thermal_acpi.c | 210 > > > ++++++++++++++++++ > > > include/linux/thermal.h | 8 + > > > 9 files changed, 286 insertions(+), 214 deletions(-) > > > create mode 100644 drivers/thermal/thermal_acpi.c > > >
Hi Srinivas, On 18/01/2023 20:01, srinivas pandruvada wrote: [ ... ] >> The whole series looks good to me. >> >> Reviwed-by: Zhang Rui <rui.zhang@intel.com> >> >> But we'd better wait for the thermald test result from Srinvias. > > A quick test show that things still work with thermald and these > changes. Thanks for testing. Shall I consider as Tested-by or do you want to test more ?
On Wed, 2023-01-18 at 11:01 -0800, srinivas pandruvada wrote: > On Wed, 2023-01-18 at 13:48 +0000, Zhang, Rui wrote: > > On Wed, 2023-01-18 at 10:53 +0100, Daniel Lezcano wrote: > > > Hi, > > > > > > On 13/01/2023 19:02, Daniel Lezcano wrote: > > > > Recently sent as a RFC, the thermal ACPI for generic trip > > > > points > > > > is > > > > a set of > > > > functions to fill the generic trip points structure which will > > > > become the > > > > standard structure for the thermal framework and its users. > > > > > > > > Different Intel drivers and the ACPI thermal driver are using > > > > the > > > > ACPI tables to > > > > get the thermal zone information. As those are getting the same > > > > information, > > > > providing this set of ACPI function with the generic trip > > > > points > > > > will > > > > consolidate the code. > > > > > > > > Also, the Intel PCH and the Intel 34xx drivers are converted to > > > > use > > > > the generic > > > > trip points relying on the ACPI generic trip point parsing > > > > functions. > > > > > > > > These changes have been tested on a Thinkpad Lenovo x280 with > > > > the > > > > PCH and > > > > INT34xx drivers. No regression have been observed, the trip > > > > points > > > > remain the > > > > same for what is described on this system. > > > > > > Are we ok with this series ? > > > > > > Sorry for insisting but I would like to go forward with the > > > generic > > > thermal trip work. There are more patches pending depending on > > > this > > > series. > > > > The whole series looks good to me. > > > > Reviwed-by: Zhang Rui <rui.zhang@intel.com> > > > > But we'd better wait for the thermald test result from Srinvias. > > A quick test show that things still work with thermald and these > changes. But I have a question. In some devices trip point temperature is not static. When hardware changes, we get notification. For example INT3403_PERF_TRIP_POINT_CHANGED for INT3403 drivers. Currently get_trip can get the latest changed value. But if we preregister, we need some mechanism to update them. Thanks, Srinivas > Thanks, > Srinivas > > > > > thanks, > > rui > > > > > > Thanks > > > -- Daniel > > > > > > > Changelog: > > > > - V5: > > > > - Fixed GTSH unit conversion, deciK -> milli C > > > > > > > > - V4: > > > > - Fixed Kconfig option dependency, select THERMAL_ACPI if > > > > ACPI > > > > is set > > > > only for the PCH driver > > > > > > > > - V3: > > > > - Took into account Rafael's comments > > > > - Used a silence option THERMAL_ACPI in order to stay > > > > consistent > > > > with THERMAL_OF. It is up to the API user to select the > > > > option. > > > > > > > > - V2: > > > > - Fix the thermal ACPI patch where the thermal_acpi.c was > > > > not > > > > included in > > > > the series > > > > - Provide a couple of users of this API which could have > > > > been > > > > tested on a > > > > real system > > > > > > > > Daniel Lezcano (3): > > > > thermal/acpi: Add ACPI trip point routines > > > > thermal/drivers/intel: Use generic trip points for intel_pch > > > > thermal/drivers/intel: Use generic trip points int340x > > > > > > > > drivers/thermal/Kconfig | 4 + > > > > drivers/thermal/Makefile | 1 + > > > > drivers/thermal/intel/Kconfig | 1 + > > > > drivers/thermal/intel/int340x_thermal/Kconfig | 1 + > > > > .../int340x_thermal/int340x_thermal_zone.c | 177 ++++----- > > > > -- > > > > -- > > > > -- > > > > .../int340x_thermal/int340x_thermal_zone.h | 10 +- > > > > drivers/thermal/intel/intel_pch_thermal.c | 88 ++------ > > > > drivers/thermal/thermal_acpi.c | 210 > > > > ++++++++++++++++++ > > > > include/linux/thermal.h | 8 + > > > > 9 files changed, 286 insertions(+), 214 deletions(-) > > > > create mode 100644 drivers/thermal/thermal_acpi.c > > > > >
On 18/01/2023 20:16, srinivas pandruvada wrote: [ ... ] >>> But we'd better wait for the thermald test result from Srinvias. >> >> A quick test show that things still work with thermald and these >> changes. > > But I have a question. In some devices trip point temperature is not > static. When hardware changes, we get notification. For example > INT3403_PERF_TRIP_POINT_CHANGED for INT3403 drivers. > Currently get_trip can get the latest changed value. But if we > preregister, we need some mechanism to update them. When the notification INT3403_PERF_TRIP_POINT_CHANGED happens, we call int340x_thermal_read_trips() which in turn updates the trip points.
On Wed, 2023-01-18 at 21:00 +0100, Daniel Lezcano wrote: > On 18/01/2023 20:16, srinivas pandruvada wrote: > > [ ... ] > > > > > But we'd better wait for the thermald test result from > > > > Srinvias. > > > > > > A quick test show that things still work with thermald and these > > > changes. > > > > But I have a question. In some devices trip point temperature is > > not > > static. When hardware changes, we get notification. For example > > INT3403_PERF_TRIP_POINT_CHANGED for INT3403 drivers. > > Currently get_trip can get the latest changed value. But if we > > preregister, we need some mechanism to update them. > > When the notification INT3403_PERF_TRIP_POINT_CHANGED happens, we > call > int340x_thermal_read_trips() which in turn updates the trip points. > Not sure how we handle concurrency here when driver can freely update trips while thermal core is using trips. Thanks, Srinivas > >
On 18/01/2023 21:53, srinivas pandruvada wrote: > On Wed, 2023-01-18 at 21:00 +0100, Daniel Lezcano wrote: >> On 18/01/2023 20:16, srinivas pandruvada wrote: >> >> [ ... ] >> >>>>> But we'd better wait for the thermald test result from >>>>> Srinvias. >>>> >>>> A quick test show that things still work with thermald and these >>>> changes. >>> >>> But I have a question. In some devices trip point temperature is >>> not >>> static. When hardware changes, we get notification. For example >>> INT3403_PERF_TRIP_POINT_CHANGED for INT3403 drivers. >>> Currently get_trip can get the latest changed value. But if we >>> preregister, we need some mechanism to update them. >> >> When the notification INT3403_PERF_TRIP_POINT_CHANGED happens, we >> call >> int340x_thermal_read_trips() which in turn updates the trip points. >> > > Not sure how we handle concurrency here when driver can freely update > trips while thermal core is using trips. Don't we have the same race without this patch ? The thermal core can call get_trip_temp() while there is an update, no ?
On Wed, 2023-01-18 at 22:01 +0100, Daniel Lezcano wrote: > On 18/01/2023 21:53, srinivas pandruvada wrote: > > On Wed, 2023-01-18 at 21:00 +0100, Daniel Lezcano wrote: > > > On 18/01/2023 20:16, srinivas pandruvada wrote: > > > > > > [ ... ] > > > > > > > > > But we'd better wait for the thermald test result from > > > > > > Srinvias. > > > > > > > > > > A quick test show that things still work with thermald and > > > > > these > > > > > changes. > > > > > > > > But I have a question. In some devices trip point temperature > > > > is > > > > not > > > > static. When hardware changes, we get notification. For example > > > > INT3403_PERF_TRIP_POINT_CHANGED for INT3403 drivers. > > > > Currently get_trip can get the latest changed value. But if we > > > > preregister, we need some mechanism to update them. > > > > > > When the notification INT3403_PERF_TRIP_POINT_CHANGED happens, we > > > call > > > int340x_thermal_read_trips() which in turn updates the trip > > > points. > > > > > > > Not sure how we handle concurrency here when driver can freely > > update > > trips while thermal core is using trips. > > Don't we have the same race without this patch ? The thermal core can > call get_trip_temp() while there is an update, no ? Yes it is. But I can add a mutex locally here to solve. But not any longer. I think you need some thermal_zone_read_lock/unlock() in core, which can use rcu. Even mutex is fine as there will be no contention as updates to trips will be rare. Thanks, Srinivas >
On 18/01/2023 22:16, srinivas pandruvada wrote: > On Wed, 2023-01-18 at 22:01 +0100, Daniel Lezcano wrote: >> On 18/01/2023 21:53, srinivas pandruvada wrote: >>> On Wed, 2023-01-18 at 21:00 +0100, Daniel Lezcano wrote: >>>> On 18/01/2023 20:16, srinivas pandruvada wrote: >>>> >>>> [ ... ] >>>> >>>>>>> But we'd better wait for the thermald test result from >>>>>>> Srinvias. >>>>>> >>>>>> A quick test show that things still work with thermald and >>>>>> these >>>>>> changes. >>>>> >>>>> But I have a question. In some devices trip point temperature >>>>> is >>>>> not >>>>> static. When hardware changes, we get notification. For example >>>>> INT3403_PERF_TRIP_POINT_CHANGED for INT3403 drivers. >>>>> Currently get_trip can get the latest changed value. But if we >>>>> preregister, we need some mechanism to update them. >>>> >>>> When the notification INT3403_PERF_TRIP_POINT_CHANGED happens, we >>>> call >>>> int340x_thermal_read_trips() which in turn updates the trip >>>> points. >>>> >>> >>> Not sure how we handle concurrency here when driver can freely >>> update >>> trips while thermal core is using trips. >> >> Don't we have the same race without this patch ? The thermal core can >> call get_trip_temp() while there is an update, no ? > Yes it is. But I can add a mutex locally here to solve. > But not any longer. > > I think you need some thermal_zone_read_lock/unlock() in core, which > can use rcu. Even mutex is fine as there will be no contention as > updates to trips will be rare. I was planning to provide a thermal_trips_update(tz, trips) and from there handle the locking. As the race was already existing, can we postpone this change after the generic trip points changes? There is still a lot of work to do to consolidate the code. One of them is to provide a generic function to browse the trip points and ensure the code is using it instead of directly inspect the thermal zone internals structure. I'm almost there but I need the remaining Intel drivers changes to be merged (as well as ACPI which is finished but depending on this series).
On Wed, 2023-01-18 at 23:14 +0100, Daniel Lezcano wrote: > On 18/01/2023 22:16, srinivas pandruvada wrote: > > On Wed, 2023-01-18 at 22:01 +0100, Daniel Lezcano wrote: > > > On 18/01/2023 21:53, srinivas pandruvada wrote: > > > > On Wed, 2023-01-18 at 21:00 +0100, Daniel Lezcano wrote: > > > > > On 18/01/2023 20:16, srinivas pandruvada wrote: > > > > > > > > > > [ ... ] > > > > > > > > > > > > > But we'd better wait for the thermald test result from > > > > > > > > Srinvias. > > > > > > > > > > > > > > A quick test show that things still work with thermald > > > > > > > and > > > > > > > these > > > > > > > changes. > > > > > > > > > > > > But I have a question. In some devices trip point > > > > > > temperature > > > > > > is > > > > > > not > > > > > > static. When hardware changes, we get notification. For > > > > > > example > > > > > > INT3403_PERF_TRIP_POINT_CHANGED for INT3403 drivers. > > > > > > Currently get_trip can get the latest changed value. But if > > > > > > we > > > > > > preregister, we need some mechanism to update them. > > > > > > > > > > When the notification INT3403_PERF_TRIP_POINT_CHANGED > > > > > happens, we > > > > > call > > > > > int340x_thermal_read_trips() which in turn updates the trip > > > > > points. > > > > > > > > > > > > > Not sure how we handle concurrency here when driver can freely > > > > update > > > > trips while thermal core is using trips. > > > > > > Don't we have the same race without this patch ? The thermal core > > > can > > > call get_trip_temp() while there is an update, no ? > > Yes it is. But I can add a mutex locally here to solve. > > But not any longer. > > > > I think you need some thermal_zone_read_lock/unlock() in core, > > which > > can use rcu. Even mutex is fine as there will be no contention as > > updates to trips will be rare. > > I was planning to provide a thermal_trips_update(tz, trips) and from > there handle the locking. > > As the race was already existing, can we postpone this change after > the > generic trip points changes? I think so. > > There is still a lot of work to do to consolidate the code. One of > them > is to provide a generic function to browse the trip points and ensure > the code is using it instead of directly inspect the thermal zone > internals structure. > > I'm almost there but I need the remaining Intel drivers changes to be > merged (as well as ACPI which is finished but depending on this > series). > Sounds good. You can add my tested by for this. Thanks, Srinivas
On Thu, Jan 19, 2023 at 12:04 AM srinivas pandruvada <srinivas.pandruvada@linux.intel.com> wrote: > > On Wed, 2023-01-18 at 23:14 +0100, Daniel Lezcano wrote: > > On 18/01/2023 22:16, srinivas pandruvada wrote: > > > On Wed, 2023-01-18 at 22:01 +0100, Daniel Lezcano wrote: > > > > On 18/01/2023 21:53, srinivas pandruvada wrote: > > > > > On Wed, 2023-01-18 at 21:00 +0100, Daniel Lezcano wrote: > > > > > > On 18/01/2023 20:16, srinivas pandruvada wrote: > > > > > > > > > > > > [ ... ] > > > > > > > > > > > > > > > But we'd better wait for the thermald test result from > > > > > > > > > Srinvias. > > > > > > > > > > > > > > > > A quick test show that things still work with thermald > > > > > > > > and > > > > > > > > these > > > > > > > > changes. > > > > > > > > > > > > > > But I have a question. In some devices trip point > > > > > > > temperature > > > > > > > is > > > > > > > not > > > > > > > static. When hardware changes, we get notification. For > > > > > > > example > > > > > > > INT3403_PERF_TRIP_POINT_CHANGED for INT3403 drivers. > > > > > > > Currently get_trip can get the latest changed value. But if > > > > > > > we > > > > > > > preregister, we need some mechanism to update them. > > > > > > > > > > > > When the notification INT3403_PERF_TRIP_POINT_CHANGED > > > > > > happens, we > > > > > > call > > > > > > int340x_thermal_read_trips() which in turn updates the trip > > > > > > points. > > > > > > > > > > > > > > > > Not sure how we handle concurrency here when driver can freely > > > > > update > > > > > trips while thermal core is using trips. > > > > > > > > Don't we have the same race without this patch ? The thermal core > > > > can > > > > call get_trip_temp() while there is an update, no ? > > > Yes it is. But I can add a mutex locally here to solve. > > > But not any longer. > > > > > > I think you need some thermal_zone_read_lock/unlock() in core, > > > which > > > can use rcu. Even mutex is fine as there will be no contention as > > > updates to trips will be rare. > > > > I was planning to provide a thermal_trips_update(tz, trips) and from > > there handle the locking. > > > > As the race was already existing, can we postpone this change after > > the > > generic trip points changes? > I think so. Well, what if this bug is reported by a user and a fix needs to be backported to "stable"? Are we going to backport the whole framework redesign along with it? Or is this extremely unlikely?
On Thu, 2023-01-19 at 13:17 +0100, Rafael J. Wysocki wrote: > On Thu, Jan 19, 2023 at 12:04 AM srinivas pandruvada > <srinivas.pandruvada@linux.intel.com> wrote: > > > > On Wed, 2023-01-18 at 23:14 +0100, Daniel Lezcano wrote: > > > On 18/01/2023 22:16, srinivas pandruvada wrote: > > > > On Wed, 2023-01-18 at 22:01 +0100, Daniel Lezcano wrote: > > > > > On 18/01/2023 21:53, srinivas pandruvada wrote: > > > > > > On Wed, 2023-01-18 at 21:00 +0100, Daniel Lezcano wrote: > > > > > > > On 18/01/2023 20:16, srinivas pandruvada wrote: > > > > > > > > > > > > > > [ ... ] > > > > > > > > > > > > > > > > > But we'd better wait for the thermald test result > > > > > > > > > > from > > > > > > > > > > Srinvias. > > > > > > > > > > > > > > > > > > A quick test show that things still work with > > > > > > > > > thermald > > > > > > > > > and > > > > > > > > > these > > > > > > > > > changes. > > > > > > > > > > > > > > > > But I have a question. In some devices trip point > > > > > > > > temperature > > > > > > > > is > > > > > > > > not > > > > > > > > static. When hardware changes, we get notification. For > > > > > > > > example > > > > > > > > INT3403_PERF_TRIP_POINT_CHANGED for INT3403 drivers. > > > > > > > > Currently get_trip can get the latest changed value. > > > > > > > > But if > > > > > > > > we > > > > > > > > preregister, we need some mechanism to update them. > > > > > > > > > > > > > > When the notification INT3403_PERF_TRIP_POINT_CHANGED > > > > > > > happens, we > > > > > > > call > > > > > > > int340x_thermal_read_trips() which in turn updates the > > > > > > > trip > > > > > > > points. > > > > > > > > > > > > > > > > > > > Not sure how we handle concurrency here when driver can > > > > > > freely > > > > > > update > > > > > > trips while thermal core is using trips. > > > > > > > > > > Don't we have the same race without this patch ? The thermal > > > > > core > > > > > can > > > > > call get_trip_temp() while there is an update, no ? > > > > Yes it is. But I can add a mutex locally here to solve. > > > > But not any longer. > > > > > > > > I think you need some thermal_zone_read_lock/unlock() in core, > > > > which > > > > can use rcu. Even mutex is fine as there will be no contention > > > > as > > > > updates to trips will be rare. > > > > > > I was planning to provide a thermal_trips_update(tz, trips) and > > > from > > > there handle the locking. > > > > > > As the race was already existing, can we postpone this change > > > after > > > the > > > generic trip points changes? > > I think so. > > Well, what if this bug is reported by a user and a fix needs to be > backported to "stable"? > > Are we going to backport the whole framework redesign along with it? > > Or is this extremely unlikely? These trips are read at the start of DTT/Thermald and will be read once after notification is received. So extremely unlikely. But we can add the patch before this series to address this issue, which can be marked stable. I can submit this. Thanks, Srinivas
On Thu, Jan 19, 2023 at 5:58 PM srinivas pandruvada <srinivas.pandruvada@linux.intel.com> wrote: > > On Thu, 2023-01-19 at 13:17 +0100, Rafael J. Wysocki wrote: > > On Thu, Jan 19, 2023 at 12:04 AM srinivas pandruvada > > <srinivas.pandruvada@linux.intel.com> wrote: > > > > > > On Wed, 2023-01-18 at 23:14 +0100, Daniel Lezcano wrote: > > > > On 18/01/2023 22:16, srinivas pandruvada wrote: > > > > > On Wed, 2023-01-18 at 22:01 +0100, Daniel Lezcano wrote: > > > > > > On 18/01/2023 21:53, srinivas pandruvada wrote: > > > > > > > On Wed, 2023-01-18 at 21:00 +0100, Daniel Lezcano wrote: > > > > > > > > On 18/01/2023 20:16, srinivas pandruvada wrote: > > > > > > > > > > > > > > > > [ ... ] > > > > > > > > > > > > > > > > > > > But we'd better wait for the thermald test result > > > > > > > > > > > from > > > > > > > > > > > Srinvias. > > > > > > > > > > > > > > > > > > > > A quick test show that things still work with > > > > > > > > > > thermald > > > > > > > > > > and > > > > > > > > > > these > > > > > > > > > > changes. > > > > > > > > > > > > > > > > > > But I have a question. In some devices trip point > > > > > > > > > temperature > > > > > > > > > is > > > > > > > > > not > > > > > > > > > static. When hardware changes, we get notification. For > > > > > > > > > example > > > > > > > > > INT3403_PERF_TRIP_POINT_CHANGED for INT3403 drivers. > > > > > > > > > Currently get_trip can get the latest changed value. > > > > > > > > > But if > > > > > > > > > we > > > > > > > > > preregister, we need some mechanism to update them. > > > > > > > > > > > > > > > > When the notification INT3403_PERF_TRIP_POINT_CHANGED > > > > > > > > happens, we > > > > > > > > call > > > > > > > > int340x_thermal_read_trips() which in turn updates the > > > > > > > > trip > > > > > > > > points. > > > > > > > > > > > > > > > > > > > > > > Not sure how we handle concurrency here when driver can > > > > > > > freely > > > > > > > update > > > > > > > trips while thermal core is using trips. > > > > > > > > > > > > Don't we have the same race without this patch ? The thermal > > > > > > core > > > > > > can > > > > > > call get_trip_temp() while there is an update, no ? > > > > > Yes it is. But I can add a mutex locally here to solve. > > > > > But not any longer. > > > > > > > > > > I think you need some thermal_zone_read_lock/unlock() in core, > > > > > which > > > > > can use rcu. Even mutex is fine as there will be no contention > > > > > as > > > > > updates to trips will be rare. > > > > > > > > I was planning to provide a thermal_trips_update(tz, trips) and > > > > from > > > > there handle the locking. > > > > > > > > As the race was already existing, can we postpone this change > > > > after > > > > the > > > > generic trip points changes? > > > I think so. > > > > Well, what if this bug is reported by a user and a fix needs to be > > backported to "stable"? > > > > Are we going to backport the whole framework redesign along with it? > > > > Or is this extremely unlikely? > These trips are read at the start of DTT/Thermald and will be read once > after notification is received. So extremely unlikely. > But we can add the patch before this series to address this issue, > which can be marked stable. I can submit this. Looks reasonable to me.