linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] intel_idle updates
@ 2016-06-17  5:28 Len Brown
  2016-06-17  5:28 ` [PATCH 1/2] drivers/idle: make intel_idle.c driver more explicitly non-modular Len Brown
  2016-06-24 13:41 ` [PATCH 0/2] intel_idle updates Rafael J. Wysocki
  0 siblings, 2 replies; 4+ messages in thread
From: Len Brown @ 2016-06-17  5:28 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel

Rafael,

Since you've already pulled Dave's intel-family.h intel_idle changes
into your tree, please also apply these intel_idle patches to that branch.  

[PATCH 1/2] drivers/idle: make intel_idle.c driver more explicitly
[PATCH 2/2] idle_intel: Add Denverton

And if you prefer to use git...

The following changes since commit 5edb56491d4812c42175980759da53388e5d86f5:

  Linux 4.7-rc3 (2016-06-12 07:20:35 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git cpuidle

for you to fetch changes up to 264f6eef366c0669cf9c8b1850977e13be85160a:

  idle_intel: Add Denverton (2016-06-16 21:05:24 -0400)

----------------------------------------------------------------
Jacob Pan (1):
      idle_intel: Add Denverton

Paul Gortmaker (1):
      drivers/idle: make intel_idle.c driver more explicitly non-modular

 drivers/idle/intel_idle.c | 76 +++++++++++++++++++++++++++--------------------
 1 file changed, 43 insertions(+), 33 deletions(-)


thanks!
-Len

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] drivers/idle: make intel_idle.c driver more explicitly non-modular
  2016-06-17  5:28 [PATCH 0/2] intel_idle updates Len Brown
@ 2016-06-17  5:28 ` Len Brown
  2016-06-17  5:28   ` [PATCH 2/2] idle_intel: Add Denverton Len Brown
  2016-06-24 13:41 ` [PATCH 0/2] intel_idle updates Rafael J. Wysocki
  1 sibling, 1 reply; 4+ messages in thread
From: Len Brown @ 2016-06-17  5:28 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, Paul Gortmaker, Len Brown

From: Paul Gortmaker <paul.gortmaker@windriver.com>

The Kconfig for this driver is currently declared with:

config INTEL_IDLE
        bool "Cpuidle Driver for Intel Processors"

...meaning that it currently is not being built as a module by anyone.

This was done in commit 6ce9cd8669fa1195fdc21643370e34523c7ac988
("intel_idle: disable module support") since "...the module capability
is cauing more trouble than it is worth."

This was done over 5y ago, and Daniel adds that:

    ...the modular support has been removed from almost all the cpuidle
    drivers and the cpuidle framework is no longer assuming driver could
    be unloaded.

    Removing the modular dead code in the driver makes sense as this
    what have been done in the others drivers.

So lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.  At a
later date we might want to consider whether subsys_init or another
init category seems more appropriate than device_init.

We replace module.h with moduleparam.h since the file does declare
some module parameters, and leaving them as such is currently the
easiest way to remain compatible with existing boot arg use cases.

Note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

Also note that we can't remove intel_idle_cpuidle_devices_uninit() as
that is still used for unwind purposes if the init fails.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Len Brown <len.brown@intel.com>
---
 drivers/idle/intel_idle.c | 41 ++++++++---------------------------------
 1 file changed, 8 insertions(+), 33 deletions(-)

diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index c966492..f93788f 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -46,8 +46,6 @@
  * to avoid complications with the lapic timer workaround.
  * Have not seen issues with suspend, but may need same workaround here.
  *
- * There is currently no kernel-based automatic probing/loading mechanism
- * if the driver is built as a module.
  */
 
 /* un-comment DEBUG to enable pr_debug() statements */
@@ -60,7 +58,7 @@
 #include <linux/sched.h>
 #include <linux/notifier.h>
 #include <linux/cpu.h>
-#include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <asm/cpu_device_id.h>
 #include <asm/mwait.h>
 #include <asm/msr.h>
@@ -1054,7 +1052,6 @@ static const struct x86_cpu_id intel_idle_ids[] __initconst = {
 	ICPU(0x5c, idle_cpu_bxt),
 	{}
 };
-MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids);
 
 /*
  * intel_idle_probe()
@@ -1415,34 +1412,12 @@ static int __init intel_idle_init(void)
 
 	return 0;
 }
+device_initcall(intel_idle_init);
 
-static void __exit intel_idle_exit(void)
-{
-	struct cpuidle_device *dev;
-	int i;
-
-	cpu_notifier_register_begin();
-
-	if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE)
-		on_each_cpu(__setup_broadcast_timer, (void *)false, 1);
-	__unregister_cpu_notifier(&cpu_hotplug_notifier);
-
-	for_each_possible_cpu(i) {
-		dev = per_cpu_ptr(intel_idle_cpuidle_devices, i);
-		cpuidle_unregister_device(dev);
-	}
-
-	cpu_notifier_register_done();
-
-	cpuidle_unregister_driver(&intel_idle_driver);
-	free_percpu(intel_idle_cpuidle_devices);
-}
-
-module_init(intel_idle_init);
-module_exit(intel_idle_exit);
-
+/*
+ * We are not really modular, but we used to support that.  Meaning we also
+ * support "intel_idle.max_cstate=..." at boot and also a read-only export of
+ * it at /sys/module/intel_idle/parameters/max_cstate -- so using module_param
+ * is the easiest way (currently) to continue doing that.
+ */
 module_param(max_cstate, int, 0444);
-
-MODULE_AUTHOR("Len Brown <len.brown@intel.com>");
-MODULE_DESCRIPTION("Cpuidle driver for Intel Hardware v" INTEL_IDLE_VERSION);
-MODULE_LICENSE("GPL");
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] idle_intel: Add Denverton
  2016-06-17  5:28 ` [PATCH 1/2] drivers/idle: make intel_idle.c driver more explicitly non-modular Len Brown
