kvmarm.lists.cs.columbia.edu archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Andrew Murray <andrew.murray@arm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v8 4/6] arm64: perf: extract chain helper into header
Date: Mon, 10 Jun 2019 12:39:08 +0100	[thread overview]
Message-ID: <20190610113908.GE15979@fuggles.cambridge.arm.com> (raw)
In-Reply-To: <20190522153019.18645-5-andrew.murray@arm.com>

On Wed, May 22, 2019 at 04:30:17PM +0100, Andrew Murray wrote:
> The ARMv8 Performance Monitors Extension includes an architectural
> event type named CHAIN which allows for chaining counters together.
> 
> Let's extract the test for this event into a header file such that
> other users, such as KVM (for PMU emulation) can make use of.
> 
> Signed-off-by: Andrew Murray <andrew.murray@arm.com>
> Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
>  arch/arm64/include/asm/perf_event.h | 5 +++++
>  arch/arm64/kernel/perf_event.c      | 2 +-
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/include/asm/perf_event.h b/arch/arm64/include/asm/perf_event.h
> index c593761ba61c..cd13f3fd1055 100644
> --- a/arch/arm64/include/asm/perf_event.h
> +++ b/arch/arm64/include/asm/perf_event.h
> @@ -219,6 +219,11 @@
>  #define ARMV8_PMU_USERENR_CR	(1 << 2) /* Cycle counter can be read at EL0 */
>  #define ARMV8_PMU_USERENR_ER	(1 << 3) /* Event counter can be read at EL0 */
>  
> +static inline bool armv8pmu_evtype_is_chain(u64 evtype)
> +{
> +	return (evtype == ARMV8_PMUV3_PERFCTR_CHAIN);
> +}
> +
>  #ifdef CONFIG_PERF_EVENTS
>  struct pt_regs;
>  extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
> diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
> index 314b1adedf06..265bd835a724 100644
> --- a/arch/arm64/kernel/perf_event.c
> +++ b/arch/arm64/kernel/perf_event.c
> @@ -879,7 +879,7 @@ static int armv8pmu_set_event_filter(struct hw_perf_event *event,
>  static int armv8pmu_filter_match(struct perf_event *event)
>  {
>  	unsigned long evtype = event->hw.config_base & ARMV8_PMU_EVTYPE_EVENT;
> -	return evtype != ARMV8_PMUV3_PERFCTR_CHAIN;
> +	return !armv8pmu_evtype_is_chain(evtype);

Acked-by: Will Deacon <will.deacon@arm.com>

Although if the definition of armv8pmu_evtype_is_chain() isn't going to
get any more complicated than a single evtype comparison, I'm not sure it's
worth this abstraction, to be honest.

Will
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

  reply	other threads:[~2019-06-10 11:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22 15:30 [PATCH v8 0/6] KVM: arm/arm64: add support for chained counters Andrew Murray
2019-05-22 15:30 ` [PATCH v8 1/6] KVM: arm/arm64: rename kvm_pmu_{enable/disable}_counter functions Andrew Murray
2019-05-22 15:30 ` [PATCH v8 2/6] KVM: arm/arm64: extract duplicated code to own function Andrew Murray
2019-05-22 15:30 ` [PATCH v8 3/6] KVM: arm/arm64: re-create event when setting counter value Andrew Murray
2019-05-22 15:30 ` [PATCH v8 4/6] arm64: perf: extract chain helper into header Andrew Murray
2019-06-10 11:39   ` Will Deacon [this message]
2019-05-22 15:30 ` [PATCH v8 5/6] KVM: arm/arm64: remove pmc->bitmask Andrew Murray
2019-05-22 16:07   ` Marc Zyngier
2019-05-22 16:26     ` Andrew Murray
2019-06-10 12:54       ` Suzuki K Poulose
2019-06-12 14:30         ` Andrew Murray
2019-05-22 15:30 ` [PATCH v8 6/6] KVM: arm/arm64: support chained PMU counters Andrew Murray
2019-06-10 10:21   ` Julien Thierry
2019-06-10 16:05   ` Suzuki K Poulose

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=20190610113908.GE15979@fuggles.cambridge.arm.com \
    --to=will.deacon@arm.com \
    --cc=andrew.murray@arm.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@arm.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).