All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jordan Crouse" <jordan.crouse@amd.com>
To: "Arnd Hannemann" <hannemann@i4.informatik.rwth-aachen.de>
Cc: "Lars Heete" <hel@admin.de>,
	"Andres Salomon" <dilinger@queued.net>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: 2.6.24-rc8 hangs at mfgpt-timer
Date: Tue, 22 Jan 2008 12:27:57 -0700	[thread overview]
Message-ID: <20080122192757.GC5241@cosmic.amd.com> (raw)
In-Reply-To: <4795D120.7070806@i4.informatik.rwth-aachen.de>

[-- Attachment #1: Type: text/plain, Size: 1087 bytes --]

> Indeed.
> Strange, it works at least with mfgpt_irq=8 (rtc) and mfgpt_irq=5 (audio):

I have most excellent news.  I was able to get tinyBIOS booting on my
development platform.  I looked at the problem with the debugger and
I think I might have found something.  It looks like the interrupt is
firing immediately before the clock is enabled.  In the handler, we
were returning immediately if the clock wasn't enabled (and not clearing
the event), so we were caught in a classic interrupt storm.

The attached patch rearranges the code so that the handler is installed
before we setup the interrupt (so we have somebody to listen to the
immediate interrupt), and it makes sure that we clear the event in the IRQ
handler regardless of the state of the timer tick.

I'm not 100% sure why this happens on IRQ7 but not on 5 or 8, but it might
have something to do with the interrupts already being enabled on the other
vectors.  Anyway, please try this test patch and let me know what happens.

Jordan

-- 
Jordan Crouse
Systems Software Development Engineer 
Advanced Micro Devices, Inc.

[-- Attachment #2: fix-mfgpt-race.patch --]
[-- Type: text/plain, Size: 2131 bytes --]

[GEODE] fix a race condition in the MFGPT timer tick

From: Jordan Crouse <jordan.crouse@amd.com>

When we set the MFGPT timer tick, there is a chance that we'll
immediately assert an event.  If for some reason the IRQ routing
for this clock has been setup for some other purpose, then we
could end up firing an interrupt into the SMM handler or worse.

This rearranges the timer tick init function to initalize the handler
before we set up the MFGPT clock to make sure that even if we get
an event, it will go to the handler.

Furthermore, in the handler we need to make sure that we clear the
event, even if the timer isn't running.

Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
---

 arch/x86/kernel/mfgpt_32.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

Index: git/arch/x86/kernel/mfgpt_32.c
===================================================================
--- git.orig/arch/x86/kernel/mfgpt_32.c	2008-01-21 17:09:54.000000000 -0700
+++ git/arch/x86/kernel/mfgpt_32.c	2008-01-22 12:21:21.000000000 -0700
@@ -278,12 +278,12 @@
 
 static irqreturn_t mfgpt_tick(int irq, void *dev_id)
 {
+	/* Turn off the clock (and clear the event) */
+	mfgpt_disable_timer(mfgpt_event_clock);
+
 	if (mfgpt_tick_mode == CLOCK_EVT_MODE_SHUTDOWN)
 		return IRQ_HANDLED;
 
-	/* Turn off the clock */
-	mfgpt_disable_timer(mfgpt_event_clock);
-
 	/* Clear the counter */
 	geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_COUNTER, 0);
 
@@ -319,10 +319,6 @@
 	}
 
 	mfgpt_event_clock = timer;
-	/* Set the clock scale and enable the event mode for CMP2 */
-	val = MFGPT_SCALE | (3 << 8);
-
-	geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_SETUP, val);
 
 	/* Set up the IRQ on the MFGPT side */
 	if (geode_mfgpt_setup_irq(mfgpt_event_clock, MFGPT_CMP2, irq)) {
@@ -339,6 +335,11 @@
 		goto err;
 	}
 
