From patchwork Wed Feb 21 15:29:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 129088 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp751929ljc; Wed, 21 Feb 2018 07:31:13 -0800 (PST) X-Google-Smtp-Source: AH8x227cXn97ZFGaaCw2Ax50cGn8Y6bR/3PRhU/jDcarzmequSpSz+OY5aIV5ip4MImzFo5yurp6 X-Received: by 2002:a17:902:9002:: with SMTP id a2-v6mr3481000plp.412.1519227073773; Wed, 21 Feb 2018 07:31:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519227073; cv=none; d=google.com; s=arc-20160816; b=D3Md9vJ7Svf984eWK33FMD0Wq/JyVThz4eWZzp88k1kO2apeynwn4jhNcro+dxmN33 sSdRF/owPPNRrIfY1rhlT5LHqyLxo/+3C6o3Nexj7+CsR3R061Dc2Dtg+toA6PhiWdd6 Q7Fsi2mdeXfiEumFX2xw2upneQVAYL19CV1vH8rs6+m2YNTQmd52C14P6mzPwxcDZJo8 2c7vKs6/6RcrbEWkYuZKd/KTFg0quGx9JX1WXf4vPvS2Qqnxr6Fvakmns9XPn9YAbfJ7 s1Enc33E4ErT7WegCqNJ7KdtmubTRHszbgCd2gt5ROnUtQQLE62NuVsl6dWXt9cuAJ2b HcNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=80bRM8Y9T3uly8qDJ7zFvZJXXQeEYsO2UFsSnX8shUM=; b=I5MAOx7eRic7hkb78gDLdNfWk5bjdq56oC2F2h8i4FZPGl+Aj7/VHLmD75dHG3hX0V rln9V1sz+b162yV/pfCdNKq2LsVLWbn/nDkXf57WDn3RLItaZlYVcl8T3jvov8M0wx4i kYFoTdFhAKIGDlsYsZJsIqcQXKTPPs3SlBmUxkEDNQLkvaNJVoCON+evkjV7ZI4hrrLv WcbG2wV6j6JgxFaLXO03Eb/4nrzhihW5Lp1wcpCxCLQ/BXd43lTERlzBdLxT0y7JYFq4 A7GYZmIwdlMOZpOTB8R92Rp8KVBj9ZYjhq7uTbKT6bss9TqD7KV4hkgzp8gDlJGmQ4N6 aDQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KxLsQkTz; 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 t1-v6si1250742plr.558.2018.02.21.07.31.13; Wed, 21 Feb 2018 07:31:13 -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=KxLsQkTz; 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 S938293AbeBUP3o (ORCPT + 28 others); Wed, 21 Feb 2018 10:29:44 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:41428 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938264AbeBUP3l (ORCPT ); Wed, 21 Feb 2018 10:29:41 -0500 Received: by mail-wr0-f193.google.com with SMTP id f14so5590779wre.8 for ; Wed, 21 Feb 2018 07:29:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=80bRM8Y9T3uly8qDJ7zFvZJXXQeEYsO2UFsSnX8shUM=; b=KxLsQkTzfnTIktaQrJMAQRH/FwqYusEU7IhHOXCuyeRLD4UtHJBrbTSAYXI307SvFs Z4wNGUn1bj+OJV5jPzpPiJNqprfqlTBWt6bpz/u+/b5yLGAl3c6ep8LSUrhBLRGAnS31 E2a1W/npP7TgZW7wNkEqgaRPWAIdYdsnjy3ro= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=80bRM8Y9T3uly8qDJ7zFvZJXXQeEYsO2UFsSnX8shUM=; b=EnvimUDqQktPApGaZ+h/r8OpWbhqKdKZ22A0n/iAikEGwAjgSF3NviWrjOjvE3B5gz 1zMhEV5qMcscvU5tg4DMDrx+G9f0ijmcpUSxDpyFWnUxgj7dGSGIs5W/VNrUjGUdRSUu 5Pgi9+jxTUDb99i3GwjbSnnXSBU8+WtXzJd2CR8tBZVc/NJMjBhdoYN26lMxq5kQFdxL YxxaZBSgl/jid172sX/MjFK+qcF9qH1VP3mNYcW6Tu4zqvjdQMUc3Y7rmP9PUCFWc7sT ma2K/93rfgQw+YgkN4MqYlJOMOp/ujhC5gQrevHKRB9zzGgVjBTF017LgMrvZSlmRP6B yRNQ== X-Gm-Message-State: APf1xPDDc2FbQc/byee4ZZGhq72d9z2+MsR8JRqpO/tVXw5wB8z1BFZK nbeAi4WvBbXJQhvW6WqCLzXV/w== X-Received: by 10.28.92.70 with SMTP id q67mr2484914wmb.43.1519226979924; Wed, 21 Feb 2018 07:29:39 -0800 (PST) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:c4f2:763f:443f:f48]) by smtp.gmail.com with ESMTPSA id 32sm26552736wrm.14.2018.02.21.07.29.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Feb 2018 07:29:39 -0800 (PST) From: Daniel Lezcano To: edubezval@gmail.com Cc: kevin.wangtao@linaro.org, leo.yan@linaro.org, vincent.guittot@linaro.org, amit.kachhap@gmail.com, linux-kernel@vger.kernel.org, javi.merino@kernel.org, rui.zhang@intel.com, daniel.thompson@linaro.org, linux-pm@vger.kernel.org, Viresh Kumar Subject: [PATCH V2 1/7] thermal/drivers/cpu_cooling: Fixup the header and copyright Date: Wed, 21 Feb 2018 16:29:22 +0100 Message-Id: <1519226968-19821-2-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519226968-19821-1-git-send-email-daniel.lezcano@linaro.org> References: <1519226968-19821-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The copyright format does not conform to the format requested by Linaro: https://wiki.linaro.org/Copyright Fix it. Signed-off-by: Daniel Lezcano --- drivers/thermal/cpu_cooling.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index dc63aba..42110ee 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -2,9 +2,11 @@ * linux/drivers/thermal/cpu_cooling.c * * Copyright (C) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com) - * Copyright (C) 2012 Amit Daniel * - * Copyright (C) 2014 Viresh Kumar + * Copyright (C) 2012-2018 Linaro Limited. + * + * Authors: Amit Daniel + * Viresh Kumar * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * This program is free software; you can redistribute it and/or modify From patchwork Wed Feb 21 15:29:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 129084 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp750518ljc; Wed, 21 Feb 2018 07:30:00 -0800 (PST) X-Google-Smtp-Source: AH8x2258d4MR2Wj+B7QZu2wKio7Kq5f6YFyuwMHTUJj4XqsIKKz6A6nxXdTiQmhFFAdgbcp47vsy X-Received: by 10.99.152.10 with SMTP id q10mr3112884pgd.212.1519227000674; Wed, 21 Feb 2018 07:30:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519227000; cv=none; d=google.com; s=arc-20160816; b=OtJIEJn9jzg/4KTYV8oS29+g5z9OfJns0iQcMlc9jWA5QU8SdjeZE6oSyhUmx4juC2 GhNaHbMPuPoRgfZHw4kyYBGxtTTjXDV3WeJDqLDZgnwaj+W5gZnECeW+qtTFclROVVVZ BRuu1cqeHk/UQyvfoIRlU4w8S14eWkleS+wyLvbgKm7YcRO3bF2vAu1YKYWzTFPkqgka 5v2EsfG3HyCgNUPI6kcl0Umae3nBN3a1au0oNxoSDXUVPhiGVjZfTcCG1If3fLX1MpTM 7DEuZOV6+EzrlrLJglTu+g+TvW0Q/yF937v6AkstsmnfEiTPJlJLfGjgueSOEtCMlW/6 vhHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=2B+u7r7k98kBwXfr9ac52jfD5UJK1QPtdRFSc0U8m8k=; b=x4VKVxl2v6GGT+6xUsI4anQtbw1ctliEdrTg6QRcI3kN5JoM9v+Mf5ExWD49jGwvHz s9ot69bg5GfZmur2zxL1V0Zr2xBgg5EmXMZuddHR8BzFG7+PqvaukHrmXT2BDAkHr0gP QiLyRGOX06vnqjfmjxV1vEpmBQz73yW/PlClkEhZ81u4rB33AA+g2KcHiCS0Q2OaoUgt UT3lQn1ZTFAFEC2cyUbM6SaKJRySC5xUCdPeuupeWpUryuKVc9HUKMVDOAXSpp60FENC riDawT8ivyHcnhGx6W0zmNbnf7calZ+autaVkzdlKnBemdQLCIVg9h6gQtVeBJAuPAZG aZHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J9ET5G7f; 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 69si1518747pfv.15.2018.02.21.07.30.00; Wed, 21 Feb 2018 07:30:00 -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=J9ET5G7f; 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 S938321AbeBUP36 (ORCPT + 28 others); Wed, 21 Feb 2018 10:29:58 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:36405 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938264AbeBUP3r (ORCPT ); Wed, 21 Feb 2018 10:29:47 -0500 Received: by mail-wr0-f193.google.com with SMTP id u15so5631384wrg.3 for ; Wed, 21 Feb 2018 07:29:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2B+u7r7k98kBwXfr9ac52jfD5UJK1QPtdRFSc0U8m8k=; b=J9ET5G7fzbsua3egWlykAIq5TZ1IUpIf6DJ1/UqDAJCmgdj1bDlp1CptTmccB22FF4 KLc73mjx81VfqWeKt6IZ+T91lMx4mb+Aw9KYaIg+LBdfiAI16PHfirnG5tKzzbSOyFDR iofdUu6Ity7rfgMLg8CHsNjvULjeLrpiTANSY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2B+u7r7k98kBwXfr9ac52jfD5UJK1QPtdRFSc0U8m8k=; b=Z/DujicCSPPy4x0YKBe1KmdcV9t8YqAZO5yAi6pIaz0ctzKFNhkdqa8/lgk0iPuMCm iqGk2v/XazF29LMiY9bK49+TZbalsH2KF9I0pUsRlD2hNPqltwYE7f319aTJypaWeXDO wg2lgwOqyFxIrsUwwrD4SNuhUqN+7bjTneHY2C/YTL6l//PXvdRcamfAFFT5EXeR7W6B jj38lRse4D2iJjhtfm2n5VIpYMYT0DkRCkDOb2X9Cuk7gIYnglqU2PSIK4+XRNX0Qvug MxaFeju3O/qjr0fwpiyzXGFqP88m+Xl1L5dYZZDzL0KP7hFvNOdoRSUJO2FV9wUKFdPt f53w== X-Gm-Message-State: APf1xPAfirn+Dbb80p+PydRW9k53EBkVmXgv7axKc271QRM3Y3AH0DSp aiaR216R++GyJveWS5jjOpY1/Q== X-Received: by 10.28.87.20 with SMTP id l20mr2308233wmb.48.1519226985596; Wed, 21 Feb 2018 07:29:45 -0800 (PST) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:c4f2:763f:443f:f48]) by smtp.gmail.com with ESMTPSA id 32sm26552736wrm.14.2018.02.21.07.29.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Feb 2018 07:29:44 -0800 (PST) From: Daniel Lezcano To: edubezval@gmail.com Cc: kevin.wangtao@linaro.org, leo.yan@linaro.org, vincent.guittot@linaro.org, amit.kachhap@gmail.com, linux-kernel@vger.kernel.org, javi.merino@kernel.org, rui.zhang@intel.com, daniel.thompson@linaro.org, linux-pm@vger.kernel.org, Viresh Kumar Subject: [PATCH V2 4/7] thermal/drivers/Kconfig: Convert the CPU cooling device to a choice Date: Wed, 21 Feb 2018 16:29:25 +0100 Message-Id: <1519226968-19821-5-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519226968-19821-1-git-send-email-daniel.lezcano@linaro.org> References: <1519226968-19821-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Daniel Lezcano --- drivers/thermal/Kconfig | 20 +++++++++++++++++--- drivers/thermal/cpu_cooling.c | 2 ++ include/linux/cpu_cooling.h | 6 +++--- 3 files changed, 22 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index b6adc54..5aaae1b 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. +endchoice config CLOCK_THERMAL bool "Generic clock cooling support" diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 7bdc19f..5c219dc 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -22,6 +22,7 @@ #include +#ifdef CONFIG_CPU_FREQ_THERMAL /* * Cooling state <-> CPUFreq frequency * @@ -926,3 +927,4 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) kfree(cpufreq_cdev); } EXPORT_SYMBOL_GPL(cpufreq_cooling_unregister); +#endif /* CONFIG_CPU_FREQ_THERMAL */ diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h index d4292eb..c0accc7 100644 --- a/include/linux/cpu_cooling.h +++ b/include/linux/cpu_cooling.h @@ -33,7 +33,7 @@ struct cpufreq_policy; typedef int (*get_static_t)(cpumask_t *cpumask, int interval, unsigned long voltage, u32 *power); -#ifdef CONFIG_CPU_THERMAL +#ifdef CONFIG_CPU_FREQ_THERMAL /** * cpufreq_cooling_register - function to create cpufreq cooling device. * @policy: cpufreq policy. @@ -84,7 +84,7 @@ of_cpufreq_power_cooling_register(struct device_node *np, */ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); -#else /* !CONFIG_CPU_THERMAL */ +#else /* !CONFIG_CPU_FREQ_THERMAL */ static inline struct thermal_cooling_device * cpufreq_cooling_register(struct cpufreq_policy *policy) { @@ -118,6 +118,6 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) { return; } -#endif /* CONFIG_CPU_THERMAL */ +#endif /* CONFIG_CPU_FREQ_THERMAL */ #endif /* __CPU_COOLING_H__ */ From patchwork Wed Feb 21 15:29:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 129085 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp750641ljc; Wed, 21 Feb 2018 07:30:07 -0800 (PST) X-Google-Smtp-Source: AH8x2265k7SaNYyiDZHpSaMZjd8duwwPz6/DSZ3xJR2zZh0B9CBzuogFy3jYz+HxZ6SmFgM3gQyg X-Received: by 10.98.71.3 with SMTP id u3mr3692526pfa.219.1519227007262; Wed, 21 Feb 2018 07:30:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519227007; cv=none; d=google.com; s=arc-20160816; b=RmJUIZ3aVpMTLzuH3pvnkwVm4CY4Oaq3Ed1XcTadCI0FEQPtDZvjBHaSBGXwfNHbWH 9guMMUo7ubf/aJYj2qIZSh29l9DQVNKKlYSdA41GFLTTYIbTVcvkWk+y6r8LTPWDueeE iQTVZG4j70CfgAkVHQeRlOnKH0Fq50e1eAN0Liwkm81Pi8LadWzoSIQOW2PlQQdmO4ZL Cgtu7E+qZjyv+47F3ANccbdRNYOpgIHRBYnYPGSUieg0ZW6+Cjy0854R91h3v0aAr5PB R8t0FiUu46H3Sbd+r+4FtTnyNjOpNLrayzZnX5FBryFJwqdtUxod7oKLOX3qoYh8nDbn BiWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=kTkJlfqja9pe90J9GmtjZEgGq0M+vVVr/PR/H26gJ7I=; b=SJqXPtoLP1RoMSI3BzVFzHtiB8dq28J+DL/3eW0Hvo9azVsQt+kuRbh5Q+fhgZ28Q8 gpwprrQ60z2CK2QjHedoerpwwzChkVjlIL+vZKXbjo6rRyDD7RPndGQ8sN6VYjm5GwWp VidmshbaYrfwolOvt2s45NRRk2jHsUYSK8INGwcQkW3nmIHfT3mAfVntViUvGd0uRuE3 5CgGZe62daukK/N1ctgFGUzkXrzvxOv9A8F++QzOEcITQ00noz2BtnSqZtU9QV3IzZQk ROnQw0LBvOqLs5zKXEnvqa2CB7HlfeZGzdPHChaJU4PI1YSAZ1Cc/Qcw0syFAlSCUoC3 hg5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LVXPJvu7; 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 69si1518747pfv.15.2018.02.21.07.30.06; Wed, 21 Feb 2018 07:30:07 -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=LVXPJvu7; 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 S938339AbeBUPaD (ORCPT + 28 others); Wed, 21 Feb 2018 10:30:03 -0500 Received: from mail-wr0-f179.google.com ([209.85.128.179]:42870 "EHLO mail-wr0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938295AbeBUP36 (ORCPT ); Wed, 21 Feb 2018 10:29:58 -0500 Received: by mail-wr0-f179.google.com with SMTP id k9so5602606wre.9 for ; Wed, 21 Feb 2018 07:29:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kTkJlfqja9pe90J9GmtjZEgGq0M+vVVr/PR/H26gJ7I=; b=LVXPJvu77BAvoKDRH0LMxYbDayEl4IO02ptF9EQ4I1CGweOi3FE0TvCs40TTI7q+L1 6W4zub3JrLfF1ojK5MOcBuljS939i/N0FK6zqQguRqwXtH5jjJo8j41mJkg2BdebcgSh bv5ixx8fWJ8HTXZeLNZ1P/duKyBOOXD3cOH4c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kTkJlfqja9pe90J9GmtjZEgGq0M+vVVr/PR/H26gJ7I=; b=pjtG/rubboaPqOJBYGbtt4ZetYbuNEJVfpcGNYCI6TTbwIIjJ5TXgbmnTjK5wLrV80 2+wYquILZYvOd5F8Ibg04O6iFhn5bOqrgGugZ4lvNZup7i3ObhpaRltld6QeRfqLfVtv MSzFVOp+SSVpSH3y6JcqodfGe7nncshXHoFGVbCoXeT+bDnvlEHSJlQinZorUj2A4DxS 04v/CNKM7Wr4lYWapHbnEHxaPQfeHCCe3quw8TIV7XJYXQom106+39tLPy0/2JmS1PVz DmT+eletYsOPaimPXJ90H08u/pAa6w22QjkUxz55O0iRluaqAyytwlDu4ACIu5CUmVPB uDFQ== X-Gm-Message-State: APf1xPAWmsuZ3cYJE35bZPb7SSW8NvP66wuwBzM9a3Tsd8CumcotvT6O RLnPAXbyrBcN7NWASPnuB5NDdw== X-Received: by 10.223.158.193 with SMTP id b1mr3600679wrf.156.1519226996548; Wed, 21 Feb 2018 07:29:56 -0800 (PST) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:c4f2:763f:443f:f48]) by smtp.gmail.com with ESMTPSA id 32sm26552736wrm.14.2018.02.21.07.29.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Feb 2018 07:29:55 -0800 (PST) From: Daniel Lezcano To: edubezval@gmail.com Cc: kevin.wangtao@linaro.org, leo.yan@linaro.org, vincent.guittot@linaro.org, amit.kachhap@gmail.com, linux-kernel@vger.kernel.org, javi.merino@kernel.org, rui.zhang@intel.com, daniel.thompson@linaro.org, linux-pm@vger.kernel.org, Jonathan Corbet , linux-doc@vger.kernel.org (open list:DOCUMENTATION) Subject: [PATCH V2 5/7] thermal/drivers/cpu_cooling: Add idle cooling device documentation Date: Wed, 21 Feb 2018 16:29:26 +0100 Message-Id: <1519226968-19821-6-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519226968-19821-1-git-send-email-daniel.lezcano@linaro.org> References: <1519226968-19821-1-git-send-email-daniel.lezcano@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Provide some documentation for the idle injection cooling effect in order to let people to understand the rational of the approach for the idle injection CPU cooling device. Signed-off-by: Daniel Lezcano --- Documentation/thermal/cpu-idle-cooling.txt | 165 +++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 Documentation/thermal/cpu-idle-cooling.txt -- 2.7.4 diff --git a/Documentation/thermal/cpu-idle-cooling.txt b/Documentation/thermal/cpu-idle-cooling.txt new file mode 100644 index 0000000..29fc651 --- /dev/null +++ b/Documentation/thermal/cpu-idle-cooling.txt @@ -0,0 +1,165 @@ + +Situation: +---------- + +Under certain circumstances, the SoC reaches a temperature exceeding +the allocated power budget or the maximum temperature limit. The +former must be mitigated to stabilize the SoC temperature around the +temperature control using the defined cooling devices, the latter is a +catastrophic situation where a radical decision must be taken to +reduce the temperature under the critical threshold, that can impact +the performances. + +Another situation is when the silicon reaches a certain temperature +which continues to increase even if the dynamic leakage is reduced to +its minimum by clock gating the component. The runaway phenomena will +continue with the static leakage and only powering down the component, +thus dropping the dynamic and static leakage will allow the component +to cool down. This situation is critical. + +Last but not least, the system can ask for a specific power budget but +because of the OPP density, we can only choose an OPP with a power +budget lower than the requested one and underuse the CPU, thus losing +performances. In other words, one OPP under uses the CPU with a power +lesser than the power budget and the next OPP exceed the power budget, +an intermediate OPP could have been used if it were present. + +Solutions: +---------- + +If we can remove the static and the dynamic leakage for a specific +duration in a controlled period, the SoC temperature will +decrease. Acting at the idle state duration or the idle cycle +injection period, we can mitigate the temperature by modulating the +power budget. + +The Operating Performance Point (OPP) density has a great influence on +the control precision of cpufreq, however different vendors have a +plethora of OPP density, and some have large power gap between OPPs, +that will result in loss of performance during thermal control and +loss of power in other scenes. + +At a specific OPP, we can assume injecting idle cycle on all CPUs, +belonging to the same cluster, with a duration greater than the +cluster idle state target residency, we drop the static and the +dynamic leakage for this period (modulo the energy needed to enter +this state). So the sustainable power with idle cycles has a linear +relation with the OPP’s sustainable power and can be computed with a +coefficient similar to: + + Power(IdleCycle) = Coef x Power(OPP) + +Idle Injection: +--------------- + +The base concept of the idle injection is to force the CPU to go to an +idle state for a specified time each control cycle, it provides +another way to control CPU power and heat in addition to +cpufreq. Ideally, if all CPUs of a cluster inject idle synchronously, +this cluster can get into the deepest idle state and achieve minimum +power consumption, but that will also increase system response latency +if we inject less than cpuidle latency. + + ^ + | + | + |------- ------- ------- + |_______|_____|_______|_____|_______|___________ + + <-----> + idle <----> + running + +With the fixed idle injection duration, we can give a value which is +an acceptable performance drop off or latency when we reach a specific +temperature and we begin to mitigate by varying the Idle injection +period. + +The mitigation begins with a maximum period value which decrease when +more cooling effect is requested. When the period duration is equal to +the idle duration, then we are in a situation the platform can’t +dissipate the heat enough and the mitigation fails. In this case the +situation is considered critical and there is nothing to do. The idle +injection duration must be changed by configuration and until we reach +the cooling effect, otherwise an additionnal cooling device must be +used or ultimately decrease the SoC performance by dropping the +highest OPP point of the SoC. + +The idle injection duration value must comply with the constraints: + +- It is lesser or equal to the latency we tolerate when the mitigation + begins. It is platform dependent and will depend on the user + experience, reactivity vs performance trade off we want. This value + should be specified. + +- It is greater than the idle state’s target residency we want to go + for thermal mitigation, otherwise we end up consuming more energy. + +Minimum period +-------------- + +The idle injection duration being fixed, it is obvious the minimum +period can’t be lesser than that, otherwise we will be scheduling the +idle injection task right before the idle injection duration is +complete, so waking up the CPU to put it asleep again. + +Maximum period +-------------- + +The maximum period is the initial period when the mitigation +begins. Theoretically when we reach the thermal trip point, we have to +sustain a specified power for specific temperature but at this time we +consume: + + Power = Capacitance x Voltage^2 x Frequency x Utilisation + +... which is more than the sustainable power (or there is something +wrong on the system setup). The ‘Capacitance’ and ‘Utilisation’ are a +fixed value, ‘Voltage’ and the ‘Frequency’ are fixed artificially +because we don’t want to change the OPP. We can group the +‘Capacitance’ and the ‘Utilisation’ into a single term which is the +‘Dynamic Power Coefficient (Cdyn)’ Simplifying the above, we have: + + Pdyn = Cdyn x Voltage^2 x Frequency + +The IPA will ask us somehow to reduce our power in order to target the +sustainable power defined in the device tree. So with the idle +injection mechanism, we want an average power (Ptarget) resulting on +an amount of time running at full power on a specific OPP and idle +another amount of time. That could be put in a equation: + + P(opp)target = ((trunning x (P(opp)running) + (tidle P(opp)idle)) / + (trunning + tidle) + ... + + tidle = trunning x ((P(opp)running / P(opp)target) - 1) + +At this point if we know the running period for the CPU, that gives us +the idle injection, we need. Alternatively if we have the idle +injection duration, we can compute the running duration with: + + trunning = tidle / ((P(opp)running / P(opp)target) - 1) + +Practically, if the running power is lesses than the targeted power, +we end up with a negative time value, so obviously the equation usage +is bound to a power reduction, hence a higher OPP is needed to have +the running power greater than the targeted power. + +However, in this demonstration we ignore three aspects: + + * The static leakage is not defined here, we can introduce it in the + equation but assuming it will be zero most of the time as it is + difficult to get the values from the SoC vendors + + * The idle state wake up latency (or entry + exit latency) is not + taken into account, it must be added in the equation in order to + rigorously compute the idle injection + + * The injected idle duration must be greater than the idle state + target residency, otherwise we end up consuming more energy and + potentially invert the mitigation effect + +So the final equation is: + + trunning = (tidle - twakeup ) x + (((P(opp)dyn + P(opp)static ) - P(opp)target) / P(opp)target ) From patchwork Wed Feb 21 15:29:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 129086 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp750768ljc; Wed, 21 Feb 2018 07:30:14 -0800 (PST) X-Google-Smtp-Source: AH8x224dHqMxLFWY4jKhLyQPwgfN7vrS8NTX942eP+2qiYBnJbvQka33btn0gybJQpJElCpETDLT X-Received: by 10.101.80.3 with SMTP id f3mr3098813pgo.242.1519227013987; Wed, 21 Feb 2018 07:30:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519227013; cv=none; d=google.com; s=arc-20160816; b=RhJZg1i8db99nHYTQk2cQhNoM984YZpTZ7TcD/vgIRgDNi0/sUdX+DKXSZD/vsMgam 1G22mSAjtro4fZFHWGLPbvezy266zXzInxA2R11gue9h92k8Svym0I6j3sG+Swya7Jld xQFd6HkVlCEkYHk2Foy/Ydb4xU1KinyOOU5LLbh/cbfxCSmo46oHsEJIC2CpXaTp1ab7 ahjMDcr2UXNZ73b5rYhc76mMLUi2azy76wgrP7NtkEECxgh47yC+NPkDpaUJvq72C20o kYOKS2sUbjmFutp9e9rgMXU45+BIImWZDMWlAVXO3E70PKWZo0VVuhxjr8eAsf/s1nH9 R8hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ZqxBlmNsHznBskX1KBTP0UGbIstMc1gUTKwTLHUhTJE=; b=hNsrJREDaSPeTHLfVtW0oBFK8ESFWyi4DCby7dPFauGFNCf1UFPXciaV3/nO7v9jS9 DR0SrSoxalW5NO2RUGOEBAuMR7havoT2sV9/N/ELpRucZJmbihY9kwL3clEgEse081Ai bQA1H4dU8tbZhAX7QpmB3YNCqCe1w1BjAkRYcB0cH+55NB5hOBYmC6Q9HbZGrwpgtZwD B6hl3gtwoOsDEYDo1ssvTvwD4AAnv3WXuY5fWpTvt0zgYINOOUyXIB59tNH7GhPNEdIt KdVWj/4yA+PHRgLE/Ic3SX72SNTC6yBf6IVu/KCaQsTmaxr0Rwqk6vJALG981HFztk73 E2uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Js+ESfZu; 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 r4si1203020pgp.603.2018.02.21.07.30.13; Wed, 21 Feb 2018 07:30:13 -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=Js+ESfZu; 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 S938354AbeBUPaJ (ORCPT + 28 others); Wed, 21 Feb 2018 10:30:09 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:39530 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938327AbeBUPaC (ORCPT ); Wed, 21 Feb 2018 10:30:02 -0500 Received: by mail-wr0-f196.google.com with SMTP id w77so5602669wrc.6 for ; Wed, 21 Feb 2018 07:30:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZqxBlmNsHznBskX1KBTP0UGbIstMc1gUTKwTLHUhTJE=; b=Js+ESfZubhJgUaTrLDJBqPj/9NIEKV6I+ePSvi8R9NFJhQZuWnEmigEL3frvl08a6+ uBa/hwdIJE8N5cJ7/NUAKMzfMMMW9L4NgyYTkaYrzcXzlEjAEbglNFVBzy4+nvkZtuay lwVryUBoeGOect0PiXamXDQGKLqzU7Zc6YwtY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZqxBlmNsHznBskX1KBTP0UGbIstMc1gUTKwTLHUhTJE=; b=mn9OpnRPCHkkQvBt/XTAU6bu3HuUlW3KSH6uZTnP/Ey2TBvKWRDLgndnqLiVCjR6iB edmb2VpLY2X/2L+HAN98ZA2bpmvrzm4mh93AqMsZ4vnaSH0/oOKHX9KgTgtw+6AoN9kU /6wKP6Ox77rZVsme0GmJBTw9hLuM8nMkR5yllzCfANndTE9WVd6OfKp/3uX+qi1R7Cwk 9r3f7yPT2JixfaXQy/F/ddUWqutBbcfpsIJedA9Z8FAWB77hGZhULVoX9Sxp5qGF7i9z iFNS3PkAxksG86B/9a1Owc5m31C2Riv2EJMczo5F2dx467h3o/tbglKmiCCDd3BmK6SS agaQ== X-Gm-Message-State: APf1xPB/eVxhk3wDlLVIw8PC/xLY21yHNZQuOO+tlPKxyY2cy0IQAOx4 6YvgrtpM8S0KYvErymXVW+3YFg== X-Received: by 10.223.134.12 with SMTP id 12mr3291571wrv.193.1519227000876; Wed, 21 Feb 2018 07:30:00 -0800 (PST) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:c4f2:763f:443f:f48]) by smtp.gmail.com with ESMTPSA id 32sm26552736wrm.14.2018.02.21.07.29.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Feb 2018 07:29:59 -0800 (PST) From: Daniel Lezcano To: edubezval@gmail.com Cc: kevin.wangtao@linaro.org, leo.yan@linaro.org, vincent.guittot@linaro.org, amit.kachhap@gmail.com, linux-kernel@vger.kernel.org, javi.merino@kernel.org, rui.zhang@intel.com, daniel.thompson@linaro.org, linux-pm@vger.kernel.org, "Rafael J. Wysocki" Subject: [PATCH V2 7/7] cpuidle/drivers/cpuidle-arm: Register the cooling device Date: Wed, 21 Feb 2018 16:29:28 +0100 Message-Id: <1519226968-19821-8-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519226968-19821-1-git-send-email-daniel.lezcano@linaro.org> References: <1519226968-19821-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Register the ARM generic cpuidle driver as a cooling device. Signed-off-by: Daniel Lezcano --- drivers/cpuidle/cpuidle-arm.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.7.4 diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c index ddee1b6..c100915 100644 --- a/drivers/cpuidle/cpuidle-arm.c +++ b/drivers/cpuidle/cpuidle-arm.c @@ -11,6 +11,7 @@ #define pr_fmt(fmt) "CPUidle arm: " fmt +#include #include #include #include @@ -172,6 +173,10 @@ static int __init arm_idle_init(void) goto out_fail; } + ret = cpuidle_cooling_register(); + if (ret) + pr_warn("Failed to register the cpuidle cooling device\n"); + return 0; out_fail: