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=-7.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 6E963C4CEC9 for ; Sat, 14 Sep 2019 09:53:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2C0B620693 for ; Sat, 14 Sep 2019 09:53:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pXrIGRZV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727909AbfINJxy (ORCPT ); Sat, 14 Sep 2019 05:53:54 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:36897 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727822AbfINJxx (ORCPT ); Sat, 14 Sep 2019 05:53:53 -0400 Received: by mail-wm1-f67.google.com with SMTP id r195so5158956wme.2 for ; Sat, 14 Sep 2019 02:53:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=pNp4HRnH8LauXw36MlEHyntC6rJWJRXDy9OYuB0DD6A=; b=pXrIGRZVCQXP/pZJ2SCbWHN71Lj/izr55YPO6ML8ydoxl0chUeMS9yWh/g+POxzoFq dviapQmRrAHXfozcl8/JMCnv4DNGYc0dxuJ0LThqV7kciyxElH/94rhUwCDNW61UcnBa gJ7xQQTwcvNHt2yMfHtGuiQngwPoYWnxZtJmW0avd1v5nRjYtq1CO9S/DxrSOyU8NQ5N aTDokYyc6VicwlWu37guun6NrU9mpydcxcNVp67g60gsbPr3OaNBnPxXPA4wNeL1aLe7 XwqrhQT59LDDXgFVs8kE757Qi40cCc0zlsOzQCgC1XEPS9UGcImZl6kbbVkavL5qG1So nZPQ== 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:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=pNp4HRnH8LauXw36MlEHyntC6rJWJRXDy9OYuB0DD6A=; b=Ao36484BIlU+K0Ih1RMGGvSEpGRpL8kzqtzUF3kLtSQcGXMa8nJWLFjzaI19FAyH5U S9AiDAJu33gd4wxtdsp7c42gDHDsXDaN7pH2m1jF5katfPMRN8Ap+EFDk5Y5ACHxoVaF P1+M7oMRt0QVc+63lxz7ssYnv/K4x/Ss3zuh8/55s3x/a4dFdMawGjeuf41+bkATk4WG 33Bp1fAx6iZT6OJLgEC0/PiNYl3YZ2JAr+kPJwYuQupzxbHBuTQ38s9+QZTqSUiyKmwa wR3O3HUHbNwRCo9L4jv+7thiOjPILQZZoaoJvtqw2QRlgG1xt6GJYTE2kK3OBhC92y7L ss4Q== X-Gm-Message-State: APjAAAV5GH8zmKc6mYcjrRXNMm68rFDY5u1uDtgpS75u5oYwl4hvVWTa 4e7oJPh5ZT6gjFcXBI6o8YEDFw== X-Google-Smtp-Source: APXvYqysEKRXnto253Lar5weIIvCNBZo/zO3EjaRdSEEi21VxQpnnpafcNJt0LN9C/Y2LOX/8oNDWg== X-Received: by 2002:a1c:ed03:: with SMTP id l3mr6796311wmh.29.1568454830326; Sat, 14 Sep 2019 02:53:50 -0700 (PDT) Received: from ?IPv6:2a01:e34:ed2f:f020:1071:7577:6038:b6fe? ([2a01:e34:ed2f:f020:1071:7577:6038:b6fe]) by smtp.googlemail.com with ESMTPSA id z1sm55541572wre.40.2019.09.14.02.53.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 14 Sep 2019 02:53:49 -0700 (PDT) Subject: Re: [RFC] ARM: dts: omap36xx: Enable thermal throttling To: "H. Nikolaus Schaller" Cc: Adam Ford , Linux-OMAP , Tony Lindgren , =?UTF-8?Q?Andr=c3=a9_Roth?= , Discussions about the Letux Kernel , Linux Kernel Mailing List , Andreas Kemnade , Nishanth Menon , Adam Ford , kernel@pyra-handheld.com References: <20190912183037.18449-1-aford173@gmail.com> <98751DAF-B3F7-4638-97BE-1D067B24EF18@goldelico.com> <7C9393BD-B23B-41A6-BF96-E53CD707AAC7@goldelico.com> <81d6cd33-4930-6753-d5ed-678cb1d2038d@linaro.org> <7ebe4c56-1b89-d90d-eeb4-25adaa58dd17@linaro.org> <42A53316-100E-4899-9D77-CD9F5129179E@goldelico.com> From: Daniel Lezcano Openpgp: preference=signencrypt Autocrypt: addr=daniel.lezcano@linaro.org; prefer-encrypt=mutual; keydata= mQINBFv/yykBEADDdW8RZu7iZILSf3zxq5y8YdaeyZjI/MaqgnvG/c3WjFaunoTMspeusiFE sXvtg3ehTOoyD0oFjKkHaia1Zpa1m/gnNdT/WvTveLfGA1gH+yGes2Sr53Ht8hWYZFYMZc8V 2pbSKh8wepq4g8r5YI1XUy9YbcTdj5mVrTklyGWA49NOeJz2QbfytMT3DJmk40LqwK6CCSU0 9Ed8n0a+vevmQoRZJEd3Y1qXn2XHys0F6OHCC+VLENqNNZXdZE9E+b3FFW0lk49oLTzLRNIq 0wHeR1H54RffhLQAor2+4kSSu8mW5qB0n5Eb/zXJZZ/bRiXmT8kNg85UdYhvf03ZAsp3qxcr xMfMsC7m3+ADOtW90rNNLZnRvjhsYNrGIKH8Ub0UKXFXibHbafSuq7RqyRQzt01Ud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6G/l2lDYsqKeRG55TXbu9M LqJYccPJ85B0PXcy63fL9U5DTysmxKQ5RgaxcxIZCM528ULFQs3dfEx5euWTWnnh7pN30RLg a+0AjSGd886Bh0kT1Dznrite0dzYlTHlacbITZG84yRk/gS7DkYQdjL8zgFr/pxH5CbYJDk0 tYUhisTESeesbvWSPO5uNqqy1dAFw+dqRcF5gXIh3NKX0gqiAA87NM7nL5ym/CNpJ7z7nRC8 qePOXubgouxumi5RQs1+crBmCDa/AyJHKdG2mqCt9fx5EPbDpw6Zzx7hgURh4ikHoS7/tLjK iqWjuat8/HWc01yEd8rtkGuUcMqbCi1XhcAmkaOnX8FYscMRoyyMrWClRZEQRokqZIj79+PR adkDXtr4MeL8BaB7Ij2oyRVjXUwhFQNKi5Z5Rve0a3zvGkkqw8Mz20BOksjSWjAF6g9byukl CUVjC03PdMSufNLK06x5hPc/c4tFR4J9cLrV+XxdCX7r0zGos9SzTPGNuIk1LK++S3EJhLFj 4eoWtNhMWc1uiTf9ENza0ntqH9XBWEQ6IA1gubCniGG+Xg== Message-ID: Date: Sat, 14 Sep 2019 11:53:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <42A53316-100E-4899-9D77-CD9F5129179E@goldelico.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nikolauss, On 13/ 09/2019 22:34, H. Nikolaus Schaller wrote: [ ... ] >> The governor continues to read the temperature and see the temperature >> decrease, it does nothing. > > Ah, I think our misunderstanding is that the govenor "enables" and > "disables" a set of OPPs. Rather it goes down or up in the list if > above or below a trip point. Right. >> The governor continues to read the temperature, see the temperature >> decreases and is below 75°C, it decrease the state (state=>1), the OPP >> change to 2.36GHz. >> >> The temperature then increases, etc ... >> >> Actually the governors do more than that but it is for the example. >> >> So it is a bad idea to set boundaries for the cooling device state as >> that may prevent the governor to take the right decision for the cooling >> effect. Imagine in the example above, we set the max state to 1 for the >> cooling device, that would mean the governor won't be able to stop the >> temperature increasing, thus ending up to a hard reboot. > > Well, the data sheet only requires that the high speed OPPs are only > used below 90°C. If I understand correctly if we set the trip point to > 90°C it will simply go down through the full list of OPPs. This will > clearly avoid the high speed OPPs (and potentially some low-speed > ones, but that does not harm). Yes, right. > So our approach "how to make it disable these two OPPs" seems to be > wrong. Rather, we have to think "make sure the temperature > stays below 90°C". Your approach is not wrong, it proves there is a limitation in the thermal/cpufreq framework. There is the 'turbo mode' [1] which describes exactly what you want but I'm not sure it is fully implemented. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/opp/opp.txt#n138 > And is it true that we do not have to define mapping for the "critical" > trip points? Right, you don't have to, it is optional. But the critical trip point will make your system to shutdown in case something is going wrong, for example an external heating source, like the sun or whatever. It is good to set a high temperature to force the shutdown . Usually it is below the hardware reset temperature. >>>> Now the different combinations: >>>> >>>> <&cpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT> the governor will use the state >>>> 0 to 7. >>>> >>>> <&cpu THERMAL_NO_LIMIT 2> the governor will use the state 0 to 2 >>> >>> What would be the difference between <&cpu THERMAL_NO_LIMIT 2> and >>> <&cpu 0 2> ? >>> (if there is any) >> >> There is no difference. >> >> >>>> <&cpu 1 2> the governor will use the state 1 and 2. That means there is >>>> always the cooling effect as the governor won't set it to zero thus >>>> stopping the mitigation. >>> >>> For the purposes of the board in question, we have 4 operating points, >>> 300MHz, 600MHz, 800MHz and 1GHz. Once the board reaches 90C, we need >>> them to cease operation at 800MHz and 1GHz and only permit operation >>> at 300MHz and 600MHz. I am going under the assumption that the cpu >>> index[0] would be for 300MHz, index[1] = 600MHz, etc. >>> >>> If I am interpreting your comment correctly, I should set <&cpu >>> THERMAL_NO_LIMIT 2> which would allow it to either not cool and run up >>> to 600MHz and not exceed, is that correct? >> >> Nope, it will mean the cooling device can only reduce to 800MHz and to >> 600MHz to mitigate. >> >> Actually the thermal framework neither the kernel are designed to handle >> this case. They assume the OPPs are stable whatever the thermal situation. >> >> That is the reason why I think it is a very interesting use case because >> it introduces a temperature constraint in addition to a duration for a >> certain OPP. IMO, that could be an extension of the turbo-mode. >> >> With what we have now, I doubt it is feasible. >> >> The best we can do is preventing to reach the 90°C, so we remove the OPP >> temperature constraint. I suppose 85°C is a safe temperature to stick on. >> >> And in order to let the governor have free hand. >> >> <&cpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT> >> >> I don't think that will have a significant impact on performances >> compared to be able to run at a higher temperature with less OPPs. >> >> >>>> Does it clarify the DT spec? >>>> >>> >>> I think your reply to my inquiry might. If possible, it would be nice >>> to get this documented into the bindings doc for others in the future. >>> I can do it, but someone with a better understanding of the concept >>> maybe more qualified. I can totally understand why some may want to >>> integrate this into their SoC device trees to slow the processor when >>> hot. >>> >>> Thank you for taking the time to review this. I appreciate it. >>> >>> adam > > BR, > Nikolaus > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog