Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3310692pxu; Tue, 8 Dec 2020 08:45:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2gW8dtrXv78M3/6D6RF99wyzDe5eBkVcJUNdZZ7oL9xJzxqCbJUb+LtPmnPfzOX/WdKCK X-Received: by 2002:a17:906:3ac2:: with SMTP id z2mr23053582ejd.26.1607445927172; Tue, 08 Dec 2020 08:45:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607445927; cv=none; d=google.com; s=arc-20160816; b=j7B9r8dIxSBRi2p3bIprQVGgKrU7lhkV6xUTDO8vfbnVRDXTTqXIsdjDcUiUkIhY9T dPHMq+3F6te/wOGD4pae1gfsA+YKHHLTjF58Tm+UeXSQJ2yYJpntKKnjE0Z9jHnftAa9 ZTIZPYfCAvQNufs9K6ggVVgjtDDBELSkuUaM1rV/y0SkLMO4h1GR2TZY8abD9duq9pCU MX/J6xMLDvhdCV6UX69qau3aXNPcHlLIxWvYYS6KAPbrxZWkBNSZ3YyH8AzhFXDMFyZc L0WBC1RfxEfdVCoI6hAdecIovSOnIBSjUje53HCszjDFS2+rQQ5tJWbRMYhnurCs7ord Kucw== 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=gOmkWkHuHy4Gb4FfIQWdkD+bla2WmtUKPJO1TFN0wbeABwCjMVdefkxBKvZ0oNEN2l t2F5hPyA81I7leK+RBqucRL7kkgKf4qmxnvFDnhYWO0eDawlp58kgqqznTS8mJPLNPhx YIVBj6WZ6kvLojKUOGJSxVCSAhkbC/vPC2uewe8Zrnxmm/LYwIyUmSmFAlCeiCwv4Osp 93SPBKhmubexAzYRvvJqeRwR1ioKbeQU2g5EuVzZMKiPOqy+8+j/PC+68ZSPCumCafqK 7CcEKtqzZA64onXO4OMrc0P1Eg1BmIAql13t7YM37L6L9d+3ANU2j6qXBN7ER+tB8ZBj XAcQ== 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-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id g3si10030558edu.11.2020.12.08.08.45.03; Tue, 08 Dec 2020 08:45:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1730526AbgLHQnB (ORCPT + 99 others); Tue, 8 Dec 2020 11:43:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729948AbgLHQnB (ORCPT ); Tue, 8 Dec 2020 11:43:01 -0500 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A061BC061793 for ; Tue, 8 Dec 2020 08:42:20 -0800 (PST) Received: by mail-ej1-x641.google.com with SMTP id n26so25454798eju.6 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=TWmM9Ngo0KYzWNptBJBxBsaVSSlx0gWQVjMDNIc1z7Q4oPxYW6NUCWWGqFwyJI+FER uWz1tLNeZwzTw0SGE3YCzKi2Q2kwVs7B1rnvA1FCvUxJpgw5OtMtEnhE4aWBD8n9dbo1 muhymosflcG85RO4LBgvdaWAyBuz/uZqZcyp8VoGzVzC+5WRDv0ygC+X11K6Sblb9m/z 3CPhtKOvHwgGT0K/Cw3aDeD4zG1Zb07UCLvB+lGhZRp7MO9YWuKyRGb8s1ulNU2+jvW0 G6Hr+BloPsxKI28q11tremmzXIFTWSSDnfoSS9ARbROvoTnaIWL6GDJN0EsFu+BZeqEV 8TrA== X-Gm-Message-State: AOAM531cWZ1NSYy0X6/9rFa8Rpy72XAah5dslSrOJj13xcq6G30fPjCr qBD2g//R+tUzlLdYSWb+K20G1A== 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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