Fixes a regression in "perf: Rewrite core context handling" for arm_pmu
based drivers without a filter function pointer as the Apple M1 PMU.
The event is ignored if filter() returns 'true' opposite to
filter_match(). The refactoring failed to invert the return value if
arm_pmu has no filter() function pointer of its own.
Fixes: bd2756811766 ("perf: Rewrite core context handling")
Signed-off-by: Janne Grunau <[email protected]>
---
drivers/perf/arm_pmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index 9b593f985805..9cb22f36cf66 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -556,7 +556,7 @@ static bool armpmu_filter(struct pmu *pmu, int cpu)
if (ret && armpmu->filter)
return armpmu->filter(pmu, cpu);
- return ret;
+ return !ret;
}
static ssize_t cpus_show(struct device *dev,
---
base-commit: ceaa837f96adb69c0df0397937cd74991d5d821a
change-id: 20230215-arm_pmu_m1_regression-b6dd48d0c792
Best regards,
--
Janne Grunau <[email protected]>
On Wed, 15 Feb 2023 at 11:36, Janne Grunau <[email protected]> wrote:
>
> Fixes a regression in "perf: Rewrite core context handling" for arm_pmu
> based drivers without a filter function pointer as the Apple M1 PMU.
> The event is ignored if filter() returns 'true' opposite to
> filter_match(). The refactoring failed to invert the return value if
> arm_pmu has no filter() function pointer of its own.
>
> Fixes: bd2756811766 ("perf: Rewrite core context handling")
> Signed-off-by: Janne Grunau <[email protected]>
Makes sense we return the inverse of armpmu_filter everywhere else in the code.
Reviewed-by: Eric Curtin <[email protected]>
Is mise le meas/Regards,
Eric Curtin
> ---
> drivers/perf/arm_pmu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
> index 9b593f985805..9cb22f36cf66 100644
> --- a/drivers/perf/arm_pmu.c
> +++ b/drivers/perf/arm_pmu.c
> @@ -556,7 +556,7 @@ static bool armpmu_filter(struct pmu *pmu, int cpu)
> if (ret && armpmu->filter)
> return armpmu->filter(pmu, cpu);
>
> - return ret;
> + return !ret;
> }
>
> static ssize_t cpus_show(struct device *dev,
>
> ---
> base-commit: ceaa837f96adb69c0df0397937cd74991d5d821a
> change-id: 20230215-arm_pmu_m1_regression-b6dd48d0c792
>
> Best regards,
> --
> Janne Grunau <[email protected]>
>
>
On Wed, 15 Feb 2023 at 11:40, Eric Curtin <[email protected]> wrote:
>
> On Wed, 15 Feb 2023 at 11:36, Janne Grunau <[email protected]> wrote:
> >
> > Fixes a regression in "perf: Rewrite core context handling" for arm_pmu
> > based drivers without a filter function pointer as the Apple M1 PMU.
> > The event is ignored if filter() returns 'true' opposite to
> > filter_match(). The refactoring failed to invert the return value if
> > arm_pmu has no filter() function pointer of its own.
> >
> > Fixes: bd2756811766 ("perf: Rewrite core context handling")
> > Signed-off-by: Janne Grunau <[email protected]>
>
> Makes sense we return the inverse of armpmu_filter everywhere else in the code.
or we return the inverse of cpumask_test_cpu rather... copy/paste
error on my part.
>
> Reviewed-by: Eric Curtin <[email protected]>
>
> Is mise le meas/Regards,
>
> Eric Curtin
>
> > ---
> > drivers/perf/arm_pmu.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
> > index 9b593f985805..9cb22f36cf66 100644
> > --- a/drivers/perf/arm_pmu.c
> > +++ b/drivers/perf/arm_pmu.c
> > @@ -556,7 +556,7 @@ static bool armpmu_filter(struct pmu *pmu, int cpu)
> > if (ret && armpmu->filter)
> > return armpmu->filter(pmu, cpu);
> >
> > - return ret;
> > + return !ret;
> > }
> >
> > static ssize_t cpus_show(struct device *dev,
> >
> > ---
> > base-commit: ceaa837f96adb69c0df0397937cd74991d5d821a
> > change-id: 20230215-arm_pmu_m1_regression-b6dd48d0c792
> >
> > Best regards,
> > --
> > Janne Grunau <[email protected]>
> >
> >
On 15/02/2023 20.27, Janne Grunau wrote:
> Fixes a regression in "perf: Rewrite core context handling" for arm_pmu
> based drivers without a filter function pointer as the Apple M1 PMU.
> The event is ignored if filter() returns 'true' opposite to
> filter_match(). The refactoring failed to invert the return value if
> arm_pmu has no filter() function pointer of its own.
>
> Fixes: bd2756811766 ("perf: Rewrite core context handling")
> Signed-off-by: Janne Grunau <[email protected]>
> ---
> drivers/perf/arm_pmu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
> index 9b593f985805..9cb22f36cf66 100644
> --- a/drivers/perf/arm_pmu.c
> +++ b/drivers/perf/arm_pmu.c
> @@ -556,7 +556,7 @@ static bool armpmu_filter(struct pmu *pmu, int cpu)
> if (ret && armpmu->filter)
> return armpmu->filter(pmu, cpu);
>
> - return ret;
> + return !ret;
> }
>
> static ssize_t cpus_show(struct device *dev,
>
> ---
> base-commit: ceaa837f96adb69c0df0397937cd74991d5d821a
> change-id: 20230215-arm_pmu_m1_regression-b6dd48d0c792
>
> Best regards,
Tested-by: Asahi Lina <[email protected]>
This fixes `perf` being completely broken on 6.2. Adding a note to the
subject, I hope this can get picked up before release...
~~ Lina
Hi,
On Wed, Feb 15, 2023 at 12:27:13PM +0100, Janne Grunau wrote:
> Fixes a regression in "perf: Rewrite core context handling" for arm_pmu
> based drivers without a filter function pointer as the Apple M1 PMU.
> The event is ignored if filter() returns 'true' opposite to
> filter_match(). The refactoring failed to invert the return value if
> arm_pmu has no filter() function pointer of its own.
>
> Fixes: bd2756811766 ("perf: Rewrite core context handling")
> Signed-off-by: Janne Grunau <[email protected]>
Thanks for the report and the patch, and apologies for this happening in the
first place; this has clearly slipped by our testing...
I think this fix is correct, but I spot that bd2756811766 also broken CHAIN
event filtering, and made armv8pmu_filter() trivial, so we can get rid of
arm_pmu::filter() entirely and make this simpler and clearer.
I'm going to send a couple of patches to addres both those issues in a moment,
with everyone here on Cc.
Thanks,
Mark.
> ---
> drivers/perf/arm_pmu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
> index 9b593f985805..9cb22f36cf66 100644
> --- a/drivers/perf/arm_pmu.c
> +++ b/drivers/perf/arm_pmu.c
> @@ -556,7 +556,7 @@ static bool armpmu_filter(struct pmu *pmu, int cpu)
> if (ret && armpmu->filter)
> return armpmu->filter(pmu, cpu);
>
> - return ret;
> + return !ret;
> }
>
> static ssize_t cpus_show(struct device *dev,
>
> ---
> base-commit: ceaa837f96adb69c0df0397937cd74991d5d821a
> change-id: 20230215-arm_pmu_m1_regression-b6dd48d0c792
>
> Best regards,
> --
> Janne Grunau <[email protected]>
>