public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: john stultz <johnstul@us.ibm.com>, Thomas Gleixner <tglx@linutronix.de>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Ian Campbell <Ian.Campbell@eu.citrix.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
	andi@firstfloor.org, williams@redhat.com, schwidefsky@de.ibm.com,
	mingo@elte.hu, linux-tip-commits@vger.kernel.org
Subject: [PATCH] acpi/pm: If failed at validating ACPI PM timer, inhibit future reads.
Date: Thu, 13 Jan 2011 16:40:22 -0500	[thread overview]
Message-ID: <20110113214022.GA12097@dumpdata.com> (raw)
In-Reply-To: <1294941698.5617.12.camel@work-vm>

tgl, John,

Should I push this to Linus or are you guys going to push
this patch during this merge window?

commit ad0a17d46570aca172080016601813173a778fb7
Author: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Date:   Thu Jan 13 12:56:51 2011 -0500

    acpi/pm: If failed at validating ACPI PM timer, inhibit future reads.
    
    Without this patch we get:
    [    4.628136] divide error: 0000 [#1] SMP
    .. snip..
    Pid: 441, comm: kworker/1:1 Not tainted 2.6.37test-05765-gda43a99-dirty #14 N61PB-M2S/N61PB-M2S
    [    4.628150] RIP: e030:[<ffffffff8101109b>]  [<ffffffff8101109b>] tsc_refine_calibration_work+0x149/0x1bb
    [    4.628157] RSP: e02b:ffff88008f0d1df0  EFLAGS: 00010246
    .. when running Linux under Xen.
    
    I've traced it down to the fact that when we boot under Xen we do
    not have the HPET enabled nor the ACPI PM timer setup. The
    hpet_enable() is never called (b/c xen_time_init is called), and
    for calibration of tsc_khz (calibrate_tsc == xen_tsc_khz) we
    get a valid value.
    
    So 'tsc_read_refs' tries to read the ACPI PM timer (acpi_pm_read_early),
    however that is disabled under Xen:
    
    [    1.099272] calling  init_acpi_pm_clocksource+0x0/0xdc @ 1
    [    1.140186] PM-Timer failed consistency check  (0x0xffffff) - aborting.
    
    So the tsc_calibrate_check gets called, it can't do HPET, and reading
    from ACPI PM timer results in getting 0xffffff.. .. and
    (0xffff..-0xffff..)/some other value results in div_zero.
    
    There is a check in 'tsc_refine_calibration_work' for invalid
    values:
    
       /* hpet or pmtimer available ? */
             if (!hpet && !ref_start && !ref_stop)
                      goto out;
    
    But since ref_start and ref_stop have 0xffffff it does not trigger.
    
    This little fix makes the read to be 0 and the check triggers.
    
    Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Acked-by: John Stultz <johnstul@us.ibm.com>

diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index cfb0f52..709bb6d 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -207,6 +207,7 @@ static int __init init_acpi_pm_clocksource(void)
 		if (i == ACPI_PM_READ_CHECKS) {
 			printk(KERN_INFO "PM-Timer failed consistency check "
 			       " (0x%#llx) - aborting.\n", value1);
+			pmtmr_ioport = 0;
 			return -ENODEV;
 		}
 	}

  reply	other threads:[~2011-01-13 21:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-06  0:39 [PATCH] Greatly improve TSC calibration using a delayed workqueue John Stultz
2010-11-07 20:41 ` Andi Kleen
2010-11-08 22:04   ` john stultz
2010-11-09 13:43     ` Andi Kleen
2010-11-09 21:41       ` john stultz
2010-11-10 13:47         ` Andi Kleen
2010-12-05 11:18 ` [tip:x86/tsc] x86: Improve " tip-bot for John Stultz
2011-01-11  8:13   ` Kirill A. Shutemov
2011-01-11  8:26     ` Thomas Gleixner
2011-01-11  8:30       ` Kirill A. Shutemov
2011-01-11  8:37         ` Thomas Gleixner
2011-01-11  9:56           ` Kirill A. Shutemov
2011-01-11 10:26             ` Thomas Gleixner
2011-01-13 17:49             ` Konrad Rzeszutek Wilk
2011-01-13 18:01               ` john stultz
2011-01-13 21:40                 ` Konrad Rzeszutek Wilk [this message]
2011-01-13 22:15                   ` [PATCH] acpi/pm: If failed at validating ACPI PM timer, inhibit future reads Thomas Gleixner
2011-01-14 14:09                     ` Konrad Rzeszutek Wilk
2011-01-14 15:44                       ` john stultz
2011-01-14 15:54                         ` john stultz
2011-01-14 16:02                           ` Thomas Gleixner
2011-01-14 16:33                             ` john stultz
2011-01-14 16:28                           ` Konrad Rzeszutek Wilk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110113214022.GA12097@dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=Ian.Campbell@eu.citrix.com \
    --cc=andi@firstfloor.org \
    --cc=hpa@zytor.com \
    --cc=jeremy@goop.org \
    --cc=johnstul@us.ibm.com \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tglx@linutronix.de \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox