Re: [RFC patch 0/4] TSC calibration improvements

From: Linus Torvalds
Date: Sat Sep 06 2008 - 17:15:33 EST




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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/