+	/* Set the clock scale and enable the event mode for CMP2 */
+	val = MFGPT_SCALE | (3 << 8);
+
+	geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_SETUP, val);
+
 	/* Set up the clock event */
 	mfgpt_clockevent.mult = div_sc(MFGPT_HZ, NSEC_PER_SEC, 32);
 	mfgpt_clockevent.min_delta_ns = clockevent_delta2ns(0xF,

  parent reply	other threads:[~2008-01-22 19:27 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-16 17:44 2.6.24-rc8 hangs at mfgpt-timer Arnd Hannemann
2008-01-16 21:19 ` Andres Salomon
2008-01-16 21:56   ` Andres Salomon
2008-01-17  9:54     ` Arnd Hannemann
2008-01-17 18:40       ` Andres Salomon
2008-01-17 19:53         ` Arnd Hannemann
2008-01-17 20:42           ` Andres Salomon
2008-01-17 21:19           ` Jordan Crouse
2008-01-17 21:50             ` Arnd Hannemann
2008-01-17 22:36               ` Jordan Crouse
2008-01-17 22:52                 ` Arnd Hannemann
2008-01-17 22:57                   ` Jordan Crouse
2008-01-17 23:39                     ` Arnd Hannemann
2008-01-18  0:40                       ` Jordan Crouse
2008-01-21 23:27                       ` Jordan Crouse
2008-01-21 23:32                         ` Willy Tarreau
2008-01-22 20:15                           ` Willy Tarreau
2008-01-22 21:08                             ` Jordan Crouse
2008-01-22 21:15                               ` Willy Tarreau
2008-01-23 16:36                                 ` Jordan Crouse
2008-01-23 16:10                                   ` Willy Tarreau
2008-01-22  9:03                         ` Arnd Hannemann
2008-01-22 10:11                           ` Lars Heete
2008-01-22 11:18                             ` Arnd Hannemann
2008-01-22 18:15                               ` Jordan Crouse
2008-01-22 19:27                               ` Jordan Crouse [this message]
2008-01-22 20:54                                 ` Arnd Hannemann
2008-01-22 21:10                                   ` Ingo Molnar
2008-01-22 21:20                                     ` Willy Tarreau
2008-01-22 21:53                                     ` [git pull] was: " Thomas Gleixner
2008-01-23 21:17                                     ` [PATCH 0/2] Was: " Willy Tarreau
2008-01-23 21:18                                       ` [PATCH 1/2] x86: GEODE fix MFGPT input clock value Willy Tarreau
2008-01-23 21:59                                         ` H. Peter Anvin
2008-01-23 22:11                                           ` Willy Tarreau
2008-01-23 22:22                                             ` H. Peter Anvin
2008-01-23 22:10                                               ` Willy Tarreau
2008-01-23 22:38                                             ` Jordan Crouse
2008-01-23 23:17                                               ` Arnd Hannemann
2008-01-23 21:19                                       ` [PATCH 2/2] x86: GEODE add the "mfgptfix" boot time option to fix MFGPT timers Willy Tarreau
2008-01-19  1:06                   ` [GEODE] Geode GX/LX watchdog timer (was 2.6.24-rc8 hangs at mfgpt-timer) Jordan Crouse
2008-01-19  6:36                     ` Willy Tarreau
2008-01-20 13:22                     ` Arnd Hannemann
2008-01-20 16:34                       ` Jordan Crouse
2008-01-21 17:07                       ` Geode GX/LX watchdog timer (RESEND) Jordan Crouse
2008-01-21 18:37                         ` Arnd Hannemann
2008-02-17 14:14                           ` Iain Paton
2008-02-17 14:46                             ` Arnd Hannemann
2008-02-17 14:54                               ` Adrian Bunk
2008-02-17 16:10                                 ` Iain Paton
2008-02-17 17:32                                   ` Andres Salomon
2008-02-17 19:46                                   ` Arnd Hannemann
2008-01-20 20:16                     ` [GEODE] Geode GX/LX watchdog timer (was 2.6.24-rc8 hangs at mfgpt-timer) Lennart Sorensen

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=20080122192757.GC5241@cosmic.amd.com \
    --to=jordan.crouse@amd.com \
    --cc=dilinger@queued.net \
    --cc=hannemann@i4.informatik.rwth-aachen.de \
    --cc=hel@admin.de \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.