From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753385AbbJSItw (ORCPT ); Mon, 19 Oct 2015 04:49:52 -0400 Received: from mga03.intel.com ([134.134.136.65]:13374 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750759AbbJSItv (ORCPT ); Mon, 19 Oct 2015 04:49:51 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,701,1437462000"; d="scan'208";a="814205284" Subject: Re: [PATCH 1/1] perf/x86: Fix time_shift in perf_event_mmap_page To: Ingo Molnar References: <1445001845-13688-1-git-send-email-adrian.hunter@intel.com> <1445001845-13688-2-git-send-email-adrian.hunter@intel.com> <20151019080852.GA24924@gmail.com> Cc: Peter Zijlstra , Arnaldo Carvalho de Melo , Andy Lutomirski , Thomas Gleixner , linux-kernel@vger.kernel.org, Stephane Eranian , Andi Kleen From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <5624ADF8.3090505@intel.com> Date: Mon, 19 Oct 2015 11:46:48 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151019080852.GA24924@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/10/15 11:08, Ingo Molnar wrote: > > * Adrian Hunter wrote: > >> Commit b20112edeadf ("perf/x86: Improve accuracy of perf/sched clock") >> allowed the time_shift value in perf_event_mmap_page to be as much >> as 32. Unfortunately the documented algorithms for using time_shift >> have it shifting an integer, whereas to work correctly with the value >> 32, the type must be u64. >> >> Fix by limiting the shift to 31 and adjusting the multiplier accordingly. >> >> Also update the documentation of perf_event_mmap_page so that new code >> based on it will be more future-proof. >> >> Fixes: b20112edeadf ("perf/x86: Improve accuracy of perf/sched clock") >> Signed-off-by: Adrian Hunter > > Would be nice to point out via what symptoms the code misbehaves and how users > notice. In the case of perf tools, Intel PT decodes correctly but the timestamps that are output (for example by perf script) have lost 32-bits of granularity so they look like they are not changing at all.