All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Amir Ayupov" <aaupov@fb.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v3 5/7] perf: arm_pmuv3: Add pmuv3_event_implemented()
Date: Sun, 25 Oct 2026 06:47:54 +0000	[thread overview]
Message-ID: <sashiko-outbox-184102@kernel.org> (raw)
In-Reply-To: <cd3e622681f7254216b0488f09d2cb2d91a2d8ca.1792907333.git.aaupov@fb.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] perf: arm_pmuv3: circular header inclusion in pmuv3_event_implemented()
--

commit fe846ad9d18510169af8401fb7c59990c15ea903
Author: Amir Ayupov <aaupov@fb.com>

perf: arm_pmuv3: Add pmuv3_event_implemented()

This commit adds pmuv3_event_implemented() to include/linux/perf/arm_pmuv3.h
to allow drivers outside the PMU driver to check whether the local CPU's PMU
implements a common event via PMCEID0/1, and moves
ARMV8_PMUV3_EXT_COMMON_EVENT_BASE into include/linux/perf/arm_pmuv3.h.

> diff --git a/include/linux/perf/arm_pmuv3.h b/include/linux/perf/arm_pmuv3.h
> index d698efba28a27..965c40b28dd77 100644
> --- a/include/linux/perf/arm_pmuv3.h
> +++ b/include/linux/perf/arm_pmuv3.h

[ ... ]

> @@ -315,4 +318,23 @@
>  
>  #include <asm/arm_pmuv3.h>
>  
> +/*
> + * Whether this CPU's PMU implements a common event, as reported by
> + * PMCEID{0,1}: events 0x0000-0x003f in bits [31:0], and from PMUv3p1 events
> + * 0x4000-0x403f in bits [63:32], which read as zero before PMUv3p1.
> + * Must run on the CPU whose PMU is queried.
> + */
> +static inline bool pmuv3_event_implemented(u16 event)
> +{
> +	bool ext = event >= ARMV8_PMUV3_EXT_COMMON_EVENT_BASE;
> +	u16 id = ext ? event - ARMV8_PMUV3_EXT_COMMON_EVENT_BASE : event;
> +	u64 pmceid;
> +
> +	if (id >= 64 || !pmuv3_implemented(read_pmuver()))
> +		return false;
> +
> +	pmceid = id < 32 ? read_pmceid0() : read_pmceid1();
> +	return pmceid & BIT_ULL(id % 32 + (ext ? 32 : 0));
> +}

[Severity: Low]
Does defining pmuv3_event_implemented() here break arm64 builds due to a
circular header dependency when a translation unit includes
<asm/arm_pmuv3.h> before <asm/kvm_host.h> or <linux/perf/arm_pmuv3.h>?

For example, arch/arm64/kernel/cpufeature.c includes <asm/arm_pmuv3.h>
first:

    #include <asm/arm_pmuv3.h>
    #include <asm/cpu.h>
    #include <asm/cpufeature.h>
    #include <asm/cpu_ops.h>
    #include <asm/fpsimd.h>
    #include <asm/hwcap.h>
    #include <asm/insn.h>
    #include <asm/kvm_host.h>

In arch/arm64/include/asm/arm_pmuv3.h, the header guard __ASM_PMUV3_H is
defined and <asm/kvm_host.h> is included at the top before read_pmuver(),
read_pmceid0(), read_pmceid1(), and pmuv3_implemented() are defined:

    #ifndef __ASM_PMUV3_H
    #define __ASM_PMUV3_H

    #include <asm/kvm_host.h>

That triggers the inclusion chain:

    arch/arm64/include/asm/arm_pmuv3.h
      -> arch/arm64/include/asm/kvm_host.h
        -> include/kvm/arm_pmu.h
          -> include/linux/perf/arm_pmuv3.h

