From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00E88C5519F for ; Mon, 30 Nov 2020 07:58:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A02720857 for ; Mon, 30 Nov 2020 07:58:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LJJsVkD4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727693AbgK3H6k (ORCPT ); Mon, 30 Nov 2020 02:58:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727007AbgK3H6i (ORCPT ); Mon, 30 Nov 2020 02:58:38 -0500 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69B2BC0613CF for ; Sun, 29 Nov 2020 23:57:58 -0800 (PST) Received: by mail-wm1-x342.google.com with SMTP id k10so10754407wmi.3 for ; Sun, 29 Nov 2020 23:57:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=V0CDXKuLozXjhXcBQBmMbRd7ZZ/O71fg8ffP+P4Shm4=; b=LJJsVkD4/qL3CwL+0yuRVvBg2cAb8AkbAIXghbYWrbazovXABi5ROy6IA+QjqmSmen WyrgQMABKv0loc8sz90wxLE3WFRaZ+M+Bxt+TrecekfYFsXGYE+fLNCGWvsV6vO/Rfn7 CB1iS0xR98BBOLCkgw+MGUzoB4Ii9bfhZpsUnKfSL08sPtMQlOswQxGjR+jAkykyf61Q w91Fx1Qe7KBoeYkpXQ+e7Fz2XyDuT3Df/6ri4uZ+rhngSkQ2mon6ULnw0EsZ1LdFOYSe Yia8bWpN1Ay/oe9v6fjIi2FplY3aJSMqRr4OpXJCgod4ika8/tIewOhu9Z6J5CT3uOp9 7qDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=V0CDXKuLozXjhXcBQBmMbRd7ZZ/O71fg8ffP+P4Shm4=; b=PvRr5R0czn3OHl5bEf4nuMw1nN/mwhdPAX9UdDdd58fbMGzpcMZI8bnW/xaTa/XL6W EQ7UNcAH7OA5oSVJCow0+1kr8nJPZbfn/ST6t/0KHu+B0H+O3hvyMM0awy92iAgDHTI+ hyDKX3XoIDwTC2a9LnVQyT+VpM4JM8Sof4wfT9XuQibgxM9Gta+KGZGirwsA8Wli16ko Zy8Lq/pgOh49+jEJgR5I6W0jDbReZ/OETYjHYh4+GzF1wFXndgtdk4nGyrThR49gFY6p kZplFE4UV8lXirUT2GZmi3lQgGXzZTGejJnbxT9LF2/Os1fKtyVNjWXzE/oyvtJrep6l 3OfA== X-Gm-Message-State: AOAM530lDyIbbSzzNS6TwjWYoXjvZzz4ohNsZqwmBW1kufzLtHkdbZSK gIeCyA4v9T3jB65cbgUTx+if6qitc4eu3A== X-Google-Smtp-Source: ABdhPJysnaWKPrsGc5wrxoxN1GbeW452RPruvjezGfpM4trTqIm1yehTdfcSSlrI19JZE0KBGKJsGw== X-Received: by 2002:a1c:1dd4:: with SMTP id d203mr3904405wmd.118.1606723076938; Sun, 29 Nov 2020 23:57:56 -0800 (PST) Received: from ?IPv6:2a01:e34:ed2f:f020:a9e1:bc04:469:f21b? ([2a01:e34:ed2f:f020:a9e1:bc04:469:f21b]) by smtp.googlemail.com with ESMTPSA id w15sm26834820wrp.52.2020.11.29.23.57.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 29 Nov 2020 23:57:56 -0800 (PST) Subject: Re: [PATCH 1/3] thermal: core: Add indication for userspace usage To: Kai-Heng Feng , rui.zhang@intel.com, amitk@kernel.org Cc: "open list:THERMAL" , open list , Srinivas Pandruvada References: <20201128175450.12456-1-kai.heng.feng@canonical.com> From: Daniel Lezcano Message-ID: <004fe225-1009-06d8-b297-c03a4c67550f@linaro.org> Date: Mon, 30 Nov 2020 08:57:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201128175450.12456-1-kai.heng.feng@canonical.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [Added Srinivas] On 28/11/2020 18:54, 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. 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. Well, actually it is stated before: "This object, when defined under a thermal zone, returns the critical temperature at which OSPM must shutdown the system". That is what does the thermal subsystem, no ? > So add an indication to let thermal core know it should leave thermal > device to userspace to handle. You may want to check the 'HOT' trip point and then use the notification mechanism to get notified in userspace and take action from there (eg. offline some CPUs). > 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 c6d74bc1c90b..6561e3767529 100644 > --- a/drivers/thermal/thermal_core.c > +++ b/drivers/thermal/thermal_core.c > @@ -1477,6 +1477,9 @@ thermal_zone_device_register(const char *type, int trips, int mask, > goto unregister; > } > > + if (tz->tzp && tz->tzp->userspace) > + thermal_zone_device_disable(tz); > + > mutex_lock(&thermal_list_lock); > list_add_tail(&tz->node, &thermal_tz_list); > mutex_unlock(&thermal_list_lock); > diff --git a/include/linux/thermal.h b/include/linux/thermal.h > index d07ea27e72a9..e8e8fac78fc8 100644 > --- a/include/linux/thermal.h > +++ b/include/linux/thermal.h > @@ -247,6 +247,8 @@ struct thermal_zone_params { > */ > bool no_hwmon; > > + bool userspace; > + > int num_tbps; /* Number of tbp entries */ > struct thermal_bind_params *tbp; > > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog