public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: "Yan, Zheng" <zheng.z.yan@intel.com>
Cc: eranian@google.com, mingo@elte.hu, andi@firstfloor.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] perf/x86: Add Intel Nehalem-EX uncore support
Date: Wed, 04 Jul 2012 12:04:53 +0200	[thread overview]
Message-ID: <1341396293.2507.77.camel@laptop> (raw)
In-Reply-To: <1341381616-12229-6-git-send-email-zheng.z.yan@intel.com>

On Wed, 2012-07-04 at 14:00 +0800, Yan, Zheng wrote:
> +static void nhmex_uncore_msr_enable_event(struct intel_uncore_box *box,
> +                                         struct perf_event *event)
> +{
> +       struct hw_perf_event *hwc = &event->hw;
> +
> +       if (box->pmu->type == &nhmex_uncore_bbox)
> +               nhmex_bbox_msr_enable_event(box, event);
> +       else if (box->pmu->type == &nhmex_uncore_sbox)
> +               nhmex_sbox_msr_enable_event(box, event);
> +       else if (box->pmu->type == &nhmex_uncore_mbox)
> +               nhmex_mbox_msr_enable_event(box, event);
> +       else if (box->pmu->type == &nhmex_uncore_rbox)
> +               nhmex_rbox_msr_enable_event(box, event);
> +       else if (hwc->idx >= UNCORE_PMC_IDX_FIXED)
> +               wrmsrl(hwc->config_base, NHMEX_PMON_CTL_EN_BIT0);
> +       else if (box->pmu->type->event_mask & NHMEX_PMON_CTL_EN_BIT0)
> +               wrmsrl(hwc->config_base, hwc->config | NHMEX_PMON_CTL_EN_BIT22);
> +       else
> +               wrmsrl(hwc->config_base, hwc->config | NHMEX_PMON_CTL_EN_BIT0);
> +} 

wouldn't it be easier to do something like:

  box->pmu->type->enable_event(box, event);

The same for these other functions that are massive ->type switches.

Also, can you please add more comments, note all the face_cpuc stuff,
and there's some rather dense code in all the alternative stuff. 

Also, how can a single extra register require 192 bits of config space?


  reply	other threads:[~2012-07-04 10:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-04  6:00 [PATCH 0/5] perf/x86: Uncore updates Yan, Zheng
2012-07-04  6:00 ` [PATCH 1/5] perf/x86: Use 0xff as pseudo code for fixed uncore event Yan, Zheng
2012-07-04  6:00 ` [PATCH 2/5] perf/x86: Fix event constraint for SandyBridge-EP CBox Yan, Zheng
2012-07-04  6:00 ` [PATCH 3/5] perf/x86: Detect number of instances of uncore CBox Yan, Zheng
2012-07-06  6:32   ` [tip:perf/core] " tip-bot for Yan, Zheng
2012-07-04  6:00 ` [PATCH 4/5] perf/x86: Uncore filter support for SandyBridge-EP Yan, Zheng
2012-07-06  6:33   ` [tip:perf/core] " tip-bot for Yan, Zheng
2012-07-22 19:25   ` [PATCH 4/5] " Stephane Eranian
2012-07-04  6:00 ` [PATCH 5/5] perf/x86: Add Intel Nehalem-EX uncore support Yan, Zheng
2012-07-04 10:04   ` Peter Zijlstra [this message]
2012-07-04 16:00     ` Yan, Zheng
2012-07-04 16:53       ` Peter Zijlstra
2012-07-04 17:46         ` Yan, Zheng 
2012-07-05  6:32     ` [PATCH V2 " Yan, Zheng
2012-07-05 14:51       ` Andi Kleen
2012-07-05 15:46         ` Yan, Zheng
2012-07-10 12:17       ` Peter Zijlstra
2012-07-11  2:06         ` Yan, Zheng
2012-07-11  9:57           ` Peter Zijlstra
2012-07-11 12:02             ` Yan, Zheng
2012-07-26 15:11       ` [tip:perf/core] " tip-bot for 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=1341396293.2507.77.camel@laptop \
    --to=a.p.zijlstra@chello.nl \
    --cc=andi@firstfloor.org \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox