Linux Perf Users
 help / color / mirror / Atom feed
From: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
To: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: acme@kernel.org, jolsa@kernel.org, adrian.hunter@intel.com,
	irogers@google.com, namhyung@kernel.org,
	linux-perf-users@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	maddy@linux.ibm.com, kjain@linux.ibm.com,
	disgoel@linux.vnet.ibm.com, hbathini@linux.ibm.com,
	Tejas Manhas <Tejas.Manhas1@ibm.com>
Subject: Re: [PATCH] tools/perf/tests: Update event_groups test to use instructions as one of the sibling event for hw type
Date: Mon, 20 Jan 2025 13:53:08 +0530	[thread overview]
Message-ID: <7626F28E-7BEC-4374-800F-ABD1D044D092@linux.vnet.ibm.com> (raw)
In-Reply-To: <d4403303-81b5-4f7d-b7b1-1550c37d9e0f@amd.com>



> On 20 Jan 2025, at 12:00 PM, Ravi Bangoria <ravi.bangoria@amd.com> wrote:
> 
> Hi Athira,
> 
> On 10-Jan-25 3:16 PM, Athira Rajeev wrote:
>> In some of the powerpc platforms, event group testcase fails as below:
>> 
>>   # perf test -v 'Event groups'
>>   69: Event groups                                                    :
>>   --- start ---
>>   test child forked, pid 9765
>>   Using CPUID 0x00820200
>>   Using hv_24x7 for uncore pmu event
>>   0x0 0x0, 0x0 0x0, 0x0 0x0: Fail
>>   0x0 0x0, 0x0 0x0, 0x1 0x3: Pass
>> 
>> The testcase creates various combinations of hw, sw and uncore
>> PMU events and verify group creation succeeds or fails as expected.
>> This tests one of the limitation in perf where it doesn't allow
>> creating a group of events from different hw PMUs.
>> 
>> The testcase starts a leader event and opens two sibling events.
>> The combination the fails is three hardware events in a group.
>> "0x0 0x0, 0x0 0x0, 0x0 0x0: Fail"
>> 
>> Type zero and config zero which translates to PERF_TYPE_HARDWARE
>> and PERF_COUNT_HW_CPU_CYCLE. There is event constraint in powerpc
>> that events using same counter cannot be programmed in a group.
>> Here there is one alternative event for cycles, hence one leader
>> and only one sibling event can go in as a group.
> 
> For power9, cycles seems to map to PM_CYC event:
> 
>   GENERIC_EVENT_ATTR(cpu-cycles,                  PM_CYC);
> 
> However, I don't see PM_CYC in power9_event_alternatives[]. Is PM_RUN_CYC
> and PM_CYC are same?

Hi Ravi

They are not the same. PM_CYC count irrespective of the run latch state (idle state)
whereas PM_RUN_CYC doesn’t do that.

This test runs fine in power9. The event code for PM_CYC is 
EVENT(PM_CYC,                                   0x0001e)

Here it is not specifically meant to be run a particular counter and even if no alternative event is defined, it can pick available counters and go in as a group. But there are cases like other PMU (which is used in absence of platform specific PMU) , where alternative event is specified to run a particular counter.
Example: arch/powerpc/perf/generic-compat-pmu.c 

        EVENT(PM_CYC_ALT,                       0x100f0)
	EVENT(PM_CYC,                           0x600f4)

In this case, we can have only two cycles events to go in a group. So with our testcase events, one leader and only one sibling event
can go in a group (checked other PMU’s to confirm two is possible). So added this fix to consider instructions as one of the sibling event.

Thanks
Athira

> 
> Thanks,
> Ravi



  reply	other threads:[~2025-01-20  8:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-10  9:46 [PATCH] tools/perf/tests: Update event_groups test to use instructions as one of the sibling event for hw type Athira Rajeev
2025-01-20  6:30 ` Ravi Bangoria
2025-01-20  8:23   ` Athira Rajeev [this message]
2025-01-20  9:38     ` Ravi Bangoria
2025-01-20 18:26 ` Namhyung Kim

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=7626F28E-7BEC-4374-800F-ABD1D044D092@linux.vnet.ibm.com \
    --to=atrajeev@linux.vnet.ibm.com \
    --cc=Tejas.Manhas1@ibm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=disgoel@linux.vnet.ibm.com \
    --cc=hbathini@linux.ibm.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kjain@linux.ibm.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=namhyung@kernel.org \
    --cc=ravi.bangoria@amd.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