From mboxrd@z Thu Jan 1 00:00:00 1970 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=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 C6452C433FE for ; Tue, 8 Dec 2020 16:43:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 775E523B00 for ; Tue, 8 Dec 2020 16:43:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730531AbgLHQnB (ORCPT ); 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-Google-Smtp-Source: ABdhPJwuTYn2PCtf27aYV9lEwk/hkNPq/4oVElXDbSYN5MnVac0/xmcuysMZmnFAgoFeiwgJ0CtkLw== 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