Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754136AbbFDRyl (ORCPT ); Thu, 4 Jun 2015 13:54:41 -0400 Received: from ns.horizon.com ([71.41.210.147]:20836 "HELO ns.horizon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754001AbbFDRyj (ORCPT ); Thu, 4 Jun 2015 13:54:39 -0400 Date: 4 Jun 2015 13:54:38 -0400 Message-ID: <20150604175438.12888.qmail@ns.horizon.com> From: "George Spelvin" To: linux@horizon.com, torvalds@linux-foundation.org Subject: Re: [PATCH RFC] x86, tsc: Allow for high latency in quick_pit_calibrate() Cc: adrian.hunter@intel.com, ak@linux.intel.com, hpa@zytor.com, linux-kernel@vger.kernel.org, luto@amacapital.net, mingo@kernel.org, tglx@linutronix.de In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1409 Lines: 31 On Thu, 4 Jun 2015 at 09:52:34, Linus Torvalds wrote: > With the usual "have timestamp both before the read that shows the bit > set, and after the read" so that you can estimate how big the error > window is. Actually, the current code uses three timestamps: one before the last read of the unwanted value, one in the middle, and one after the read of the target value (bit set in this case). The delta beween the outer two is used for error estimaion, and the middle timestamp is used as the guess for when the clock ticked. Because, if you properly factor out the common code, an RTC read is just one inb(), as opposed to two for the PIT, I would hope it could do better. > And you definitely want to disable interrupts and make sure nobody > else reads that register, since reading it will clear it. Although I > guess that during early boot there shouldn't be any other RTC > activity.. That's the other reason to factor out the CMOS locking. There's code in e.g.: arch/x86/kernel/rtc.c:mach_get_cmos_time() or drivers/rtc/rtc-cmos.c:cmos_nvram_read() that would also benefit from not acquiring and releasing the lock around every single one-byte read. -- 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/