[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.1.10.0809061411430.3117@nehalem.linux-foundation.org>
Date: Sat, 6 Sep 2008 14:15:00 -0700 (PDT)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Thomas Gleixner <tglx@...utronix.de>
cc: Alok Kataria <akataria@...are.com>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
LKML <linux-kernel@...r.kernel.org>,
Arjan van de Veen <arjan@...radead.org>,
"H. Peter Anvin" <hpa@...or.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Dan Hecht <dhecht@...are.com>,
Garrett Smith <garrett@...are.com>
Subject: Re: [RFC patch 0/4] TSC calibration improvements
On Sat, 6 Sep 2008, Thomas Gleixner wrote:
> >
> > Show some _taste_.
>
> Tell the hardware dudes who made that crap so difficult
No. I'm telling you, because that patch IS CRAP.
> Over which _whole_ thing ? You want to have the very very fast thing,
> which is not reliable under all circumstances as Alok pointed out and
> I merily added a sanity check around that for testing.
You can move that thing _out_ into a function of its own.
Look at this piece fo CRAP, and tell me, HOW MANY TIMES do you want to
repeat it?
+ /*
+ * Return the fast_calibrate value when neither hpet
+ * nor pmtimer are available.
+ */
+ if (!hpet && !ref1 && !ref2) {
+ printk("Fast TSC calibration using PIT\n");
+ return fast_calibrate;
+ }
+
+ /* Check, whether the sampling was disturbed by an SMI */
+ if (tsc1 == ULLONG_MAX || tsc2 == ULLONG_MAX)
+ goto slowpath;
+
+ tsc2 = (tsc2 - tsc1) * 1000000LL;
+ if (hpet)
+ tsc2 = calc_hpet_ref(tsc2, ref1, ref2);
+ else
+ tsc2 = calc_pmtimer_ref(tsc2, ref1, ref2);
+
+ /* Check the reference deviation */
+ delta = ((u64) fast_calibrate) * 100;
+ do_div(delta, tsc2);
+
+ if (delta >= 90 && delta <= 110) {
+ printk("Fast TSC calibration using PIT\n");
+ return fast_calibrate;
+ }
+ }
Here's a hint: we don't do cut-and-paste programming. And we don't get
extra points for bloating a single function with the same unreadable code
over and over and over again.
How many copies do you want? And here's a hint: the answer is _one_. If
you get any other answer, your patch is SHIT.
Linus
--
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