@ 2016-06-17  5:28   ` Len Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Len Brown @ 2016-06-17  5:28 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, Jacob Pan, Len Brown

From: Jacob Pan <jacob.jun.pan@linux.intel.com>

Denverton is an Intel Atom based micro server which shares the same
Goldmont architecture as Broxton. The available C-states on
Denverton is a subset of Broxton with only C1, C1e, and C6.

Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
---
 drivers/idle/intel_idle.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index f93788f..46fed5a 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -825,6 +825,35 @@ static struct cpuidle_state bxt_cstates[] = {
 		.enter = NULL }
 };
 
+static struct cpuidle_state dnv_cstates[] = {
+	{
+		.name = "C1-DNV",
+		.desc = "MWAIT 0x00",
+		.flags = MWAIT2flg(0x00),
+		.exit_latency = 2,
+		.target_residency = 2,
+		.enter = &intel_idle,
+		.enter_freeze = intel_idle_freeze, },
+	{
+		.name = "C1E-DNV",
+		.desc = "MWAIT 0x01",
+		.flags = MWAIT2flg(0x01),
+		.exit_latency = 10,
+		.target_residency = 20,
+		.enter = &intel_idle,
+		.enter_freeze = intel_idle_freeze, },
+	{
+		.name = "C6-DNV",
+		.desc = "MWAIT 0x20",
+		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
+		.exit_latency = 50,
+		.target_residency = 500,
+		.enter = &intel_idle,
+		.enter_freeze = intel_idle_freeze, },
+	{
+		.enter = NULL }
+};
+
 /**
  * intel_idle
  * @dev: cpuidle_device
@@ -1014,6 +1043,11 @@ static const struct idle_cpu idle_cpu_bxt = {
 	.disable_promotion_to_c1e = true,
 };
 
+static const struct idle_cpu idle_cpu_dnv = {
+	.state_table = dnv_cstates,
+	.disable_promotion_to_c1e = true,
+};
+
 #define ICPU(model, cpu) \
 	{ X86_VENDOR_INTEL, 6, model, X86_FEATURE_MWAIT, (unsigned long)&cpu }
 
@@ -1050,6 +1084,7 @@ static const struct x86_cpu_id intel_idle_ids[] __initconst = {
 	ICPU(0x55, idle_cpu_skx),
 	ICPU(0x57, idle_cpu_knl),
 	ICPU(0x5c, idle_cpu_bxt),
+	ICPU(0x5f, idle_cpu_dnv),
 	{}
 };
 
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] intel_idle updates
  2016-06-17  5:28 [PATCH 0/2] intel_idle updates Len Brown
  2016-06-17  5:28 ` [PATCH 1/2] drivers/idle: make intel_idle.c driver more explicitly non-modular Len Brown
@ 2016-06-24 13:41 ` Rafael J. Wysocki
  1 sibling, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2016-06-24 13:41 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-pm, linux-kernel, Jacob Pan

On Friday, June 17, 2016 01:28:32 AM Len Brown wrote:
> Rafael,
> 
> Since you've already pulled Dave's intel-family.h intel_idle changes
> into your tree, please also apply these intel_idle patches to that branch.  
> 
> [PATCH 1/2] drivers/idle: make intel_idle.c driver more explicitly
> [PATCH 2/2] idle_intel: Add Denverton

Both [1-2/2] applied, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-24 13:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-17  5:28 [PATCH 0/2] intel_idle updates Len Brown
2016-06-17  5:28 ` [PATCH 1/2] drivers/idle: make intel_idle.c driver more explicitly non-modular Len Brown
2016-06-17  5:28   ` [PATCH 2/2] idle_intel: Add Denverton Len Brown
2016-06-24 13:41 ` [PATCH 0/2] intel_idle updates Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).