[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 1 Feb 2007 18:34:50 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: jbohac@...e.cz
Cc: Andi Kleen <ak@...e.de>, linux-kernel@...r.kernel.org,
Vojtech Pavlik <vojtech@...e.cz>, ssouhlal@...ebsd.org,
arjan@...radead.org, tglx@...utronix.de, johnstul@...ibm.com,
zippel@...ux-m68k.org, andrea@...e.de
Subject: Re: [patch 1/9] Fix HPET init race
On Thu, 01 Feb 2007 10:59:53 +0100 jbohac@...e.cz wrote:
> Fix a race in the initialization of HPET, which might result in a
> 5 minute lockup on boot.
>
What race? Please always describe bugs when fixing them.
>
> Index: linux-2.6.20-rc5/arch/x86_64/kernel/apic.c
> ===================================================================
> --- linux-2.6.20-rc5.orig/arch/x86_64/kernel/apic.c
> +++ linux-2.6.20-rc5/arch/x86_64/kernel/apic.c
> @@ -764,10 +767,12 @@ static void setup_APIC_timer(unsigned in
>
> /* wait for irq slice */
> if (vxtime.hpet_address && hpet_use_timer) {
> - int trigger = hpet_readl(HPET_T0_CMP);
> - while (hpet_readl(HPET_COUNTER) >= trigger)
> - /* do nothing */ ;
> - while (hpet_readl(HPET_COUNTER) < trigger)
> + int trigger;
> + do
> + trigger = hpet_readl(HPET_T0_CMP);
> + while (hpet_readl(HPET_COUNTER) >= trigger);
> +
Is this signedness-safe and wraparound-safe? It might be better to make
`trigger' unsigned and do
while (hpet_readl(HPET_COUNTER) - trigger >= 0)
> + while (hpet_readl(HPET_COUNTER) < trigger)
> /* do nothing */ ;
ditto.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists