Re: [PATCH -mm 3/5][time][x86_64] Split x86_64/kernel/time.c up

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 20 Dec 2006 17:13:37 -0500
john stultz <[email protected]> wrote:

> +
> +unsigned int __init hpet_calibrate_tsc(void)
> +{
> +	int tsc_start, hpet_start;
> +	int tsc_now, hpet_now;
> +	unsigned long flags;
> +
> +	local_irq_save(flags);
> +	local_irq_disable();
> +
> +	hpet_start = hpet_readl(HPET_COUNTER);
> +	rdtscl(tsc_start);
> +
> +	do {
> +		local_irq_disable();
> +		hpet_now = hpet_readl(HPET_COUNTER);
> +		tsc_now = get_cycles_sync();
> +		local_irq_restore(flags);
> +	} while ((tsc_now - tsc_start) < TICK_COUNT &&
> +		(hpet_now - hpet_start) < TICK_COUNT);
> +
> +	return (tsc_now - tsc_start) * 1000000000L
> +		/ ((hpet_now - hpet_start) * hpet_period / 1000);
> +}

What a confused function.  If called with local irqs disabled it'll fail to
enable interrupts in that loop.  Perhaps that's deliberate, dunno.

Plus local_irq_save() disables interrupts, so the first local_irq_disable()
is not needed.

I will kill the unneeded local_irq_disable() and then shall back slowly away
from it.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux