public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] acpi_pm: Clear pmtmr_ioport if acpi_pm initialization fails
@ 2011-01-14 17:47 John Stultz
  2011-01-21 14:50 ` Konrad Rzeszutek Wilk
  2011-01-21 16:40 ` [tip:timers/urgent] " tip-bot for Konrad Rzeszutek Wilk
  0 siblings, 2 replies; 4+ messages in thread
From: John Stultz @ 2011-01-14 17:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Konrad Rzeszutek Wilk, Thomas Gleixner, John Stultz

From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

If the acpi pm timer throws invalid data, clear pmtmr_ioport
so the pm timer won't accidentally be used.

This was found when using Xen where there is a acpi pm reported,
but gives bogus values, and other code was continuing to try
to use the pm timer after the initialization failed.

[jstultz: Catch additional failure and reword changelog message. ]

CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Thomas Gleixner <tglx@linutronix.de>
Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: John Stultz <johnstul@us.ibm.com>
---
 drivers/clocksource/acpi_pm.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index cfb0f52..effe797 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -202,17 +202,21 @@ static int __init init_acpi_pm_clocksource(void)
 			printk(KERN_INFO "PM-Timer had inconsistent results:"
 			       " 0x%#llx, 0x%#llx - aborting.\n",
 			       value1, value2);
+			pmtmr_ioport = 0;
 			return -EINVAL;
 		}
 		if (i == ACPI_PM_READ_CHECKS) {
 			printk(KERN_INFO "PM-Timer failed consistency check "
 			       " (0x%#llx) - aborting.\n", value1);
+			pmtmr_ioport = 0;
 			return -ENODEV;
 		}
 	}
 
-	if (verify_pmtmr_rate() != 0)
+	if (verify_pmtmr_rate() != 0){
+		pmtmr_ioport = 0;
 		return -ENODEV;
+	}
 
 	return clocksource_register_hz(&clocksource_acpi_pm,
 						PMTMR_TICKS_PER_SEC);
-- 
1.7.3.2.146.gca209


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

* Re: [PATCH] acpi_pm: Clear pmtmr_ioport if acpi_pm initialization fails
  2011-01-14 17:47 [PATCH] acpi_pm: Clear pmtmr_ioport if acpi_pm initialization fails John Stultz
@ 2011-01-21 14:50 ` Konrad Rzeszutek Wilk
  2011-01-21 16:09   ` Thomas Gleixner
  2011-01-21 16:40 ` [tip:timers/urgent] " tip-bot for Konrad Rzeszutek Wilk
  1 sibling, 1 reply; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2011-01-21 14:50 UTC (permalink / raw)
  To: John Stultz; +Cc: linux-kernel, Thomas Gleixner

On Fri, Jan 14, 2011 at 09:47:26AM -0800, John Stultz wrote:
> From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 

tgl,

Are you OK pushing this up to Linus or should I do it? We can
also delay this till the next merge window as the other fix
that John proposed solves the bootup issue so it is not that urgent.

> If the acpi pm timer throws invalid data, clear pmtmr_ioport
> so the pm timer won't accidentally be used.
> 
> This was found when using Xen where there is a acpi pm reported,
> but gives bogus values, and other code was continuing to try
> to use the pm timer after the initialization failed.
> 
> [jstultz: Catch additional failure and reword changelog message. ]

Thank you John.

> 
> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> CC: Thomas Gleixner <tglx@linutronix.de>
> Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Signed-off-by: John Stultz <johnstul@us.ibm.com>
> ---
>  drivers/clocksource/acpi_pm.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
> index cfb0f52..effe797 100644
> --- a/drivers/clocksource/acpi_pm.c
> +++ b/drivers/clocksource/acpi_pm.c
> @@ -202,17 +202,21 @@ static int __init init_acpi_pm_clocksource(void)
>  			printk(KERN_INFO "PM-Timer had inconsistent results:"
>  			       " 0x%#llx, 0x%#llx - aborting.\n",
>  			       value1, value2);
> +			pmtmr_ioport = 0;
>  			return -EINVAL;
>  		}
>  		if (i == ACPI_PM_READ_CHECKS) {
>  			printk(KERN_INFO "PM-Timer failed consistency check "
>  			       " (0x%#llx) - aborting.\n", value1);
> +			pmtmr_ioport = 0;
>  			return -ENODEV;
>  		}
>  	}
>  
> -	if (verify_pmtmr_rate() != 0)
> +	if (verify_pmtmr_rate() != 0){
> +		pmtmr_ioport = 0;
>  		return -ENODEV;
> +	}
>  
>  	return clocksource_register_hz(&clocksource_acpi_pm,
>  						PMTMR_TICKS_PER_SEC);
> -- 
> 1.7.3.2.146.gca209

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

* Re: [PATCH] acpi_pm: Clear pmtmr_ioport if acpi_pm initialization fails
  2011-01-21 14:50 ` Konrad Rzeszutek Wilk
