public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Vikas Shivappa <vikas.shivappa@linux.intel.com>
Cc: vikas.shivappa@intel.com, x86@kernel.org,
	linux-kernel@vger.kernel.org, hpa@zytor.com, tglx@linutronix.de,
	mingo@kernel.org, ravi.v.shankar@intel.com, tony.luck@intel.com,
	fenghua.yu@intel.com
Subject: Re: [PATCH 2/3] perf/x86/mbm: Fix mbm counting for RMID reuse
Date: Tue, 10 May 2016 14:15:38 +0200	[thread overview]
Message-ID: <20160510121538.GA3193@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1462578255-5858-3-git-send-email-vikas.shivappa@linux.intel.com>

On Fri, May 06, 2016 at 04:44:14PM -0700, Vikas Shivappa wrote:
> This patch tries to fix the issue where multiple perf instances try to
> monitor the same PID.

> MBM cannot count directly in the usual perf way of continuously adding
> the diff of current h/w counter and the prev count to the event->count
> because of some h/w dependencies:

And yet the patch appears to do exactly that; *confused*.

>  (1) the mbm h/w counters overflow.

As do most other counters.. so your point is? You also have the software
timer < overflow period..

>  (2) There are limited h/w RMIDs and hence we recycle the RMIDs due to
>      which an event may count from different RMIDs.

This fails to explain why this is a problem.

>  (3) Also we may not want to count at every sched_in and sched_out
>      because the MSR reads involve quite a bit of overhead.

Every single other PMU driver just does this; why are you special?

You list 3 issues of why you think you cannot do the regular thing, but
completely fail to explain how these issues are a problem.

> However we try to do something similar to usual perf way in this patch
> and mainly handle (1) and (3).

> update_sample takes care of the overflow in the hardware counters and
> provides abstraction by returning total bytes counted as if there was no
> overflow. We use this abstraction to count as below:
> 
> init:
>   event->prev_count = update_sample(rmid) //returns current total_bytes
> 
> count: // MBM right now uses count instead of read
>   cur_count = update_sample(rmid)
>   event->count += cur_count - event->prev_count
>   event->prev_count = cur_count

So where does cqm_prev_count come from and why do you need it? What's
wrong with event->hw.prev_count ?

In fact, I cannot seem to find any event->hw.prev_count usage in this or
the next patch, so can we simply use that and not add pointless new
members?

  reply	other threads:[~2016-05-10 12:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06 23:44 [PATCH V2 0/3] Urgent fixes for Intel CQM/MBM counting Vikas Shivappa
2016-05-06 23:44 ` [PATCH 1/3] perf/x86/cqm,mbm: Store cqm,mbm count for all events when RMID is recycled Vikas Shivappa
2016-05-06 23:44 ` [PATCH 2/3] perf/x86/mbm: Fix mbm counting for RMID reuse Vikas Shivappa
2016-05-10 12:15   ` Peter Zijlstra [this message]
2016-05-10 16:39     ` Luck, Tony
2016-05-11  7:23       ` Peter Zijlstra
2016-05-06 23:44 ` [PATCH 3/3] perf/x86/mbm: Fix mbm counting during RMID recycling Vikas Shivappa

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=20160510121538.GA3193@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=fenghua.yu@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=ravi.v.shankar@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=vikas.shivappa@intel.com \
    --cc=vikas.shivappa@linux.intel.com \
    --cc=x86@kernel.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