All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: "Liang, Kan" <kan.liang@linux.intel.com>
Cc: Carel Si <beibei.si@intel.com>,
	acme@redhat.com, alexander.shishkin@linux.intel.com,
	alexandre.torgue@foss.st.com, ak@linux.intel.com,
	mingo@redhat.com, james.clark@arm.com, jolsa@kernel.org,
	john.garry@huawei.com, mark.rutland@arm.com,
	mcoquelin.stm32@gmail.com, namhyung@kernel.org,
	peterz@infradead.org, eranian@google.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	lkp@lists.01.org, lkp@intel.com
Subject: Re: [LKP] Re: [perf vendor events] 3f5f0df7bf: perf-sanity-tests.perf_all_metrics_test.fail
Date: Wed, 13 Apr 2022 10:09:15 -0700	[thread overview]
Message-ID: <CAP-5=fXj+WT3ExNo-fL4d9b_Wm5swnKaCWd67rU85Q=QFg5KUw@mail.gmail.com> (raw)
In-Reply-To: <85eed89f-e4a8-2887-a0b3-579704304357@linux.intel.com>

On Wed, Apr 13, 2022 at 9:37 AM Liang, Kan <kan.liang@linux.intel.com> wrote:
>
>
>
> On 4/13/2022 12:03 PM, Ian Rogers wrote:
> > 3) Weak group doesn't fall back to no group:
>
> That's because the group validation code doesn't take pinned events,
> such as the NMI watchdog, into account.
>
> I proposed a kernel patch to fix it, but it's rejected. It should be
> hard to find a generic way to fix it from the kernel side.
> https://lore.kernel.org/lkml/1565977750-76693-1-git-send-email-kan.liang@linux.intel.com/
>
> Maybe we can workaround it from the perf tool side?
> For example, for each weak group with cycles event and NMI watchdog is
> enabled, add an extra cycles event when opening the group. If the open
> fails with the extra cycles event, fall back to no group. After the
> extra cycles event check, remove the extra cycles.
>
> What do you think?

Thanks Kan, it is a shame the kernel support is lacking here. I'm not
sure what you are proposing for the perf tool to do. So:

> for each weak group with cycles event and NMI watchdog

Okay, let's try Branching_Overhead as mentioned in this report - but
the event is CPU_CLK_UNHALTED.THREAD here :-/

> add an extra cycles event when opening the group

So the perf_event_open doesn't fail here for me:
$ perf stat -e '{BR_INST_RETIRED.NEAR_CALL,BR_INST_RETIRED.NEAR_TAKEN,BR_INST_RETIRED.NOT_TAKEN,BR_INST_RETIRED.CONDITIONAL,CPU_CLK_UNHALTED.THREAD},cycles'
-a sleep 1

 Performance counter stats for 'system wide':

     <not counted>      BR_INST_RETIRED.NEAR_CALL
               (0.00%)
     <not counted>      BR_INST_RETIRED.NEAR_TAKEN
                (0.00%)
     <not counted>      BR_INST_RETIRED.NOT_TAKEN
               (0.00%)
     <not counted>      BR_INST_RETIRED.CONDITIONAL
                 (0.00%)
     <not counted>      CPU_CLK_UNHALTED.THREAD
               (0.00%)
     4,071,908,022      cycles
               (49.97%)

       0.998134717 seconds time elapsed

Some events weren't counted. Try disabling the NMI watchdog:
echo 0 > /proc/sys/kernel/nmi_watchdog
perf stat ...
echo 1 > /proc/sys/kernel/nmi_watchdog
The events in group usually have to be from the same PMU. Try
reorganizing the group.

I'm not sure what the cycles event is achieving here, but it seems the
behavior will need a kernel change. I think I'm misunderstanding your
proposal :-)

Thanks,
Ian

> Thanks,
> Kan
> > $ perf stat -e '{BR_INST_RETIRED.NEAR_CALL,BR_INST_RETIRED.NEAR_TAKEN,BR_INST_RETIRED.NOT_TAKEN,BR_INST_RETIRED.CONDITIONAL,CPU_CLK_UNHALTED.THREAD}:W'
> > -a sleep 1
> >
> >   Performance counter stats for 'system wide':
> >
> >       <not counted>      BR_INST_RETIRED.NEAR_CALL
> >                 (0.00%)
> >       <not counted>      BR_INST_RETIRED.NEAR_TAKEN
> >                  (0.00%)
> >       <not counted>      BR_INST_RETIRED.NOT_TAKEN
> >                 (0.00%)
> >       <not counted>      BR_INST_RETIRED.CONDITIONAL
> >                   (0.00%)
> >       <not counted>      CPU_CLK_UNHALTED.THREAD
> >                 (0.00%)
> >
> >         1.001690318 seconds time elapsed
> >
> > Some events weren't counted. Try disabling the NMI watchdog:
> > echo 0 > /proc/sys/kernel/nmi_watchdog
> > perf stat ...
> > echo 1 > /proc/sys/kernel/nmi_watchdog

WARNING: multiple messages have this Message-ID (diff)
From: Ian Rogers <irogers@google.com>
To: lkp@lists.01.org
Subject: Re: [perf vendor events] 3f5f0df7bf: perf-sanity-tests.perf_all_metrics_test.fail
Date: Wed, 13 Apr 2022 10:09:15 -0700	[thread overview]
Message-ID: <CAP-5=fXj+WT3ExNo-fL4d9b_Wm5swnKaCWd67rU85Q=QFg5KUw@mail.gmail.com> (raw)
In-Reply-To: <85eed89f-e4a8-2887-a0b3-579704304357@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 3337 bytes --]

