Received: by 10.223.176.46 with SMTP id f43csp48385wra; Fri, 19 Jan 2018 13:35:14 -0800 (PST) X-Google-Smtp-Source: ACJfBotVYRCMekAMrZPPOEFO3FhDq9H/SsdPbg+GekrLDL5BlnL5CFNlWXBcljetemA4veRBE2+s X-Received: by 10.99.94.69 with SMTP id s66mr42575406pgb.145.1516397714373; Fri, 19 Jan 2018 13:35:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516397714; cv=none; d=google.com; s=arc-20160816; b=00UKdfF53wmz0iSOSkKgNG3i50MHgZnTjFukXYwo6BmK+kOi+QSvt9yeZ66PGjwr75 AjbTLBr9ArxeGIEy7t4CD+6Y3hiHvoXPVAEfvquDWcKiOUIzRwrNP9NMOPMjOnB6/PSe 2l4R9lAfF725AH4nAFnCdqgHaDlq1LHeQmfzTS8A0vmg0hWhBA7xOd2d9ETL2qZgnPLT Asu6cqQOzXMtI/OTTZgxqeGG4Kuv9T7fOh5jNT4+8aDTg6kEi7uGEvjoeF111Quig3oZ I4oQmZOqvN976Lh6KLzn7Qn6zOjAe6JYGkvZGsffsX460/2AQ9bOIuoochfFkTsnzDZ1 cwkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=bcKvM+PteWetGsrlHtSCuWdYOb5A0wau7AnzVX7TWk8=; b=gtolEPN1SOQCbXBa1YB/fIgv1EFUGFuTGW+h2/1mq11UgcGjJGHtUEe4OTZHsGawDV SBeRMoQYAKgejQ8FWXvgXuvTdXphlbDeF7m33CpQOOG9WoMNIx3u/QCtx/ybv4gPc6/H i5cT9zGDJFeAnU0YF/7Ru+Q8rlA9cpnOaSz/8WVQoyY+Hq6KavgLfW0aVluYmAwUcpyQ fYhDm+/0anV2pOj1bbwo+B/oUcMHu/nOtKv83dfzq29Y2s86Z7D/AKDyxZXvl35M+kcv enjMinB+eXY2Zfi2rU2ZpUE2s/S0QhPouZEy7uQxMQdtNwXPcEVlXSPJ9WwjlmjSZE/E WGYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=sAsIxopE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b126si8819594pgc.610.2018.01.19.13.34.59; Fri, 19 Jan 2018 13:35:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=sAsIxopE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756582AbeASVeN (ORCPT + 99 others); Fri, 19 Jan 2018 16:34:13 -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 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=bcKvM+PteWetGsrlHtSCuWdYOb5A0wau7AnzVX7TWk8=; b=sAsIxopE6g5buUpGWP6GBg3zI 1a8piDnfyD9nDE1EPNAQ+jedL5BdUynK+oG/i+v/rHMcxeQ0LAy+NHmenh4zYgy2K5IvTgX4070F/ 8qjU76AqJ5NtC4LUuFxmRYRZj9sb44yOanr2Nl5i0SymBfi0FO70/1v3EiPTMQ27zpTnHYNsxqpZ4 HpK3FT6nhCYiltF6Kfexras/ZfRcLXT2+d8Zo/Yg7rY5osaditDBrE42z/c56IUQ00Jw5uXUkhVBe yG27AU9f2kliOworAk3Tp4U902Tv2LGOluuFSDTiAbh5UtBo5gzhMd0VJyCdKBn/CRXJ/ayZ9TjJ3 o3zignP3g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1eceIQ-00013L-ST; Fri, 19 Jan 2018 21:33:59 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AF30D2029F9F9; Fri, 19 Jan 2018 22:33:55 +0100 (CET) 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 Precedence: bulk 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).