Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754115AbbFCS3s (ORCPT ); Wed, 3 Jun 2015 14:29:48 -0400 Received: from ns.horizon.com ([71.41.210.147]:12727 "HELO ns.horizon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S932475AbbFCS3i (ORCPT ); Wed, 3 Jun 2015 14:29:38 -0400 Date: 3 Jun 2015 14:29:36 -0400 Message-ID: <20150603182936.16475.qmail@ns.horizon.com> From: "George Spelvin" To: hpa@zytor.com Subject: Re: [PATCH RFC] x86, tsc: Allow for high latency in quick_pit_calibrate() Cc: adrian.hunter@intel.com, ak@linux.intel.com, linux-kernel@vger.kernel.org, linux@horizon.com, luto@amacapital.net, tglx@linutronix.de, torvalds@linux-foundation.org In-Reply-To: <20150603062742.19228.qmail@ns.horizon.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1427 Lines: 33 H. Peter Anvin wrote: > The RTC is probably the most reliable reference clock, in part because > 32 kHz crystals are generally calibrated and extremely stable. However, > to get more than 1 Hz frequency out of it you have to enable interrupts > (which gets you to 8192 Hz). Indeed, it's the only one which is guaranteed a separate crystal. Many low-cost chipsets generate ALL other frequencies from one crystal with PLLs. (This is why I'm keen on using the RTC interrupt for an entropy source.) But as I mentioned earlier, you *can* get higher frequencies with interrupts *or* polling. When you program the periodic event frequency (from 2 to 8192 Hz), it does three things at that rate: 1) Periodic interrupts (if enabled), 2) Square wave output (if enabled, and relevant to discrete chips only), and 3) Sets the PE bit (register C, bit 6), which is auto-cleared on read. So if you're willing to poll the device (which the TSC calibration does already), you can get high resolution tick edges without interrupts. Because it's only one read (port 0x71), it's slightly faster than the PIT. (I also wish we could use all those TSC reads for initial entropy seeding somehow.) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/