From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752777AbeANUun (ORCPT + 1 other); Sun, 14 Jan 2018 15:50:43 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:38460 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752047AbeANUul (ORCPT ); Sun, 14 Jan 2018 15:50:41 -0500 Date: Sun, 14 Jan 2018 21:50:35 +0100 (CET) From: Thomas Gleixner To: Kan Liang cc: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org, acme@kernel.org, eranian@google.com, ak@linux.intel.com Subject: Re: [PATCH V4 4/8] perf/x86/intel/uncore: add new data structures for free running counters In-Reply-To: <1509654593-4446-4-git-send-email-kan.liang@intel.com> Message-ID: References: <1509654593-4446-1-git-send-email-kan.liang@intel.com> <1509654593-4446-4-git-send-email-kan.liang@intel.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Thu, 2 Nov 2017, kan.liang@intel.com wrote: > +/* > + * Free running counter is similar as fixed counter, except it is read-only > + * and always active when the uncore box is powered up. > + * > + * Here are the rules which are used to encode the event for free running > + * counter. > + * - The event for free running counter has the same event code 0xff as > + * the event for fixed counter. > + * - The umask of the event starts from 0x10. The umask which is less > + * than 0x10 is reserved for the event of fixed counter. > + * - The free running counters can be divided into different types according > + * to the MSR location, bit width or definition. The start point of the > + * umask for different type has 0x10 offset. > + * > + * For example, there are three types of IIO free running counters on Skylake > + * server, IO CLOCKS counters, BANDWIDTH counters and UTILIZATION counters. > + * The event code for all the free running counters is 0xff. > + * 'ioclk' is the first counter of IO CLOCKS. IO CLOCKS is the first type, > + * which umask starts from 0x10. > + * So 'ioclk' is encoded as event=0xff,umask=0x10 > + * 'bw_in_port2' is the third counter of BANDWIDTH counters. BANDWIDTH is > + * the second type, which umask starts from 0x20. > + * So 'bw_in_port2' is encoded as event=0xff,umask=0x22 > + */ > +static inline unsigned int uncore_freerunning_idx(u64 config) > +{ > + return ((config >> 8) & 0xf); > +} > + > +#define UNCORE_FREERUNNING_UMASK_START 0x10 > +static inline unsigned int uncore_freerunning_type(u64 config) Groan. I asked that before that you please stop glueing defines right in front of a function declaration w/o any visible space. Is it that hard to read and address _ALL_ review comments? > +{ > + return ((((config >> 8) - UNCORE_FREERUNNING_UMASK_START) >> 4) & 0xf); > +} Other than that this looks reasonable.