All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Suzuki K Poulose <Suzuki.Poulose@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, will.deacon@arm.com,
	robin.murphy@arm.com
Subject: Re: [PATCH v2 5/5] arm64: perf: Add support for chaining event counters
Date: Mon, 11 Jun 2018 15:24:32 +0100	[thread overview]
Message-ID: <20180611142431.4svc26y27scgzfcg@lakrids.cambridge.arm.com> (raw)
In-Reply-To: <847dfe5c-665c-6398-f87f-3ca56e73f5aa@arm.com>

On Mon, Jun 11, 2018 at 02:54:16PM +0100, Suzuki K Poulose wrote:
> On 08/06/18 15:46, Suzuki K Poulose wrote:
> > On 06/06/2018 07:01 PM, Mark Rutland wrote:
> > > On Tue, May 29, 2018 at 11:55:56AM +0100, Suzuki K Poulose wrote:
> 
> > > > -        value |= 0xffffffff00000000ULL;
> > > > +        if (!armv8pmu_event_is_64bit(event))
> > > > +            value |= 0xffffffff00000000ULL;
> > > >           write_sysreg(value, pmccntr_el0);
> > > > -    } else if (armv8pmu_select_counter(idx) == idx)
> > > > -        write_sysreg(value, pmxevcntr_el0);
> > > > +    } else
> > > > +        armv8pmu_write_hw_counter(event, value);
> > > >   }
> > > 
> > > > +static inline void armv8pmu_write_event_type(struct perf_event *event)
> > > > +{
> > > > +    struct hw_perf_event *hwc = &event->hw;
> > > > +    int idx = hwc->idx;
> > > > +
> > > > +    /*
> > > > +     * For chained events, write the the low counter event type
> > > > +     * followed by the high counter. The high counter is programmed
> > > > +     * with CHAIN event code with filters set to count at all ELs.
> > > > +     */
> > > > +    if (armv8pmu_event_is_chained(event)) {
> > > > +        u32 chain_evt = ARMV8_PMUV3_PERFCTR_CHAIN |
> > > > +                ARMV8_PMU_INCLUDE_EL2;
> > > > +
> > > > +        armv8pmu_write_evtype(idx - 1, hwc->config_base);
> > > > +        isb();
> > > > +        armv8pmu_write_evtype(idx, chain_evt);
> > > 
> > > The ISB isn't necessary here, AFAICT. We only do this while the PMU is
> > > disabled; no?
> > 
> > You're right. I was just following the ARM ARM.
> 
> Taking another look, it is not clear about the semantics of "pmu->enable()"
> and pmu->disable() callbacks. 

I was talking about pmu::{pmu_disable,pmu_enable}(), so I'm not sure I
follow how arm_pmu::{enable,disable}() are relevant here.

The arm_pmu::{enable,disable}() callbacks enable or disable individual
counters. For example, leaving unused counters disabled may save power,
even if the PMU as a whole is enabled.

> I don't see any reference to them in the perf core
> driver anymore. The perf core uses add() / del () instead, with the PMU
> turned off. Do you have any idea about the enable()/disable() callbacks ?

I'm not sure I understand what you're asking here.

Thanks,
Mark.

WARNING: multiple messages have this Message-ID (diff)
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 5/5] arm64: perf: Add support for chaining event counters
Date: Mon, 11 Jun 2018 15:24:32 +0100	[thread overview]
Message-ID: <20180611142431.4svc26y27scgzfcg@lakrids.cambridge.arm.com> (raw)
In-Reply-To: <847dfe5c-665c-6398-f87f-3ca56e73f5aa@arm.com>

On Mon, Jun 11, 2018 at 02:54:16PM +0100, Suzuki K Poulose wrote:
> On 08/06/18 15:46, Suzuki K Poulose wrote:
> > On 06/06/2018 07:01 PM, Mark Rutland wrote:
> > > On Tue, May 29, 2018 at 11:55:56AM +0100, Suzuki K Poulose wrote:
> 
> > > > -??????? value |= 0xffffffff00000000ULL;
> > > > +??????? if (!armv8pmu_event_is_64bit(event))
> > > > +??????????? value |= 0xffffffff00000000ULL;
> > > > ????????? write_sysreg(value, pmccntr_el0);
> > > > -??? } else if (armv8pmu_select_counter(idx) == idx)
> > > > -??????? write_sysreg(value, pmxevcntr_el0);
> > > > +??? } else
> > > > +??????? armv8pmu_write_hw_counter(event, value);
> > > > ? }
> > > 
> > > > +static inline void armv8pmu_write_event_type(struct perf_event *event)
> > > > +{
> > > > +??? struct hw_perf_event *hwc = &event->hw;
> > > > +??? int idx = hwc->idx;
> > > > +
> > > > +??? /*
> > > > +???? * For chained events, write the the low counter event type
> > > > +???? * followed by the high counter. The high counter is programmed
> > > > +???? * with CHAIN event code with filters set to count at all ELs.
> > > > +???? */
> > > > +??? if (armv8pmu_event_is_chained(event)) {
> > > > +??????? u32 chain_evt = ARMV8_PMUV3_PERFCTR_CHAIN |
> > > > +??????????????? ARMV8_PMU_INCLUDE_EL2;
> > > > +
> > > > +??????? armv8pmu_write_evtype(idx - 1, hwc->config_base);
> > > > +??????? isb();
> > > > +??????? armv8pmu_write_evtype(idx, chain_evt);
> > > 
> > > The ISB isn't necessary here, AFAICT. We only do this while the PMU is
> > > disabled; no?
> > 
> > You're right. I was just following the ARM ARM.
> 
> Taking another look, it is not clear about the semantics of "pmu->enable()"
> and pmu->disable() callbacks. 

I was talking about pmu::{pmu_disable,pmu_enable}(), so I'm not sure I
follow how arm_pmu::{enable,disable}() are relevant here.

The arm_pmu::{enable,disable}() callbacks enable or disable individual
counters. For example, leaving unused counters disabled may save power,
even if the PMU as a whole is enabled.

> I don't see any reference to them in the perf core
> driver anymore. The perf core uses add() / del () instead, with the PMU
> turned off. Do you have any idea about the enable()/disable() callbacks ?

I'm not sure I understand what you're asking here.

Thanks,
Mark.

  reply	other threads:[~2018-06-11 14:25 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-29 10:55 [PATCH v2 0/5] arm64: perf: Support for chained counters Suzuki K Poulose
2018-05-29 10:55 ` Suzuki K Poulose
2018-05-29 10:55 ` [PATCH v2 1/5] arm_pmu: Clean up maximum period handling Suzuki K Poulose
2018-05-29 10:55   ` Suzuki K Poulose
2018-05-29 10:55 ` [PATCH v2 2/5] arm_pmu: Change API to support 64bit counter values Suzuki K Poulose
2018-05-29 10:55   ` Suzuki K Poulose
2018-05-29 10:55 ` [PATCH v2 3/5] arm_pmu: Add support for 64bit event counters Suzuki K Poulose
2018-05-29 10:55   ` Suzuki K Poulose
2018-06-06 16:48   ` Mark Rutland
2018-06-06 16:48     ` Mark Rutland
2018-06-07  7:34     ` Suzuki K Poulose
2018-06-07  7:34       ` Suzuki K Poulose
2018-05-29 10:55 ` [PATCH v2 4/5] arm_pmu: Tidy up clear_event_idx call backs Suzuki K Poulose
2018-05-29 10:55   ` Suzuki K Poulose
2018-05-29 10:55 ` [PATCH v2 5/5] arm64: perf: Add support for chaining event counters Suzuki K Poulose
2018-05-29 10:55   ` Suzuki K Poulose
2018-06-06 18:01   ` Mark Rutland
2018-06-06 18:01     ` Mark Rutland
2018-06-08 14:46     ` Suzuki K Poulose
2018-06-08 14:46       ` Suzuki K Poulose
2018-06-08 15:24       ` Mark Rutland
2018-06-08 15:24         ` Mark Rutland
2018-06-08 16:05         ` Suzuki K Poulose
2018-06-08 16:05           ` Suzuki K Poulose
2018-06-11 13:54       ` Suzuki K Poulose
2018-06-11 13:54         ` Suzuki K Poulose
2018-06-11 14:24         ` Mark Rutland [this message]
2018-06-11 14:24           ` Mark Rutland
2018-06-11 16:18           ` Suzuki K Poulose
2018-06-11 16:18             ` Suzuki K Poulose
2018-06-05 15:00 ` [PATCH v2 0/5] arm64: perf: Support for chained counters Julien Thierry
2018-06-05 15:00   ` Julien Thierry

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=20180611142431.4svc26y27scgzfcg@lakrids.cambridge.arm.com \
    --to=mark.rutland@arm.com \
    --cc=Suzuki.Poulose@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will.deacon@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 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.