@ 2011-01-21 16:09   ` Thomas Gleixner
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2011-01-21 16:09 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: John Stultz, linux-kernel

On Fri, 21 Jan 2011, Konrad Rzeszutek Wilk wrote:

> On Fri, Jan 14, 2011 at 09:47:26AM -0800, John Stultz wrote:
> > From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > 
> 
> tgl,
> 
> Are you OK pushing this up to Linus or should I do it? We can
> also delay this till the next merge window as the other fix
> that John proposed solves the bootup issue so it is not that urgent.

It's in my queue, no worry.

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

* [tip:timers/urgent] acpi_pm: Clear pmtmr_ioport if acpi_pm initialization fails
  2011-01-14 17:47 [PATCH] acpi_pm: Clear pmtmr_ioport if acpi_pm initialization fails John Stultz
  2011-01-21 14:50 ` Konrad Rzeszutek Wilk
@ 2011-01-21 16:40 ` tip-bot for Konrad Rzeszutek Wilk
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Konrad Rzeszutek Wilk @ 2011-01-21 16:40 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, konrad.wilk, johnstul, tglx

Commit-ID:  db6b175fa6ad1408cbb2fb62949a6d55cfece03e
Gitweb:     http://git.kernel.org/tip/db6b175fa6ad1408cbb2fb62949a6d55cfece03e
Author:     Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
AuthorDate: Fri, 14 Jan 2011 09:47:26 -0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 21 Jan 2011 17:38:19 +0100

acpi_pm: Clear pmtmr_ioport if acpi_pm initialization fails

If the acpi pm timer throws invalid data, clear pmtmr_ioport
so the pm timer won't accidentally be used.

This was found when using Xen where there is a acpi pm reported,
but gives bogus values, and other code was continuing to try
to use the pm timer after the initialization failed.

[jstultz: Catch additional failure and reword changelog message. ]

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: John Stultz <johnstul@us.ibm.com>
LKML-Reference: <1295027246-11110-1-git-send-email-johnstul@us.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/clocksource/acpi_pm.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index cfb0f52..effe797 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -202,17 +202,21 @@ static int __init init_acpi_pm_clocksource(void)
 			printk(KERN_INFO "PM-Timer had inconsistent results:"
 			       " 0x%#llx, 0x%#llx - aborting.\n",
 			       value1, value2);
+			pmtmr_ioport = 0;
 			return -EINVAL;
 		}
 		if (i == ACPI_PM_READ_CHECKS) {
 			printk(KERN_INFO "PM-Timer failed consistency check "
 			       " (0x%#llx) - aborting.\n", value1);
+			pmtmr_ioport = 0;
 			return -ENODEV;
 		}
 	}
 
-	if (verify_pmtmr_rate() != 0)
+	if (verify_pmtmr_rate() != 0){
+		pmtmr_ioport = 0;
 		return -ENODEV;
+	}
 
 	return clocksource_register_hz(&clocksource_acpi_pm,
 						PMTMR_TICKS_PER_SEC);

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

end of thread, other threads:[~2011-01-21 16:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-14 17:47 [PATCH] acpi_pm: Clear pmtmr_ioport if acpi_pm initialization fails John Stultz
2011-01-21 14:50 ` Konrad Rzeszutek Wilk
2011-01-21 16:09   ` Thomas Gleixner
2011-01-21 16:40 ` [tip:timers/urgent] " tip-bot for Konrad Rzeszutek Wilk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox