mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Kan Liang <kan.liang@intel.com>
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 2/2] perf/x86/intel/uncore: support IIO freerunning counter for SKX
Date: Wed, 18 Oct 2017 17:29:05 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1710181715100.1925@nanos> (raw)
In-Reply-To: <1505149816-12580-2-git-send-email-kan.liang@intel.com>

On Mon, 11 Sep 2017, kan.liang@intel.com wrote:
> -	if (event->hw.idx >= UNCORE_PMC_IDX_FIXED)
> +	if (event->hw.idx >= UNCORE_PMC_IDX_FREERUNNING)
> +		shift = 64 - uncore_free_running_bits(box, event);
> +	else if (event->hw.idx == UNCORE_PMC_IDX_FIXED)

I have no idea why the original check was

       	  event->hw.idx >= UNCORE_PMC_IDX_FIXED

and why the new one is

          event->hw.idx >= UNCORE_PMC_IDX_FREERUNNING

when you check in the next conditional:

> +		if (event->hw.idx == UNCORE_PMC_IDX_FREERUNNING)
> +			continue;

This stinks. Anything > UNCORE_PMC_IDX_FREERUNNING is bogus.

> @@ -454,6 +459,12 @@ static void uncore_pmu_event_start(struct perf_event *event, int flags)
>  	struct intel_uncore_box *box = uncore_event_to_box(event);
>  	int idx = event->hw.idx;
>  
> +	if (event->hw.idx == UNCORE_PMC_IDX_FREERUNNING) {
> +		local64_set(&event->hw.prev_count,
> +			    uncore_read_counter(box, event));

A comment why this has special treatment would be helpful. Here and in
other places.

> +/*
> + * Free running MSR events have the same event code 0xff as fixed events.
> + * The Free running events umask starts from 0x10.
> + * The umask which is less than 0x10 is reserved for fixed events.
> + *
> + * The Free running events are divided into different types according to
> + * MSR location, bit width or definition. Each type is limited to only have
> + * at most 16 events.
> + * So the umask of first type starts from 0x10, the second starts from 0x20,
> + * the rest can be done in the same manner.
> + */
> +#define UNCORE_FREE_RUNNING_MSR_START			0x10

> +#define UNCORE_FREE_RUNNING_MSR_IDX(config)		((config >> 8) & 0xf)
> +#define UNCORE_FREE_RUNNING_MSR_TYPE_IDX(config)	\
> +		((((config >> 8) - UNCORE_FREE_RUNNING_MSR_START) >> 4) & 0xf)
> +

Any reason why these two need to be fugly macros instead of inlines which
simply take an event or an attribute pointer?

> @@ -34,6 +52,7 @@ struct intel_uncore_ops;
>  struct intel_uncore_pmu;
>  struct intel_uncore_box;
>  struct uncore_event_desc;
> +struct free_running_msr;
>  
>  struct intel_uncore_type {
>  	const char *name;
> @@ -41,6 +60,7 @@ struct intel_uncore_type {
>  	int num_boxes;
>  	int perf_ctr_bits;
>  	int fixed_ctr_bits;
> +	int num_free_running_type;

  	s/type/types/

> @@ -128,6 +149,13 @@ struct uncore_event_desc {
>  	const char *config;
>  };
>  
> +struct free_running_msr {
> +	unsigned msr_base;

unsigned int please

> +	unsigned msr_off;
> +	unsigned num_counters;
> +	unsigned bits;
> +};
> +
>  struct pci2phy_map {
>  	struct list_head list;
>  	int segment;
> @@ -214,6 +242,18 @@ static inline unsigned uncore_msr_fixed_ctr(struct intel_uncore_box *box)
>  }

> +enum perf_uncore_iio_free_running_msr_type_id {
> +	SKX_IIO_MSR_IOCLK			= 0,
> +	SKX_IIO_MSR_BW				= 1,
> +	SKX_IIO_MSR_UTIL			= 2,
> +
> +	SKX_IIO_FREE_RUNNING_MSR_TYPE_MAX,
> +};


Please split the patch in two parts:

       1) Add infrastructure for free running counters

       2) Add SKX support

Thanks,

	tglx

  parent reply	other threads:[~2017-10-18 15:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-11 17:10 [PATCH 1/2] perf/x86/intel/uncore: correct num_boxes for IIO and IRP kan.liang
2017-09-11 17:10 ` [PATCH 2/2] perf/x86/intel/uncore: support IIO freerunning counter for SKX kan.liang
2017-10-17  1:20   ` Liang, Kan
2017-10-18 15:29   ` Thomas Gleixner [this message]
2017-09-25 10:48 ` [tip:x86/urgent] perf/x86/intel/uncore: Correct num_boxes for IIO and IRP tip-bot for Kan Liang

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=alpine.DEB.2.20.1710181715100.1925@nanos \
    --to=tglx@linutronix.de \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=eranian@google.com \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /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

all inboxes | Powered by JetHome®