From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zhang Rui Subject: Re: [PATCH v6 3/3] PM: Introduce Intel PowerClamp Driver Date: Wed, 16 Jan 2013 20:20:08 +0800 Message-ID: <1358338808.2252.54.camel@rzhang1-mobl4> References: <1357297965-17839-1-git-send-email-jacob.jun.pan@linux.intel.com> <1357297965-17839-4-git-send-email-jacob.jun.pan@linux.intel.com> <1358338729.2252.53.camel@rzhang1-mobl4> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mga11.intel.com ([192.55.52.93]:56432 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751969Ab3APMUS (ORCPT ); Wed, 16 Jan 2013 07:20:18 -0500 In-Reply-To: <1358338729.2252.53.camel@rzhang1-mobl4> Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Jacob Pan Cc: Linux PM , LKML , Peter Zijlstra , Rafael Wysocki , Len Brown , Thomas Gleixner , "H. Peter Anvin" , Ingo Molnar , Joe Perches , Rob Landley , Arjan van de Ven , Paul McKenney On Wed, 2013-01-16 at 20:18 +0800, Zhang Rui wrote: > Hi, Jacob, >=20 > On Fri, 2013-01-04 at 03:12 -0800, Jacob Pan wrote: > > Intel PowerClamp driver performs synchronized idle injection across > > all online CPUs. The goal is to maintain a given package level C-st= ate > > ratio. > >=20 > > Compared to other throttling methods already exist in the kernel, > > such as ACPI PAD (taking CPUs offline) and clock modulation, this i= s often > > more efficient in terms of performance per watt. > >=20 > > Please refer to Documentation/thermal/intel_powerclamp.txt for more= details. > >=20 > > Signed-off-by: Arjan van de Ven > > Signed-off-by: Jacob Pan > > --- > > Documentation/thermal/intel_powerclamp.txt | 307 +++++++++++ > > drivers/thermal/Kconfig | 10 + > > drivers/thermal/Makefile | 2 + > > drivers/thermal/intel_powerclamp.c | 788 ++++++++++++++++= ++++++++++++ > > 4 files changed, 1107 insertions(+) > > create mode 100644 Documentation/thermal/intel_powerclamp.txt > > create mode 100644 drivers/thermal/intel_powerclamp.c >=20 > > diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig > > index c2c77d1..7d90ab8 100644 > > --- a/drivers/thermal/Kconfig > > +++ b/drivers/thermal/Kconfig > > @@ -122,4 +122,14 @@ config DB8500_CPUFREQ_COOLING > > bound cpufreq cooling device turns active to set CPU frequency = low to > > cool down the CPU. > > =20 > > +config INTEL_POWERCLAMP > > + tristate "Intel PowerClamp idle injection driver" > > + depends on THERMAL > > + depends on X86 > > + depends on CPU_SUP_INTEL > > + help > > + Enable this to enable Intel PowerClamp idle injection driver. T= his > > + enforce idle time which results in more package C-state residen= cy. The > > + user interface is exposed via generic thermal framework. > > + > > endif > > diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile > > index d8da683..574f5f5 100644 > > --- a/drivers/thermal/Makefile > > +++ b/drivers/thermal/Makefile > > @@ -18,3 +18,5 @@ obj-$(CONFIG_RCAR_THERMAL) +=3D rcar_thermal.o > > obj-$(CONFIG_EXYNOS_THERMAL) +=3D exynos_thermal.o > > obj-$(CONFIG_DB8500_THERMAL) +=3D db8500_thermal.o > > obj-$(CONFIG_DB8500_CPUFREQ_COOLING) +=3D db8500_cpufreq_cooling.o > > +obj-$(CONFIG_INTEL_POWERCLAMP) +=3D intel_powerclamp.o > > + > > diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/i= ntel_powerclamp.c > > new file mode 100644 > > index 0000000..314b6fc > > --- /dev/null > > +++ b/drivers/thermal/intel_powerclamp.c > > @@ -0,0 +1,788 @@ > > +/* > > + * intel_powerclamp.c - package c-state idle injection > > + * > > + * Copyright (c) 2012, Intel Corporation. > > + * > > + * Authors: > > + * Arjan van de Ven > > + * Jacob Pan > > + * > > + * This program is free software; you can redistribute it and/or m= odify it > > + * under the terms and conditions of the GNU General Public Licens= e, > > + * version 2, as published by the Free Software Foundation. > > + * > > + * This program is distributed in the hope it will be useful, but = WITHOUT > > + * ANY WARRANTY; without even the implied warranty of MERCHANTABIL= ITY or > > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public L= icense for > > + * more details. > > + * > > + * You should have received a copy of the GNU General Public Licen= se along with > > + * this program; if not, write to the Free Software Foundation, In= c., > > + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. > > + * > > + * > > + * TODO: > > + * 1. better handle wakeup from external interrupts, cur= rently a fixed > > + * compensation is added to clamping duration when ex= cessive amount > > + * of wakeups are observed during idle time. the reas= on is that in > > + * case of external interrupts without need for ack, = clamping down > > + * cpu in non-irq context does not reduce irq. for ma= jority of the > > + * cases, clamping down cpu does help reduce irq as w= ell, we should > > + * be able to differenciate the two cases and give a = quantitative > > + * solution for the irqs that we can control. perhaps= based on > > + * get_cpu_iowait_time_us() > > + * > > + * 2. synchronization with other hw blocks > > + * > > + * > > + */ > > + > > +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > drivers/thermal/intel_powerclamp.c: In function =E2=80=98clamp_thread= =E2=80=99: > drivers/thermal/intel_powerclamp.c:435:4: error: implicit declaration= of > function =E2=80=98local_touch_nmi=E2=80=99 [-Werror=3Dimplicit-functi= on-declaration] >=20 > changing to=20 > #include > fixes the problem. >=20 and this is because I have neither CONFIG_HAVE_NMI_WATCHDOG set nor CONFIG_HARDLOCKUP_DETECTOR set in my configuration. :) thanks, rui