* Re: sysrq-o broken since 2.6.38
From: Rafael J. Wysocki @ 2012-01-08 21:35 UTC (permalink / raw)
To: Phil Oester; +Cc: linux-pm
In-Reply-To: <201201042352.59710.rjw@sisk.pl>
On Wednesday, January 04, 2012, Rafael J. Wysocki wrote:
> On Wednesday, January 04, 2012, Phil Oester wrote:
> > In commit 1eb208ae [PM: Make CONFIG_PM depend on (CONFIG_PM_SLEEP || CONFIG_PM_RUNTIME)],
> > sysrq-o option no longer works unless PM_SLEEP or PM_RUNTIME is enabled. I doubt
> > this was an intended consequence of this change. Could someone confirm?
>
> No, it wasn't.
>
> I'll try to find out what the problem is.
I don't really see what the problem is right now and I'm unable to reproduce it
on the boxes available to me at the moment.
Please send your .config.
Thanks,
Rafael
^ permalink raw reply
* Re: [PATCH 0/6] RFC: CPU frequency min/max as PM QoS params
From: Rafael J. Wysocki @ 2012-01-08 22:59 UTC (permalink / raw)
To: markgross; +Cc: linux-pm, Antti P Miettinen
In-Reply-To: <20120106182743.GA13859@mgross-G62>
On Friday, January 06, 2012, mark gross wrote:
> On Fri, Jan 06, 2012 at 02:36:20AM +0200, Antti P Miettinen wrote:
> > The inspiration for this patch series is the N9 CPU frequency boost
> > upon input events:
> >
> > http://www.spinics.net/lists/cpufreq/msg00667.html
> >
> > and the related changes in git://codeaurora.org/kernel/msm.git tree.
> > Those patches modify the ondemand cpufreq governor. This patch series
> > adds minimum and maximum CPU frequency as PM QoS parameters and
> > modifies the cpufreq core to enforce the PM QoS limits. There is also
> > an example module for boosting the frequency upon input events.
> >
> > I've been testing these changes against Ubuntu 3.2 kernel on a Dell
> > E6420 with the ACPI cpufreq driver. The patches are against
> > linux-next/master, compile tested against it.
> >
> > --Antti
> >
> > Alex Frid (1):
> > PM QoS: Simplify PM QoS expansion/merge
> >
> > Antti P Miettinen (5):
> > PM QoS: Add CPU frequency min/max as PM QoS params
> > cpufreq: Export user_policy min/max
> > cpufreq: Preserve sysfs min/max request
> > cpufreq: Enforce PM QoS min/max limits
> > input: CPU frequency booster
> >
> > drivers/cpufreq/cpufreq.c | 57 +++++++++++++-
> > drivers/input/Kconfig | 9 ++
> > drivers/input/Makefile | 1 +
> > drivers/input/input-cfboost.c | 174 +++++++++++++++++++++++++++++++++++++++++
> > include/linux/pm_qos.h | 19 ++++-
> > kernel/power/qos.c | 55 ++++++++++----
> > 6 files changed, 293 insertions(+), 22 deletions(-)
> > create mode 100644 drivers/input/input-cfboost.c
> >
>
> The following is my version of part of this patch set I was tinkering
> with. Its missing the cpufreq notification this change has and doesn't
> do anything WRT cfboost.
>
> Would it be ok if we could consolidate our two implementations and
> completely separate the cfboost stuff as a separate patch set?
>
> My code below is missing the cpufreq notification logic you have.
Well, I have one substantial problem with this approach. Namely, our
current PM QoS infrastructure is not suitable for throughput constraints,
because they should be additive, unlike the latency ones.
Namely, if sombody requests throughput X and someone else Y, the resulting
combined throughput should be X+Y rather than max(X, Y).
Thanks,
Rafael
> >From b4be99354c5af20cbd4041cddd6038e2353e06b4 Mon Sep 17 00:00:00 2001
> >From: mgross <mgross@mini>
> >Date: Sat, 24 Dec 2011 13:40:03 -0800
> >Subject: [PATCH] Some devices have a subtle relationship with the CPU
> throughput and need to set a minimum cpu frequency en order
> for the device to not experience performance issues with
> buffer under runs because the cpu was throttled too much to
> be able to keep the buffers full enough.
>
> One graphics benchmark has shown this issue on Intel SOC devices. The
> graphics part ends up waiting on the cpu to fill the open GL instruction
> queue between frames and thus graphic performance suffers because of the
> cpu throttling because the CPU really isn't very busy while running the
> benchmark.
> ---
> drivers/cpufreq/cpufreq.c | 8 ++++++++
> include/linux/pm_qos.h | 8 +++++---
> kernel/power/qos.c | 19 +++++++++++++++++++
> 3 files changed, 32 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 987a165..4cbd58b 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -29,6 +29,7 @@
> #include <linux/completion.h>
> #include <linux/mutex.h>
> #include <linux/syscore_ops.h>
> +#include <linux/pm_qos.h>
>
> #include <trace/events/power.h>
>
> @@ -1629,6 +1630,9 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data,
>
> pr_debug("setting new policy for CPU %u: %u - %u kHz\n", policy->cpu,
> policy->min, policy->max);
> +
> + if (policy->min < pm_qos_request(PM_QOS_CPU_THROUGHPUT))
> + policy->min = pm_qos_request(PM_QOS_CPU_THROUGHPUT);
>
> memcpy(&policy->cpuinfo, &data->cpuinfo,
> sizeof(struct cpufreq_cpuinfo));
> @@ -1736,6 +1740,10 @@ int cpufreq_update_policy(unsigned int cpu)
> policy.policy = data->user_policy.policy;
> policy.governor = data->user_policy.governor;
>
> + if (policy.min < pm_qos_request(PM_QOS_CPU_THROUGHPUT))
> + policy.min = pm_qos_request(PM_QOS_CPU_THROUGHPUT);
> +
> +
> /* BIOS might change freq behind our back
> -> ask driver for current freq and notify governors about a change */
> if (cpufreq_driver->get) {
> diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
> index 83b0ea3..ead081c 100644
> --- a/include/linux/pm_qos.h
> +++ b/include/linux/pm_qos.h
> @@ -11,13 +11,15 @@
>
> #define PM_QOS_RESERVED 0
> #define PM_QOS_CPU_DMA_LATENCY 1
> -#define PM_QOS_NETWORK_LATENCY 2
> -#define PM_QOS_NETWORK_THROUGHPUT 3
> +#define PM_QOS_CPU_THROUGHPUT 2
> +#define PM_QOS_NETWORK_LATENCY 3
> +#define PM_QOS_NETWORK_THROUGHPUT 4
>
> -#define PM_QOS_NUM_CLASSES 4
> +#define PM_QOS_NUM_CLASSES 5
> #define PM_QOS_DEFAULT_VALUE -1
>
> #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
> +#define PM_QOS_CPU_THROUGHPUT_DEFAULT_VALUE 0
> #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
> #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0
> #define PM_QOS_DEV_LAT_DEFAULT_VALUE 0
> diff --git a/kernel/power/qos.c b/kernel/power/qos.c
> index 995e3bd..92951fa 100644
> --- a/kernel/power/qos.c
> +++ b/kernel/power/qos.c
> @@ -60,6 +60,19 @@ static DEFINE_SPINLOCK(pm_qos_lock);
>
> static struct pm_qos_object null_pm_qos;
>
> +static BLOCKING_NOTIFIER_HEAD(cpu_throughput_notifier);
> +static struct pm_qos_constraints cpu_throughput_constraints = {
> + .list = PLIST_HEAD_INIT(cpu_throughput_constraints.list),
> + .target_value = PM_QOS_CPU_THROUGHPUT_DEFAULT_VALUE,
> + .default_value = PM_QOS_CPU_THROUGHPUT_DEFAULT_VALUE,
> + .type = PM_QOS_MIN,
> + .notifiers = &cpu_throughput_notifier,
> +};
> +static struct pm_qos_object cpu_throughput_pm_qos = {
> + .constraints = &cpu_throughput_constraints,
> + .name = "cpu_throughput",
> +};
> +
> static BLOCKING_NOTIFIER_HEAD(cpu_dma_lat_notifier);
> static struct pm_qos_constraints cpu_dma_constraints = {
> .list = PLIST_HEAD_INIT(cpu_dma_constraints.list),
> @@ -104,6 +117,7 @@ static struct pm_qos_object network_throughput_pm_qos = {
> static struct pm_qos_object *pm_qos_array[] = {
> &null_pm_qos,
> &cpu_dma_pm_qos,
> + &cpu_throughput_pm_qos,
> &network_lat_pm_qos,
> &network_throughput_pm_qos
> };
> @@ -475,6 +489,11 @@ static int __init pm_qos_power_init(void)
> printk(KERN_ERR "pm_qos_param: cpu_dma_latency setup failed\n");
> return ret;
> }
> + ret = register_pm_qos_misc(&cpu_throughput_pm_qos);
> + if (ret < 0) {
> + printk(KERN_ERR "pm_qos_param: cpu_throughput setup failed\n");
> + return ret;
> + }
> ret = register_pm_qos_misc(&network_lat_pm_qos);
> if (ret < 0) {
> printk(KERN_ERR "pm_qos_param: network_latency setup failed\n");
>
^ permalink raw reply
* Re: [PATCH 1/6] PM QoS: Simplify PM QoS expansion/merge
From: Rafael J. Wysocki @ 2012-01-08 23:03 UTC (permalink / raw)
To: markgross; +Cc: Alex Frid, linux-pm, Antti P Miettinen
In-Reply-To: <20120106152430.GD12530@mgross-G62>
On Friday, January 06, 2012, mark gross wrote:
> Acked-by: markgross <markgross@thegnar.org>
OK, I'm going to take this one for 3.4.
Thanks,
Rafael
> On Fri, Jan 06, 2012 at 02:36:21AM +0200, Antti P Miettinen wrote:
> > From: Alex Frid <afrid@nvidia.com>
> >
> > - Replace class ID #define with enumeration
> > - Loop through PM QoS objects during initialization (rather than
> > initializing them one-by-one)
> >
> > Signed-off-by: Alex Frid <afrid@nvidia.com>
> > Reviewed-by: Antti Miettinen <amiettinen@nvidia.com>
> > Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
> > Reviewed-by: Scott Williams <scwilliams@nvidia.com>
> > Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
> > ---
> > include/linux/pm_qos.h | 14 +++++++++-----
> > kernel/power/qos.c | 23 ++++++++++-------------
> > 2 files changed, 19 insertions(+), 18 deletions(-)
> >
> > diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
> > index e5bbcba..5ac91d8 100644
> > --- a/include/linux/pm_qos.h
> > +++ b/include/linux/pm_qos.h
> > @@ -9,12 +9,16 @@
> > #include <linux/miscdevice.h>
> > #include <linux/device.h>
> >
> > -#define PM_QOS_RESERVED 0
> > -#define PM_QOS_CPU_DMA_LATENCY 1
> > -#define PM_QOS_NETWORK_LATENCY 2
> > -#define PM_QOS_NETWORK_THROUGHPUT 3
> > +enum {
> > + PM_QOS_RESERVED = 0,
> > + PM_QOS_CPU_DMA_LATENCY,
> > + PM_QOS_NETWORK_LATENCY,
> > + PM_QOS_NETWORK_THROUGHPUT,
> > +
> > + /* insert new class ID */
> > + PM_QOS_NUM_CLASSES,
> > +};
> >
> > -#define PM_QOS_NUM_CLASSES 4
> > #define PM_QOS_DEFAULT_VALUE -1
> >
> > #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
> > diff --git a/kernel/power/qos.c b/kernel/power/qos.c
> > index 995e3bd..d6d6dbd 100644
> > --- a/kernel/power/qos.c
> > +++ b/kernel/power/qos.c
> > @@ -469,21 +469,18 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
> > static int __init pm_qos_power_init(void)
> > {
> > int ret = 0;
> > + int i;
> >
> > - ret = register_pm_qos_misc(&cpu_dma_pm_qos);
> > - if (ret < 0) {
> > - printk(KERN_ERR "pm_qos_param: cpu_dma_latency setup failed\n");
> > - return ret;
> > - }
> > - ret = register_pm_qos_misc(&network_lat_pm_qos);
> > - if (ret < 0) {
> > - printk(KERN_ERR "pm_qos_param: network_latency setup failed\n");
> > - return ret;
> > + BUILD_BUG_ON(ARRAY_SIZE(pm_qos_array) != PM_QOS_NUM_CLASSES);
> > +
> > + for (i = 1; i < PM_QOS_NUM_CLASSES; i++) {
> > + ret = register_pm_qos_misc(pm_qos_array[i]);
> > + if (ret < 0) {
> > + printk(KERN_ERR "pm_qos_param: %s setup failed\n",
> > + pm_qos_array[i]->name);
> > + return ret;
> > + }
> > }
> > - ret = register_pm_qos_misc(&network_throughput_pm_qos);
> > - if (ret < 0)
> > - printk(KERN_ERR
> > - "pm_qos_param: network_throughput setup failed\n");
> >
> > return ret;
> > }
> _______________________________________________
> linux-pm mailing list
> linux-pm@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/linux-pm
>
>
^ permalink raw reply
* Re: [PATCH v2] PM: HIBERNATION: skip the swap size check if the snapshot image size is anticipative
From: Barry Song @ 2012-01-09 2:50 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Xiangzhen Ye, linux-kernel, workgroup.linux, linux-arm-kernel,
Barry Song, linux-pm
In-Reply-To: <201201082231.44510.rjw@sisk.pl>
2012/1/9 Rafael J. Wysocki <rjw@sisk.pl>:
> On Friday, January 06, 2012, Barry Song wrote:
>> 2012/1/6 Pavel Machek <pavel@ucw.cz>:
>> > Hi!
>> >
>> > Is the check even useful these days? Should we remove it altogether?
>>
>> i think we can let users or distributions decide whether it is useful.
>> On PC, disk space is not an issue, people might run many applications
>> while doing hibernation, so snapshot is much big. an early check will
>> improve user experience because people don't need to wait a long time
>> and find space is not enough.
>> for embedded system, SoC solutions can know whether the space is
>> enough since they know what are running while doing hibernation, so
>> they can skip the check by setting the flag in sysfs.
>> that is why i had this patch sent.
>
> I agree with Pavel that it's better to drop the check altogether.
>
> The sysfs switch you're adding doesn't seem to be very useful, as PC
> users won't touch it and whoever needs it to be 0, will always set it
> that way and won't change it afterwards.
ok. if we don't have the check, in case swap partition is not enough,
writing failure will happen, system still can restore to normal
status:
for example, in the following test, only 27% data is written with a
small partition, "Restarting tasks ... done" will make system restore
to normal status.
[ 11.2080 27%
[ 11.403274] PM: Wrote uncompressed 34920 kbytes in 0.65 seconds (53.72 MB/s)
[ 11.407649] PM: Wrote compressed 3500 kbytes in 0.65 seconds (5.38 MB/s)
[ 11.447176] Restarting tasks ... done.
[ 11.448801] ...
>
> Thanks,
> Rafael
-barry
^ permalink raw reply
* [PATCH] PM:Hibernation: drop the check of swap space size for compressed image
From: Barry Song @ 2012-01-09 4:56 UTC (permalink / raw)
To: rjw, pavel; +Cc: linux-pm, workgroup.linux, linux-arm-kernel, Barry Song
From: Barry Song <Baohua.Song@csr.com>
For compressed image, the space required is not known until
we finish compressing and writing all pages.
This patch drops the check, and if swap space is not enough
finally, system can still restore to normal after writing
swap fails for compressed images.
Signed-off-by: Barry Song <Baohua.Song@csr.com>
---
kernel/power/swap.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 11a594c..c8306a5 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -774,8 +774,7 @@ static int enough_swap(unsigned int nr_pages, unsigned int flags)
pr_debug("PM: Free swap pages: %u\n", free_swap);
- required = PAGES_FOR_IO + ((flags & SF_NOCOMPRESS_MODE) ?
- nr_pages : (nr_pages * LZO_CMP_PAGES) / LZO_UNC_PAGES + 1);
+ required = PAGES_FOR_IO + nr_pages;
return free_swap > required;
}
@@ -803,10 +802,12 @@ int swsusp_write(unsigned int flags)
printk(KERN_ERR "PM: Cannot get swap writer\n");
return error;
}
- if (!enough_swap(pages, flags)) {
- printk(KERN_ERR "PM: Not enough free swap\n");
- error = -ENOSPC;
- goto out_finish;
+ if (flags & SF_NOCOMPRESS_MODE) {
+ if (!enough_swap(pages, flags)) {
+ printk(KERN_ERR "PM: Not enough free swap\n");
+ error = -ENOSPC;
+ goto out_finish;
+ }
}
memset(&snapshot, 0, sizeof(struct snapshot_handle));
error = snapshot_read_next(&snapshot);
--
1.7.1
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
^ permalink raw reply related
* [PATCH] mmc: core: move suspend/resume to dev_pm_ops and add hibernation support
From: Barry Song @ 2012-01-09 6:22 UTC (permalink / raw)
To: cjb; +Cc: Bin Shi, linux-pm, linux-mmc, workgroup.linux
From: Bin Shi <Bin.Shi@csr.com>
This patch moves suspend/resume to dev_pm_ops and add hibernation support.
It was tested on CSR SiRFprimaII cortex-a9 platform. A sd partition is used
as swsusp partition.
Signed-off-by: Bin Shi <Bin.Shi@csr.com>
Signed-off-by: Barry Song <Barry.Song@csr.com>
---
drivers/mmc/core/bus.c | 38 +++++++++++++++++++++++++-------------
1 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 6be4924..bab50f7 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -122,14 +122,14 @@ static int mmc_bus_remove(struct device *dev)
return 0;
}
-static int mmc_bus_suspend(struct device *dev, pm_message_t state)
+static int mmc_bus_suspend(struct device *dev)
{
struct mmc_driver *drv = to_mmc_driver(dev->driver);
struct mmc_card *card = mmc_dev_to_card(dev);
int ret = 0;
if (dev->driver && drv->suspend)
- ret = drv->suspend(card, state);
+ ret = drv->suspend(card, PMSG_SUSPEND);
return ret;
}
@@ -144,6 +144,17 @@ static int mmc_bus_resume(struct device *dev)
return ret;
}
+static int mmc_bus_freeze(struct device *dev)
+{
+ struct mmc_driver *drv = to_mmc_driver(dev->driver);
+ struct mmc_card *card = mmc_dev_to_card(dev);
+ int ret = 0;
+
+ if (dev->driver && drv->suspend)
+ ret = drv->suspend(card, PMSG_FREEZE);
+ return ret;
+}
+
#ifdef CONFIG_PM_RUNTIME
static int mmc_runtime_suspend(struct device *dev)
@@ -165,20 +176,23 @@ static int mmc_runtime_idle(struct device *dev)
return pm_runtime_suspend(dev);
}
+#else /* !CONFIG_PM_RUNTIME */
+#define mmc_runtime_suspend NULL
+#define mmc_runtime_resume NULL
+#define mmc_runtime_idle NULL
+#endif /* !CONFIG_PM_RUNTIME */
+
static const struct dev_pm_ops mmc_bus_pm_ops = {
.runtime_suspend = mmc_runtime_suspend,
.runtime_resume = mmc_runtime_resume,
.runtime_idle = mmc_runtime_idle,
+ .suspend = mmc_bus_suspend,
+ .resume = mmc_bus_resume,
+ .freeze = mmc_bus_freeze,
+ .restore = mmc_bus_resume,
+ .thaw = mmc_bus_resume,
};
-#define MMC_PM_OPS_PTR (&mmc_bus_pm_ops)
-
-#else /* !CONFIG_PM_RUNTIME */
-
-#define MMC_PM_OPS_PTR NULL
-
-#endif /* !CONFIG_PM_RUNTIME */
-
static struct bus_type mmc_bus_type = {
.name = "mmc",
.dev_attrs = mmc_dev_attrs,
@@ -186,9 +200,7 @@ static struct bus_type mmc_bus_type = {
.uevent = mmc_bus_uevent,
.probe = mmc_bus_probe,
.remove = mmc_bus_remove,
- .suspend = mmc_bus_suspend,
- .resume = mmc_bus_resume,
- .pm = MMC_PM_OPS_PTR,
+ .pm = &mmc_bus_pm_ops,
};
int mmc_register_bus(void)
--
1.7.1
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
^ permalink raw reply related
* Re: [PATCH] PM:Hibernation: drop the check of swap space size for compressed image
From: Pavel Machek @ 2012-01-09 10:10 UTC (permalink / raw)
To: Barry Song; +Cc: linux-pm, workgroup.linux, linux-arm-kernel, Barry Song
In-Reply-To: <1326084983-22237-1-git-send-email-Barry.Song@csr.com>
On Mon 2012-01-09 12:56:23, Barry Song wrote:
> From: Barry Song <Baohua.Song@csr.com>
>
> For compressed image, the space required is not known until
> we finish compressing and writing all pages.
> This patch drops the check, and if swap space is not enough
> finally, system can still restore to normal after writing
> swap fails for compressed images.
>
> Signed-off-by: Barry Song <Baohua.Song@csr.com>
ACK.
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply
* Re: [PATCH 3/6] cpufreq: Export user_policy min/max
From: mark gross @ 2012-01-09 14:18 UTC (permalink / raw)
To: ananaza; +Cc: linux-pm, cpufreq, markgross
In-Reply-To: <20120107.104723.1386766787855536005.apm@brigitte.kvy.fi>
On Sat, Jan 07, 2012 at 10:47:23AM +0200, Antti P Miettinen wrote:
> From: mark gross <markgross@thegnar.org>
> > Maybe I'm missing something but cpufreq already has ABI for setting
> > upper and lower bounds for frequencies.
> >
> > /sys/devices/system/cpu/cpu0/cpufreq/[scaling_min_freq,
> > scaling_max_freq]
> >
> > --mark
>
> Yes, and the patch just adds two read-only files,
> /sys/devices/system/cpu/cpu?/cpufreq/policy_{min,max}_freq:
I didn't catch the read-only part of that. maybe thats not a big deal
--mark
>
> +show_one(policy_min_freq, user_policy.min);
> +show_one(policy_max_freq, user_policy.max);
>
> to show the user_policy.min/max in addition to the
> policy->min/max. This is related to patch 4 which changes the
> scaling_{min,max}_freq store function to store the received value to
> user_policy instead of the enforced value. Related in turn to the
> restoring of the policy values when PM QoS constraints get lifted. The
> purpose of patch 3 is to allow inspecting the requested min/max in
> addition to the enforced min/max.
>
> --Antti
>
> Adding cpufreq to cc, previous comments for context:
>
> http://thread.gmane.org/gmane.linux.power-management.general/26532
>
> _______________________________________________
> linux-pm mailing list
> linux-pm@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/linux-pm
^ permalink raw reply
* Re: [PATCH 0/6] RFC: CPU frequency min/max as PM QoS params
From: mark gross @ 2012-01-09 14:23 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: linux-pm, Antti P Miettinen, markgross
In-Reply-To: <201201082359.25077.rjw@sisk.pl>
On Sun, Jan 08, 2012 at 11:59:24PM +0100, Rafael J. Wysocki wrote:
> On Friday, January 06, 2012, mark gross wrote:
> > On Fri, Jan 06, 2012 at 02:36:20AM +0200, Antti P Miettinen wrote:
> > > The inspiration for this patch series is the N9 CPU frequency boost
> > > upon input events:
> > >
> > > http://www.spinics.net/lists/cpufreq/msg00667.html
> > >
> > > and the related changes in git://codeaurora.org/kernel/msm.git tree.
> > > Those patches modify the ondemand cpufreq governor. This patch series
> > > adds minimum and maximum CPU frequency as PM QoS parameters and
> > > modifies the cpufreq core to enforce the PM QoS limits. There is also
> > > an example module for boosting the frequency upon input events.
> > >
> > > I've been testing these changes against Ubuntu 3.2 kernel on a Dell
> > > E6420 with the ACPI cpufreq driver. The patches are against
> > > linux-next/master, compile tested against it.
> > >
> > > --Antti
> > >
> > > Alex Frid (1):
> > > PM QoS: Simplify PM QoS expansion/merge
> > >
> > > Antti P Miettinen (5):
> > > PM QoS: Add CPU frequency min/max as PM QoS params
> > > cpufreq: Export user_policy min/max
> > > cpufreq: Preserve sysfs min/max request
> > > cpufreq: Enforce PM QoS min/max limits
> > > input: CPU frequency booster
> > >
> > > drivers/cpufreq/cpufreq.c | 57 +++++++++++++-
> > > drivers/input/Kconfig | 9 ++
> > > drivers/input/Makefile | 1 +
> > > drivers/input/input-cfboost.c | 174 +++++++++++++++++++++++++++++++++++++++++
> > > include/linux/pm_qos.h | 19 ++++-
> > > kernel/power/qos.c | 55 ++++++++++----
> > > 6 files changed, 293 insertions(+), 22 deletions(-)
> > > create mode 100644 drivers/input/input-cfboost.c
> > >
> >
> > The following is my version of part of this patch set I was tinkering
> > with. Its missing the cpufreq notification this change has and doesn't
> > do anything WRT cfboost.
> >
> > Would it be ok if we could consolidate our two implementations and
> > completely separate the cfboost stuff as a separate patch set?
> >
> > My code below is missing the cpufreq notification logic you have.
>
> Well, I have one substantial problem with this approach. Namely, our
> current PM QoS infrastructure is not suitable for throughput constraints,
> because they should be additive, unlike the latency ones.
>
> Namely, if sombody requests throughput X and someone else Y, the resulting
> combined throughput should be X+Y rather than max(X, Y).
That can be done easy enough. However; in practice I'm not convinced
doing and additive aggregation of the requested QoS would be any better
than just taking the max. But, we can give it a try.
--mark
> Thanks,
> Rafael
>
>
> > >From b4be99354c5af20cbd4041cddd6038e2353e06b4 Mon Sep 17 00:00:00 2001
> > >From: mgross <mgross@mini>
> > >Date: Sat, 24 Dec 2011 13:40:03 -0800
> > >Subject: [PATCH] Some devices have a subtle relationship with the CPU
> > throughput and need to set a minimum cpu frequency en order
> > for the device to not experience performance issues with
> > buffer under runs because the cpu was throttled too much to
> > be able to keep the buffers full enough.
> >
> > One graphics benchmark has shown this issue on Intel SOC devices. The
> > graphics part ends up waiting on the cpu to fill the open GL instruction
> > queue between frames and thus graphic performance suffers because of the
> > cpu throttling because the CPU really isn't very busy while running the
> > benchmark.
> > ---
> > drivers/cpufreq/cpufreq.c | 8 ++++++++
> > include/linux/pm_qos.h | 8 +++++---
> > kernel/power/qos.c | 19 +++++++++++++++++++
> > 3 files changed, 32 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> > index 987a165..4cbd58b 100644
> > --- a/drivers/cpufreq/cpufreq.c
> > +++ b/drivers/cpufreq/cpufreq.c
> > @@ -29,6 +29,7 @@
> > #include <linux/completion.h>
> > #include <linux/mutex.h>
> > #include <linux/syscore_ops.h>
> > +#include <linux/pm_qos.h>
> >
> > #include <trace/events/power.h>
> >
> > @@ -1629,6 +1630,9 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data,
> >
> > pr_debug("setting new policy for CPU %u: %u - %u kHz\n", policy->cpu,
> > policy->min, policy->max);
> > +
> > + if (policy->min < pm_qos_request(PM_QOS_CPU_THROUGHPUT))
> > + policy->min = pm_qos_request(PM_QOS_CPU_THROUGHPUT);
> >
> > memcpy(&policy->cpuinfo, &data->cpuinfo,
> > sizeof(struct cpufreq_cpuinfo));
> > @@ -1736,6 +1740,10 @@ int cpufreq_update_policy(unsigned int cpu)
> > policy.policy = data->user_policy.policy;
> > policy.governor = data->user_policy.governor;
> >
> > + if (policy.min < pm_qos_request(PM_QOS_CPU_THROUGHPUT))
> > + policy.min = pm_qos_request(PM_QOS_CPU_THROUGHPUT);
> > +
> > +
> > /* BIOS might change freq behind our back
> > -> ask driver for current freq and notify governors about a change */
> > if (cpufreq_driver->get) {
> > diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
> > index 83b0ea3..ead081c 100644
> > --- a/include/linux/pm_qos.h
> > +++ b/include/linux/pm_qos.h
> > @@ -11,13 +11,15 @@
> >
> > #define PM_QOS_RESERVED 0
> > #define PM_QOS_CPU_DMA_LATENCY 1
> > -#define PM_QOS_NETWORK_LATENCY 2
> > -#define PM_QOS_NETWORK_THROUGHPUT 3
> > +#define PM_QOS_CPU_THROUGHPUT 2
> > +#define PM_QOS_NETWORK_LATENCY 3
> > +#define PM_QOS_NETWORK_THROUGHPUT 4
> >
> > -#define PM_QOS_NUM_CLASSES 4
> > +#define PM_QOS_NUM_CLASSES 5
> > #define PM_QOS_DEFAULT_VALUE -1
> >
> > #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
> > +#define PM_QOS_CPU_THROUGHPUT_DEFAULT_VALUE 0
> > #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
> > #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0
> > #define PM_QOS_DEV_LAT_DEFAULT_VALUE 0
> > diff --git a/kernel/power/qos.c b/kernel/power/qos.c
> > index 995e3bd..92951fa 100644
> > --- a/kernel/power/qos.c
> > +++ b/kernel/power/qos.c
> > @@ -60,6 +60,19 @@ static DEFINE_SPINLOCK(pm_qos_lock);
> >
> > static struct pm_qos_object null_pm_qos;
> >
> > +static BLOCKING_NOTIFIER_HEAD(cpu_throughput_notifier);
> > +static struct pm_qos_constraints cpu_throughput_constraints = {
> > + .list = PLIST_HEAD_INIT(cpu_throughput_constraints.list),
> > + .target_value = PM_QOS_CPU_THROUGHPUT_DEFAULT_VALUE,
> > + .default_value = PM_QOS_CPU_THROUGHPUT_DEFAULT_VALUE,
> > + .type = PM_QOS_MIN,
> > + .notifiers = &cpu_throughput_notifier,
> > +};
> > +static struct pm_qos_object cpu_throughput_pm_qos = {
> > + .constraints = &cpu_throughput_constraints,
> > + .name = "cpu_throughput",
> > +};
> > +
> > static BLOCKING_NOTIFIER_HEAD(cpu_dma_lat_notifier);
> > static struct pm_qos_constraints cpu_dma_constraints = {
> > .list = PLIST_HEAD_INIT(cpu_dma_constraints.list),
> > @@ -104,6 +117,7 @@ static struct pm_qos_object network_throughput_pm_qos = {
> > static struct pm_qos_object *pm_qos_array[] = {
> > &null_pm_qos,
> > &cpu_dma_pm_qos,
> > + &cpu_throughput_pm_qos,
> > &network_lat_pm_qos,
> > &network_throughput_pm_qos
> > };
> > @@ -475,6 +489,11 @@ static int __init pm_qos_power_init(void)
> > printk(KERN_ERR "pm_qos_param: cpu_dma_latency setup failed\n");
> > return ret;
> > }
> > + ret = register_pm_qos_misc(&cpu_throughput_pm_qos);
> > + if (ret < 0) {
> > + printk(KERN_ERR "pm_qos_param: cpu_throughput setup failed\n");
> > + return ret;
> > + }
> > ret = register_pm_qos_misc(&network_lat_pm_qos);
> > if (ret < 0) {
> > printk(KERN_ERR "pm_qos_param: network_latency setup failed\n");
> >
>
> _______________________________________________
> linux-pm mailing list
> linux-pm@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/linux-pm
^ permalink raw reply
* Re: [PATCH 0/6] RFC: CPU frequency min/max as PM QoS params
From: Rafael J. Wysocki @ 2012-01-09 21:27 UTC (permalink / raw)
To: markgross; +Cc: linux-pm, Antti P Miettinen
In-Reply-To: <20120109142353.GC11463@mgross-G62>
On Monday, January 09, 2012, mark gross wrote:
> On Sun, Jan 08, 2012 at 11:59:24PM +0100, Rafael J. Wysocki wrote:
> > On Friday, January 06, 2012, mark gross wrote:
> > > On Fri, Jan 06, 2012 at 02:36:20AM +0200, Antti P Miettinen wrote:
> > > > The inspiration for this patch series is the N9 CPU frequency boost
> > > > upon input events:
> > > >
> > > > http://www.spinics.net/lists/cpufreq/msg00667.html
> > > >
> > > > and the related changes in git://codeaurora.org/kernel/msm.git tree.
> > > > Those patches modify the ondemand cpufreq governor. This patch series
> > > > adds minimum and maximum CPU frequency as PM QoS parameters and
> > > > modifies the cpufreq core to enforce the PM QoS limits. There is also
> > > > an example module for boosting the frequency upon input events.
> > > >
> > > > I've been testing these changes against Ubuntu 3.2 kernel on a Dell
> > > > E6420 with the ACPI cpufreq driver. The patches are against
> > > > linux-next/master, compile tested against it.
> > > >
> > > > --Antti
> > > >
> > > > Alex Frid (1):
> > > > PM QoS: Simplify PM QoS expansion/merge
> > > >
> > > > Antti P Miettinen (5):
> > > > PM QoS: Add CPU frequency min/max as PM QoS params
> > > > cpufreq: Export user_policy min/max
> > > > cpufreq: Preserve sysfs min/max request
> > > > cpufreq: Enforce PM QoS min/max limits
> > > > input: CPU frequency booster
> > > >
> > > > drivers/cpufreq/cpufreq.c | 57 +++++++++++++-
> > > > drivers/input/Kconfig | 9 ++
> > > > drivers/input/Makefile | 1 +
> > > > drivers/input/input-cfboost.c | 174 +++++++++++++++++++++++++++++++++++++++++
> > > > include/linux/pm_qos.h | 19 ++++-
> > > > kernel/power/qos.c | 55 ++++++++++----
> > > > 6 files changed, 293 insertions(+), 22 deletions(-)
> > > > create mode 100644 drivers/input/input-cfboost.c
> > > >
> > >
> > > The following is my version of part of this patch set I was tinkering
> > > with. Its missing the cpufreq notification this change has and doesn't
> > > do anything WRT cfboost.
> > >
> > > Would it be ok if we could consolidate our two implementations and
> > > completely separate the cfboost stuff as a separate patch set?
> > >
> > > My code below is missing the cpufreq notification logic you have.
> >
> > Well, I have one substantial problem with this approach. Namely, our
> > current PM QoS infrastructure is not suitable for throughput constraints,
> > because they should be additive, unlike the latency ones.
> >
> > Namely, if sombody requests throughput X and someone else Y, the resulting
> > combined throughput should be X+Y rather than max(X, Y).
>
> That can be done easy enough. However; in practice I'm not convinced
> doing and additive aggregation of the requested QoS would be any better
> than just taking the max.
Well, I'd say it's necessary for correctness, perhaps not for the CPU, but in
general. If Y is the max, then the subsystem that requested X may easily
starve whoever requested the Y by using all of the bandwidth it asked for.
> But, we can give it a try.
Good. :-)
Thanks,
Rafael
^ permalink raw reply
* Re: [PATCH v2] PM: HIBERNATION: skip the swap size check if the snapshot image size is anticipative
From: Rafael J. Wysocki @ 2012-01-09 21:46 UTC (permalink / raw)
To: Barry Song
Cc: Xiangzhen Ye, linux-kernel, workgroup.linux, linux-arm-kernel,
Barry Song, linux-pm
In-Reply-To: <CAGsJ_4y+fQ14yDzD1FxtutD7b17KqK+voaywHAZuS0SXK5Z_xQ@mail.gmail.com>
On Monday, January 09, 2012, Barry Song wrote:
> 2012/1/9 Rafael J. Wysocki <rjw@sisk.pl>:
> > On Friday, January 06, 2012, Barry Song wrote:
> >> 2012/1/6 Pavel Machek <pavel@ucw.cz>:
> >> > Hi!
> >> >
> >> > Is the check even useful these days? Should we remove it altogether?
> >>
> >> i think we can let users or distributions decide whether it is useful.
> >> On PC, disk space is not an issue, people might run many applications
> >> while doing hibernation, so snapshot is much big. an early check will
> >> improve user experience because people don't need to wait a long time
> >> and find space is not enough.
> >> for embedded system, SoC solutions can know whether the space is
> >> enough since they know what are running while doing hibernation, so
> >> they can skip the check by setting the flag in sysfs.
> >> that is why i had this patch sent.
> >
> > I agree with Pavel that it's better to drop the check altogether.
> >
> > The sysfs switch you're adding doesn't seem to be very useful, as PC
> > users won't touch it and whoever needs it to be 0, will always set it
> > that way and won't change it afterwards.
>
> ok. if we don't have the check, in case swap partition is not enough,
> writing failure will happen, system still can restore to normal
> status:
>
> for example, in the following test, only 27% data is written with a
> small partition, "Restarting tasks ... done" will make system restore
> to normal status.
>
> [ 11.2080 27%
> [ 11.403274] PM: Wrote uncompressed 34920 kbytes in 0.65 seconds (53.72 MB/s)
> [ 11.407649] PM: Wrote compressed 3500 kbytes in 0.65 seconds (5.38 MB/s)
> [ 11.447176] Restarting tasks ... done.
> [ 11.448801] ...
That's exactly correct.
Thanks,
Rafael
^ permalink raw reply
* Re: [PATCH 0/6] RFC: CPU frequency min/max as PM QoS params
From: Antti P Miettinen @ 2012-01-09 21:57 UTC (permalink / raw)
To: linux-pm
In-Reply-To: <201201092227.29857.rjw@sisk.pl>
"Rafael J. Wysocki" <rjw@sisk.pl> writes:
> Well, I'd say it's necessary for correctness, perhaps not for the CPU, but in
> general. If Y is the max, then the subsystem that requested X may easily
> starve whoever requested the Y by using all of the bandwidth it asked for.
Hmm.. congestion is an issue for latency requests as well. I've viewed
the current PM QoS handling system level requests. If we want some kind
of resource reservation/provisioning that could probably be layered on
top of system level requests, no?
--Antti
^ permalink raw reply
* Re: [PATCH 0/6] RFC: CPU frequency min/max as PM QoS params
From: mark gross @ 2012-01-10 4:50 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: linux-pm, Antti P Miettinen, markgross
In-Reply-To: <201201092227.29857.rjw@sisk.pl>
On Mon, Jan 09, 2012 at 10:27:29PM +0100, Rafael J. Wysocki wrote:
> On Monday, January 09, 2012, mark gross wrote:
> > On Sun, Jan 08, 2012 at 11:59:24PM +0100, Rafael J. Wysocki wrote:
> > > On Friday, January 06, 2012, mark gross wrote:
> > > > On Fri, Jan 06, 2012 at 02:36:20AM +0200, Antti P Miettinen wrote:
> > > > > The inspiration for this patch series is the N9 CPU frequency boost
> > > > > upon input events:
> > > > >
> > > > > http://www.spinics.net/lists/cpufreq/msg00667.html
> > > > >
> > > > > and the related changes in git://codeaurora.org/kernel/msm.git tree.
> > > > > Those patches modify the ondemand cpufreq governor. This patch series
> > > > > adds minimum and maximum CPU frequency as PM QoS parameters and
> > > > > modifies the cpufreq core to enforce the PM QoS limits. There is also
> > > > > an example module for boosting the frequency upon input events.
> > > > >
> > > > > I've been testing these changes against Ubuntu 3.2 kernel on a Dell
> > > > > E6420 with the ACPI cpufreq driver. The patches are against
> > > > > linux-next/master, compile tested against it.
> > > > >
> > > > > --Antti
> > > > >
> > > > > Alex Frid (1):
> > > > > PM QoS: Simplify PM QoS expansion/merge
> > > > >
> > > > > Antti P Miettinen (5):
> > > > > PM QoS: Add CPU frequency min/max as PM QoS params
> > > > > cpufreq: Export user_policy min/max
> > > > > cpufreq: Preserve sysfs min/max request
> > > > > cpufreq: Enforce PM QoS min/max limits
> > > > > input: CPU frequency booster
> > > > >
> > > > > drivers/cpufreq/cpufreq.c | 57 +++++++++++++-
> > > > > drivers/input/Kconfig | 9 ++
> > > > > drivers/input/Makefile | 1 +
> > > > > drivers/input/input-cfboost.c | 174 +++++++++++++++++++++++++++++++++++++++++
> > > > > include/linux/pm_qos.h | 19 ++++-
> > > > > kernel/power/qos.c | 55 ++++++++++----
> > > > > 6 files changed, 293 insertions(+), 22 deletions(-)
> > > > > create mode 100644 drivers/input/input-cfboost.c
> > > > >
> > > >
> > > > The following is my version of part of this patch set I was tinkering
> > > > with. Its missing the cpufreq notification this change has and doesn't
> > > > do anything WRT cfboost.
> > > >
> > > > Would it be ok if we could consolidate our two implementations and
> > > > completely separate the cfboost stuff as a separate patch set?
> > > >
> > > > My code below is missing the cpufreq notification logic you have.
> > >
> > > Well, I have one substantial problem with this approach. Namely, our
> > > current PM QoS infrastructure is not suitable for throughput constraints,
> > > because they should be additive, unlike the latency ones.
> > >
> > > Namely, if sombody requests throughput X and someone else Y, the resulting
> > > combined throughput should be X+Y rather than max(X, Y).
> >
> > That can be done easy enough. However; in practice I'm not convinced
> > doing and additive aggregation of the requested QoS would be any better
> > than just taking the max.
>
> Well, I'd say it's necessary for correctness, perhaps not for the CPU, but in
> general. If Y is the max, then the subsystem that requested X may easily
> starve whoever requested the Y by using all of the bandwidth it asked for.
I was thinking about this from the CPU point of view more over the day.
Given that there are many times more than one make the qos requests
additive will result in quickly requesting more cpu than is available
and waisting a lot of power. Also additive aggregation falls over a
bit on with multi-core.
As the consumer of the cpu resources are tasks, and we can only run one
task at a time on a cpu, I'm talking myself into thinking that max
*is* the right way to go for cpu throughput (i.e. frequency).
Other resources (network?) could benefit from additive aggregation of
qos requests if they are resources that are concurrently shared with
multiple tasks.
--mark
> > But, we can give it a try.
>
> Good. :-)
>
> Thanks,
> Rafael
> _______________________________________________
> linux-pm mailing list
> linux-pm@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/linux-pm
^ permalink raw reply
* Re: [PATCH 1/7] x86, acpi, tboot: Have a ACPI os prepare sleep instead of calling tboot_sleep.
From: Cihula, Joseph @ 2012-01-10 20:09 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, linux-kernel@vger.kernel.org, rjw@sisk.pl,
x86@kernel.org, Brown, Len, linux-pm@lists.linux-foundation.org,
tboot-devel@lists.sourceforge.net, linux-acpi@vger.kernel.org,
liang.tang@oracle.com
Cc: Wang, Shane, Thomas Gleixner, xen-devel@lists.xensource.com,
hpa@zytor.com
In-Reply-To: <20120103171318.GA25341@phenom.dumpdata.com>
ACK
> -----Original Message-----
> From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com]
> Sent: Tuesday, January 03, 2012 9:13 AM
> To: linux-kernel@vger.kernel.org; rjw@sisk.pl; x86@kernel.org; Brown, Len; Cihula, Joseph; linux-
> pm@lists.linux-foundation.org; tboot-devel@lists.sourceforge.net; linux-acpi@vger.kernel.org;
> liang.tang@oracle.com
> Cc: hpa@zytor.com; Thomas Gleixner; Wang, Shane; xen-devel@lists.xensource.com
> Subject: Re: [PATCH 1/7] x86, acpi, tboot: Have a ACPI os prepare sleep instead of calling
> tboot_sleep.
>
> On Fri, Dec 16, 2011 at 05:38:13PM -0500, Konrad Rzeszutek Wilk wrote:
> > From: Tang Liang <liang.tang@oracle.com>
>
> Hey Joseph,
>
> I remember you acked the initial rfc patches I had posted.
> But I was wondering if these ones are to your liking (I think they are - they aren't that much
> different, but I didn't want to blindly sticking 'Acked-by' as they did change a bit).
>
> Thanks!
> >
> > The ACPI suspend path makes a call to tboot_sleep right before it
> > writes the PM1A, PM1B values. We replace the direct call to tboot via
> > an registration callback similar to __acpi_register_gsi.
> >
> > CC: Thomas Gleixner <tglx@linutronix.de>
> > CC: "H. Peter Anvin" <hpa@zytor.com>
> > CC: x86@kernel.org
> > CC: Len Brown <len.brown@intel.com>
> > CC: Joseph Cihula <joseph.cihula@intel.com>
> > CC: Shane Wang <shane.wang@intel.com>
> > CC: xen-devel@lists.xensource.com
> > CC: linux-pm@lists.linux-foundation.org
> > CC: tboot-devel@lists.sourceforge.net
> > CC: linux-acpi@vger.kernel.org
> > [v1: Added __attribute__ ((unused))]
> > [v2: Introduced a wrapper instead of changing tboot_sleep return
> > values]
> > [v3: Added return value AE_CTRL_SKIP for acpi_os_sleep_prepare]
> > Signed-off-by: Tang Liang <liang.tang@oracle.com>
> > [v1: Fix compile issues on IA64 and PPC64]
> > [v2: Fix where __acpi_os_prepare_sleep==NULL and did not go in sleep
> > properly]
> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > ---
> > arch/x86/kernel/tboot.c | 8 ++++++++
> > drivers/acpi/acpica/hwsleep.c | 10 +++++++---
> > drivers/acpi/osl.c | 24 ++++++++++++++++++++++++
> > include/acpi/acexcep.h | 1 +
> > include/linux/acpi.h | 10 ++++++++++
> > include/linux/tboot.h | 1 -
> > 6 files changed, 50 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c index
> > e2410e2..1a4ab7d 100644
> > --- a/arch/x86/kernel/tboot.c
> > +++ b/arch/x86/kernel/tboot.c
> > @@ -297,6 +297,12 @@ void tboot_sleep(u8 sleep_state, u32
> > pm1a_control, u32 pm1b_control)
> >
> > tboot_shutdown(acpi_shutdown_map[sleep_state]);
> > }
> > +static int tboot_sleep_wrapper(u8 sleep_state, u32 pm1a_control,
> > + u32 pm1b_control)
> > +{
> > + tboot_sleep(sleep_state, pm1a_control, pm1b_control);
> > + return 0;
> > +}
> >
> > static atomic_t ap_wfs_count;
> >
> > @@ -345,6 +351,8 @@ static __init int tboot_late_init(void)
> >
> > atomic_set(&ap_wfs_count, 0);
> > register_hotcpu_notifier(&tboot_cpu_notifier);
> > +
> > + acpi_os_set_prepare_sleep(&tboot_sleep_wrapper);
> > return 0;
> > }
> >
> > diff --git a/drivers/acpi/acpica/hwsleep.c
> > b/drivers/acpi/acpica/hwsleep.c index d52da30..992359a 100644
> > --- a/drivers/acpi/acpica/hwsleep.c
> > +++ b/drivers/acpi/acpica/hwsleep.c
> > @@ -43,9 +43,9 @@
> > */
> >
> > #include <acpi/acpi.h>
> > +#include <linux/acpi.h>
> > #include "accommon.h"
> > #include "actables.h"
> > -#include <linux/tboot.h>
> > #include <linux/module.h>
> >
> > #define _COMPONENT ACPI_HARDWARE
> > @@ -344,8 +344,12 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8
> > sleep_state)
> >
> > ACPI_FLUSH_CPU_CACHE();
> >
> > - tboot_sleep(sleep_state, pm1a_control, pm1b_control);
> > -
> > + status = acpi_os_prepare_sleep(sleep_state, pm1a_control,
> > + pm1b_control);
> > + if (ACPI_SKIP(status))
> > + return_ACPI_STATUS(AE_OK);
> > + if (ACPI_FAILURE(status))
> > + return_ACPI_STATUS(status);
> > /* Write #2: Write both SLP_TYP + SLP_EN */
> >
> > status = acpi_hw_write_pm1_control(pm1a_control, pm1b_control); diff
> > --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index f31c5c5..f3aae4b
> > 100644
> > --- a/drivers/acpi/osl.c
> > +++ b/drivers/acpi/osl.c
> > @@ -76,6 +76,9 @@ EXPORT_SYMBOL(acpi_in_debugger); extern char
> > line_buf[80];
> > #endif /*ENABLE_DEBUGGER */
> >
> > +static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
> > + u32 pm1b_ctrl);
> > +
> > static acpi_osd_handler acpi_irq_handler; static void
> > *acpi_irq_context; static struct workqueue_struct *kacpid_wq; @@
> > -1659,3 +1662,24 @@ acpi_status acpi_os_terminate(void)
> >
> > return AE_OK;
> > }
> > +
> > +acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
> > + u32 pm1b_control)
> > +{
> > + int rc = 0;
> > + if (__acpi_os_prepare_sleep)
> > + rc = __acpi_os_prepare_sleep(sleep_state,
> > + pm1a_control, pm1b_control);
> > + if (rc < 0)
> > + return AE_ERROR;
> > + else if (rc > 0)
> > + return AE_CTRL_SKIP;
> > +
> > + return AE_OK;
> > +}
> > +
> > +void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
> > + u32 pm1a_ctrl, u32 pm1b_ctrl)) {
> > + __acpi_os_prepare_sleep = func;
> > +}
> > diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index
> > 5b6c391..fa0d22c 100644
> > --- a/include/acpi/acexcep.h
> > +++ b/include/acpi/acexcep.h
> > @@ -57,6 +57,7 @@
> > #define ACPI_SUCCESS(a) (!(a))
> > #define ACPI_FAILURE(a) (a)
> >
> > +#define ACPI_SKIP(a) (a == AE_CTRL_SKIP)
> > #define AE_OK (acpi_status) 0x0000
> >
> > /*
> > diff --git a/include/linux/acpi.h b/include/linux/acpi.h index
> > 6001b4da..fccd017 100644
> > --- a/include/linux/acpi.h
> > +++ b/include/linux/acpi.h
> > @@ -359,4 +359,14 @@ static inline int suspend_nvs_register(unsigned
> > long a, unsigned long b) } #endif
> >
> > +#ifdef CONFIG_ACPI
> > +void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
> > + u32 pm1a_ctrl, u32 pm1b_ctrl));
> > +
> > +acpi_status acpi_os_prepare_sleep(u8 sleep_state,
> > + u32 pm1a_control, u32 pm1b_control); #else #define
> > +acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while
> > +(0) #endif
> > +
> > #endif /*_LINUX_ACPI_H*/
> > diff --git a/include/linux/tboot.h b/include/linux/tboot.h index
> > 1dba6ee..c75128b 100644
> > --- a/include/linux/tboot.h
> > +++ b/include/linux/tboot.h
> > @@ -143,7 +143,6 @@ static inline int tboot_enabled(void)
> >
> > extern void tboot_probe(void);
> > extern void tboot_shutdown(u32 shutdown_type); -extern void
> > tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control);
> > extern struct acpi_table_header *tboot_get_dmar_table(
> > struct acpi_table_header *dmar_tbl); extern int
> > tboot_force_iommu(void);
> > --
> > 1.7.7.4
^ permalink raw reply
* Re: [PATCH 2/7] tboot: Add return values for tboot_sleep
From: Cihula, Joseph @ 2012-01-10 20:10 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk, linux-kernel@vger.kernel.org, rjw@sisk.pl,
x86@kernel.org, Brown, Len, linux-pm@lists.linux-foundation.org,
tboot-devel@lists.sourceforge.net, linux-acpi@vger.kernel.org,
liang.tang@oracle.com
Cc: hpa@zytor.com
In-Reply-To: <1324075099-11397-3-git-send-email-konrad.wilk@oracle.com>
ACK, but tboot_sleep() calls tboot_shutdown() and there are error conditions in that which you are not reflecting upward--i.e. you should make tboot_shutdown() return an 'int' and propagate its errors through tboot_sleep().
Joe
> -----Original Message-----
> From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com]
> Sent: Friday, December 16, 2011 2:38 PM
> To: linux-kernel@vger.kernel.org; rjw@sisk.pl; x86@kernel.org; Brown, Len; Cihula, Joseph; linux-
> pm@lists.linux-foundation.org; tboot-devel@lists.sourceforge.net; linux-acpi@vger.kernel.org;
> liang.tang@oracle.com
> Cc: hpa@zytor.com; Konrad Rzeszutek Wilk
> Subject: [PATCH 2/7] tboot: Add return values for tboot_sleep
>
> . as appropiately. As tboot_sleep now returns values.
> remove tboot_sleep_wrapper.
>
> Suggested-by: "Rafael J. Wysocki" <rjw@sisk.pl>
> CC: Joseph Cihula <joseph.cihula@intel.com>
> [v1: Return -1/0/+1 instead of ACPI_xx values]
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
> arch/x86/kernel/tboot.c | 13 ++++---------
> 1 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c index 1a4ab7d..6410744 100644
> --- a/arch/x86/kernel/tboot.c
> +++ b/arch/x86/kernel/tboot.c
> @@ -272,7 +272,7 @@ static void tboot_copy_fadt(const struct acpi_table_fadt *fadt)
> offsetof(struct acpi_table_facs, firmware_waking_vector); }
>
> -void tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
> +static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32
> +pm1b_control)
> {
> static u32 acpi_shutdown_map[ACPI_S_STATE_COUNT] = {
> /* S0,1,2: */ -1, -1, -1,
> @@ -281,7 +281,7 @@ void tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
> /* S5: */ TB_SHUTDOWN_S5 };
>
> if (!tboot_enabled())
> - return;
> + return 0;
>
> tboot_copy_fadt(&acpi_gbl_FADT);
> tboot->acpi_sinfo.pm1a_cnt_val = pm1a_control; @@ -292,15 +292,10 @@ void tboot_sleep(u8
> sleep_state, u32 pm1a_control, u32 pm1b_control)
> if (sleep_state >= ACPI_S_STATE_COUNT ||
> acpi_shutdown_map[sleep_state] == -1) {
> pr_warning("unsupported sleep state 0x%x\n", sleep_state);
> - return;
> + return -1;
> }
>
> tboot_shutdown(acpi_shutdown_map[sleep_state]);
> -}
> -static int tboot_sleep_wrapper(u8 sleep_state, u32 pm1a_control,
> - u32 pm1b_control)
> -{
> - tboot_sleep(sleep_state, pm1a_control, pm1b_control);
> return 0;
> }
>
> @@ -352,7 +347,7 @@ static __init int tboot_late_init(void)
> atomic_set(&ap_wfs_count, 0);
> register_hotcpu_notifier(&tboot_cpu_notifier);
>
> - acpi_os_set_prepare_sleep(&tboot_sleep_wrapper);
> + acpi_os_set_prepare_sleep(&tboot_sleep);
> return 0;
> }
>
> --
> 1.7.7.4
^ permalink raw reply
* Re: [PATCH 0/6] RFC: CPU frequency min/max as PM QoS params
From: Rafael J. Wysocki @ 2012-01-10 20:44 UTC (permalink / raw)
To: Antti P Miettinen; +Cc: linux-pm
In-Reply-To: <87ty44czeu.fsf@amiettinen-lnx.nvidia.com>
On Monday, January 09, 2012, Antti P Miettinen wrote:
> "Rafael J. Wysocki" <rjw@sisk.pl> writes:
> > Well, I'd say it's necessary for correctness, perhaps not for the CPU, but in
> > general. If Y is the max, then the subsystem that requested X may easily
> > starve whoever requested the Y by using all of the bandwidth it asked for.
>
> Hmm.. congestion is an issue for latency requests as well.
I'm not sure what you mean. Care to elaborate?
Rafael
^ permalink raw reply
* Re: [PATCH 0/6] RFC: CPU frequency min/max as PM QoS params
From: Rafael J. Wysocki @ 2012-01-10 20:46 UTC (permalink / raw)
To: markgross; +Cc: linux-pm, Antti P Miettinen
In-Reply-To: <20120110045042.GA14968@mgross-G62>
On Tuesday, January 10, 2012, mark gross wrote:
> On Mon, Jan 09, 2012 at 10:27:29PM +0100, Rafael J. Wysocki wrote:
> > On Monday, January 09, 2012, mark gross wrote:
> > > On Sun, Jan 08, 2012 at 11:59:24PM +0100, Rafael J. Wysocki wrote:
> > > > On Friday, January 06, 2012, mark gross wrote:
> > > > > On Fri, Jan 06, 2012 at 02:36:20AM +0200, Antti P Miettinen wrote:
> > > > > > The inspiration for this patch series is the N9 CPU frequency boost
> > > > > > upon input events:
> > > > > >
> > > > > > http://www.spinics.net/lists/cpufreq/msg00667.html
> > > > > >
> > > > > > and the related changes in git://codeaurora.org/kernel/msm.git tree.
> > > > > > Those patches modify the ondemand cpufreq governor. This patch series
> > > > > > adds minimum and maximum CPU frequency as PM QoS parameters and
> > > > > > modifies the cpufreq core to enforce the PM QoS limits. There is also
> > > > > > an example module for boosting the frequency upon input events.
> > > > > >
> > > > > > I've been testing these changes against Ubuntu 3.2 kernel on a Dell
> > > > > > E6420 with the ACPI cpufreq driver. The patches are against
> > > > > > linux-next/master, compile tested against it.
> > > > > >
> > > > > > --Antti
> > > > > >
> > > > > > Alex Frid (1):
> > > > > > PM QoS: Simplify PM QoS expansion/merge
> > > > > >
> > > > > > Antti P Miettinen (5):
> > > > > > PM QoS: Add CPU frequency min/max as PM QoS params
> > > > > > cpufreq: Export user_policy min/max
> > > > > > cpufreq: Preserve sysfs min/max request
> > > > > > cpufreq: Enforce PM QoS min/max limits
> > > > > > input: CPU frequency booster
> > > > > >
> > > > > > drivers/cpufreq/cpufreq.c | 57 +++++++++++++-
> > > > > > drivers/input/Kconfig | 9 ++
> > > > > > drivers/input/Makefile | 1 +
> > > > > > drivers/input/input-cfboost.c | 174 +++++++++++++++++++++++++++++++++++++++++
> > > > > > include/linux/pm_qos.h | 19 ++++-
> > > > > > kernel/power/qos.c | 55 ++++++++++----
> > > > > > 6 files changed, 293 insertions(+), 22 deletions(-)
> > > > > > create mode 100644 drivers/input/input-cfboost.c
> > > > > >
> > > > >
> > > > > The following is my version of part of this patch set I was tinkering
> > > > > with. Its missing the cpufreq notification this change has and doesn't
> > > > > do anything WRT cfboost.
> > > > >
> > > > > Would it be ok if we could consolidate our two implementations and
> > > > > completely separate the cfboost stuff as a separate patch set?
> > > > >
> > > > > My code below is missing the cpufreq notification logic you have.
> > > >
> > > > Well, I have one substantial problem with this approach. Namely, our
> > > > current PM QoS infrastructure is not suitable for throughput constraints,
> > > > because they should be additive, unlike the latency ones.
> > > >
> > > > Namely, if sombody requests throughput X and someone else Y, the resulting
> > > > combined throughput should be X+Y rather than max(X, Y).
> > >
> > > That can be done easy enough. However; in practice I'm not convinced
> > > doing and additive aggregation of the requested QoS would be any better
> > > than just taking the max.
> >
> > Well, I'd say it's necessary for correctness, perhaps not for the CPU, but in
> > general. If Y is the max, then the subsystem that requested X may easily
> > starve whoever requested the Y by using all of the bandwidth it asked for.
>
> I was thinking about this from the CPU point of view more over the day.
> Given that there are many times more than one make the qos requests
> additive will result in quickly requesting more cpu than is available
> and waisting a lot of power. Also additive aggregation falls over a
> bit on with multi-core.
>
> As the consumer of the cpu resources are tasks, and we can only run one
> task at a time on a cpu, I'm talking myself into thinking that max
> *is* the right way to go for cpu throughput (i.e. frequency).
I agree, but I wonder what units of throughput should be used in that case?
Rafael
^ permalink raw reply
* Re: [PATCH 0/6] RFC: CPU frequency min/max as PM QoS params
From: Jean Pihet @ 2012-01-10 21:02 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: linux-pm, Antti P Miettinen, markgross
In-Reply-To: <201201102146.23001.rjw@sisk.pl>
Hi Mark, Rafael,
On Tue, Jan 10, 2012 at 9:46 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> On Tuesday, January 10, 2012, mark gross wrote:
>> On Mon, Jan 09, 2012 at 10:27:29PM +0100, Rafael J. Wysocki wrote:
>> > On Monday, January 09, 2012, mark gross wrote:
>> > > On Sun, Jan 08, 2012 at 11:59:24PM +0100, Rafael J. Wysocki wrote:
>> > > > On Friday, January 06, 2012, mark gross wrote:
>> > > > > On Fri, Jan 06, 2012 at 02:36:20AM +0200, Antti P Miettinen wrote:
>> > > > > > The inspiration for this patch series is the N9 CPU frequency boost
>> > > > > > upon input events:
>> > > > > >
>> > > > > > http://www.spinics.net/lists/cpufreq/msg00667.html
>> > > > > >
>> > > > > > and the related changes in git://codeaurora.org/kernel/msm.git tree.
>> > > > > > Those patches modify the ondemand cpufreq governor. This patch series
>> > > > > > adds minimum and maximum CPU frequency as PM QoS parameters and
>> > > > > > modifies the cpufreq core to enforce the PM QoS limits. There is also
>> > > > > > an example module for boosting the frequency upon input events.
>> > > > > >
>> > > > > > I've been testing these changes against Ubuntu 3.2 kernel on a Dell
>> > > > > > E6420 with the ACPI cpufreq driver. The patches are against
>> > > > > > linux-next/master, compile tested against it.
>> > > > > >
>> > > > > > --Antti
>> > > > > >
>> > > > > > Alex Frid (1):
>> > > > > > PM QoS: Simplify PM QoS expansion/merge
>> > > > > >
>> > > > > > Antti P Miettinen (5):
>> > > > > > PM QoS: Add CPU frequency min/max as PM QoS params
>> > > > > > cpufreq: Export user_policy min/max
>> > > > > > cpufreq: Preserve sysfs min/max request
>> > > > > > cpufreq: Enforce PM QoS min/max limits
>> > > > > > input: CPU frequency booster
>> > > > > >
>> > > > > > drivers/cpufreq/cpufreq.c | 57 +++++++++++++-
>> > > > > > drivers/input/Kconfig | 9 ++
>> > > > > > drivers/input/Makefile | 1 +
>> > > > > > drivers/input/input-cfboost.c | 174 +++++++++++++++++++++++++++++++++++++++++
>> > > > > > include/linux/pm_qos.h | 19 ++++-
>> > > > > > kernel/power/qos.c | 55 ++++++++++----
>> > > > > > 6 files changed, 293 insertions(+), 22 deletions(-)
>> > > > > > create mode 100644 drivers/input/input-cfboost.c
>> > > > > >
>> > > > >
>> > > > > The following is my version of part of this patch set I was tinkering
>> > > > > with. Its missing the cpufreq notification this change has and doesn't
>> > > > > do anything WRT cfboost.
>> > > > >
>> > > > > Would it be ok if we could consolidate our two implementations and
>> > > > > completely separate the cfboost stuff as a separate patch set?
>> > > > >
>> > > > > My code below is missing the cpufreq notification logic you have.
>> > > >
>> > > > Well, I have one substantial problem with this approach. Namely, our
>> > > > current PM QoS infrastructure is not suitable for throughput constraints,
>> > > > because they should be additive, unlike the latency ones.
>> > > >
>> > > > Namely, if sombody requests throughput X and someone else Y, the resulting
>> > > > combined throughput should be X+Y rather than max(X, Y).
>> > >
>> > > That can be done easy enough. However; in practice I'm not convinced
>> > > doing and additive aggregation of the requested QoS would be any better
>> > > than just taking the max.
>> >
>> > Well, I'd say it's necessary for correctness, perhaps not for the CPU, but in
>> > general. If Y is the max, then the subsystem that requested X may easily
>> > starve whoever requested the Y by using all of the bandwidth it asked for.
>>
>> I was thinking about this from the CPU point of view more over the day.
>> Given that there are many times more than one make the qos requests
>> additive will result in quickly requesting more cpu than is available
>> and waisting a lot of power. Also additive aggregation falls over a
>> bit on with multi-core.
>>
>> As the consumer of the cpu resources are tasks, and we can only run one
>> task at a time on a cpu, I'm talking myself into thinking that max
>> *is* the right way to go for cpu throughput (i.e. frequency).
There are case where the constraints values should be additive. The
best example is the main memory throughput and so the memory
controller frequency (or the L3 frequency on OMAP). The main problem
is to estimate the overhead of multiple simultaneous transfers.
What do you think?
>
> I agree, but I wonder what units of throughput should be used in that case?
>
> Rafael
Regards,
Jean
> _______________________________________________
> linux-pm mailing list
> linux-pm@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/linux-pm
^ permalink raw reply
* Re: [PATCH] mmc: core: move suspend/resume to dev_pm_ops and add hibernation support
From: Barry Song @ 2012-01-11 2:54 UTC (permalink / raw)
To: Shubhrajyoti Datta
Cc: Barry Song, cjb, linux-mmc, linux-pm, workgroup.linux, Bin Shi
In-Reply-To: <CAM=Q2cv_sZ89YJbyqVhKYaBA=Yg3UDcv6hfpiebvMYoXkrVg3Q@mail.gmail.com>
2012/1/9 Shubhrajyoti Datta <omaplinuxkernel@gmail.com>:
> Hi Bin,
>
> On Mon, Jan 9, 2012 at 11:52 AM, Barry Song <Barry.Song@csr.com> wrote:
>> From: Bin Shi <Bin.Shi@csr.com>
>>
>> This patch moves suspend/resume to dev_pm_ops and add hibernation support.
>> It was tested on CSR SiRFprimaII cortex-a9 platform. A sd partition is used
>> as swsusp partition.
>>
>> Signed-off-by: Bin Shi <Bin.Shi@csr.com>
>> Signed-off-by: Barry Song <Barry.Song@csr.com>
>> ---
>> drivers/mmc/core/bus.c | 38 +++++++++++++++++++++++++-------------
>> 1 files changed, 25 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
>> index 6be4924..bab50f7 100644
>> --- a/drivers/mmc/core/bus.c
>> +++ b/drivers/mmc/core/bus.c
>> @@ -122,14 +122,14 @@ static int mmc_bus_remove(struct device *dev)
>> return 0;
>> }
>>
>> -static int mmc_bus_suspend(struct device *dev, pm_message_t state)
>> +static int mmc_bus_suspend(struct device *dev)
>> {
>> struct mmc_driver *drv = to_mmc_driver(dev->driver);
>> struct mmc_card *card = mmc_dev_to_card(dev);
>> int ret = 0;
>>
>> if (dev->driver && drv->suspend)
>> - ret = drv->suspend(card, state);
>> + ret = drv->suspend(card, PMSG_SUSPEND);
>> return ret;
>> }
>>
>> @@ -144,6 +144,17 @@ static int mmc_bus_resume(struct device *dev)
>> return ret;
>> }
>>
>> +static int mmc_bus_freeze(struct device *dev)
>> +{
>> + struct mmc_driver *drv = to_mmc_driver(dev->driver);
>> + struct mmc_card *card = mmc_dev_to_card(dev);
>> + int ret = 0;
>> +
>> + if (dev->driver && drv->suspend)
>> + ret = drv->suspend(card, PMSG_FREEZE);
>
> Not a comment , rather a doubt
>
> Any particular reason to differenciate freeze and suspend?
Shubhrajyoti,
there is no real difference for our system. this is just to keep
back-compatible with old mmc_driver.suspend() since the function
accepts a PMSG_xxx as param.
i think all things go well if we add freeze/thaw/restore in Dmitry
Shmidt's "[PATCH V4] mmc: Set suspend/resume bus operations if
CONFIG_PM_RUNTIME is used"
-barry
^ permalink raw reply
* Re: [PATCH] mmc: core: move suspend/resume to dev_pm_ops and add hibernation support
From: Shubhrajyoti Datta @ 2012-01-11 6:26 UTC (permalink / raw)
To: Barry Song; +Cc: Barry Song, cjb, linux-mmc, linux-pm, workgroup.linux, Bin Shi
In-Reply-To: <CAGsJ_4yruL+M3osK2DjWj_ankvOFnUFG_tgmrMe9c1uKa4JrNw@mail.gmail.com>
Hi Barry,
On Wed, Jan 11, 2012 at 8:24 AM, Barry Song <21cnbao@gmail.com> wrote:
> 2012/1/9 Shubhrajyoti Datta <omaplinuxkernel@gmail.com>:
>> Hi Bin,
>>
>> On Mon, Jan 9, 2012 at 11:52 AM, Barry Song <Barry.Song@csr.com> wrote:
>>> From: Bin Shi <Bin.Shi@csr.com>
>>>
>>> This patch moves suspend/resume to dev_pm_ops and add hibernation support.
>>> It was tested on CSR SiRFprimaII cortex-a9 platform. A sd partition is used
>>> as swsusp partition.
>>>
>>> Signed-off-by: Bin Shi <Bin.Shi@csr.com>
>>> Signed-off-by: Barry Song <Barry.Song@csr.com>
>>> ---
>>> drivers/mmc/core/bus.c | 38 +++++++++++++++++++++++++-------------
>>> 1 files changed, 25 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
>>> index 6be4924..bab50f7 100644
>>> --- a/drivers/mmc/core/bus.c
>>> +++ b/drivers/mmc/core/bus.c
>>> @@ -122,14 +122,14 @@ static int mmc_bus_remove(struct device *dev)
>>> return 0;
>>> }
>>>
>>> -static int mmc_bus_suspend(struct device *dev, pm_message_t state)
>>> +static int mmc_bus_suspend(struct device *dev)
>>> {
>>> struct mmc_driver *drv = to_mmc_driver(dev->driver);
>>> struct mmc_card *card = mmc_dev_to_card(dev);
>>> int ret = 0;
>>>
>>> if (dev->driver && drv->suspend)
>>> - ret = drv->suspend(card, state);
>>> + ret = drv->suspend(card, PMSG_SUSPEND);
>>> return ret;
>>> }
>>>
>>> @@ -144,6 +144,17 @@ static int mmc_bus_resume(struct device *dev)
>>> return ret;
>>> }
>>>
>>> +static int mmc_bus_freeze(struct device *dev)
>>> +{
>>> + struct mmc_driver *drv = to_mmc_driver(dev->driver);
>>> + struct mmc_card *card = mmc_dev_to_card(dev);
>>> + int ret = 0;
>>> +
>>> + if (dev->driver && drv->suspend)
>>> + ret = drv->suspend(card, PMSG_FREEZE);
>>
>> Not a comment , rather a doubt
>>
>> Any particular reason to differenciate freeze and suspend?
>
>
> Shubhrajyoti,
> there is no real difference for our system. this is just to keep
> back-compatible with old mmc_driver.suspend() since the function
> accepts a PMSG_xxx as param.
> i think all things go well if we add freeze/thaw/restore in Dmitry
> Shmidt's "[PATCH V4] mmc: Set suspend/resume bus operations if
> CONFIG_PM_RUNTIME is used"
>
Thanks for the explanation.
> -barry
^ permalink raw reply
* Re: [PATCH 0/6] RFC: CPU frequency min/max as PM QoS params
From: Antti P Miettinen @ 2012-01-11 7:26 UTC (permalink / raw)
To: linux-pm
In-Reply-To: <201201102144.00903.rjw@sisk.pl>
"Rafael J. Wysocki" <rjw@sisk.pl> writes:
> On Monday, January 09, 2012, Antti P Miettinen wrote:
>> Hmm.. congestion is an issue for latency requests as well.
>
> I'm not sure what you mean. Care to elaborate?
>
> Rafael
Well, I was just thinking that latencies can get hurt by system load
just like throughput can suffer from load. By blocking sleep states we
can address "system level latency" or "best case latency" but as far as
I can see PM QoS does not address "worst case latency". So minimum CPU
frequency would be somewhat analogous - a "best case" or "system level"
QoS concept.
--Antti
^ permalink raw reply
* Re: [PATCH 0/6] RFC: CPU frequency min/max as PM QoS params
From: Antti P Miettinen @ 2012-01-11 7:32 UTC (permalink / raw)
To: linux-pm
In-Reply-To: <CAORVsuUgL=5N1s7j3mHTzVgpq5sFO5nkotAZ1PeC=s0GfkWGwA@mail.gmail.com>
Jean Pihet <jean.pihet@newoldbits.com> writes:
> There are case where the constraints values should be additive. The
> best example is the main memory throughput and so the memory
> controller frequency (or the L3 frequency on OMAP). The main problem
> is to estimate the overhead of multiple simultaneous transfers.
>
> What do you think?
This is a valid point. What tree/branch should I look at for the OMAP L3
PM QoS?
I think for CPU performance, it's probably simplest just to use
frequency. Mapping from GOPS/MIPS/FLOPS/FPS is probably more sensily
done by PM QoS client side.
--Antti
^ permalink raw reply
* Re: [RFC PATCH 2/2] thermal: Add generic cpu cooling implementation
From: Rob Lee @ 2012-01-11 8:02 UTC (permalink / raw)
To: Amit Daniel Kachhap
Cc: mjg59-1xO5oi07KQx4cg9Nei1l7Q, linaro-dev-cunTk1MwBs8s++Sfvej+rw,
patches-QSEj5FYQhm4dnm+yROfE0A,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-acpi-u79uwXL29TY76Z2rM5mHXA,
rui.zhang-ral2JQCrhuEAvxtiuMwx3w,
linux-pm-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
lenb-DgEjT+Ai2ygdnm+yROfE0A
In-Reply-To: <1323789196-4942-3-git-send-email-amit.kachhap-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Hey Amit, I was able to use your code on an i.MX6Q thermal
implementation and it seemed to work pretty well. Thanks for adding
this. A couple of comments below.
On Tue, Dec 13, 2011 at 9:13 AM, Amit Daniel Kachhap
<amit.kachhap-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> This patch adds support for generic cpu thermal cooling low level
> implementations using frequency scaling and cpuhotplugg currently.
> Different cpu related cooling devices can be registered by the
> user and the binding of these cooling devices to the corresponding
> trip points can be easily done as the registration API's return the
> cooling device pointer.
>
> Signed-off-by: Amit Daniel Kachhap <amit.kachhap-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> Documentation/thermal/cpu-cooling-api.txt | 52 +++++
> drivers/thermal/Kconfig | 11 +
> drivers/thermal/Makefile | 1 +
> drivers/thermal/cpu_cooling.c | 302 +++++++++++++++++++++++++++++
> include/linux/cpu_cooling.h | 45 +++++
> 5 files changed, 411 insertions(+), 0 deletions(-)
> create mode 100644 Documentation/thermal/cpu-cooling-api.txt
> create mode 100644 drivers/thermal/cpu_cooling.c
> create mode 100644 include/linux/cpu_cooling.h
>
> diff --git a/Documentation/thermal/cpu-cooling-api.txt b/Documentation/thermal/cpu-cooling-api.txt
> new file mode 100644
> index 0000000..d30b4f2
> --- /dev/null
> +++ b/Documentation/thermal/cpu-cooling-api.txt
> @@ -0,0 +1,52 @@
> +CPU cooling api's How To
> +===================================
> +
> +Written by Amit Daniel Kachhap <amit.kachhap-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> +
> +Updated: 13 Dec 2011
> +
> +Copyright (c) 2011 Samsung Electronics Co., Ltd(http://www.samsung.com)
> +
> +0. Introduction
> +
> +The generic cpu cooling(freq clipping, cpuhotplug) provides
> +registration/unregistration api's to the user. The binding of the cooling
> +devices to the trip types is left for the user. The registration api's returns
> +the cooling device pointer.
> +
> +1. cpufreq cooling api's
> +
> +1.1 cpufreq registration api's
> +1.1.1 struct thermal_cooling_device *cpufreq_cooling_register(
> + struct freq_pctg_table *tab_ptr, unsigned int tab_size,
> + const struct cpumask *mask_val)
> +
> + This interface function registers the cpufreq cooling device with the name
> + "thermal-cpufreq".
> +
> + tab_ptr: The table containing the percentage of frequency to be clipped for
> + each cooling state.
> + .freq_clip_pctg[NR_CPUS]:Percentage of frequency to be clipped for each
> + cpu.
> + .polling_interval: polling interval for this cooling state.
> + tab_size: the total number of cooling state.
> + mask_val: all the allowed cpu's where frequency clipping can happen.
> +
> +1.1.2 void cpufreq_cooling_unregister(void)
> +
> + This interface function unregisters the "thermal-cpufreq" cooling device.
> +
> +
> +1.2 cpuhotplug registration api's
> +
> +1.2.1 struct thermal_cooling_device *cpuhotplug_cooling_register(
> + const struct cpumask *mask_val)
> +
> + This interface function registers the cpuhotplug cooling device with the name
> + "thermal-cpuhotplug".
> +
> + mask_val: all the allowed cpu's which can be hotplugged out.
> +
> +1.1.2 void cpuhotplug_cooling_unregister(void)
> +
> + This interface function unregisters the "thermal-cpuhotplug" cooling device.
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> index f7f71b2..298c1cd 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -18,3 +18,14 @@ config THERMAL_HWMON
> depends on THERMAL
> depends on HWMON=y || HWMON=THERMAL
> default y
> +
> +config CPU_THERMAL
> + bool "generic cpu cooling support"
> + depends on THERMAL
> + help
> + This implements the generic cpu cooling mechanism through frequency
> + reduction, cpu hotplug and any other ways of reducing temperature. An
> + ACPI version of this already exists(drivers/acpi/processor_thermal.c).
> + This will be useful for platforms using the generic thermal interface
> + and not the ACPI interface.
> + If you want this support, you should say Y or M here.
> diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
> index 31108a0..655cbc4 100644
> --- a/drivers/thermal/Makefile
> +++ b/drivers/thermal/Makefile
> @@ -3,3 +3,4 @@
> #
>
> obj-$(CONFIG_THERMAL) += thermal_sys.o
> +obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o
> diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
> new file mode 100644
> index 0000000..cdd148c
> --- /dev/null
> +++ b/drivers/thermal/cpu_cooling.c
> @@ -0,0 +1,302 @@
> +/*
> + * linux/drivers/thermal/cpu_cooling.c
> + *
> + * Copyright (C) 2011 Samsung Electronics Co., Ltd(http://www.samsung.com)
> + * Copyright (C) 2011 Amit Daniel <amit.kachhap-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> + *
> + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; version 2 of the License.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, write to the Free Software Foundation, Inc.,
> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
> + *
> + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> + */
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/thermal.h>
> +#include <linux/platform_device.h>
> +#include <linux/cpufreq.h>
> +#include <linux/err.h>
> +#include <linux/slab.h>
> +#include <linux/cpu.h>
> +#include <linux/cpu_cooling.h>
> +
> +#ifdef CONFIG_CPU_FREQ
> +struct cpufreq_cooling_device {
> + struct thermal_cooling_device *cool_dev;
> + struct freq_pctg_table *tab_ptr;
> + unsigned int tab_size;
> + unsigned int cpufreq_state;
> + const struct cpumask *allowed_cpus;
> +};
> +
> +static struct cpufreq_cooling_device *cpufreq_device;
> +
> +/*Below codes defines functions to be used for cpufreq as cooling device*/
> +static bool is_cpufreq_valid(int cpu)
> +{
> + struct cpufreq_policy policy;
> + if (!cpufreq_get_policy(&policy, cpu))
> + return true;
> + return false;
> +}
> +
> +static int cpufreq_apply_cooling(int cooling_state)
> +{
> + int cpuid, this_cpu = smp_processor_id();
> +
> + if (!is_cpufreq_valid(this_cpu))
> + return 0;
> +
> + if (cooling_state > cpufreq_device->tab_size)
> + return -EINVAL;
> +
> + /*Check if last cooling level is same as current cooling level*/
> + if (cpufreq_device->cpufreq_state == cooling_state)
> + return 0;
> +
> + cpufreq_device->cpufreq_state = cooling_state;
> +
> + for_each_cpu(cpuid, cpufreq_device->allowed_cpus) {
> + if (is_cpufreq_valid(cpuid))
> + cpufreq_update_policy(cpuid);
> + }
> +
> + return 0;
> +}
> +
> +static int thermal_cpufreq_notifier(struct notifier_block *nb,
> + unsigned long event, void *data)
> +{
> + struct cpufreq_policy *policy = data;
> + struct freq_pctg_table *th_table;
> + unsigned long max_freq = 0;
> + unsigned int cpu = policy->cpu, th_pctg = 0, level;
> +
> + if (event != CPUFREQ_ADJUST)
> + return 0;
> +
> + level = cpufreq_device->cpufreq_state;
> +
> + if (level > 0) {
> + th_table =
> + &(cpufreq_device->tab_ptr[level - 1]);
> + th_pctg = th_table->freq_clip_pctg[cpu];
> + }
> +
> + max_freq =
> + (policy->cpuinfo.max_freq * (100 - th_pctg)) / 100;
> +
> + cpufreq_verify_within_limits(policy, 0, max_freq);
> +
> + return 0;
> +}
> +
> +/*
> + * cpufreq cooling device callback functions
> + */
> +static int cpufreq_get_max_state(struct thermal_cooling_device *cdev,
> + unsigned long *state)
> +{
> + *state = cpufreq_device->tab_size;
> + return 0;
> +}
> +
> +static int cpufreq_get_cur_state(struct thermal_cooling_device *cdev,
> + unsigned long *state)
> +{
> + *state = cpufreq_device->cpufreq_state;
> + return 0;
> +}
> +
> +/*This cooling may be as PASSIVE/STATE_ACTIVE type*/
> +static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
> + unsigned long state)
> +{
> + cpufreq_apply_cooling(state);
> + return 0;
> +}
> +
> +/* bind cpufreq callbacks to cpufreq cooling device */
> +static struct thermal_cooling_device_ops cpufreq_cooling_ops = {
> + .get_max_state = cpufreq_get_max_state,
> + .get_cur_state = cpufreq_get_cur_state,
> + .set_cur_state = cpufreq_set_cur_state,
> +};
> +
> +static struct notifier_block thermal_cpufreq_notifier_block = {
> + .notifier_call = thermal_cpufreq_notifier,
> +};
> +
> +struct thermal_cooling_device *cpufreq_cooling_register(
> + struct freq_pctg_table *tab_ptr, unsigned int tab_size,
> + const struct cpumask *mask_val)
> +{
> + struct thermal_cooling_device *cool_dev;
> +
> + if (tab_ptr == NULL || tab_size == 0)
> + return ERR_PTR(-EINVAL);
> +
> + cpufreq_device =
> + kzalloc(sizeof(struct cpufreq_cooling_device), GFP_KERNEL);
> +
> + if (!cpufreq_device)
> + return ERR_PTR(-ENOMEM);
> +
> + cool_dev = thermal_cooling_device_register("thermal-cpufreq", NULL,
> + &cpufreq_cooling_ops);
> + if (!cool_dev) {
> + kfree(cpufreq_device);
> + return ERR_PTR(-EINVAL);
> + }
> +
> + cpufreq_device->tab_ptr = tab_ptr;
> + cpufreq_device->tab_size = tab_size;
> + cpufreq_device->cool_dev = cool_dev;
> + cpufreq_device->allowed_cpus = mask_val;
> +
> + cpufreq_register_notifier(&thermal_cpufreq_notifier_block,
> + CPUFREQ_POLICY_NOTIFIER);
> + return cool_dev;
> +}
> +EXPORT_SYMBOL(cpufreq_cooling_register);
> +
> +void cpufreq_cooling_unregister(void)
> +{
> + cpufreq_unregister_notifier(&thermal_cpufreq_notifier_block,
> + CPUFREQ_POLICY_NOTIFIER);
> + thermal_cooling_device_unregister(cpufreq_device->cool_dev);
> + kfree(cpufreq_device);
> +}
> +EXPORT_SYMBOL(cpufreq_cooling_unregister);
> +#else /*!CONFIG_CPU_FREQ*/
> +struct thermal_cooling_device *cpufreq_cooling_register(
> + struct freq_pctg_table *tab_ptr, unsigned int tab_size)
Need to add the "const struct cpumask *mask_val" parameter
to this function like it's used above and prototyped in the heard
or else it causes a build error when building
without CONFIG_CPU_FREQ defined.
> +{
> + return NULL;
> +}
> +EXPORT_SYMBOL(cpufreq_cooling_register);
> +void cpufreq_cooling_unregister(void)
> +{
> + return;
> +}
> +EXPORT_SYMBOL(cpufreq_cooling_unregister);
> +#endif /*CONFIG_CPU_FREQ*/
> +
> +#ifdef CONFIG_HOTPLUG_CPU
> +
> +struct hotplug_cooling_device {
> + struct thermal_cooling_device *cool_dev;
> + unsigned int hotplug_state;
> + const struct cpumask *allowed_cpus;
> +};
> +static struct hotplug_cooling_device *hotplug_device;
> +
> +/*
> + * cpu hotplug cooling device callback functions
> + */
> +static int cpuhotplug_get_max_state(struct thermal_cooling_device *cdev,
> + unsigned long *state)
> +{
> + *state = 1;
> + return 0;
> +}
> +
> +static int cpuhotplug_get_cur_state(struct thermal_cooling_device *cdev,
> + unsigned long *state)
> +{
> + /*This cooling device may be of type ACTIVE, so state field
> + can be 0 or 1*/
> + *state = hotplug_device->hotplug_state;
> + return 0;
> +}
> +
> +/*This cooling may be as PASSIVE/STATE_ACTIVE type*/
> +static int cpuhotplug_set_cur_state(struct thermal_cooling_device *cdev,
> + unsigned long state)
> +{
> + int cpuid, this_cpu = smp_processor_id();
> +
> + if (hotplug_device->hotplug_state == state)
> + return 0;
> +
> + /*This cooling device may be of type ACTIVE, so state field
> + can be 0 or 1*/
> + if (state == 1) {
> + for_each_cpu(cpuid, hotplug_device->allowed_cpus) {
> + if (cpu_online(cpuid) && (cpuid != this_cpu))
> + cpu_down(cpuid);
> + }
> + } else if (state == 0) {
> + for_each_cpu(cpuid, hotplug_device->allowed_cpus) {
> + if (!cpu_online(cpuid) && (cpuid != this_cpu))
> + cpu_up(cpuid);
> + }
> + } else
> + return -EINVAL;
> +
I don't like how ACTIVE does not have available notification callbacks
like HOT and CRITICAL do. Perhaps I fail to grasp why they aren't there
but besides just applying a cooling device, one might want to do something
else as well upon hitting these trip points. So that said, it might be nice
to add a notification to STATE_ACTIVE as well.
> + hotplug_device->hotplug_state = state;
> +
> + return 0;
> +}
> +/* bind hotplug callbacks to cpu hotplug cooling device */
> +static struct thermal_cooling_device_ops cpuhotplug_cooling_ops = {
> + .get_max_state = cpuhotplug_get_max_state,
> + .get_cur_state = cpuhotplug_get_cur_state,
> + .set_cur_state = cpuhotplug_set_cur_state,
> +};
> +
> +struct thermal_cooling_device *cpuhotplug_cooling_register(
> + const struct cpumask *mask_val)
> +{
> + struct thermal_cooling_device *cool_dev;
> +
> + hotplug_device =
> + kzalloc(sizeof(struct hotplug_cooling_device), GFP_KERNEL);
> +
> + if (!hotplug_device)
> + return ERR_PTR(-ENOMEM);
> +
> + cool_dev = thermal_cooling_device_register("thermal-cpuhotplug", NULL,
> + &cpuhotplug_cooling_ops);
> + if (!cool_dev) {
> + kfree(hotplug_device);
> + return ERR_PTR(-EINVAL);
> + }
> +
> + hotplug_device->cool_dev = cool_dev;
> + hotplug_device->hotplug_state = 0;
> + hotplug_device->allowed_cpus = mask_val;
> +
> + return cool_dev;
> +}
> +EXPORT_SYMBOL(cpuhotplug_cooling_register);
> +
> +void cpuhotplug_cooling_unregister(void)
> +{
> + thermal_cooling_device_unregister(hotplug_device->cool_dev);
> + kfree(hotplug_device);
> +}
> +EXPORT_SYMBOL(cpuhotplug_cooling_unregister);
> +#else /*!CONFIG_HOTPLUG_CPU*/
> +struct thermal_cooling_device *cpuhotplug_cooling_register(
> + const struct cpumask *mask_val)
> +{
> + return NULL;
> +}
> +EXPORT_SYMBOL(cpuhotplug_cooling_register);
> +void cpuhotplug_cooling_unregister(void)
> +{
> + return;
> +}
> +EXPORT_SYMBOL(cpuhotplug_cooling_unregister);
> +#endif /*CONFIG_HOTPLUG_CPU*/
> diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h
> new file mode 100644
> index 0000000..0c57375
> --- /dev/null
> +++ b/include/linux/cpu_cooling.h
> @@ -0,0 +1,45 @@
> +/*
> + * linux/include/linux/cpu_cooling.h
> + *
> + * Copyright (C) 2011 Samsung Electronics Co., Ltd(http://www.samsung.com)
> + * Copyright (C) 2011 Amit Daniel <amit.kachhap-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> + *
> + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; version 2 of the License.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, write to the Free Software Foundation, Inc.,
> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
> + *
> + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> + */
> +
> +#ifndef __CPU_COOLING_H__
> +#define __CPU_COOLING_H__
> +
> +#include <linux/thermal.h>
> +
> +struct freq_pctg_table {
> + unsigned int freq_clip_pctg[NR_CPUS];
> + unsigned int polling_interval;
> +};
> +
> +extern struct thermal_cooling_device *cpufreq_cooling_register(
> + struct freq_pctg_table *tab_ptr, unsigned int tab_size,
> + const struct cpumask *mask_val);
> +
> +extern void cpufreq_cooling_unregister(void);
> +
> +extern struct thermal_cooling_device *cpuhotplug_cooling_register(
> + const struct cpumask *mask_val);
> +
> +extern void cpuhotplug_cooling_unregister(void);
> +
> +#endif /* __CPU_COOLING_H__ */
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply
* Re: [linux-pm] [RFC PATCH 1/2] thermal: Add a new trip type to use cooling device instance number
From: Rob Lee @ 2012-01-11 8:12 UTC (permalink / raw)
To: Amit Kachhap
Cc: Vincent Guittot, linux-pm, linaro-dev, patches, linux-kernel,
linux-acpi
In-Reply-To: <CAK44p23apXmAUY3DR2rogeAwMQmOEdwW3SZbEpxApVkc9He+kg@mail.gmail.com>
Hey Amit/Vincent,
It appears that with this implementation the STATE_ACTIVE trip number
used will also be the index of the cool_freq_tab used. If that is
true, then perhaps a common structure would be beneficial that links
each STATE_ACTIVE trip point with its corresponding cooling data.
BR,
Rob
On Tue, Dec 20, 2011 at 11:11 PM, Amit Kachhap <amit.kachhap@linaro.org> wrote:
> Hi Vincent,
>
> Thanks for the review.
> Well actually your are correct that current temperature and last
> temperature can be used to increase or decrease the cpu frequency. But
> this has to be done again in cooling devices so to make the cooling
> devices generic and to avoid the temperature comparison again this new
> trip type passes the cooling device instance id.
> Also about your queries that this may add dependency between trip
> index and cooling state. This is actually needed and this dependency
> is created when the cooling device is binded with trip points(For
> cpufreq type cooling device just the instance of cooling device is
> associated with trip points). More over the existing PASSIVE cooling
> trip type does the same thing and iterates across all the cooling
> state.
>
> Thanks,
> Amit Daniel
>>
>> On 20 December 2011 18:07, Vincent Guittot <vincent.guittot@linaro.org> wrote:
>>>
>>> Hi Amit,
>>>
>>> I'm not sure that using the trip index for setting the state of a
>>> cooling device is a generic solution because you are adding a
>>> dependency between the trip index and the cooling device state that
>>> might be difficult to handle. This dependency implies that a cooling
>>> device like cpufreq_cooling_device must be registered in the 1st trips
>>> of a thermal_zone which is not possible when we want to register 2
>>> cpufreq_cooling_devices in the same thermal_zone.
>>> You should only rely on the current and last temperatures to detect if
>>> a trip_temp has been crossed and you should increase or decrease the
>>> current state of the cooling device accordingly.
>>>
>>> something like below should work with cpufreq_cooling_device and will
>>> not add any constraint on the trip index. The state of a cooling
>>> device is increased/decreased once for each trip
>>>
>>> + case THERMAL_TRIP_STATE_ACTIVE:
>>> + list_for_each_entry(instance, &tz->cooling_devices,
>>> + node) {
>>> + if (instance->trip != count)
>>> + continue;
>>> +
>>> + cdev = instance->cdev;
>>> +
>>> + if ((temp >= trip_temp)
>>> + && (trip_temp > tz->last_temperature)) {
>>> + cdev->ops->get_max_state(cdev,
>>> + &max_state);
>>> + cdev->ops->get_cur_state(cdev,
>>> + ¤t_state);
>>> + if (++current_state <= max_state)
>>> + cdev->ops->set_cur_state(cdev,
>>> + current_state);
>>> + }
>>> + else if ((temp < trip_temp)
>>> + && (trip_temp <= tz->last_temperature)) {
>>> + cdev->ops->get_cur_state(cdev,
>>> + ¤t_state);
>>> + if (current_state > 0)
>>> + cdev->ops->set_cur_state(cdev,
>>> + --current_state);
>>> + }
>>> + break;
>>>
>>> Regards,
>>> Vincent
>>>
>>> On 13 December 2011 16:13, Amit Daniel Kachhap <amit.kachhap@linaro.org> wrote:
>>> > This patch adds a new trip type THERMAL_TRIP_STATE_ACTIVE. This
>>> > trip behaves same as THERMAL_TRIP_ACTIVE but also passes the cooling
>>> > device instance number. This helps the cooling device registered as
>>> > different instances to perform appropriate cooling action decision in
>>> > the set_cur_state call back function.
>>> >
>>> > Also since the trip temperature's are in ascending order so some logic
>>> > is put in place to skip the un-necessary checks.
>>> >
>>> > Signed-off-by: Amit Daniel Kachhap <amit.kachhap@linaro.org>
>>> > ---
>>> > Documentation/thermal/sysfs-api.txt | 4 ++--
>>> > drivers/thermal/thermal_sys.c | 27 ++++++++++++++++++++++++++-
>>> > include/linux/thermal.h | 1 +
>>> > 3 files changed, 29 insertions(+), 3 deletions(-)
>>> >
>>> > diff --git a/Documentation/thermal/sysfs-api.txt b/Documentation/thermal/sysfs-api.txt
>>> > index b61e46f..5c1d44e 100644
>>> > --- a/Documentation/thermal/sysfs-api.txt
>>> > +++ b/Documentation/thermal/sysfs-api.txt
>>> > @@ -184,8 +184,8 @@ trip_point_[0-*]_temp
>>> >
>>> > trip_point_[0-*]_type
>>> > Strings which indicate the type of the trip point.
>>> > - E.g. it can be one of critical, hot, passive, active[0-*] for ACPI
>>> > - thermal zone.
>>> > + E.g. it can be one of critical, hot, passive, active[0-1],
>>> > + state-active[0-*] for ACPI thermal zone.
>>> > RO, Optional
>>> >
>>> > cdev[0-*]
>>> > diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
>>> > index dd9a574..72b1ab3 100644
>>> > --- a/drivers/thermal/thermal_sys.c
>>> > +++ b/drivers/thermal/thermal_sys.c
>>> > @@ -192,6 +192,8 @@ trip_point_type_show(struct device *dev, struct device_attribute *attr,
>>> > return sprintf(buf, "passive\n");
>>> > case THERMAL_TRIP_ACTIVE:
>>> > return sprintf(buf, "active\n");
>>> > + case THERMAL_TRIP_STATE_ACTIVE:
>>> > + return sprintf(buf, "state-active\n");
>>> > default:
>>> > return sprintf(buf, "unknown\n");
>>> > }
>>> > @@ -1035,7 +1037,7 @@ EXPORT_SYMBOL(thermal_cooling_device_unregister);
>>> > void thermal_zone_device_update(struct thermal_zone_device *tz)
>>> > {
>>> > int count, ret = 0;
>>> > - long temp, trip_temp;
>>> > + long temp, trip_temp, max_state, last_trip_change = 0;
>>> > enum thermal_trip_type trip_type;
>>> > struct thermal_cooling_device_instance *instance;
>>> > struct thermal_cooling_device *cdev;
>>> > @@ -1086,6 +1088,29 @@ void thermal_zone_device_update(struct thermal_zone_device *tz)
>>> > cdev->ops->set_cur_state(cdev, 0);
>>> > }
>>> > break;
>>> > + case THERMAL_TRIP_STATE_ACTIVE:
>>> > + list_for_each_entry(instance, &tz->cooling_devices,
>>> > + node) {
>>> > + if (instance->trip != count)
>>> > + continue;
>>> > +
>>> > + if (temp <= last_trip_change)
>>> > + continue;
>>> > +
>>> > + cdev = instance->cdev;
>>> > + cdev->ops->get_max_state(cdev, &max_state);
>>> > +
>>> > + if ((temp >= trip_temp) &&
>>> > + ((count + 1) <= max_state))
>>> > + cdev->ops->set_cur_state(cdev,
>>> > + count + 1);
>>> > + else if ((temp < trip_temp) &&
>>> > + (count <= max_state))
>>> > + cdev->ops->set_cur_state(cdev, count);
>>> > +
>>> > + last_trip_change = trip_temp;
>>> > + }
>>> > + break;
>>> > case THERMAL_TRIP_PASSIVE:
>>> > if (temp >= trip_temp || tz->passive)
>>> > thermal_zone_device_passive(tz, temp,
>>> > diff --git a/include/linux/thermal.h b/include/linux/thermal.h
>>> > index 47b4a27..d7d0a27 100644
>>> > --- a/include/linux/thermal.h
>>> > +++ b/include/linux/thermal.h
>>> > @@ -42,6 +42,7 @@ enum thermal_trip_type {
>>> > THERMAL_TRIP_PASSIVE,
>>> > THERMAL_TRIP_HOT,
>>> > THERMAL_TRIP_CRITICAL,
>>> > + THERMAL_TRIP_STATE_ACTIVE,
>>> > };
>>> >
>>> > struct thermal_zone_device_ops {
>>> > --
>>> > 1.7.1
>>> >
>>> > _______________________________________________
>>> > linux-pm mailing list
>>> > linux-pm@lists.linux-foundation.org
>>> > https://lists.linuxfoundation.org/mailman/listinfo/linux-pm
>>
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 4/6] cpufreq: Preserve sysfs min/max request
From: Antti P Miettinen @ 2012-01-11 21:56 UTC (permalink / raw)
To: linux-pm; +Cc: cpufreq
In-Reply-To: <1325844234-478-5-git-send-email-amiettinen@nvidia.com>
Any comments to this change?
Antti P Miettinen <amiettinen@nvidia.com> writes:
> Store the value received via sysfs as the user_policy
> min/max value instead of the currently enforced min/max.
> This allows restoring the user min/max values when
> constraints on enforced min/max change.
>
> Signed-off-by: Antti P Miettinen <amiettinen@nvidia.com>
> ---
> drivers/cpufreq/cpufreq.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index e63b29f..65a512b 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -389,7 +389,7 @@ static ssize_t store_##file_name \
> return -EINVAL; \
> \
> ret = __cpufreq_set_policy(policy, &new_policy); \
> - policy->user_policy.object = policy->object; \
> + policy->user_policy.object = new_policy.object; \
> \
> return ret ? ret : count; \
> }
--Antti
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox