linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tan Xiaojun <tanxiaojun@huawei.com>
To: James Clark <James.Clark@arm.com>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"acme@kernel.org" <acme@kernel.org>,
	"alexander.shishkin@linux.intel.com" 
	<alexander.shishkin@linux.intel.com>,
	"jolsa@redhat.com" <jolsa@redhat.com>,
	"namhyung@kernel.org" <namhyung@kernel.org>,
	"ak@linux.intel.com" <ak@linux.intel.com>,
	"adrian.hunter@intel.com" <adrian.hunter@intel.com>,
	"yao.jin@linux.intel.com" <yao.jin@linux.intel.com>,
	"tmricht@linux.ibm.com" <tmricht@linux.ibm.com>,
	"brueckner@linux.ibm.com" <brueckner@linux.ibm.com>,
	"songliubraving@fb.com" <songliubraving@fb.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	Kim Phillips <Kim.Phillips@arm.com>,
	"Jeremy Linton" <Jeremy.Linton@arm.com>
Cc: "gengdongjiu@huawei.com" <gengdongjiu@huawei.com>,
	"wxf.wang@hisilicon.com" <wxf.wang@hisilicon.com>,
	"liwei391@huawei.com" <liwei391@huawei.com>,
	"huawei.libin@huawei.com" <huawei.libin@huawei.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-perf-users@vger.kernel.org"
	<linux-perf-users@vger.kernel.org>, nd <nd@arm.com>
Subject: Re: [RFC v2 4/4] perf tools: Support "branch-misses:pp" on arm64
Date: Fri, 25 Oct 2019 10:42:52 +0800	[thread overview]
Message-ID: <38c18a3e-1b9a-05fe-63f6-920af2f53fc7@huawei.com> (raw)
In-Reply-To: <AM4PR0802MB224263700592195B3BAE9D5AE26A0@AM4PR0802MB2242.eurprd08.prod.outlook.com>

On 2019/10/25 0:29, James Clark wrote:
> Hi Xiaojun,
> 
> This looks really good. I tried this, but got an error:
> 
>     ./perf record -e branch-misses:p ls
>     Error:
>     The branch-misses:p event is not supported.

Hi, James,

I can't reproduce this problem. If the current system doesn't support spe, it shouldn't report an error. I use the latest codes of the mainline:

commit f116b96685a046a89c25d4a6ba2da489145c8888 (mainline/master)
Merge: f632bfaa33ed 603d9299da32
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Thu Oct 24 06:13:45 2019 -0400

    Merge tag 'mfd-fixes-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

I will go and see why this will be reported.

> 
> 
> I would have expected to use the event name that is listed in the SPE documentation for branch misses which is br_mis_pred or br_mis_pred_retired:
> 
>     E[7], byte 0 bit [7]
>     Mispredicted. The defined values of this bit are:
>     0 Did not cause correction to the predicted program flow.
>     1 A branch that caused a correction to the predicted program flow.
> 
>     If PMUv3 is implemented this Event is required to be implemented consistently with either BR_MIS_PRED or BR_MIS_PRED_RETIRED.
> 

Do you mean that I can add these as new events to perf? If we think of them as new events, what should we do if the user does not add :pp for them?
(Or for these events, users can only add :pp to use them?)

> 
> +       if (!strcmp(perf_env__arch(evlist->env), "arm64")
> +                       && evsel->core.attr.config == PERF_COUNT_HW_BRANCH_MISSES
> +                       && evsel->core.attr.precise_ip) {
> 
> As I mentioned above PERF_COUNT_HW_BRANCH_MISSESdoesn't seem to match up with the actual event counter that is associated with this SPE event (BR_MIS_PRED). The fix for this is probably as simple as adding an OR for the other aliases for branch mispredicts.

What you mean is that we can filter with spe events(like BR_MIS_PRED) first, and if we have other events that are exactly the same(no more for now), then we can handle them by adding OR in the future?

> 
> +               pmu = perf_pmu__find("arm_spe_0");
> +               if (pmu) {
> +                       evsel->pmu_name = pmu->name;
> +                       evsel->core.attr.type = PERF_RECORD_AUXTRACE;
> +                       evsel->core.attr.config = SPE_ATTR_TS_ENABLE
> +                                               | SPE_ATTR_PA_ENABLE
> 
> I wouldn't set physical addresses by default as this requires root. I would leave that to the user if they want to manually configure SPE.

Yes. You are right. I got a error for this case. I will fix it.

------------------
./perf record -e branch-misses:p ls
Error:
You may not have permission to collect stats.
...
------------------

Thanks.
Xiaojun.

> 
> I have only looked briefly and I will do some more testing.
> 
> 
> Thanks
> James
> 
> 



  parent reply	other threads:[~2019-10-25  2:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24 14:48 [RFC v2 0/4] perf tools: Add support for some spe events and precise ip Tan Xiaojun
2019-10-24 14:48 ` [RFC v2 1/4] perf tools: Move arm-spe-pkt-decoder.h/c to the new dir Tan Xiaojun
2019-10-24 14:48 ` [RFC v2 2/4] perf tools: Add support for "report" for some spe events Tan Xiaojun
2019-10-24 14:48 ` [RFC v2 3/4] perf report: Add --spe options for arm-spe Tan Xiaojun
2019-10-24 14:48 ` [RFC v2 4/4] perf tools: Support "branch-misses:pp" on arm64 Tan Xiaojun
     [not found]   ` <AM4PR0802MB224263700592195B3BAE9D5AE26A0@AM4PR0802MB2242.eurprd08.prod.outlook.com>
2019-10-25  2:42     ` Tan Xiaojun [this message]
2019-11-13 14:47       ` James Clark
2019-11-15  2:59         ` Tan Xiaojun
2019-11-15 11:37           ` James Clark
2019-11-18  7:05             ` Tan Xiaojun

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=38c18a3e-1b9a-05fe-63f6-920af2f53fc7@huawei.com \
    --to=tanxiaojun@huawei.com \
    --cc=James.Clark@arm.com \
    --cc=Jeremy.Linton@arm.com \
    --cc=Kim.Phillips@arm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=brueckner@linux.ibm.com \
    --cc=gengdongjiu@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=huawei.libin@huawei.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=liwei391@huawei.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=nd@arm.com \
    --cc=peterz@infradead.org \
    --cc=songliubraving@fb.com \
    --cc=tmricht@linux.ibm.com \
    --cc=wxf.wang@hisilicon.com \
    --cc=yao.jin@linux.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;
as well as URLs for NNTP newsgroup(s).