PM_QOS 1 of 2
Subsystems (4)
PATCH 1/1 PM_QOS 1 of 2
The following is the cleaned up patch implementing the power management quality of service infrastructure discussed at the pm summit last June.
It is a genralization of the latency code put into the kernel last year by Arjan.
I would like to get this code included in the MM tree and to get some milage on it.
One thing to note about this implementation is that it exposes an interface to user space for registering pm_qos constraints in addition to the kernel exports. Its a file based interface where a module can register a constraint and the constraint is valid only as long as the device node is held open. Upon closing of the device node that constraint is cleaned up.
The patch set is in two postings.
1) the base parameter code (this email)
2) replacing of latency.c/latenc.h with pm_qos_params.c/pm_qos_params.h
thanks,
--mgross
-----------
include/linux/pm_qos_params.h +35 -0
@@ -0,0 +1,35 @@ +/* interface for the pm_qos_power infrastructure of the linux kernel. +* +* Mark Gross +*/ +#include <linux/list.h> +#include <linux/notifier.h> +#include <linux/miscdevice.h> + +struct requirement_list { +struct list_head list; +union { +s32 value; +s32 usec; +s32 kbps; + }; +char *name; +}; + +#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_NUM_CLASSES 4 +#define PM_QOS_DEFAULT_VALUE -1 + +int pm_qos_add_requirement (int qos,char *name,s32 value); +int pm_qos_update_requirement (int qos,char *name,s32 new_value); +void pm_qos_remove_requirement (int qos,char *name); + +int pm_qos_requirement (int qos); + +int pm_qos_add_notifier (int qos,struct notifier_block *notifier); +int pm_qos_remove_notifier (int qos,struct notifier_block *notifier); +
kernel/Makefile +1 -1
@@ -9,7 +9,7 @@ rcupdate.o extable.o params.o posix-timers.o \ kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ hrtimer.o rwsem.o latency.o nsproxy.o srcu.o die_notifier.o \ - utsname.o + utsname.o pm_qos_params.o obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-y += time/
kernel/pm_qos_params.c +417 -0
417 lines not on this page · raw message
Re: [PATCH] PM_QOS 2 of 2
this is the second part of the patch to replace latency.c use with pm_qos_params use.
--mgross
-----------
drivers/acpi/processor_idle.c +10 -6
@@ -38,7 +38,7 @@#include <linux/dmi.h> #include <linux/moduleparam.h> #include <linux/sched.h> /* need_resched() */ -#include <linux/latency.h> +#include <linux/pm_qos_params.h> #include <linux/clockchips.h> /*
@@ -605,7 +605,8 @@if (cx->promotion.state && ((cx->promotion.state - pr->power.states) <= max_cstate)) {if (sleep_ticks > cx->promotion.threshold.ticks && - cx->promotion.state->latency <=system_latency_constraint ()) { + cx->promotion.state->latency <= +pm_qos_requirement (PM_QOS_CPU_DMA_LATENCY )) { cx->promotion.count++; cx->demotion.count =0 ; if (cx->promotion.count >=
@@ -649,7 +650,8 @@* or if the latency of the current state is unacceptable */ if ((pr->power.state - pr->power.states) > max_cstate || - pr->power.state->latency >system_latency_constraint ()) { + pr->power.state->latency > +pm_qos_requirement (PM_QOS_CPU_DMA_LATENCY )) {if (cx->demotion.state) next_state = cx->demotion.state; }
@@ -1173,7 +1175,7 @@"maximum allowed latency: %d usec\n" , pr->power.state ? pr->power.state - pr->power.states :0 , max_cstate, (unsigned )pr->power.bm_activity, - system_latency_constraint()); + pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY));seq_puts (seq,"states:\n" );
@@ -1280,7 +1282,8 @@ max_cstate); first_run++;#ifdef CONFIG_SMP -register_latency_notifier (&acpi_processor_latency_notifier); +pm_qos_add_notifier (PM_QOS_CPU_DMA_LATENCY , + &acpi_processor_latency_notifier);#endif }
@@ -1354,7 +1357,8 @@*/ cpu_idle_wait ();#ifdef CONFIG_SMP -unregister_latency_notifier (&acpi_processor_latency_notifier); +pm_qos_remove_notifier (PM_QOS_CPU_DMA_LATENCY , + &acpi_processor_latency_notifier);#endif }
drivers/net/wireless/ipw2100.c +7 -5
@@ -162,7 +162,7 @@#include <linux/firmware.h> #include <linux/acpi.h> #include <linux/ctype.h> -#include <linux/latency.h> +#include <linux/pm_qos_params.h> #include "ipw2100.h"
@@ -1701,7 +1701,7 @@/* the ipw2100 hardware really doesn't want power management delays * longer than 175usec */ -modify_acceptable_latency ("ipw2100" ,175 ); +pm_qos_update_requirement (PM_QOS_CPU_DMA_LATENCY ,"ipw2100" ,175 );/* If the interrupt is enabled, turn it off... */ spin_lock_irqsave (&priv->low_lock, flags);
@@ -1856,7 +1856,8 @@ipw2100_disable_interrupts (priv);spin_unlock_irqrestore (&priv->low_lock, flags); -modify_acceptable_latency ("ipw2100" ,INFINITE_LATENCY ); +pm_qos_update_requirement (PM_QOS_CPU_DMA_LATENCY ,"ipw2100" , +PM_QOS_DEFAULT_VALUE );#ifdef ACPI_CSTATE_LIMIT_DEFINED if (priv->config &CFG_C3_DISABLED ) {
@@ -6544,7 +6545,8 @@if (ret) goto out; -set_acceptable_latency ("ipw2100" ,INFINITE_LATENCY ); +pm_qos_add_requirement (PM_QOS_CPU_DMA_LATENCY ,"ipw2100" , +PM_QOS_DEFAULT_VALUE );#ifdef CONFIG_IPW2100_DEBUG ipw2100_debug_level = debug; ret = driver_create_file(&ipw2100_pci_driver.driver,
@@ -6566,7 +6568,7 @@ &driver_attr_debug_level);#endif pci_unregister_driver (&ipw2100_pci_driver); -remove_acceptable_latency ("ipw2100" ); +pm_qos_remove_requirement (PM_QOS_CPU_DMA_LATENCY ,"ipw2100" ); }module_init (ipw2100_init);
include/linux/latency.h +0 -25
@@ -1,25 +0,0 @@ -/* -* latency.h: Explicit system-wide latency-expectation infrastructure -* -* (C) Copyright 2006 Intel Corporation -* Author: Arjan van de Ven <[email protected]> -* -*/ - -#ifndef _INCLUDE_GUARD_LATENCY_H_ -#define _INCLUDE_GUARD_LATENCY_H_ - -#include <linux/notifier.h> - -void set_acceptable_latency (char *identifier,int usecs); -void modify_acceptable_latency (char *identifier,int usecs); -void remove_acceptable_latency (char *identifier); -void synchronize_acceptable_latency (void ); -int system_latency_constraint (void ); - -int register_latency_notifier (struct notifier_block * nb); -int unregister_latency_notifier (struct notifier_block * nb); - -#define INFINITE_LATENCY 1000000 - -#endif
kernel/latency.c +0 -280
280 lines not on this page · raw message
kernel/Makefile +1 -1
@@ -8,7 +8,7 @@ signal.o sys.o kmod.o workqueue.o pid.o \ rcupdate.o extable.o params.o posix-timers.o \ kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ - hrtimer.o rwsem.o latency.o nsproxy.o srcu.o die_notifier.o \ + hrtimer.o rwsem.o nsproxy.o srcu.o die_notifier.o \ utsname.o pm_qos_params.o obj-$(CONFIG_STACKTRACE) += stacktrace.o
sound/core/pcm_native.c +7 -4
@@ -24,7 +24,7 @@#include <linux/file.h> #include <linux/slab.h> #include <linux/time.h> -#include <linux/latency.h> +#include <linux/pm_qos_params.h> #include <linux/uio.h> #include <sound/core.h> #include <sound/control.h>
@@ -447,9 +447,11 @@snd_pcm_timer_resolution_change (substream); runtime->status->state =SNDRV_PCM_STATE_SETUP ; -remove_acceptable_latency (substream->latency_id); +pm_qos_remove_requirement (PM_QOS_CPU_DMA_LATENCY , + substream->latency_id);if ((usecs =period_to_usecs (runtime)) >=0 ) -set_acceptable_latency (substream->latency_id, usecs); +pm_qos_add_requirement (PM_QOS_CPU_DMA_LATENCY , + substream->latency_id, usecs);return 0 ; _error:/* hardware might be unuseable from this time,
@@ -509,7 +511,8 @@if (substream->ops->hw_free) result = substream->ops->hw_free (substream); runtime->status->state =SNDRV_PCM_STATE_OPEN ; -remove_acceptable_latency (substream->latency_id); +pm_qos_remove_requirement (PM_QOS_CPU_DMA_LATENCY , + substream->latency_id);return result; }
Re: [linux-pm] [PATCH] PM_QOS 2 of 2
In reply to Mark Grossthis is the second part of the patch to replace latency.c use with pm_qos_params use.
--mgross
-----------
drivers/acpi/processor_idle.c +10 -6
@@ -38,7 +38,7 @@#include <linux/dmi.h> #include <linux/moduleparam.h> #include <linux/sched.h> /* need_resched() */ -#include <linux/latency.h> +#include <linux/pm_qos_params.h> #include <linux/clockchips.h> /*
@@ -605,7 +605,8 @@if (cx->promotion.state && ((cx->promotion.state - pr->power.states) <= max_cstate)) {if (sleep_ticks > cx->promotion.threshold.ticks && - cx->promotion.state->latency <=system_latency_constraint ()) { + cx->promotion.state->latency <= +pm_qos_requirement (PM_QOS_CPU_DMA_LATENCY )) { cx->promotion.count++; cx->demotion.count =0 ; if (cx->promotion.count >=
@@ -649,7 +650,8 @@* or if the latency of the current state is unacceptable */ if ((pr->power.state - pr->power.states) > max_cstate || - pr->power.state->latency >system_latency_constraint ()) { + pr->power.state->latency > +pm_qos_requirement (PM_QOS_CPU_DMA_LATENCY )) {if (cx->demotion.state) next_state = cx->demotion.state; }
@@ -1173,7 +1175,7 @@"maximum allowed latency: %d usec\n" , pr->power.state ? pr->power.state - pr->power.states :0 , max_cstate, (unsigned )pr->power.bm_activity, - system_latency_constraint()); + pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY));seq_puts (seq,"states:\n" );
@@ -1280,7 +1282,8 @@ max_cstate); first_run++;#ifdef CONFIG_SMP -register_latency_notifier (&acpi_processor_latency_notifier); +pm_qos_add_notifier (PM_QOS_CPU_DMA_LATENCY , + &acpi_processor_latency_notifier);#endif }
@@ -1354,7 +1357,8 @@*/ cpu_idle_wait ();#ifdef CONFIG_SMP -unregister_latency_notifier (&acpi_processor_latency_notifier); +pm_qos_remove_notifier (PM_QOS_CPU_DMA_LATENCY , + &acpi_processor_latency_notifier);#endif }
drivers/net/wireless/ipw2100.c +7 -5
@@ -162,7 +162,7 @@#include <linux/firmware.h> #include <linux/acpi.h> #include <linux/ctype.h> -#include <linux/latency.h> +#include <linux/pm_qos_params.h> #include "ipw2100.h"
@@ -1701,7 +1701,7 @@/* the ipw2100 hardware really doesn't want power management delays * longer than 175usec */ -modify_acceptable_latency ("ipw2100" ,175 ); +pm_qos_update_requirement (PM_QOS_CPU_DMA_LATENCY ,"ipw2100" ,175 );/* If the interrupt is enabled, turn it off... */ spin_lock_irqsave (&priv->low_lock, flags);
@@ -1856,7 +1856,8 @@ipw2100_disable_interrupts (priv);spin_unlock_irqrestore (&priv->low_lock, flags); -modify_acceptable_latency ("ipw2100" ,INFINITE_LATENCY ); +pm_qos_update_requirement (PM_QOS_CPU_DMA_LATENCY ,"ipw2100" , +PM_QOS_DEFAULT_VALUE );#ifdef ACPI_CSTATE_LIMIT_DEFINED if (priv->config &CFG_C3_DISABLED ) {
@@ -6544,7 +6545,8 @@if (ret) goto out; -set_acceptable_latency ("ipw2100" ,INFINITE_LATENCY ); +pm_qos_add_requirement (PM_QOS_CPU_DMA_LATENCY ,"ipw2100" , +PM_QOS_DEFAULT_VALUE );#ifdef CONFIG_IPW2100_DEBUG ipw2100_debug_level = debug; ret = driver_create_file(&ipw2100_pci_driver.driver,
@@ -6566,7 +6568,7 @@ &driver_attr_debug_level);#endif pci_unregister_driver (&ipw2100_pci_driver); -remove_acceptable_latency ("ipw2100" ); +pm_qos_remove_requirement (PM_QOS_CPU_DMA_LATENCY ,"ipw2100" ); }module_init (ipw2100_init);
include/linux/latency.h +0 -25
@@ -1,25 +0,0 @@ -/* -* latency.h: Explicit system-wide latency-expectation infrastructure -* -* (C) Copyright 2006 Intel Corporation -* Author: Arjan van de Ven <[email protected]> -* -*/ - -#ifndef _INCLUDE_GUARD_LATENCY_H_ -#define _INCLUDE_GUARD_LATENCY_H_ - -#include <linux/notifier.h> - -void set_acceptable_latency (char *identifier,int usecs); -void modify_acceptable_latency (char *identifier,int usecs); -void remove_acceptable_latency (char *identifier); -void synchronize_acceptable_latency (void ); -int system_latency_constraint (void ); - -int register_latency_notifier (struct notifier_block * nb); -int unregister_latency_notifier (struct notifier_block * nb); - -#define INFINITE_LATENCY 1000000 - -#endif
kernel/latency.c +0 -280
280 lines not on this page · raw message
kernel/Makefile +1 -1
@@ -8,7 +8,7 @@ signal.o sys.o kmod.o workqueue.o pid.o \ rcupdate.o extable.o params.o posix-timers.o \ kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ - hrtimer.o rwsem.o latency.o nsproxy.o srcu.o die_notifier.o \ + hrtimer.o rwsem.o nsproxy.o srcu.o die_notifier.o \ utsname.o pm_qos_params.o obj-$(CONFIG_STACKTRACE) += stacktrace.o
sound/core/pcm_native.c +7 -4
@@ -24,7 +24,7 @@#include <linux/file.h> #include <linux/slab.h> #include <linux/time.h> -#include <linux/latency.h> +#include <linux/pm_qos_params.h> #include <linux/uio.h> #include <sound/core.h> #include <sound/control.h>
@@ -447,9 +447,11 @@snd_pcm_timer_resolution_change (substream); runtime->status->state =SNDRV_PCM_STATE_SETUP ; -remove_acceptable_latency (substream->latency_id); +pm_qos_remove_requirement (PM_QOS_CPU_DMA_LATENCY , + substream->latency_id);if ((usecs =period_to_usecs (runtime)) >=0 ) -set_acceptable_latency (substream->latency_id, usecs); +pm_qos_add_requirement (PM_QOS_CPU_DMA_LATENCY , + substream->latency_id, usecs);return 0 ; _error:/* hardware might be unuseable from this time,
@@ -509,7 +511,8 @@if (substream->ops->hw_free) result = substream->ops->hw_free (substream); runtime->status->state =SNDRV_PCM_STATE_OPEN ; -remove_acceptable_latency (substream->latency_id); +pm_qos_remove_requirement (PM_QOS_CPU_DMA_LATENCY , + substream->latency_id);return result; }
Quoted 16 lines · On Mon, 1 Oct 2007 16:45:28 -0700 Mark Gross <[email protected]> wrote:
The following is the cleaned up patch implementing the power management quality of service infrastructure discussed at the pm summit last June.
It is a genralization of the latency code put into the kernel last year by Arjan.
I would like to get this code included in the MM tree and to get some milage on it.
One thing to note about this implementation is that it exposes an interface to user space for registering
pm_qosconstraints in addition to the kernel exports. Its a file based interface where a module can register a constraint and the constraint is valid only as long as the device node is held open. Upon closing of the device node that constraint is cleaned up.
Quoted 3 lines
The patch set is in two postings.
1) the base parameter code (this email)
2) replacing oflatency.c/latenc.hwithpm_qos_params.c/pm_qos_params.h
I wouldn't really view this as an adequate changelog.
- The Subject:s are pretty pathetic (please see my suggesed replacements)
- There is no description of the proposed new kernel<->userspace interfaces.
As you are proposing new and permanent enhancements to the Linux API, this is something which should be spelled out in some detail. Because we can change the implementation, but we can not ever change your interface.
It would be nice to get that interface described in Documentation/ somewhere, but it is *critical* that the design be fully revealed right now, during review.
Anyway, I am not a suitable person to review this submission.
I'll put the patches in -mm for a bit of eyeball-and-test (not that anyone will know how to test it, due to the secret interfaces) but I do not want to move this code into mainline until someone who is familiar with the PM code has performed a detailed review of both the implementation and the design (whatever that is!).
Please send new, complete descriptions of these patches. I don't think they can be effectively reviewed without that information. Except perhaps by someone who was at the PM summit, but that's cheating.
Thanks.
Quoted 16 lines · On Mon, 1 Oct 2007 16:45:28 -0700 Mark Gross <[email protected]> wrote:
The following is the cleaned up patch implementing the power management quality of service infrastructure discussed at the pm summit last June.
It is a genralization of the latency code put into the kernel last year by Arjan.
I would like to get this code included in the MM tree and to get some milage on it.
One thing to note about this implementation is that it exposes an interface to user space for registering
pm_qosconstraints in addition to the kernel exports. Its a file based interface where a module can register a constraint and the constraint is valid only as long as the device node is held open. Upon closing of the device node that constraint is cleaned up.
Quoted 3 lines
The patch set is in two postings.
1) the base parameter code (this email)
2) replacing oflatency.c/latenc.hwithpm_qos_params.c/pm_qos_params.h
I wouldn't really view this as an adequate changelog.
- The Subject:s are pretty pathetic (please see my suggesed replacements)
- There is no description of the proposed new kernel<->userspace interfaces.
As you are proposing new and permanent enhancements to the Linux API, this is something which should be spelled out in some detail. Because we can change the implementation, but we can not ever change your interface.
It would be nice to get that interface described in Documentation/ somewhere, but it is *critical* that the design be fully revealed right now, during review.
Anyway, I am not a suitable person to review this submission.
I'll put the patches in -mm for a bit of eyeball-and-test (not that anyone will know how to test it, due to the secret interfaces) but I do not want to move this code into mainline until someone who is familiar with the PM code has performed a detailed review of both the implementation and the design (whatever that is!).
Please send new, complete descriptions of these patches. I don't think they can be effectively reviewed without that information. Except perhaps by someone who was at the PM summit, but that's cheating.
Thanks.
Quoted 19 lines · Andrew Morton
Quoted 16 lines · On Mon, 1 Oct 2007 16:45:28 -0700 Mark Gross <[email protected]> wrote:
The following is the cleaned up patch implementing the power management quality of service infrastructure discussed at the pm summit last June.
It is a genralization of the latency code put into the kernel last year by Arjan.
I would like to get this code included in the MM tree and to get some milage on it.
One thing to note about this implementation is that it exposes an interface to user space for registering
pm_qosconstraints in addition to the kernel exports. Its a file based interface where a module can register a constraint and the constraint is valid only as long as the device node is held open. Upon closing of the device node that constraint is cleaned up.
Quoted 7 lines
Quoted 3 lines
The patch set is in two postings.
1) the base parameter code (this email)
2) replacing oflatency.c/latenc.hwithpm_qos_params.c/pm_qos_params.hI wouldn't really view this as an adequate changelog.
- The Subject:s are pretty pathetic (please see my suggesed replacements)
uhg. Your right.
Quoted 4 lines
- There is no description of the proposed new kernel<->userspace interfaces.
the above description is light on specific details.
Quoted 7 lines
As you are proposing new and permanent enhancements to the Linux API, this is something which should be spelled out in some detail. Because we can change the implementation, but we can not ever change your interface.
It would be nice to get that interface described in
Documentation/somewhere, but it is *critical* that the design be fully revealed right now, during review.
I'll provide this.
Quoted 10 lines
Anyway, I am not a suitable person to review this submission.
I'll put the patches in -mm for a bit of eyeball-and-test (not that anyone will know how to test it, due to the secret interfaces) but I do not want to move this code into mainline until someone who is familiar with the PM code has performed a detailed review of both the implementation and the design (whatever that is!).
Quoted 4 lines
Please send new, complete descriptions of these patches. I don't think they can be effectively reviewed without that information. Except perhaps by someone who was at the PM summit, but that's cheating.
I will do this.
--mgross
Quoted 19 lines · Andrew Morton
Quoted 16 lines · On Mon, 1 Oct 2007 16:45:28 -0700 Mark Gross <[email protected]> wrote:
The following is the cleaned up patch implementing the power management quality of service infrastructure discussed at the pm summit last June.
It is a genralization of the latency code put into the kernel last year by Arjan.
I would like to get this code included in the MM tree and to get some milage on it.
One thing to note about this implementation is that it exposes an interface to user space for registering
pm_qosconstraints in addition to the kernel exports. Its a file based interface where a module can register a constraint and the constraint is valid only as long as the device node is held open. Upon closing of the device node that constraint is cleaned up.
Quoted 7 lines
Quoted 3 lines
The patch set is in two postings.
1) the base parameter code (this email)
2) replacing oflatency.c/latenc.hwithpm_qos_params.c/pm_qos_params.hI wouldn't really view this as an adequate changelog.
- The Subject:s are pretty pathetic (please see my suggesed replacements)
uhg. Your right.
Quoted 4 lines
- There is no description of the proposed new kernel<->userspace interfaces.
the above description is light on specific details.
Quoted 7 lines
As you are proposing new and permanent enhancements to the Linux API, this is something which should be spelled out in some detail. Because we can change the implementation, but we can not ever change your interface.
It would be nice to get that interface described in
Documentation/somewhere, but it is *critical* that the design be fully revealed right now, during review.
I'll provide this.
Quoted 10 lines
Anyway, I am not a suitable person to review this submission.
I'll put the patches in -mm for a bit of eyeball-and-test (not that anyone will know how to test it, due to the secret interfaces) but I do not want to move this code into mainline until someone who is familiar with the PM code has performed a detailed review of both the implementation and the design (whatever that is!).
Quoted 4 lines
Please send new, complete descriptions of these patches. I don't think they can be effectively reviewed without that information. Except perhaps by someone who was at the PM summit, but that's cheating.
I will do this.
--mgross