From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756588AbeASVeO (ORCPT ); Fri, 19 Jan 2018 16:34:14 -0500 Received: from merlin.infradead.org ([205.233.59.134]:58504 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754263AbeASVeJ (ORCPT ); Fri, 19 Jan 2018 16:34:09 -0500 Date: Fri, 19 Jan 2018 22:33:55 +0100 From: Peter Zijlstra To: Andi Kleen Cc: "Liang, Kan" , Stephane Eranian , "tglx@linutronix.de" , "mingo@redhat.com" , "linux-kernel@vger.kernel.org" , "acme@kernel.org" Subject: Re: [PATCH V5 4/8] perf/x86/intel/uncore: add new data structures for free running counters Message-ID: <20180119213355.GE2269@hirez.programming.kicks-ass.net> References: <1516042629-387021-4-git-send-email-kan.liang@intel.com> <20180118133248.GC2249@hirez.programming.kicks-ass.net> <37D7C6CF3E00A74B8858931C1DB2F07753801FEF@SHSMSX103.ccr.corp.intel.com> <20180119130731.GQ2228@hirez.programming.kicks-ass.net> <37D7C6CF3E00A74B8858931C1DB2F077538025E7@SHSMSX103.ccr.corp.intel.com> <20180119171929.GZ2228@hirez.programming.kicks-ass.net> <37D7C6CF3E00A74B8858931C1DB2F077538026F3@SHSMSX103.ccr.corp.intel.com> <37D7C6CF3E00A74B8858931C1DB2F07753802712@SHSMSX103.ccr.corp.intel.com> <20180119202417.GK7844@tassilo.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180119202417.GK7844@tassilo.jf.intel.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 19, 2018 at 12:24:17PM -0800, Andi Kleen wrote: > > Oh, think a bit more. > > I think we cannot do the same thing as we did for CPU PMU's fixed counters. > > > > The counters here are free running counters. They cannot be start/stop. > > Yes free running counter have completely different semantics. They > need a separate event code. The only thing that matters is if they count the same thing or not. The not start/stop thing is not important. See arch/x86/events/msr.c on how to deal with that. The short story is that you simply ignore stop and update the prev_count on start. Then any next update will increment with the correct delta. (if the counter is short you also need to run a timer to deal with wraps).