From patchwork Tue Dec 8 16:41:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 339751 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp3845319jai; Tue, 8 Dec 2020 08:43:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJzG9JtY2MxfLF9URx2v5ruDHgWndNQoMwIKMpPUsLexUX9o6SGHbbPh1VSWG+JHA0hPaotq X-Received: by 2002:a17:907:20dc:: with SMTP id qq28mr23577773ejb.403.1607445816544; Tue, 08 Dec 2020 08:43:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607445816; cv=none; d=google.com; s=arc-20160816; b=U1vgpyCdn6Td2nXUyB+c4Zv14Xzj07IUY87sMQFLVSPNlvP7zuD/R8uwbc17+bKvdX fH7QkNRD2mVJL1aMCBCmua/573CDjxJMwHbEZ7ijzqU7Yt5wcLK0GQ6jMGBJxTS7KM9q uZdcUwX8/lf5bSm9iZRSRwmmoQT1Pjpo956ktZ709T1utVfDo0ZV66rbOzgGjLPVG4zn MO9WwbMhs8SJMQd/pU2rhF9LkN6TRsVQu8jhhvvvHZkd09VheudoMcLB6Am0nGI+lcBl zOJMu4bkNNPmc8QgKeqRyDBjse5ZB/EmAFvXHwfhomxt+yKHJNIuD7izg6n+prQ7qHMv QWFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=lRHO/dd4K0+UmYNDK5G5hy4CRUx6ajfflGnapOkGJI0=; b=bKxpJ3eDORPsGQV7kp2HfhnI81DrRfZzCofxDItR2zNXGJQxnb6BOjTB0wMuK2JmQm xoTL2HeBiZjDMGyt+TGWSRdt7eqP7b5zIigqjTZPPkrd8nMpCTZUKl9oX6ULsGwU81Rx KxlAz89U/69mUPTCTE0TjewjSLqTPIy8JfpGExW+OjoUETklSZMS3a8Ea8dAK4D1CfwA 4GRgQXta6rQ9G/vgRzrF1QJT6SioqTygtrbCCnVqmaZ3HUqGyTEKqmQe9uLJZ8k59Htw y/+0VkFiYuw0s5dPAP1ytNQDY3b/sZMhggh/GIKM2BjeJ43y1O/8T0dx+McHpmRvKXEG n9MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KfCs9sjA; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-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. [23.128.96.18]) by mx.google.com with ESMTP id i11si13177074edb.323.2020.12.08.08.43.36; Tue, 08 Dec 2020 08:43:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KfCs9sjA; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-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 S1730524AbgLHQnB (ORCPT + 8 others); Tue, 8 Dec 2020 11:43:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730258AbgLHQnB (ORCPT ); Tue, 8 Dec 2020 11:43:01 -0500 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A832AC061794 for ; Tue, 8 Dec 2020 08:42:20 -0800 (PST) Received: by mail-ej1-x644.google.com with SMTP id m19so25419677ejj.11 for ; Tue, 08 Dec 2020 08:42:20 -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:mime-version :content-transfer-encoding; bh=lRHO/dd4K0+UmYNDK5G5hy4CRUx6ajfflGnapOkGJI0=; b=KfCs9sjAhAbjk8EjSJ+o/JIZLkCTlFFa6i1SDAFCvTt3CMQenAzLbZmWIbp2J5LpAz TWJE5PIb62HUICjXTqLY7vd+iWm1o5jE3e4e7Cq3lfG/XAJB/FORTRhHtf95Kn2WnN5f qcy+Ly6jEtjQTWB5nGlnImjenkVO2bigsyuRmFdsTYsV2ooYgKPUm/hd+iX3s5Fa/+c/ alfhsezXjo/FdmbmRZYaI36Ti6BNUdCN8Cciiu5/KIw356FarV+W0tC5715BB0uFab/D EW9275UxkpxG9OzjiruKMCYHT2qEVPtSLJsJ8sue42sP5jMJpCxCirdpy0tcngvhRGJo LF4A== 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=lRHO/dd4K0+UmYNDK5G5hy4CRUx6ajfflGnapOkGJI0=; b=J71oIgnwNHjbPPP78pHNJ82owXWw1Irh0p3QmsPj0E8NBYxFzIOVkSTL3PRReLGDvp Wbgh7iqI/n7sZKQEYtIQ6b45uhIlbCDzQtZxmJodUM7liw7rSwY/jMmVen87lMUS9BDR Is/zn3UzKlFH8JJnIkDiv93g9u0bDLoXPR+5VdBz40JqwPeFsDPNMkvvIO6eWTSA2ssf qR1SRAiMmtXa1E0HDErlqIx9+wV79EWpFOnpo42nUdrZlzoj83n0+5ASKt2qeyxAfydp C6cw7ZHF6ZaJYuwMOOBBALddU6Sh0t9nFw/zfU+kIW2DU3HQXkvEychs5KffgM5xInBD HOog== X-Gm-Message-State: AOAM530+1e/8bxUAH2WSgflRM1fq53GTuux7kleD2+/QTM20bW81qfr3 4r4IFwN9+JKKxRvs+nIu26EY11aj3cuu9A== X-Received: by 2002:a17:906:1102:: with SMTP id h2mr15819717eja.296.1607445739255; Tue, 08 Dec 2020 08:42:19 -0800 (PST) Received: from localhost.localdomain (lns-bzn-59-82-252-158-132.adsl.proxad.net. [82.252.158.132]) by smtp.gmail.com with ESMTPSA id t19sm16150546eje.86.2020.12.08.08.42.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Dec 2020 08:42:18 -0800 (PST) From: Daniel Lezcano To: rjw@rjwysocki.net Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Daniel Lezcano , Thara Gopinath , Lina Iyer , Ram Chandrasekar , Zhang Rui , Lukasz Luba Subject: [PATCH v5 0/4] powercap/dtpm: Add the DTPM framework Date: Tue, 8 Dec 2020 17:41:41 +0100 Message-Id: <20201208164145.19493-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The density of components greatly increased the last decade bringing a numerous number of heating sources which are monitored by more than 20 sensors on recent SoC. The skin temperature, which is the case temperature of the device, must stay below approximately 45°C in order to comply with the legal requirements. The skin temperature is managed as a whole by an user space daemon, which is catching the current application profile, to allocate a power budget to the different components where the resulting heating effect will comply with the skin temperature constraint. This technique is called the Dynamic Thermal Power Management. The Linux kernel does not provide any unified interface to act on the power of the different devices. Currently, the thermal framework is changed to export artificially the performance states of different devices via the cooling device software component with opaque values. This change is done regardless of the in-kernel logic to mitigate the temperature. The user space daemon uses all the available knobs to act on the power limit and those differ from one platform to another. This series provides a Dynamic Thermal Power Management framework to provide an unified way to act on the power of the devices. Changelog: V5: - Fixed typos in documentation - Added a dtpm NULL pointer check in the dtpm_register() function V4: - Changed fine grain spinlocks by global tree mutex lock - Dropped tested by tag from Lukasz - Fixed rollback routine in dtpm_cpu - Checked freq_qos_request_active() when releasing the dtpm_cpu node V3: - Fixed power-limit computation in addition with the hotplugging - Improved the encapsulation - Added specific ops for the leaves of the tree - Simplified API and self-encapsulation - Fixed documentation and generated it to check the content V2: - Fixed indentation - Fixed typos in comments - Fixed missing kfree for dtpm_cpu - Capitalize letters in the Kconfig description - Reduced name description - Stringified section name - Added more debug traces in the code - Removed duplicate initialization in the dtpm cpu Daniel Lezcano (4): units: Add Watt units Documentation/powercap/dtpm: Add documentation for dtpm powercap/drivers/dtpm: Add API for dynamic thermal power management powercap/drivers/dtpm: Add CPU energy model based support Documentation/power/index.rst | 1 + Documentation/power/powercap/dtpm.rst | 212 ++++++++++++ drivers/powercap/Kconfig | 13 + drivers/powercap/Makefile | 2 + drivers/powercap/dtpm.c | 473 ++++++++++++++++++++++++++ drivers/powercap/dtpm_cpu.c | 257 ++++++++++++++ include/asm-generic/vmlinux.lds.h | 11 + include/linux/cpuhotplug.h | 1 + include/linux/dtpm.h | 77 +++++ include/linux/units.h | 4 + 10 files changed, 1051 insertions(+) create mode 100644 Documentation/power/powercap/dtpm.rst create mode 100644 drivers/powercap/dtpm.c create mode 100644 drivers/powercap/dtpm_cpu.c create mode 100644 include/linux/dtpm.h Cc: Thara Gopinath Cc: Lina Iyer Cc: Ram Chandrasekar Cc: Zhang Rui Cc: Lukasz Luba -- 2.17.1