* [PATCH] perf/arm-cmn: Fix arm_cmn_node_to_xp()
@ 2024-11-20 16:41 Namhyung Kim
2024-11-20 16:55 ` Robin Murphy
0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2024-11-20 16:41 UTC (permalink / raw)
To: Will Deacon, Mark Rutland, Robin Murphy
Cc: Stephane Eranian, LKML, linux-arm-kernel
The portid_bits and deviceid_bits for XP type nodes are set in the
arm_cmn_discover() and it's copied to others in arm_cmn_init_dtcs().
But to get the XP from a node in the arm_cmn_init_dtcs(), it needs
the {port,device}id_bits.
This makes arm-cmn PMU failing to count events on my setup. What we
need is the number of bits in total which is known by the cmn config.
Fixes: e79634b53e39 ("perf/arm-cmn: Refactor node ID handling. Again.")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
drivers/perf/arm-cmn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index 49bd811c6fd6efdd..0e0d2f5cfdaea890 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -386,7 +386,7 @@ static struct arm_cmn_nodeid arm_cmn_nid(const struct arm_cmn_node *dn)
static struct arm_cmn_node *arm_cmn_node_to_xp(const struct arm_cmn *cmn,
const struct arm_cmn_node *dn)
{
- int id = dn->id >> (dn->portid_bits + dn->deviceid_bits);
+ int id = dn->id >> (cmn->num_xps == 1 ? 5 : 3);
int bits = arm_cmn_xyidbits(cmn);
int x = id >> bits;
int y = id & ((1U << bits) - 1);
base-commit: bf9aa14fc523d2763fc9a10672a709224e8fcaf4
--
2.47.0.338.g60cca15819-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf/arm-cmn: Fix arm_cmn_node_to_xp()
2024-11-20 16:41 [PATCH] perf/arm-cmn: Fix arm_cmn_node_to_xp() Namhyung Kim
@ 2024-11-20 16:55 ` Robin Murphy
2024-11-20 18:44 ` Namhyung Kim
0 siblings, 1 reply; 3+ messages in thread
From: Robin Murphy @ 2024-11-20 16:55 UTC (permalink / raw)
To: Namhyung Kim, Will Deacon, Mark Rutland
Cc: Stephane Eranian, LKML, linux-arm-kernel
On 20/11/2024 4:41 pm, Namhyung Kim wrote:
> The portid_bits and deviceid_bits for XP type nodes are set in the
> arm_cmn_discover() and it's copied to others in arm_cmn_init_dtcs().
> But to get the XP from a node in the arm_cmn_init_dtcs(), it needs
> the {port,device}id_bits.
>
> This makes arm-cmn PMU failing to count events on my setup. What we
> need is the number of bits in total which is known by the cmn config.
Hmm, what about just moving the assignment to a point where it actually
makes more sense anyway?
Cheers,
Robin.
----->8-----
diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index 397a46410f7c..30506c43776f 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -2178,8 +2178,6 @@ static int arm_cmn_init_dtcs(struct arm_cmn *cmn)
continue;
xp = arm_cmn_node_to_xp(cmn, dn);
- dn->portid_bits = xp->portid_bits;
- dn->deviceid_bits = xp->deviceid_bits;
dn->dtc = xp->dtc;
dn->dtm = xp->dtm;
if (cmn->multi_dtm)
@@ -2420,6 +2418,8 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset)
}
arm_cmn_init_node_info(cmn, reg & CMN_CHILD_NODE_ADDR, dn);
+ dn->portid_bits = xp->portid_bits;
+ dn->deviceid_bits = xp->deviceid_bits;
switch (dn->type) {
case CMN_TYPE_DTC:
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf/arm-cmn: Fix arm_cmn_node_to_xp()
2024-11-20 16:55 ` Robin Murphy
@ 2024-11-20 18:44 ` Namhyung Kim
0 siblings, 0 replies; 3+ messages in thread
From: Namhyung Kim @ 2024-11-20 18:44 UTC (permalink / raw)
To: Robin Murphy
Cc: Will Deacon, Mark Rutland, Stephane Eranian, LKML,
linux-arm-kernel
Hello,
On Wed, Nov 20, 2024 at 04:55:04PM +0000, Robin Murphy wrote:
> On 20/11/2024 4:41 pm, Namhyung Kim wrote:
> > The portid_bits and deviceid_bits for XP type nodes are set in the
> > arm_cmn_discover() and it's copied to others in arm_cmn_init_dtcs().
> > But to get the XP from a node in the arm_cmn_init_dtcs(), it needs
> > the {port,device}id_bits.
> >
> > This makes arm-cmn PMU failing to count events on my setup. What we
> > need is the number of bits in total which is known by the cmn config.
>
> Hmm, what about just moving the assignment to a point where it actually
> makes more sense anyway?
Yep, this looks good to me too. Do you want to me to resend this?
Thanks,
Namhyung
>
> ----->8-----
> diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
> index 397a46410f7c..30506c43776f 100644
> --- a/drivers/perf/arm-cmn.c
> +++ b/drivers/perf/arm-cmn.c
> @@ -2178,8 +2178,6 @@ static int arm_cmn_init_dtcs(struct arm_cmn *cmn)
> continue;
> xp = arm_cmn_node_to_xp(cmn, dn);
> - dn->portid_bits = xp->portid_bits;
> - dn->deviceid_bits = xp->deviceid_bits;
> dn->dtc = xp->dtc;
> dn->dtm = xp->dtm;
> if (cmn->multi_dtm)
> @@ -2420,6 +2418,8 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset)
> }
> arm_cmn_init_node_info(cmn, reg & CMN_CHILD_NODE_ADDR, dn);
> + dn->portid_bits = xp->portid_bits;
> + dn->deviceid_bits = xp->deviceid_bits;
> switch (dn->type) {
> case CMN_TYPE_DTC:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-20 18:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-20 16:41 [PATCH] perf/arm-cmn: Fix arm_cmn_node_to_xp() Namhyung Kim
2024-11-20 16:55 ` Robin Murphy
2024-11-20 18:44 ` Namhyung Kim
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).