From patchwork Thu Apr 5 16:16:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 132857 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp6478405ljb; Thu, 5 Apr 2018 09:17:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+cpfEGnYYVP3fF4VBQogjkbq1hD8gTwCmuoBkQvwB56LvWhj/MwWUQ/Repp+jnc5jZfwwA X-Received: by 10.101.76.129 with SMTP id m1mr15074497pgt.90.1522945020465; Thu, 05 Apr 2018 09:17:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522945020; cv=none; d=google.com; s=arc-20160816; b=d1ToMasfTg5fHauYSG8LyN41AVuANb1IUgzHxMqX+CpCXI/RkXzk0Wk5PVZ0craXcA YXg9HoqXiixnqSa9FSGOShUrFC1lYDP6/q326/eDu/Z9EqmfbQ5tS4Tjwa9KWMCwtvgO gs7by9owtNVzv9UUdp2gUPOHNMdca0EByqpMBTZBTSYZThX3S5mVaqWWLdUPm4wfnK7C ETCoZQ9P8viCS7j00sT72TUE/Kjk2yJeehWF4QRgQiidZDO13z8Ts3I2QOACaf1r77k0 ehvWhrU070EfvA5E2fLu4Ya7LeZEqX48EPPrBWMbSkmI3rXk2DrRjLSbgOS/ZSZJiFXo JtYw== 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 :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=0nbDIDquwQlvN1h5o5qzq6k0oqpKoGdx8o1EE0pTaXk=; b=KmiquSe3niJwMYSsON7LlarSCJ41g/NcK3+U9GBy3tejV5hsMhpI4xH4zlDJEn1UY3 lleXg1z0JiVqBEXkz4ujszKzP8FPWVLCY5iPQJBTbjFLSd+B/zZ6aYurq6Wl+yDIvdam bfACFLdxieCfEu8ttQRBe4589FknNF53QbU2+mOYNSQMNKUsKXmXmQ5d/0yq742+e97B ND5/cjhzRGKAul1tvKUi4llSfYq/AmNELEDmo9gW7NpWuxI5B8eNV5YscsVSWqpRBasz SoaJQi7uiDsS7f9OHq5i9eBx5l/ChFQSplV5IjZDHCGRcI3t1TkB8vtPdwQ6Vt6R3K1p FMfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LOyWfuKJ; 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 f90-v6si6249260plb.162.2018.04.05.09.17.00; Thu, 05 Apr 2018 09:17:00 -0700 (PDT) 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=LOyWfuKJ; 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 S1751495AbeDEQQ5 (ORCPT + 29 others); Thu, 5 Apr 2018 12:16:57 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:44746 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751179AbeDEQQz (ORCPT ); Thu, 5 Apr 2018 12:16:55 -0400 Received: by mail-wr0-f195.google.com with SMTP id u46so29386838wrc.11 for ; Thu, 05 Apr 2018 09:16:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0nbDIDquwQlvN1h5o5qzq6k0oqpKoGdx8o1EE0pTaXk=; b=LOyWfuKJe+owTUF9AGWO9kvCFl8Ru23sbvmJkX670C0FrKCPbYYjgxGdW4kj9QvMCT MrbULVKV97ISU2GeLygWa8Pkd2Zmnp6HpPqvS1IBbH3xpUxKieXYvdFguV0jQ2kiYDhn PjZ8J3Uv/HzSjY8id2TMolNjzj4v23EvrUFao= 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:mime-version :content-transfer-encoding; bh=0nbDIDquwQlvN1h5o5qzq6k0oqpKoGdx8o1EE0pTaXk=; b=TlGFzH3OTNYXxklSG4sJpGXz9QoOwRLLm5BOlG9sLXPIJuE0keYruaBrsJYEiU/ewq hjER/XXK7exXNQcSNcuNe4psgeerw1PgH/QCkSzX3gqigay7qrcfIvtaG1HsAHzIsD2f 50gQZI3zF0cTrr36zhbBkiyuf3EFrl/rieFa7rLW7HDiq9RQ+6vmPFjlUb7pqh8D79uc n68Yh4ZeaVTGveyXvWoL2Om65UCoP3DjS/GGI8E/pQrqiNRXm2LEOyERukxfpG61SbpW YRtwxIQeBFDMxcMnorB/qIc8bUjgGruGXQvmgCk4zCrYnL5Bi9uV0VrprUCWNUqaPvCH CgtQ== X-Gm-Message-State: AElRT7FC84Beq9uSfp4Y93c9ERqRgow5ctYA/fXA8l06GXHFhpzB6Chn KrIhBipLaL2CH5YS9dOaVV3MtQ== X-Received: by 10.223.200.138 with SMTP id k10mr17921775wrh.282.1522945014265; Thu, 05 Apr 2018 09:16:54 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:d9b6:ce30:b76c:2e56]) by smtp.gmail.com with ESMTPSA id 39sm16103904wry.89.2018.04.05.09.16.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Apr 2018 09:16:53 -0700 (PDT) From: Daniel Lezcano To: viresh.kumar@linaro.org, edubezval@gmail.com Cc: kevin.wangtao@linaro.org, leo.yan@linaro.org, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, javi.merino@kernel.org, rui.zhang@intel.com, daniel.thompson@linaro.org, linux-pm@vger.kernel.org Subject: [PATCH v3 0/7] CPU cooling device new strategies Date: Thu, 5 Apr 2018 18:16:37 +0200 Message-Id: <1522945005-7165-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changelog: V3: - Changed this description to be more clear with the numbers - Took into account the comments for the documentation - Switched to the smpboot threads to use the hotplug API - Removed usage of the waitq as the code relies on the smpboot - Removed the macro DEFAULT_IDLE_TIME_US and use directly TICK_USEC - Removed the list to store the cooling devices - Fixed static for the percpu cpuidle_cooling_tsk - Removed the BUG_ON in the cpuidle_cooling_runtime function and return 0 - Used this_cpu_ptr instead of per_cpu_ptr(smp_processor_id()) - Moved the function cpuidle_cooling_release closer to its caller - Fixed spaces instead of tab - Fixed function description log - Cancel timer on release - Fixed return value doc - Changed the initialization so the cpu numbering is no longer a problem - Removed useless atomic_set(0) - Moved the thermal cooling device creation after the cpuidle cooling device - Let the refcount to zero at init - Moved the initialization message at the end of the function - Changed the cpuidle_cooling_register to return void - Removed message in the cpuidle-arm driver if cpuidle_cooling_register fails V2: - Dropped the cpu combo cooling device - Added the acked-by tags - Replaced task array by a percpu structure - Fixed the copyright dates - Fixed the extra lines - Fixed the compilation macros to be reused - Fixed the list node removal - Massaged a couple of function names The following series provides a new way to cool down a SoC by reducing the dissipated power on the CPUs. Based on the initial work from Kevin Wangtao, the series implements a CPU cooling device based on idle injection, relying on the cpuidle framework. The patchset is designed to have the current DT binding for the cpufreq cooling device to be compatible with the new cooling devices. Different cpu cooling devices can not co-exist on the system, the cpu cooling device is enabled or not, and one cooling strategy is selected (cpufreq or cpuidle). It is not possible to have all of them available at the same time. However, the goal is to enable them all and be able to switch from one to another at runtime but the thermal framework may need some attention regarding the mitigation vs switching the cooling device at runtime. This series is divided into two parts. The first part just provides trivial changes for the copyright and removes an unused field in the cpu freq cooling device structure. The second part provides the idle injection cooling device, allowing a SoC without a cpufreq driver to use this cooling device as an alternative. The cpuidle cooling device has been tested against the cpufreq cooling in the same conditions: same board and a fan on top of the SoC. For optimal trade-off between perf vs cooling effect the cpuidle cooling device acts on one cluster only, for the bL SoC, the big cluster is idle-mitigated. The targetted temperature is 75°C. Command: -------- time ./dhrystone -t 8 -l 100 ------------------------------------------------------ | hikey6220 | hikey3660 | ------------------------------------------------------ | cpuidle | cpufreq || cpuidle | cpufreq | ----------------------------------------------------------------------- | DMIPS avg | 1007 | 922 || 2279 | 2250 | ----------------------------------------------------------------------- | rtime (sec) | 1.21 | 1.19 || 49 | 51 | ----------------------------------------------------------------------- | temp avg (mC) | 75043 | 74862 || 75640 | 75978 | ----------------------------------------------------------------------- | temp stddev | 309.357 | 6205 || 3258 | 1950 | ----------------------------------------------------------------------- | temp min (mC) | 74235 | 71880 || 66395 | 71315 | ----------------------------------------------------------------------- | temp max (mC) | 75805 | 77375 || 84640 | 81360 | ----------------------------------------------------------------------- We can see the both cooling method have similar behavior in this configuration. Daniel Lezcano (7): thermal/drivers/cpu_cooling: Fixup the header and copyright thermal/drivers/cpu_cooling: Add Software Package Data Exchange (SPDX) thermal/drivers/cpu_cooling: Remove pointless field thermal/drivers/Kconfig: Convert the CPU cooling device to a choice thermal/drivers/cpu_cooling: Add idle cooling device documentation thermal/drivers/cpu_cooling: Introduce the cpu idle cooling driver cpuidle/drivers/cpuidle-arm: Register the cooling device Documentation/thermal/cpu-idle-cooling.txt | 166 ++++++++++ drivers/cpuidle/cpuidle-arm.c | 3 + drivers/thermal/Kconfig | 30 +- drivers/thermal/cpu_cooling.c | 508 +++++++++++++++++++++++++++-- include/linux/cpu_cooling.h | 12 +- 5 files changed, 692 insertions(+), 27 deletions(-) create mode 100644 Documentation/thermal/cpu-idle-cooling.txt -- 2.7.4