Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4301719pxu; Mon, 21 Dec 2020 09:02:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzR0gbFIPOSo0bgja9tgqh4TLorv0HAwg1x1IyHLjtf7NmrAYNhrj8UPuYK8o+oF7baFGic X-Received: by 2002:a17:906:350b:: with SMTP id r11mr16575082eja.143.1608570128742; Mon, 21 Dec 2020 09:02:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608570128; cv=none; d=google.com; s=arc-20160816; b=iW/THzBXRvrcOFR0AMilDy7qcMR3Gg+TfS/M6Gxyn/KKZ0+vRBTWtAbQ97iRL5QoGV MJ/v/yMAxtXFKX2hSlia2ia0xyHWD334tXjJmp6f1GDE72b5iBdJmpMOR3ss8WXxoBgQ ruZV1tmDlYBDFOZhp+S8HKpRk6lWdQxJQJ6bvnZLqsUW/Qby7wtR74V1NV6LE/07sw0Z y4rggbAAYFcPINih9LNOskvKOzjwl4/nwjAWRR/seEaWcRg0KkYfN94vZBlSTY9zss2z RXMx0UXz49hWsM1B6G7v3DwWATXyiDguy38OiWc07EB2sDhrVTe4P7iOZn6wwhw4L6Jt tOLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=nPv3AfdO/Tw0xHDr1SCwA6GhKuMXPXJ70KMjvptB4fI=; b=CLOXlMOiHL+P4IpfoQeUjdbgm+47uGjkoyY4yd2w6E3Aaqu9HYiU7BYX8iPRzl+o+y SgTOAeSDG+F63R/H9JhBqpn+5GBVXycwbsT3T7Bbn+a7FPSEMGIr0mFjBt4GraICiDh1 MBUSJj48x26p1xqnTNO4SbE79v2tAf1T3cxmkPSg63nqpGvSign6KYaNmdf3Bb8wDCW9 r+fcK9lMeOH532JeTF8/5uLnFaAImOwBc6o1Gd4YZSluzJeSXQcTZs3xlghw1UjcIafM 6POnEGZUL4tgSCERZYcJrntL/9nMjxPIp6xKN98+/5Q/IMasV+EQ/TtthskPoG7ES+fZ EvIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bw26si1293997ejb.644.2020.12.21.09.01.45; Mon, 21 Dec 2020 09:02:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726547AbgLUQ7n convert rfc822-to-8bit (ORCPT + 99 others); Mon, 21 Dec 2020 11:59:43 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:60429 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726525AbgLUQ7l (ORCPT ); Mon, 21 Dec 2020 11:59:41 -0500 Received: from mail-lf1-f70.google.com ([209.85.167.70]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1krOWQ-0001hO-Ra for linux-kernel@vger.kernel.org; Mon, 21 Dec 2020 16:58:58 +0000 Received: by mail-lf1-f70.google.com with SMTP id i21so11265811lfe.14 for ; Mon, 21 Dec 2020 08:58:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=mrI0NOhbwzArwu7CQoQtAICpbAp0ocXR0WvQgJQ+Flk=; b=U02Yc249Xh48y0VTbFmE/Z3/wKtQ8gSUMpcmZqXJQiswDyGi7NRsG/Wd+BRi9uKUd2 ygpNijixsHWAPfVfx6xbvTzyVegy2qYVzNKxPtTECE61prckbFtoNDM5ZNLXvsFxc7u3 FnIThS+x32JaW2M5rKwmA3YqIqJXz4JF3w0RnNSwkqU90iaOBwvMe7d77a6ihOGndMk3 gaWMQOfTXK1xrPyfB199vFisX4EGMb7E/lz+GyWDGT3FOUd3yok8++BRx80emseVsaHu aWqpE3X7SIFviJkwTDemeLfBbSqcQZULJBmeSq98eXYusm/OsEZQhhl1W+jhjjfZUPuP J7pA== X-Gm-Message-State: AOAM533y+6oEAp3dc0OUKjGJka50rSLn9t8Duiu18YQTmHX9bG3GrHEl 0qcweiujJIOo693B+hdATj4vTm76I+wtsmCBKBMhCzgID5YLTJNdzhdXqJOjOxJ0iHrQ0j8leSE SVrhwuvudj0EIhHEP0NHBsoir0HZ95fVo55DSt0G6GqElZLd6kh+uCeQ/lg== X-Received: by 2002:a19:dc5:: with SMTP id 188mr7303000lfn.513.1608569938239; Mon, 21 Dec 2020 08:58:58 -0800 (PST) X-Received: by 2002:a19:dc5:: with SMTP id 188mr7302992lfn.513.1608569937971; Mon, 21 Dec 2020 08:58:57 -0800 (PST) MIME-Version: 1.0 References: <20201221135206.17671-1-kai.heng.feng@canonical.com> In-Reply-To: From: Kai-Heng Feng Date: Tue, 22 Dec 2020 00:58:46 +0800 Message-ID: Subject: Re: [PATCH 1/2] thermal: int340x: Add critical callback to override default shutdown behavior To: Srinivas Pandruvada Cc: "Zhang, Rui" , Daniel Lezcano , amitk@kernel.org, Andrzej Pietrasiewicz , Matthew Garrett , Bartlomiej Zolnierkiewicz , Peter Kaestle , Gayatri Kammela , Akinobu Mita , Andy Shevchenko , Andrew Morton , "open list:THERMAL" , open list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 22, 2020 at 12:55 AM Srinivas Pandruvada wrote: > > On Mon, 2020-12-21 at 21:52 +0800, Kai-Heng Feng wrote: > > 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 namespace. 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. > > > > As int340x device isn't present under ACPI ThermalZone, override the > > default .critical callback to prevent surprising thermal shutdown. > > > > Signed-off-by: Kai-Heng Feng > > --- > > drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 6 > > ++++++ > > .../thermal/intel/int340x_thermal/int340x_thermal_zone.c | 6 > > ++++++ > > 2 files changed, 12 insertions(+) > > > > diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c > > b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c > > index 823354a1a91a..9778a6dba939 100644 > > --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c > > +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c > > @@ -431,9 +431,15 @@ static int int3400_thermal_change_mode(struct > > thermal_zone_device *thermal, > > return result; > > } > > > > +static void int3400_thermal_critical(struct thermal_zone_device > > *thermal) > > +{ > > + dev_dbg(&thermal->device, "%s: critical temperature > > reached\n", thermal->type); > > +} > > + > > static struct thermal_zone_device_ops int3400_thermal_ops = { > > .get_temp = int3400_thermal_get_temp, > > .change_mode = int3400_thermal_change_mode, > > + .critical = int3400_thermal_critical, > > }; > > You don't need for int3400 device. This is a fake sensor. Thanks. Let me send a v2. Kai-Heng > > > > > static struct thermal_zone_params int3400_thermal_params = { > > diff --git > > a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c > > b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c > > index 6e479deff76b..d1248ba943a4 100644 > > --- a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c > > +++ b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c > > @@ -146,12 +146,18 @@ static int int340x_thermal_get_trip_hyst(struct > > thermal_zone_device *zone, > > return 0; > > } > > > > +static void int340x_thermal_critical(struct thermal_zone_device > > *zone) > > +{ > > + dev_dbg(&zone->device, "%s: critical temperature reached\n", > > zone->type); > > +} > > + > > static struct thermal_zone_device_ops int340x_thermal_zone_ops = { > > .get_temp = int340x_thermal_get_zone_temp, > > .get_trip_temp = int340x_thermal_get_trip_temp, > > .get_trip_type = int340x_thermal_get_trip_type, > > .set_trip_temp = int340x_thermal_set_trip_temp, > > .get_trip_hyst = int340x_thermal_get_trip_hyst, > > + .critical = int340x_thermal_critical, > > }; > > > > static int int340x_thermal_get_trip_config(acpi_handle handle, char > > *name, > > Thanks, > Srinivas > >