From: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
To: Kajol Jain <kjain@linux.ibm.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>,
linuxppc-dev@lists.ozlabs.org, disgoel@linux.vnet.ibm.com,
Nageswara Sastry <rnsastry@linux.ibm.com>
Subject: Re: [PATCH 2/2] powerpc/perf: Fix the threshold compare group constraint for power9
Date: Tue, 17 May 2022 19:36:24 +0530 [thread overview]
Message-ID: <2E9D3C37-F4FB-4480-B007-49E1ABD0A36D@linux.vnet.ibm.com> (raw)
In-Reply-To: <20220506061015.43916-2-kjain@linux.ibm.com>
> On 06-May-2022, at 11:40 AM, Kajol Jain <kjain@linux.ibm.com> wrote:
>
> Thresh compare bits for a event is used to program thresh compare
> field in Monitor Mode Control Register A (MMCRA: 9-18 bits for power9).
> When scheduling events as a group, all events in that group should
> match value in threshold bits (like thresh compare, thresh control,
> thresh select). Otherwise event open for the sibling events should fail.
> But in the current code, incase thresh compare bits are not valid,
> we are not failing in group_constraint function which can result
> in invalid group schduling.
>
> Fix the issue by returning -1 incase event is threshold and threshold
> compare value is not valid.
>
> Thresh control bits in the event code is used to program thresh_ctl
> field in Monitor Mode Control Register A (MMCRA: 48-55). In below example,
> the scheduling of group events PM_MRK_INST_CMPL (873534401e0) and
> PM_THRESH_MET (8734340101ec) is expected to fail as both event
> request different thresh control bits and invalid thresh compare value.
>
> Result before the patch changes:
>
> [command]# perf stat -e "{r8735340401e0,r8734340101ec}" sleep 1
>
> Performance counter stats for 'sleep 1':
>
> 11,048 r8735340401e0
> 1,967 r8734340101ec
>
> 1.001354036 seconds time elapsed
>
> 0.001421000 seconds user
> 0.000000000 seconds sys
>
> Result after the patch changes:
>
> [command]# perf stat -e "{r8735340401e0,r8734340101ec}" sleep 1
> Error:
> The sys_perf_event_open() syscall returned with 22 (Invalid argument)
> for event (r8735340401e0).
> /bin/dmesg | grep -i perf may provide additional information.
>
> Fixes: 78a16d9fc1206 ("powerpc/perf: Avoid FAB_*_MATCH checks for power9")
> Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
Reviewed-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Thanks
Athira
> ---
> arch/powerpc/perf/isa207-common.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/perf/isa207-common.c b/arch/powerpc/perf/isa207-common.c
> index 013b06af6fe6..bb5d64862bc9 100644
> --- a/arch/powerpc/perf/isa207-common.c
> +++ b/arch/powerpc/perf/isa207-common.c
> @@ -508,7 +508,8 @@ int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp,
> if (event_is_threshold(event) && is_thresh_cmp_valid(event)) {
> mask |= CNST_THRESH_MASK;
> value |= CNST_THRESH_VAL(event >> EVENT_THRESH_SHIFT);
> - }
> + } else if (event_is_threshold(event))
> + return -1;
> } else {
> /*
> * Special case for PM_MRK_FAB_RSP_MATCH and PM_MRK_FAB_RSP_MATCH_CYC,
> --
> 2.31.1
>
next prev parent reply other threads:[~2022-05-17 14:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-06 6:10 [PATCH 1/2] powerpc/perf: Fix the threshold compare group constraint for power10 Kajol Jain
2022-05-06 6:10 ` [PATCH 2/2] powerpc/perf: Fix the threshold compare group constraint for power9 Kajol Jain
2022-05-17 14:06 ` Athira Rajeev [this message]
2022-05-09 5:52 ` [PATCH 1/2] powerpc/perf: Fix the threshold compare group constraint for power10 Athira Rajeev
2022-05-24 11:09 ` Michael Ellerman
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=2E9D3C37-F4FB-4480-B007-49E1ABD0A36D@linux.vnet.ibm.com \
--to=atrajeev@linux.vnet.ibm.com \
--cc=disgoel@linux.vnet.ibm.com \
--cc=kjain@linux.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=rnsastry@linux.ibm.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).