On Wed, Apr 13, 2022 at 9:37 AM Liang, Kan <kan.liang@linux.intel.com> wrote:
>
>
>
> On 4/13/2022 12:03 PM, Ian Rogers wrote:
> > 3) Weak group doesn't fall back to no group:
>
> That's because the group validation code doesn't take pinned events,
> such as the NMI watchdog, into account.
>
> I proposed a kernel patch to fix it, but it's rejected. It should be
> hard to find a generic way to fix it from the kernel side.
> https://lore.kernel.org/lkml/1565977750-76693-1-git-send-email-kan.liang(a)linux.intel.com/
>
> Maybe we can workaround it from the perf tool side?
> For example, for each weak group with cycles event and NMI watchdog is
> enabled, add an extra cycles event when opening the group. If the open
> fails with the extra cycles event, fall back to no group. After the
> extra cycles event check, remove the extra cycles.
>
> What do you think?

Thanks Kan, it is a shame the kernel support is lacking here. I'm not
sure what you are proposing for the perf tool to do. So:

> for each weak group with cycles event and NMI watchdog

Okay, let's try Branching_Overhead as mentioned in this report - but
the event is CPU_CLK_UNHALTED.THREAD here :-/

> add an extra cycles event when opening the group

So the perf_event_open doesn't fail here for me:
$ perf stat -e '{BR_INST_RETIRED.NEAR_CALL,BR_INST_RETIRED.NEAR_TAKEN,BR_INST_RETIRED.NOT_TAKEN,BR_INST_RETIRED.CONDITIONAL,CPU_CLK_UNHALTED.THREAD},cycles'
-a sleep 1

 Performance counter stats for 'system wide':

     <not counted>      BR_INST_RETIRED.NEAR_CALL
               (0.00%)
     <not counted>      BR_INST_RETIRED.NEAR_TAKEN
                (0.00%)
     <not counted>      BR_INST_RETIRED.NOT_TAKEN
               (0.00%)
     <not counted>      BR_INST_RETIRED.CONDITIONAL
                 (0.00%)
     <not counted>      CPU_CLK_UNHALTED.THREAD
               (0.00%)
     4,071,908,022      cycles
               (49.97%)

       0.998134717 seconds time elapsed

Some events weren't counted. Try disabling the NMI watchdog:
echo 0 > /proc/sys/kernel/nmi_watchdog
perf stat ...
echo 1 > /proc/sys/kernel/nmi_watchdog
The events in group usually have to be from the same PMU. Try
reorganizing the group.

I'm not sure what the cycles event is achieving here, but it seems the
behavior will need a kernel change. I think I'm misunderstanding your
proposal :-)

Thanks,
Ian

> Thanks,
> Kan
> > $ perf stat -e '{BR_INST_RETIRED.NEAR_CALL,BR_INST_RETIRED.NEAR_TAKEN,BR_INST_RETIRED.NOT_TAKEN,BR_INST_RETIRED.CONDITIONAL,CPU_CLK_UNHALTED.THREAD}:W'
> > -a sleep 1
> >
> >   Performance counter stats for 'system wide':
> >
> >       <not counted>      BR_INST_RETIRED.NEAR_CALL
> >                 (0.00%)
> >       <not counted>      BR_INST_RETIRED.NEAR_TAKEN
> >                  (0.00%)
> >       <not counted>      BR_INST_RETIRED.NOT_TAKEN
> >                 (0.00%)
> >       <not counted>      BR_INST_RETIRED.CONDITIONAL
> >                   (0.00%)
> >       <not counted>      CPU_CLK_UNHALTED.THREAD
> >                 (0.00%)
> >
> >         1.001690318 seconds time elapsed
> >
> > Some events weren't counted. Try disabling the NMI watchdog:
> > echo 0 > /proc/sys/kernel/nmi_watchdog
> > perf stat ...
> > echo 1 > /proc/sys/kernel/nmi_watchdog

  reply	other threads:[~2022-04-13 17:09 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04  8:33 [perf vendor events] 3f5f0df7bf: perf-sanity-tests.perf_all_metrics_test.fail kernel test robot
2022-03-04  8:33 ` kernel test robot
2022-03-04 18:10 ` Ian Rogers
2022-03-04 18:10   ` Ian Rogers
2022-04-13  7:05   ` [LKP] " Carel Si
2022-04-13  7:05     ` Carel Si
2022-04-13 16:03     ` [LKP] " Ian Rogers
2022-04-13 16:03       ` Ian Rogers
2022-04-13 16:37       ` [LKP] " Liang, Kan
2022-04-13 16:37         ` Liang, Kan
2022-04-13 17:09         ` Ian Rogers [this message]
2022-04-13 17:09           ` Ian Rogers
2022-04-13 18:17           ` [LKP] " Liang, Kan
2022-04-13 18:17             ` Liang, Kan
2022-04-14 16:09             ` [LKP] " Ian Rogers
2022-04-14 16:09               ` Ian Rogers
2022-04-14 19:06               ` [LKP] " Liang, Kan
2022-04-14 19:06                 ` Liang, Kan
2022-04-14 22:58                 ` [LKP] " Namhyung Kim
2022-04-14 22:58                   ` Namhyung Kim
2022-04-18 12:42                   ` [LKP] " Liang, Kan
2022-04-18 12:42                     ` Liang, Kan

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='CAP-5=fXj+WT3ExNo-fL4d9b_Wm5swnKaCWd67rU85Q=QFg5KUw@mail.gmail.com' \
    --to=irogers@google.com \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=beibei.si@intel.com \
    --cc=eranian@google.com \
    --cc=james.clark@arm.com \
    --cc=john.garry@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=lkp@lists.01.org \
    --cc=mark.rutland@arm.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --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 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.