[PATCH v2 5/5] perf: Record sample last_period before updating

Leo Yan leo.yan at arm.com
Tue Jan 21 09:22:02 PST 2025


On Mon, Jan 06, 2025 at 12:01:56PM +0000, mark.barnett at arm.com wrote:
> From: Mark Barnett <mark.barnett at arm.com>
> 
> This change alters the PowerPC and x86 driver implementations to record
> the last sample period before the event is updated for the next period.
> 
> A common pattern in PMU driver implementations is to have a
> "*_event_set_period" function which takes care of updating the various
> period-related fields in a perf_event structure. In most cases, the
> drivers choose to call this function after initializing a sample data
> structure with perf_sample_data_init. The x86 and PowerPC drivers
> deviate from this, choosing to update the period before initializing the
> sample data. When using an event with an alternate sample period, this
> causes an incorrect period to be written to the sample data that gets
> reported to userspace.

I found conflict when I applied this patch on linux-next [1], with the
commit below:

commit faac6f105ef169e2e5678c14e1ffebf2a7d780b6
Author: Yabin Cui <yabinc at google.com>
Date:   Wed May 15 12:36:09 2024 -0700

    perf/core: Check sample_type in perf_sample_save_brstack

    Check sample_type in perf_sample_save_brstack() to prevent
    saving branch stack data when it isn't required.

    Suggested-by: Namhyung Kim <namhyung at kernel.org>
    Signed-off-by: Yabin Cui <yabinc at google.com>
    Signed-off-by: Ingo Molnar <mingo at kernel.org>
    Reviewed-by: Ian Rogers <irogers at google.com>
    Acked-by: Namhyung Kim <namhyung at kernel.org>
    Link: https://lore.kernel.org/r/20240515193610.2350456-4-yabinc@google.com


Please consider to rebase the patch to fix conflict in next spin.

Thanks,
Leo

[1] git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git



More information about the linux-arm-kernel mailing list