Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752359AbaLSRIN (ORCPT ); Fri, 19 Dec 2014 12:08:13 -0500 Received: from mail-lb0-f170.google.com ([209.85.217.170]:35990 "EHLO mail-lb0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752113AbaLSRIL (ORCPT ); Fri, 19 Dec 2014 12:08:11 -0500 MIME-Version: 1.0 In-Reply-To: <20141219170334.GM30905@twins.programming.kicks-ass.net> References: <8559794d3a1924408a811a2881ab916fffb6015b.1418857018.git.shli@fb.com> <95a7ba1a95a6251439d5ca2d3d56fe7f0778cb95.1418857018.git.shli@fb.com> <20141219112350.GJ30905@twins.programming.kicks-ass.net> <20141219170334.GM30905@twins.programming.kicks-ass.net> From: Andy Lutomirski Date: Fri, 19 Dec 2014 09:07:49 -0800 Message-ID: Subject: Re: [PATCH v2 3/3] X86: Add a thread cpu time implementation to vDSO To: Peter Zijlstra Cc: Shaohua Li , "linux-kernel@vger.kernel.org" , X86 ML , Kernel-team@fb.com, "H. Peter Anvin" , Ingo Molnar , John Stultz Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 19, 2014 at 9:03 AM, Peter Zijlstra wrote: > On Fri, Dec 19, 2014 at 08:48:07AM -0800, Andy Lutomirski wrote: >> On Fri, Dec 19, 2014 at 3:23 AM, Peter Zijlstra wrote: >> > On Thu, Dec 18, 2014 at 04:22:59PM -0800, Andy Lutomirski wrote: >> >> Bad news: this patch is incorrect, I think. Take a look at >> >> update_rq_clock -- it does fancy things involving irq time and >> >> paravirt steal time. So this patch could result in extremely >> >> non-monotonic results. >> > >> > Yeah, I'm not sure how (and if) we could make all that work :/ >> >> I obviously can't comment on what Facebook needs, but if I were >> rigging something up to profile my own code*, I'd want a count of >> elapsed time, including user, system, and probably interrupt as well. >> I would probably not want to count time during which I'm not >> scheduled, and I would also probably not want to count steal time. >> The latter makes any implementation kind of nasty. >> >> The API presumably doesn't need to be any particular clock id for >> clock_gettime, and it may not even need to be clock_gettime at all. >> >> Is perf self-monitoring good enough for this? If not, can we make it >> good enough? > > Yeah, I think you should be able to use that. You could count a NOP > event and simply use its activated time. We have PERF_COUNT_SW_DUMMY for > such purposes iirc. > > The advantage of using perf self profiling is that it (obviously) > extends to more than just walltime. Re-asking my old question: would it make sense to add a vdso helper for the magic self-monitoring interface? Or, at the very least, we could try to tidy up the docs a bit. --Andy -- Andy Lutomirski AMA Capital Management, LLC -- 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/