Received: by 10.223.176.46 with SMTP id f43csp1971750wra; Thu, 25 Jan 2018 02:58:08 -0800 (PST) X-Google-Smtp-Source: AH8x226CICgE8dPpJS9OLGirfnLllty1rGq0fA6G1pUu50l+7U4dv5WgD9MKS10uVa5BvbB+Gsxc X-Received: by 2002:a17:902:208:: with SMTP id 8-v6mr11031367plc.359.1516877888239; Thu, 25 Jan 2018 02:58:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516877888; cv=none; d=google.com; s=arc-20160816; b=Rs7QppRA5Gb1DbiE65Uz2i3UcXBNnn0BKDGNtMivWIcdcThUSNoX9BN+U2IdIa1A4R KbQIrlb+geSPRwzPXB6iFuQNyJ1u08Qqiq8uQt7uPpzymAK0E9e1ZIrRE+EciYy15OhT h+ucA5Bnlik1pcVZHiGhYRpaHQRHIJvFQgjjrAKMpKke0QRic7bO9kWUiAx7RkPoy21f AqXwAR7T78JdLcrehaeG/eFU547Fhbg76zm8uBYHJpDoVFRqTwjMeoPMYhuishQNgSDt Kh+KNnWXbZteHzERRg2EX8GEYBQALgVzGQGZIe7uFezOS+sEqBK5ytbcEsyTUqdqF5H+ c38A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=IjWHrX41VqgrN4qBBe0HOcHCEkRT+iLDqTX2flo0Tp0=; b=S0+FW1i7j+RvAidLjWUr3aFYyTUrNvKQ6rqwJjrWHZ9c7pUPAdtn9F5EZJECsa/CoO 08dVv0XxToFtX9TixBy2JzJd6LMg7priBRaPgLdmXNFKAsJy0w4UMIUk7cCQyL/HVjmx gwsle+x/MAaLBWFRKEyTZ+SutkmMpVqv/tesIlwAY/MiEAjp9Xcxy35q11zNdyeIrhPH ScdFEuMsSc+uFQ/ALN20JalgmBliq21Uf96Vy+chcjRzK34mJ1tcSCvYw3eoN1yv+3ZC BudkNsoS0TA1NgqJ6HFPNzrmNhU2FfWJmi68Ud9sw1AQhG33rnN27IwaSBEGhbRVDBIW pVxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QIRCSzg6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j2si1421204pgp.372.2018.01.25.02.57.53; Thu, 25 Jan 2018 02:58:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QIRCSzg6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1751655AbeAYK5W (ORCPT + 99 others); Thu, 25 Jan 2018 05:57:22 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:39758 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750851AbeAYK5U (ORCPT ); Thu, 25 Jan 2018 05:57:20 -0500 Received: by mail-wr0-f194.google.com with SMTP id z48so7180298wrz.6 for ; Thu, 25 Jan 2018 02:57:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=IjWHrX41VqgrN4qBBe0HOcHCEkRT+iLDqTX2flo0Tp0=; b=QIRCSzg6QtKiWZU215JcoAlbLvBWjLNCf+LgR97ntjM1i9VJWa41ORQQb//7fIgqVR V4Sqaql+wc7W9/FU5AHBXWEySEgERnKu2ZebuVHOUQYX0E6VwCHzEvLl3UNT3VFn/Vwv BwZjGscpo1zv16+Kn2XUzRuPAxRo1Z8kvq3AM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=IjWHrX41VqgrN4qBBe0HOcHCEkRT+iLDqTX2flo0Tp0=; b=m5VAgW23CMVghfKeGwXAT6ooi3azKu658Xluo/UFijvTbvNmWM95EkEqNop3Dsvk0r eiAvbVqCxKjvt73joUvLlQ3wh14vXYdwwnyhyWOmEb1ai/It6ikyKS5Nz2LZ3RQy4eUq 0WrMLFIhCoZrSowswxm547Wrf6LobWTFBsJDi1tRTZ92Day+UHZ6G7GsRxlDGuc01yac ZLvwNwLpx5wqk+tANOPmVsX2//1C5uKJ+z8nol1gq0UIn7Sz1ovpjTa5dtdSMTi41u0J RY6ffL+/lC6d0OwI7PCStMCf9S3tLEikg6gtacB8WbjDqxzEeoL+fyD6LDNdIGqDo7SG d+ZA== X-Gm-Message-State: AKwxytflG894pnNfP6Gc6prn2oNnoIIYpMBC8CEEwk515ZuDZAbMKPnS eYL7xuEdky0TVhDnFCaNrFi/6g== X-Received: by 10.223.129.227 with SMTP id 90mr8347307wra.148.1516877838953; Thu, 25 Jan 2018 02:57:18 -0800 (PST) Received: from oak.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id x135sm1011399wmf.35.2018.01.25.02.57.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Jan 2018 02:57:17 -0800 (PST) Date: Thu, 25 Jan 2018 10:57:15 +0000 From: Daniel Thompson To: Daniel Lezcano Cc: edubezval@gmail.com, kevin.wangtao@linaro.org, leo.yan@linaro.org, vincent.guittot@linaro.org, amit.kachhap@gmail.com, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, Zhang Rui , "open list:THERMAL" Subject: Re: [PATCH 4/8] thermal/drivers/Kconfig: Convert the CPU cooling device to a choice Message-ID: <20180125105715.sae3nwvz7u32v4va@oak.lan> References: <1516721671-16360-1-git-send-email-daniel.lezcano@linaro.org> <1516721671-16360-5-git-send-email-daniel.lezcano@linaro.org> <20180124163441.7sqq7qny66d6sqrz@oak.lan> <02e80d2c-3672-f7e2-dfb2-aed3efc84759@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <02e80d2c-3672-f7e2-dfb2-aed3efc84759@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 24, 2018 at 05:59:09PM +0100, Daniel Lezcano wrote: > On 24/01/2018 17:34, Daniel Thompson wrote: > > On Tue, Jan 23, 2018 at 04:34:27PM +0100, Daniel Lezcano wrote: > >> The next changes will add new way to cool down a CPU. In order to > >> sanitize and make the overall cpu cooling code consistent and robust > >> we must prevent the cpu cooling devices to co-exists with the same > >> purpose at the same time in the kernel. > >> > >> Make the CPU cooling device a choice in the Kconfig, so only one CPU > >> cooling strategy can be chosen. > > > > I puzzled by the role of Kconfig here. > > > > IIUC a distro kernel will always be forced to select the combo strategy > > otherwise it will never be able to cool systems that don't have cpufreq > > (I hope the combo strategy treats such system as a special case with > > only one OPP). > > Actually it does not make sense to select the combo if there is no > cpufreq support. The cpuidle cooling device must be used instead. Well, I said before what I hoped. This is what I feared! ;-) > > This raises the question what the other options (cpufreq-only > > idle-injection-only) are for? Are they just for petrol heads who want to > > save a few bytes of code or is idle-injection undesirable for some > > users. > > The combo cooling device must be used on a system with a proper support > for cpuidle and cpufreq and with the power numbers specified in the DT. > > By proper support of cpuidle, I mean a cluster power down idle state, > fast enough. This idle state allows to drop the dynamic power *and* the > static leakage (the latter to prevent a thermal runaway). > > If the system does not have power numbers, no (or bad) cpuidle, the > combo cooling device must not be used. If there is no cpufreq support, > the cpuidle cooling must be used and if there is no proper support for > both, the CPU cooling can't be used. In this case, you have to put a fan > on your board or reduce the frequency where the system stays in its > thermal envelope. How can we know (in the general case) what is going to be in the DT at compile time? > > If the later, how can a distro kernel mitigate the undesired effects > > whilst still selecting the combo strategy. > > I'm not sure to understand the question. Distros always use the make > allmodconfig, so that chooses the cpufreq CPU cooling device which was > the case before without this change. So there's no regression. That's nice but doesn't that mean distros cannot exploit the new features. > However, we are talking about distros here but the CPU cooling mechanism > is for mobile and in this case the kernel (usually Android based) comes > with a specific configuration file and this is where the SoC vendor has > to choose the right strategy. I agree its hard to conceive of a modern Android device that doesn't implement both the needed features but the performance figures in the covering letter come from Hikey (and they look pretty good) and Hikey is supported by a good number of regular Linux distros now. Using Kconfig to force what should be runtime decisions to happen at compile time means that Hikey becomes an example of a platform that is unable to run at max performance on the distros that have added support for it. Daniel. > >> Signed-off-by: Daniel Lezcano > >> --- > >> drivers/thermal/Kconfig | 20 +++++++++++++++++--- > >> 1 file changed, 17 insertions(+), 3 deletions(-) > >> > >> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig > >> index 315ae29..925e73b 100644 > >> --- a/drivers/thermal/Kconfig > >> +++ b/drivers/thermal/Kconfig > >> @@ -142,17 +142,31 @@ config THERMAL_GOV_POWER_ALLOCATOR > >> allocating and limiting power to devices. > >> > >> config CPU_THERMAL > >> - bool "generic cpu cooling support" > >> - depends on CPU_FREQ > >> + bool "Generic cpu cooling support" > >> depends on THERMAL_OF > >> help > >> + Enable the CPU cooling features. If the system has no active > >> + cooling device available, this option allows to use the CPU > >> + as a cooling device. > >> + > >> +choice > >> + prompt "CPU cooling strategies" > >> + depends on CPU_THERMAL > >> + default CPU_FREQ_THERMAL > >> + help > >> + Select the CPU cooling strategy. > >> + > >> +config CPU_FREQ_THERMAL > >> + bool "CPU frequency cooling strategy" > >> + depends on CPU_FREQ > >> + help > >> This implements the generic cpu cooling mechanism through frequency > >> reduction. An ACPI version of this already exists > >> (drivers/acpi/processor_thermal.c). > >> This will be useful for platforms using the generic thermal interface > >> and not the ACPI interface. > >> > >> - If you want this support, you should say Y here. > > > > ... this may not be great advice... if you think you want this support > > then you *probably* actually want the comboappears to be terrible advice. > > > > This cooling strategies should only be selected by petrolheads making a > > device specific *and* are obsessive about code size. > > > > The > >> +endchoice > >> > >> config CLOCK_THERMAL > >> bool "Generic clock cooling support" > >> -- > >> 2.7.4 > >> > > > -- > Linaro.org │ Open source software for ARM SoCs > > Follow Linaro: Facebook | > Twitter | > Blog >