From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755394AbdKJArB (ORCPT ); Thu, 9 Nov 2017 19:47:01 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:53205 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752494AbdKJArA (ORCPT ); Thu, 9 Nov 2017 19:47:00 -0500 Date: Fri, 10 Nov 2017 01:46:52 +0100 (CET) From: Thomas Gleixner To: Arnd Bergmann cc: Kees Cook , Anton Vorontsov , Colin Cross , Tony Luck , John Stultz , Stephen Boyd , Ingo Molnar , LKML Subject: Re: [PATCH] pstore: use ktime_get_real_fast_ns() instead of __getnstimeofday() In-Reply-To: Message-ID: References: <20171108160056.3042976-1-arnd@arndb.de> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 10 Nov 2017, Arnd Bergmann wrote: > On Fri, Nov 10, 2017 at 12:00 AM, Thomas Gleixner wrote: > > Hmm, no. None of the regular accessor functions can be called from NMI > > context safely. > > Right, that's what I mean: it must not get called from NMI context, but it > currently is, at least for this case: > > NMI handler: > something bad > panic() > kmsg_dump() > pstore_dump() > pstore_record_init() > __getnstimeofday() > > I should probably add that to the changelog text ;-) Indeed. > Also, I have a related patch series that renames getrawmonotonic64(), > current_kernel_time64() and get_monotonic_coarse64() to > ktime_get_raw_ts64(), ktime_get_coarse_real_ts64() and > ktime_get_coarse_ts64(), for consistency, but then I couldn't > come up with a good name for __getnstimeofday64(), as the > __ktime_get_*() naming is already used for a number of other > things and I did not want to overload that more. Completely > removing __getnstimeofday64() would be handier here. Oh yes, it's an abomination. > > The normal timekeeping accessor functions cannot be called between > > timekeeping_suspend() and timekeeping_resume() at all. They will emit a > > warning and can indeed crash and burn in one of the ways you described > > above. This does not happen on x86 because the TSC will just work on > > systems with pstore. > > Sure, except for __getnstimeofday64(), which will intentionally not warn but > could crash in the clocksource driver (on non-x86). We do ignore the result > from __getnstimeofday64() when timekeeping is suspended, but only after > we call into the clocksource driver. Right, let's get rid of it before it grows another user. Thanks, tglx