From patchwork Mon Nov 16 15:26:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11909639 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=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=no 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 741CEC61DD8 for ; Mon, 16 Nov 2020 15:33:57 +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 DAED0221FD for ; Mon, 16 Nov 2020 15:33:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mMtBnvuj"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="XpH8iEeu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DAED0221FD 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=NxkFv7v++IGhGcQLf56ac+w6cM1NbhuS3xuy2USEqkw=; b=mMtBnvuj+ueaSwv8EVelBqRHgi Aqk/gqjRPa9xHNXyYIvOgseLJnJaScJFXaR5STHdbjM+TVSQibD+f0X4p0SnovWIN667bthWsJ8k7 sVZchMZSpgS0azr5lgjlGzXmbnkcIsdqVVC+tPqdw/cTwb+8YftGkdTZ8idpDWG0ui642XI3BuDRE 2qVZkqDz0fpsERAdHhfWqgWzlqjANdOlyX8uCJJMfGc61D6B7Dbq5Nab7iq8NQ/HTPYhXmBGKGtY7 z0ZS1jgixCCoz6JvrQ0QjdiYj27uCdaMG/f9MtcFRaazMo+FaKVB0OtZnEz/qW1TVnfNlxJyOMpJF wIPB1W0w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kegUK-0003FQ-5d; Mon, 16 Nov 2020 15:32:16 +0000 Received: from mail-wr1-f53.google.com ([209.85.221.53]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kegPQ-00010T-Qf for linux-arm-kernel@lists.infradead.org; Mon, 16 Nov 2020 15:27:34 +0000 Received: by mail-wr1-f53.google.com with SMTP id j7so19111164wrp.3 for ; Mon, 16 Nov 2020 07:27:11 -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=/nUNOFLN6IikzihRcWpgoGdh6TnItZX1uNVpsszzMXQ=; b=XpH8iEeu08Fe9sEZDYnOcbXjab9a1kGi0+K3Vf7ZkwPegpg9qLfQKOhYvbxG/EvDeO /KvmOdIW/ZJpRWDinTXXRTpi7ZyVTUzq/8Oui6wJ3RwUSpzPhNEpUPyrwcbaBdFyTue1 LKlXJEZCq5kY552c8gYHd3zYadmq0gn7oiWmCrBDRnTDcGhPyuUpG4QctH9AGLFLm3YO 14Xv7zIDRvds0IJuR2W4WYlrXs/o73DgDOh1Py54MHup2GdE+i33X68ygR0taw//kaiu xej+e7UfwlbvBer88QzQStJ0+YPd1HC6OQu0qg+6ti8nDabxTqLnHacev3oGtuJaHryW ivMg== 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=/nUNOFLN6IikzihRcWpgoGdh6TnItZX1uNVpsszzMXQ=; b=PrIHrcxVnslKEdsXp+KCr6koswDIuujkndyFa8b5AGlhAWPZb+duyekaQL+PMbAkOz qKu/Gd815L6iwmopVxg1f5XXOC9fATTxZvgsW8vgWs4Rw+cSj8Qnl2XClMVZwoLtpxnI SsJVe31wemylh3XWd+Zn8wPX5AQQtnw9KkEZSnOyrHIImAJ4lPOveoNxVoyKrlmWp/B0 RhGMM+/3qu7zxHlGYK/788UCRv82yYReVozbzqTIFIaDiS2W8ZqmOLwXAcY1Nerk8TLr lnSCHw4vGsNzRYXfR5YhUsh0FSy8C/s/Bth65moMoQ4krzeE/kJQQfNhMLURM8+YUyDP A/FQ== X-Gm-Message-State: AOAM531VY32Ml4fwtWoWR9NMERPfaBPejMUxVoEMyJm9nmEZuKAoTSLj sU/I+JezTHwTwAsGicfV2EjPLw== X-Google-Smtp-Source: ABdhPJxAprY9OOmw66oSB+iId6DIhrCa8bWI+rKVkdeNdwJQavoObh/EzTKd0o2MtdyprhVHKeQ6Yg== X-Received: by 2002:adf:a343:: with SMTP id d3mr19990822wrb.91.1605540428664; Mon, 16 Nov 2020 07:27:08 -0800 (PST) Received: from localhost.localdomain (lns-bzn-59-82-252-135-240.adsl.proxad.net. [82.252.135.240]) by smtp.gmail.com with ESMTPSA id k20sm19930453wmi.15.2020.11.16.07.27.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2020 07:27:07 -0800 (PST) From: Daniel Lezcano To: rjw@rjwysocki.net Subject: [PATCH V2 0/4] powercap/dtpm: Add the DTPM framework Date: Mon, 16 Nov 2020 16:26:45 +0100 Message-Id: <20201116152649.11482-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-20201116_102713_092561_DD704577 X-CRM114-Status: GOOD ( 17.77 ) 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: ulf.hansson@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, ilina@codeaurora.org, lukasz.luba@arm.com, rkumbako@codeaurora.org, rui.zhang@intel.com, linux-arm-kernel@lists.infradead.org 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: 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/powercap/dtpm.rst | 222 +++++++++++++ drivers/powercap/Kconfig | 13 + drivers/powercap/Makefile | 2 + drivers/powercap/dtpm.c | 436 ++++++++++++++++++++++++++ drivers/powercap/dtpm_cpu.c | 282 +++++++++++++++++ include/asm-generic/vmlinux.lds.h | 11 + include/linux/cpuhotplug.h | 1 + include/linux/dtpm.h | 75 +++++ include/linux/units.h | 4 + 9 files changed, 1046 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