Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751731AbbBSP4h (ORCPT ); Thu, 19 Feb 2015 10:56:37 -0500 Received: from mga11.intel.com ([192.55.52.93]:13010 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750976AbbBSP4g (ORCPT ); Thu, 19 Feb 2015 10:56:36 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,609,1418112000"; d="scan'208";a="456814186" Message-ID: <54E607AE.8080707@intel.com> Date: Thu, 19 Feb 2015 17:56:30 +0200 From: Adrian Hunter User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Peter Zijlstra CC: Ingo Molnar , Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org, David Ahern , Frederic Weisbecker , Jiri Olsa , Namhyung Kim , Paul Mackerras , Stephane Eranian , John Stultz , Thomas Gleixner , Pawel Moll , Steven Rostedt , Andi Kleen Subject: Re: [PATCH 0/2] perf/x86: Add ability to sample TSC References: <1424347870-8492-1-git-send-email-adrian.hunter@intel.com> <20150219135002.GJ5029@twins.programming.kicks-ass.net> <54E5F581.9000205@intel.com> <20150219150543.GE21418@twins.programming.kicks-ass.net> In-Reply-To: <20150219150543.GE21418@twins.programming.kicks-ass.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3044 Lines: 77 On 19/02/2015 5:05 p.m., Peter Zijlstra wrote: > On Thu, Feb 19, 2015 at 04:38:57PM +0200, Adrian Hunter wrote: >> On 19/02/15 15:50, Peter Zijlstra wrote: >>> On Thu, Feb 19, 2015 at 02:11:08PM +0200, Adrian Hunter wrote: >>>> Hi >>>> >>>> With the advent of switching perf_clock to CLOCK_MONOTONIC, >>>> it will not be possible to convert perf_clock directly to/from >>>> TSC. So add the ability to sample TSC instead. >>> >>> Well, you can, mostly. MONOTONIC is only affected by NTP slew rate >>> changes, not offset changes. >> >> man page says is also subject to adjtime(3) > > which is slew adjustment; read the adjtime manpage :-) > >>> And NTP limits the slew rate to 500 PPM, so even if you would get a >> >> Assuming it is not broken. > > NTP people are a cautious crowd, sure they get it wrong just like the > rest of us, but mostly it needs to work. > >>> slew change and then not update the userpage data for a second you'd be >>> maximally off by 0.0005 seconds. >> >> That could still be enough to break the decoder. It will certainly >> misrepresent the order of events, which is a big loss of information. > > What decoder? perf report is already subject to much larger shifts in > time if you run it on say a core2 machine. Any decoder of Intel PT data. Side-band events like sched_switch or mmap have to be sync'ed with Intel PT TSC timestamps to decode the trace. But synchronizing any kind of event could be useful for analysis. > >>> And that is way below what the current perf clock guarantees on funny >>> hardware. >>> >>> If you're really worried about this; we could maybe get John and Thomas >>> to allow us a callback on every slew change so we can update the >>> userpage data ASAP, much reducing the max error. >>> >>> Say it takes a 10e5 cycles to update your userpage, then you're never >>> further off than 50 cycles, which is below your ART multiplier. >> >> You still need to wake up user space to read the userpage. > > Uhm what? Userspace is already awake. For Intel PT recording, perf record will be sleeping on poll(). > >>> Does that really matter? Also, if you have a stable crystal, the slew >>> rate change should be minimal and infrequent, never getting you close to >>> these numbers. >>> >>> So no, I'm not convinced we need this. >> >> Adding TSC to the sample is a lot simpler and more accurate. > > Finding multiple samples and interpolating between them is much simpler > than reading tsc and doing the mult, shift and offset addition? > > I suspect you're talking about something else entirely; your changelogs > are inadequate for they tell ntohing of your usecase and have me > guessing. Don't do that. Sorry. I did mention Intel PT in patch 2, but I basically assumed the need to synchronize events with other time sources was understood. -- 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/