From: George Anzinger <george@mvista.com>
To: Andrew Morton <akpm@osdl.org>
Cc: "J. Bruce Fields" <bfields@fieldses.org>,
Lee Revell <rlrevell@joe-job.com>, Ingo Molnar <mingo@elte.hu>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: spin_lock error in arch/i386/kernel/time.c on APM resume
Date: Sat, 12 Mar 2005 07:56:10 -0800 [thread overview]
Message-ID: <4233111A.5070807@mvista.com> (raw)
In-Reply-To: <20050312131143.GA31038@fieldses.org>
[-- Attachment #1: Type: text/plain, Size: 1498 bytes --]
J. Bruce Fields wrote:
> On APM resume this morning on my Thinkpad X31, I got a "spin_lock is
> already locked" error; see below. This doesn't happen on every resume,
> though it's happened before. The kernel is 2.6.11 plus a bunch of
> (hopefully unrelated...) NFS patches.
>
> Any ideas?
>
Yesterday's night mare, todays bug :(
Looks like we need the irq on the read clock also. This is true both before and
after the prior cmos_time changes.
Andrew,
The attached replaces the patch I sent yesterday.
For those wanting to fix the kernel with out those patches, all that is needed
its the chunk that applies, i.e. the _irq on the get_cmos_time() spinlocks.
And more... That this occures implies we are attempting to update the cmos clock
on resume seems wrong. One would presume that the time is wrong at this time
and we are about to save that wrong time. Possibly the APM code should change
time_status to STA_UNSYNC on the way into the sleep (or what ever it is called).
Who should we ping with this?
~
> Mar 12 07:07:31 puzzle kernel: PCI: Setting latency timer of device 0000:00:1f.5 to 64
> Mar 12 07:07:31 puzzle kernel: arch/i386/kernel/time.c:179: spin_lock(arch/i386/kernel/time.c:c0603c28) already locked by arch/i386/kernel/time.c/309
> Mar 12 07:07:31 puzzle kernel: arch/i386/kernel/time.c:316: spin_unlock(arch/i386/kernel/time.c:c0603c28) not locked
~
--
George Anzinger george@mvista.com
High-res-timers: http://sourceforge.net/projects/high-res-timers/
[-- Attachment #2: cmos_time_lock.patch --]
[-- Type: text/plain, Size: 1515 bytes --]
Source: MontaVista Software, Inc.
Type: Defect Fix
Disposition: Pending
Description:
I was not happy with the locking on this. Two changes:
1) Turn off irq while setting the clock.
2) Call the timer code only through the timer interface
(set a short timer to do it from the ntp call).
Signed-off-by: George Anzinger <george@mvista.com>
time.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
Index: linux-2.6.12-rc/arch/i386/kernel/time.c
===================================================================
--- linux-2.6.12-rc.orig/arch/i386/kernel/time.c
+++ linux-2.6.12-rc/arch/i386/kernel/time.c
@@ -176,12 +176,12 @@ static int set_rtc_mmss(unsigned long no
int retval;
/* gets recalled with irq locally disabled */
- spin_lock(&rtc_lock);
+ spin_lock_irq(&rtc_lock);
if (efi_enabled)
retval = efi_set_rtc_mmss(nowtime);
else
retval = mach_set_rtc_mmss(nowtime);
- spin_unlock(&rtc_lock);
+ spin_unlock_irq(&rtc_lock);
return retval;
}
@@ -282,14 +282,14 @@ unsigned long get_cmos_time(void)
{
unsigned long retval;
- spin_lock(&rtc_lock);
+ spin_lock_irq(&rtc_lock);
if (efi_enabled)
retval = efi_get_time();
else
retval = mach_get_cmos_time();
- spin_unlock(&rtc_lock);
+ spin_unlock_irq(&rtc_lock);
return retval;
}
@@ -338,7 +338,7 @@ static void sync_cmos_clock(unsigned lon
}
void notify_arch_cmos_timer(void)
{
- sync_cmos_clock(0);
+ mod_timer(&sync_cmos_timer, jiffies + 1);
}
static long clock_cmos_diff, sleep_start;
next prev parent reply other threads:[~2005-03-12 16:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-12 13:11 spin_lock error in arch/i386/kernel/time.c on APM resume J. Bruce Fields
2005-03-12 15:21 ` [PATCH] APM: fix interrupts enabled in device_power_up Zwane Mwaikambo
2005-03-15 22:33 ` J. Bruce Fields
2005-03-15 22:40 ` Zwane Mwaikambo
2005-03-12 15:56 ` George Anzinger [this message]
2005-03-12 16:25 ` spin_lock error in arch/i386/kernel/time.c on APM resume Zwane Mwaikambo
2005-03-12 16:36 ` Venkatesh Pallipadi
2005-03-12 16:46 ` Zwane Mwaikambo
2005-03-12 17:45 ` Venkatesh Pallipadi
2005-03-12 18:04 ` George Anzinger
2005-03-12 19:58 ` Zwane Mwaikambo
2005-03-12 20:25 ` George Anzinger
2005-03-13 18:35 ` Pavel Machek
2005-03-14 23:49 ` George Anzinger
2005-03-15 0:08 ` Pavel Machek
2005-03-15 9:04 ` George Anzinger
2005-03-12 21:14 ` Barry K. Nathan
2005-03-12 21:18 ` Lee Revell
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=4233111A.5070807@mvista.com \
--to=george@mvista.com \
--cc=akpm@osdl.org \
--cc=bfields@fieldses.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rlrevell@joe-job.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