When include/linux/perf/arm_pmuv3.h reaches #include <asm/arm_pmuv3.h>, it
is skipped because __ASM_PMUV3_H is already defined, so
pmuv3_event_implemented() is compiled before pmuv3_implemented(),
read_pmuver(), read_pmceid0(), and read_pmceid1() have been declared.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1792907332.git.aaupov@fb.com?part=5

  reply	other threads:[~2026-10-25  6:47 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12 23:05 [PATCH v2 0/4] coresight: Pulse an ETM external output for a PMU event Amir Ayupov
2026-10-12 23:05 ` [PATCH v2 1/4] coresight: syscfg: Fail to enable a configuration not loaded on the device Amir Ayupov
2026-10-21 14:09   ` Leo Yan
2026-10-12 23:05 ` [PATCH v2 2/4] coresight: syscfg: Match feature capabilities separately from device class Amir Ayupov
2026-10-21 14:39   ` Leo Yan
2026-10-25  6:21     ` Amir Ayupov
2026-10-27 11:21     ` Suzuki K Poulose
2026-10-12 23:05 ` [PATCH v2 3/4] coresight: etm4x: Report the external outputs the PMU counts Amir Ayupov
2026-10-21 16:43   ` Leo Yan
2026-10-23  9:49     ` James Clark
2026-10-23 14:00       ` Leo Yan
2026-10-26  9:22         ` James Clark
2026-10-25  6:34     ` Amir Ayupov
2026-10-23  9:57   ` James Clark
2026-10-12 23:05 ` [PATCH v2 4/4] coresight: Add pmu_pulse/extout_pulse Amir Ayupov
2026-10-13  1:09   ` Daniel Pereira
2026-10-25  6:38     ` Amir Ayupov
2026-10-26  9:36       ` James Clark
2026-10-25  6:39 ` [PATCH v3 0/7] coresight: Pulse an ETM external output for a PMU event Amir Ayupov
2026-10-25  6:39   ` [PATCH v3 1/7] coresight: etm4x: Fix event count decoding Amir Ayupov
2026-10-25  6:45     ` sashiko-bot
2026-10-25  6:39   ` [PATCH v3 2/7] coresight: syscfg: Fail to enable a configuration not loaded on the device Amir Ayupov
2026-10-25  6:46     ` sashiko-bot
2026-10-25  6:39   ` [PATCH v3 3/7] coresight: syscfg: Match feature capabilities separately from device class Amir Ayupov
2026-10-25  6:44     ` sashiko-bot
2026-10-25  6:39   ` [PATCH v3 4/7] coresight: syscfg: Remove unused CS_CFG_MATCH_INST_ANY Amir Ayupov
2026-10-25  6:42     ` sashiko-bot
2026-10-25  6:39   ` [PATCH v3 5/7] perf: arm_pmuv3: Add pmuv3_event_implemented() Amir Ayupov
2026-10-25  6:47     ` sashiko-bot [this message]
2026-10-25 17:05     ` kernel test robot
2026-10-26  0:43     ` kernel test robot
2026-10-25  6:39   ` [PATCH v3 6/7] coresight: etm4x: Report whether the PMU counts the external outputs Amir Ayupov
2026-10-25  6:46     ` sashiko-bot
2026-10-25  6:39   ` [PATCH v3 7/7] coresight: Add pmu_pulse/extout_pulse Amir Ayupov
2026-10-25  6:50     ` sashiko-bot
2026-10-26  5:48   ` [PATCH v4 0/7] coresight: Pulse an ETM external output for a PMU event Amir Ayupov
2026-10-26  5:48     ` [PATCH v4 1/7] coresight: etm4x: Fix event count decoding Amir Ayupov
2026-10-26  8:42       ` sashiko-bot
2026-10-26  9:37       ` James Clark
2026-10-26  5:48     ` [PATCH v4 2/7] coresight: syscfg: Fail to enable a configuration not loaded on the device Amir Ayupov
2026-10-26  8:48       ` sashiko-bot
2026-10-26  5:48     ` [PATCH v4 3/7] coresight: syscfg: Match feature capabilities separately from device class Amir Ayupov
2026-10-26  8:49       ` sashiko-bot
2026-10-26  9:45       ` James Clark
2026-10-26  5:48     ` [PATCH v4 4/7] coresight: syscfg: Remove unused CS_CFG_MATCH_INST_ANY Amir Ayupov
2026-10-26  8:41       ` sashiko-bot
2026-10-26  9:45       ` James Clark
2026-10-26  5:48     ` [PATCH v4 5/7] perf: arm_pmuv3: Add pmuv3_event_implemented() Amir Ayupov
2026-10-26  8:45       ` sashiko-bot
2026-10-26  9:47       ` James Clark
2026-10-26  5:48     ` [PATCH v4 6/7] coresight: etm4x: Report whether the PMU counts the external outputs Amir Ayupov
2026-10-26  8:48       ` sashiko-bot
2026-10-26  9:49       ` James Clark
2026-10-26  5:48     ` [PATCH v4 7/7] coresight: Add pmu_pulse/extout_pulse Amir Ayupov
2026-10-26  8:50       ` sashiko-bot
2026-10-26  9:50       ` James Clark

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=sashiko-outbox-184102@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=aaupov@fb.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.