From patchwork Mon Nov 23 21:42:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11926797 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E360EC2D0E4 for ; Mon, 23 Nov 2020 21:42:59 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5451720C56 for ; Mon, 23 Nov 2020 21:42:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZexLw4TI"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MTjtpKkU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5451720C56 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=lz/y6aj9EwVCH0cy2N1C69iUxyUG4CmBd8O2NA9DYhQ=; b=ZexLw4TIwdAhgzoqdX1aM1bHnB eEudl6Mdm5TRZ8YpTvBmv+wJklIP7Je4C8d2mlihHlxiBzxA4zQSmSbuptPouz2PPRUMFvml8gIMV kGzbEtG/pocAwRATQlQSFbsB+WGHj/qhB5jQ8aHkW1JqDJJYS6Mk4E12yPe8oQ8X33S5N/HIxB1d+ r8MTG/0nlgz6uWGAl9sp7+lzc63chLOChPaBEUBPyO3TyX7eeqUPRvAe3lL1GCROxpl1JH9Q4n4xw trtvYFVv7es/0VWncHNAhr3pt4rulevGzXa/A0zPdO4En7nQqpCtddn1A1y7T5jBugzJqfsfFy7b2 2k1lkPqw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1khJbM-00058B-LK; Mon, 23 Nov 2020 21:42:24 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1khJbJ-00056V-3F for linux-arm-kernel@lists.infradead.org; Mon, 23 Nov 2020 21:42:22 +0000 Received: by mail-wr1-x430.google.com with SMTP id 23so20244582wrc.8 for ; Mon, 23 Nov 2020 13:42:19 -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=FURT5aJ8Y84zCkcTMva4r1vaAztUoaAN182A6565glQ=; b=MTjtpKkU+YwmI1AycB693SeABSqeeKRW43pQSRko+D52FGBzBj5GQA495bL1s7YX7x K7eV7Ygp9x4KCPPuAIVfUQvIl+fXsghVLEzy1EQeEKmxP3eomyN17NrC9gLwGRij8uVY H64YyeDSPxfCk8JmoKDvdNQEhJmh78Fwy0FbjA/wOzfhlcoykJO70sDBeeVqO1GrImd0 SXwohJ8duggSGepknmCxaVz/FYtI95mRECmdmwIjfW7NRiFqpVEEA+y5X9QHXppiHu2S 04XMKUNZrxqc8MTl4PdO5tjAEobMUeKR9zaH4rNmJDi5TVJVpXmato9o3mqoVrncyaXd J9gg== 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=FURT5aJ8Y84zCkcTMva4r1vaAztUoaAN182A6565glQ=; b=MZ0fgdDKqxjx9nk6MRRRBw92jKev9nrOeQNcl/RPW43x5vETj+gHEnCFW35aA9Au2/ G1gexRkB6nGTJv8u/uxaPerZJEHnZC2u7rTvgaan7CtJzmtziTXWJzWcb7fS+PH6aJ00 HMcMfRnahZKup5I5x+30gACYazaVinrJN7fLs8/j3qfbFrJKiYEhSPH7M3e8gbqMOKO+ VL+CApeA+QZwn4uXvzumvg0W2cUMzbCzHWU2ZflUToR2cv/jDkwSL7InhfhDO85g3eqE NTdbgeNJWE/LfdsICpAozCBO/hRp8VCA6I9n2+U6IY0gDCSqa0bZtYEvsrJCXnv0kD45 g1BQ== X-Gm-Message-State: AOAM532lENlVQ2StNEc4f91FVLHCKEGumDrxRhLMp4c6Mao6AfhmK52F L0+amroOzeVcO7vL71aTFM75Dg== X-Google-Smtp-Source: ABdhPJwqDNGVlTIdxmQ5yPFhXOgcm4zJ3MQNR1aBInJ/WQxwwPe2t5EPF1kQSngaK8GWo6pSSSX2Lw== X-Received: by 2002:a5d:4084:: with SMTP id o4mr1665471wrp.278.1606167738095; Mon, 23 Nov 2020 13:42:18 -0800 (PST) Received: from localhost.localdomain (lns-bzn-59-82-252-157-164.adsl.proxad.net. [82.252.157.164]) by smtp.gmail.com with ESMTPSA id 35sm22400598wro.71.2020.11.23.13.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2020 13:42:17 -0800 (PST) From: Daniel Lezcano To: rjw@rjwysocki.net Subject: [PATCH V2 0/4] powercap/dtpm: Add the DTPM framework Date: Mon, 23 Nov 2020 22:42:04 +0100 Message-Id: <20201123214208.11007-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201123_164221_439016_CC69F8BB X-CRM114-Status: GOOD ( 17.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, corbet@lwn.net, ulf.hansson@linaro.org, linux-pm@vger.kernel.org, daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org, ilina@codeaurora.org, rkumbako@codeaurora.org, rui.zhang@intel.com, lukasz.luba@arm.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: 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 | 210 ++++++++++++ drivers/powercap/Kconfig | 13 + drivers/powercap/Makefile | 2 + drivers/powercap/dtpm.c | 441 ++++++++++++++++++++++++++ drivers/powercap/dtpm_cpu.c | 252 +++++++++++++++ include/asm-generic/vmlinux.lds.h | 11 + include/linux/cpuhotplug.h | 1 + include/linux/dtpm.h | 78 +++++ include/linux/units.h | 4 + 10 files changed, 1013 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 --- 2.17.1