All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: "Yan, Zheng" <zheng.z.yan@intel.com>
Cc: linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl,
	acme@infradead.org, eranian@google.com, andi@firstfloor.org
Subject: Re: [PATCH v2 4/4] perf/x86/uncore: modularize Intel uncore driver
Date: Tue, 22 Apr 2014 13:35:45 +0200	[thread overview]
Message-ID: <20140422113545.GA14950@gmail.com> (raw)
In-Reply-To: <53548008.3040504@intel.com>


* Yan, Zheng <zheng.z.yan@intel.com> wrote:

> On 04/18/2014 06:53 PM, Ingo Molnar wrote:
> > 
> > * Yan, Zheng <zheng.z.yan@intel.com> wrote:
> > 
> >> This patch adds support for building Intel uncore driver as module.
> >> It adds clean-up code and config option for the Intel uncore driver
> >>
> >> Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
> >> ---
> >> Changes since v1:
> >>  move config option to "General setup/Kernel Performance Events and Counters"
> >>
> >>  arch/x86/kernel/cpu/Makefile                  |  3 +-
> >>  arch/x86/kernel/cpu/perf_event_intel_uncore.c | 48 ++++++++++++++++++++++++---
> >>  init/Kconfig                                  | 10 ++++++
> >>  3 files changed, 56 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
> >> index 7fd54f0..5d3da70 100644
> >> --- a/arch/x86/kernel/cpu/Makefile
> >> +++ b/arch/x86/kernel/cpu/Makefile
> >> @@ -36,7 +36,8 @@ obj-$(CONFIG_CPU_SUP_AMD)		+= perf_event_amd_iommu.o
> >>  endif
> >>  obj-$(CONFIG_CPU_SUP_INTEL)		+= perf_event_p6.o perf_event_knc.o perf_event_p4.o
> >>  obj-$(CONFIG_CPU_SUP_INTEL)		+= perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o
> >> -obj-$(CONFIG_CPU_SUP_INTEL)		+= perf_event_intel_uncore.o perf_event_intel_rapl.o
> >> +obj-$(CONFIG_CPU_SUP_INTEL)		+= perf_event_intel_rapl.o
> >> +obj-$(CONFIG_PERF_X86_INTEL_UNCORE)	+= perf_event_intel_uncore.o
> >>  endif
> >>  
> >>  
> >> diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> >> index 618d502..fd5e883 100644
> >> --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> >> +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> > 
> > So I'm not willing to apply this patch until the documentation of 
> > perf_event_intel_uncore.c is improved. Right now the file starts 
> > without a single comment (!). Just lines after lines of code, without 
> > any explanation what it does, what its scope is, etc.
> 
> there are comments mark the scope of code for different CPU.
> 
> > 
> > How should even a knowledgable user know about what it's all about?
> > 
> > That problem percolates to the Kconfig entry as well:
> > 
> 
> Most of the codes without comments are hardware specific codes. The 
> corresponding contents in Intel uncore documents are big 
> tables/lists, nothing tricky/interesting. I really don't know how to 
> comment these code.

Have a look at other PMU drivers, such as 
arch/x86/kernel/cpu/perf_event_intel_rapl.c, which begin with a 
general explanation attached below.

Thanks,

	Ingo


/*
 * perf_event_intel_rapl.c: support Intel RAPL energy consumption counters
 * Copyright (C) 2013 Google, Inc., Stephane Eranian
 *
 * Intel RAPL interface is specified in the IA-32 Manual Vol3b
 * section 14.7.1 (September 2013)
 *
 * RAPL provides more controls than just reporting energy consumption
 * however here we only expose the 3 energy consumption free running
 * counters (pp0, pkg, dram).
 *
 * Each of those counters increments in a power unit defined by the
 * RAPL_POWER_UNIT MSR. On SandyBridge, this unit is 1/(2^16) Joules
 * but it can vary.
 *
 * Counter to rapl events mappings:
 *
 *  pp0 counter: consumption of all physical cores (power plane 0)
 * 	  event: rapl_energy_cores
 *    perf code: 0x1
 *
 *  pkg counter: consumption of the whole processor package
 *	  event: rapl_energy_pkg
 *    perf code: 0x2
 *
 * dram counter: consumption of the dram domain (servers only)
 *	  event: rapl_energy_dram
 *    perf code: 0x3
 *
 * dram counter: consumption of the builtin-gpu domain (client only)
 *	  event: rapl_energy_gpu
 *    perf code: 0x4
 *
 * We manage those counters as free running (read-only). They may be
 * use simultaneously by other tools, such as turbostat.
 *
 * The events only support system-wide mode counting. There is no
 * sampling support because it does not make sense and is not
 * supported by the RAPL hardware.
 *
 * Because we want to avoid floating-point operations in the kernel,
 * the events are all reported in fixed point arithmetic (32.32).
 * Tools must adjust the counts to convert them to Watts using
 * the duration of the measurement. Tools may use a function such as
 * ldexp(raw_count, -32);
 */

  reply	other threads:[~2014-04-22 11:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20  6:03 [PATCH v2 4/4] perf/x86/uncore: modularize Intel uncore driver Yan, Zheng
2014-03-20  8:27 ` Peter Zijlstra
2014-04-18 10:53 ` Ingo Molnar
2014-04-18 16:49   ` Andi Kleen
2014-04-21  2:18   ` Yan, Zheng
2014-04-22 11:35     ` Ingo Molnar [this message]
2014-04-23 14:55       ` Stephane Eranian
2014-04-24  8:14         ` Ingo Molnar
2014-04-24 10:25           ` Yan, Zheng
2014-04-24 10:36             ` Stephane Eranian
2014-04-24 10:37               ` Yan, Zheng
2014-04-24 11:27               ` Peter Zijlstra
2014-04-25 13:17                 ` Yan, Zheng
2014-04-25 13:55                   ` Peter Zijlstra
2014-04-25 14:06                     ` Yan, Zheng
2014-04-25 14:35                       ` Peter Zijlstra
2014-04-25 14:44                         ` Yan, Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140422113545.GA14950@gmail.com \
    --to=mingo@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@infradead.org \
    --cc=andi@firstfloor.org \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zheng.z.yan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.