public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: john stultz <johnstul@us.ibm.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: Mikael Pettersson <mikpe@it.uu.se>, linux-kernel@vger.kernel.org
Subject: Re: [BUG] APM resume breakage from 2.6.18-rc1 clocksource changes
Date: Mon, 10 Jul 2006 11:19:48 -0700	[thread overview]
Message-ID: <1152555588.5320.13.camel@localhost.localdomain> (raw)
In-Reply-To: <20060710180839.GA16503@elf.ucw.cz>

On Mon, 2006-07-10 at 20:08 +0200, Pavel Machek wrote:
> Hi!
> 
> > > >> I've traced the cause of this problem to the i386 time-keeping
> > > >> changes in kernel 2.6.17-git11. What happens is that:
> > > >> - The kernel autoselects TSC as my clocksource, which is
> > > >>   reasonable since it's a PentiumII. 2.6.17 also chose the TSC.
> > > >> - Immediately after APM resumes (arch/i386/kernel/apm.c line
> > > >>   1231 in 2.6.18-rc1) there is an interrupt from the PIT,
> > > >>   which takes us to kernel/timer.c:update_wall_time().
> > > >> - update_wall_time() does a clocksource_read() and computes
> > > >>   the offset from the previous read. However, the TSC was
> > > >>   reset by HW or BIOS during the APM suspend/resume cycle and
> > > >>   is now smaller than it was at the prevous read. On my machine,
> > > >>   the offset is 0xffffffd598e0a566 at this point, which appears
> > > >>   to throw update_wall_time() into a very very long loop.
> > > >
> > > >Huh. It seems you're getting an interrupt before timekeeping_resume()
> > > >runs (which resets cycle_last). I'll look over the code and see if I can
> > > >sort out why it works w/ ACPI suspend, but not APM, or if the
> > > >resume/interrupt-enablement bit is just racy in general.
> > > 
> > > I forgot to mention this, but I had a debug printk() in apm.c
> > > which showed that irqs_disabled() == 0 at the point when APM
> > > resumes the kernel.
> > 
> > So it seems possible that the timer tick will be enabled before the
> > timekeeping resume code runs. I'm not sure why this isn't seen w/ ACPI
> > suspend/resume, as I think they're using the same
> > sysdev_class .suspend/.resume bits. 
> 
> ACPI actually keeps interrupts disabled, always.
> 
> APM can only keep interrupts disabled on non-IBM machines, presumably
> due to BIOS problems.
> 
> Could we get some sanity check into looping function? If timesource
> goes backwards, at least somehow reporting it would be nice...

Yep, I'm working on a debug patch (similar to the paranoid timekeeping
debugging option in earlier versions of the TOD patch) that will spit
out warnings when we see unusual behavior: large numbers of lost ticks,
timer ticks arriving too early, settimeofday being call, etc.

thanks
-john


  reply	other threads:[~2006-07-10 18:19 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-09 23:52 [BUG] APM resume breakage from 2.6.18-rc1 clocksource changes Mikael Pettersson
2006-07-10  7:55 ` Pavel Machek
2006-07-10 17:58 ` john stultz
2006-07-10 18:08   ` Pavel Machek
2006-07-10 18:19     ` john stultz [this message]
2006-07-10 22:37     ` Roman Zippel
2006-07-10 22:50       ` john stultz
2006-07-10 22:59         ` Roman Zippel
2006-07-11  8:07           ` Thomas Gleixner
2006-07-11  9:29             ` Roman Zippel
2006-07-11 11:07               ` Thomas Gleixner
2006-07-11 23:31                 ` Roman Zippel
2006-07-12  0:42                   ` john stultz
2006-07-13 20:27                     ` Thomas Gleixner
2006-07-13 22:05                       ` john stultz
2006-07-14  6:56                         ` Thomas Gleixner
2006-07-16 15:52                         ` Roman Zippel
2006-07-16 15:50                       ` Roman Zippel
2006-07-16 16:09                         ` Thomas Gleixner
2006-07-16 16:15                           ` Roman Zippel
2006-07-10 23:17       ` Pavel Machek
  -- strict thread matches above, loose matches on Subject: below --
2006-07-10 23:36 Mikael Pettersson
2006-07-09 23:53 Mikael Pettersson
2006-07-09 20:58 Mikael Pettersson
2006-07-09 21:20 ` john stultz
2006-07-09 21:31 ` Valdis.Kletnieks
2006-07-09 21:44 ` Pavel Machek
2006-07-09 22:51   ` Alan Cox

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=1152555588.5320.13.camel@localhost.localdomain \
    --to=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikpe@it.uu.se \
    --cc=pavel@ucw.cz \
    /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