From patchwork Sun Nov 29 17:35:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kai-Heng Feng X-Patchwork-Id: 1407854 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ckb9P5dldz9s0b; Mon, 30 Nov 2020 04:35:20 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1kjQbU-0008Es-SA; Sun, 29 Nov 2020 17:35:16 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kjQbT-0008ES-Jj for kernel-team@lists.ubuntu.com; Sun, 29 Nov 2020 17:35:15 +0000 Received: from 220-133-187-190.hinet-ip.hinet.net ([220.133.187.190] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kjQbS-0002Qz-Nq for kernel-team@lists.ubuntu.com; Sun, 29 Nov 2020 17:35:15 +0000 From: Kai-Heng Feng To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/3] UBUNTU: SAUCE: thermal: core: Add indication for userspace usage Date: Mon, 30 Nov 2020 01:35:04 +0800 Message-Id: <20201129173506.738561-2-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201129173506.738561-1-kai.heng.feng@canonical.com> References: <20201129173506.738561-1-kai.heng.feng@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1906168 We are seeing thermal shutdown on Intel based mobile workstations, the shutdown happens during the first trip handle in thermal_zone_device_register(): kernel: thermal thermal_zone15: critical temperature reached (101 C), shutting down However, we shouldn't do a thermal shutdown here, since 1) We may want to use a dedicated daemon, Intel's thermald in this case, to handle thermal shutdown. 2) For ACPI based system, _CRT doesn't mean shutdown unless it's inside ThermalZone. ACPI Spec, 11.4.4 _CRT (Critical Temperature): "... If this object it present under a device, the device’s driver evaluates this object to determine the device’s critical cooling temperature trip point. This value may then be used by the device’s driver to program an internal device temperature sensor trip point." So a "critical trip" here merely means we should take a more aggressive cooling method. So add an indication to let thermal core know it should leave thermal device to userspace to handle. Signed-off-by: Kai-Heng Feng --- drivers/thermal/thermal_core.c | 3 +++ include/linux/thermal.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 9a321dc548c8..5eb89dc0ff42 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -474,6 +474,9 @@ void thermal_zone_device_update(struct thermal_zone_device *tz, { int count; + if (tz->tzp && tz->tzp->userspace) + return; + if (atomic_read(&in_suspend)) return; diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 126913c6a53b..b4ef84cd18ac 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -276,6 +276,8 @@ struct thermal_zone_params { */ bool no_hwmon; + bool userspace; + int num_tbps; /* Number of tbp entries */ struct thermal_bind_params *tbp; From patchwork Sun Nov 29 17:35:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai-Heng Feng X-Patchwork-Id: 1407856 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ckb9V24Wrz9sSf; Mon, 30 Nov 2020 04:35:26 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1kjQbZ-0008G8-18; Sun, 29 Nov 2020 17:35:21 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kjQbX-0008Fi-MC for kernel-team@lists.ubuntu.com; Sun, 29 Nov 2020 17:35:19 +0000 Received: from 220-133-187-190.hinet-ip.hinet.net ([220.133.187.190] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kjQbW-0002R8-Qz for kernel-team@lists.ubuntu.com; Sun, 29 Nov 2020 17:35:19 +0000 From: Kai-Heng Feng To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/3] UBUNTU: SAUCE: thermal: int340x: Indicate userspace usage Date: Mon, 30 Nov 2020 01:35:05 +0800 Message-Id: <20201129173506.738561-3-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201129173506.738561-1-kai.heng.feng@canonical.com> References: <20201129173506.738561-1-kai.heng.feng@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1906168 The device isn't present under ACPI ThermalZone, and there's a dedicated userspace daemon for this thermal device. Let thermal core know it shouldn't handle trips to avoid surprising thermal shutdown. Signed-off-by: Kai-Heng Feng --- drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 1 + drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c index 6cad15eb9cf4..920cd7732b02 100644 --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c @@ -276,6 +276,7 @@ static struct thermal_zone_device_ops int3400_thermal_ops = { static struct thermal_zone_params int3400_thermal_params = { .governor_name = "user_space", .no_hwmon = true, + .userspace = true, }; static int int3400_thermal_probe(struct platform_device *pdev) diff --git a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c index 432213272f1e..a103eb42ef2d 100644 --- a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +++ b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c @@ -208,6 +208,7 @@ EXPORT_SYMBOL_GPL(int340x_thermal_read_trips); static struct thermal_zone_params int340x_thermal_params = { .governor_name = "user_space", .no_hwmon = true, + .userspace = true, }; struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, From patchwork Sun Nov 29 17:35:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai-Heng Feng X-Patchwork-Id: 1407857 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ckb9X0wNTz9sSn; Mon, 30 Nov 2020 04:35:28 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1kjQbd-0008I6-8L; Sun, 29 Nov 2020 17:35:25 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kjQbb-0008H8-PY for kernel-team@lists.ubuntu.com; Sun, 29 Nov 2020 17:35:23 +0000 Received: from 220-133-187-190.hinet-ip.hinet.net ([220.133.187.190] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kjQba-0002RQ-U0 for kernel-team@lists.ubuntu.com; Sun, 29 Nov 2020 17:35:23 +0000 From: Kai-Heng Feng To: kernel-team@lists.ubuntu.com Subject: [PATCH 3/3] UBUNTU: SAUCE: thermal: intel: intel_pch_thermal: Indicate userspace usage Date: Mon, 30 Nov 2020 01:35:06 +0800 Message-Id: <20201129173506.738561-4-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201129173506.738561-1-kai.heng.feng@canonical.com> References: <20201129173506.738561-1-kai.heng.feng@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1906168 The device isn't present under ACPI ThermalZone, and there's a dedicated userspace daemon for this thermal device. Let thermal core know it shouldn't handle trips to avoid surprising thermal shutdown. Signed-off-by: Kai-Heng Feng --- drivers/thermal/intel/intel_pch_thermal.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/intel/intel_pch_thermal.c b/drivers/thermal/intel/intel_pch_thermal.c index 56401fd4708d..591f54633343 100644 --- a/drivers/thermal/intel/intel_pch_thermal.c +++ b/drivers/thermal/intel/intel_pch_thermal.c @@ -269,6 +269,10 @@ static struct thermal_zone_device_ops tzd_ops = { .get_trip_temp = pch_get_trip_temp, }; +static struct thermal_zone_params tzd_params = { + .userspace = true, +}; + enum board_ids { board_hsw, board_wpt, @@ -345,7 +349,7 @@ static int intel_pch_thermal_probe(struct pci_dev *pdev, goto error_cleanup; ptd->tzd = thermal_zone_device_register(bi->name, nr_trips, 0, ptd, - &tzd_ops, NULL, 0, 0); + &tzd_ops, &tzd_params, 0, 0); if (IS_ERR(ptd->tzd)) { dev_err(&pdev->dev, "Failed to register thermal zone %s\n", bi->name);