From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 08/11] drivers: perf: hisi: use poll method to avoid L3C counter overflow
Date: Fri, 24 Mar 2017 11:43:25 +0000 [thread overview]
Message-ID: <20170324114325.GC22771@leverpostej> (raw)
In-Reply-To: <58D4C006.2010907@gmail.com>
On Fri, Mar 24, 2017 at 12:13:18PM +0530, Anurup M wrote:
> On Tuesday 21 March 2017 10:46 PM, Mark Rutland wrote:
> >On Fri, Mar 10, 2017 at 01:28:45AM -0500, Anurup M wrote:
> >>+/* The counter overflow IRQ is not supported for some PMUs
> >>+ * use hrtimer to periodically poll and avoid overflow
> >>+ */
> >>+static enum hrtimer_restart hisi_hrtimer_callback(struct hrtimer *hrtimer)
> >>+{
> >>+ struct hisi_pmu *hisi_pmu = container_of(hrtimer,
> >>+ struct hisi_pmu, hrtimer);
> >>+ struct perf_event *event;
> >>+ struct hw_perf_event *hwc;
> >>+ unsigned long flags;
> >>+
> >>+ /* Return if no active events */
> >>+ if (!hisi_pmu->num_active)
> >>+ return HRTIMER_NORESTART;
> >>+
> >>+ local_irq_save(flags);
> >>+
> >>+ /* Update event count for each active event */
> >>+ list_for_each_entry(event, &hisi_pmu->active_list, active_entry) {
> >>+ hwc = &event->hw;
> >>+ /* Read hardware counter and update the Perf event counter */
> >>+ hisi_pmu->ops->event_update(event, hwc, GET_CNTR_IDX(hwc));
> >>+ }
> >How do we ensure that we don't take the interrupt in the middle of a
> >sequence of accesses to the HW?
>
> The L3 cache and MN PMU does not use the overflow IRQ and it does
> not occur here
> as the interrupt Mask register is by default masked in hardware.
I was referring to the timer interrupt which backs the hrtimer.
i.e. how do we guarantee that hisi_hrtimer_callback() is not called
while we are in the middle of a RMW sequence? Are interrupts disabled
for all of those seqeunces?
Thanks,
Mark.
WARNING: multiple messages have this Message-ID (diff)
From: Mark Rutland <mark.rutland@arm.com>
To: Anurup M <anurupvasu@gmail.com>
Cc: will.deacon@arm.com, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, anurup.m@huawei.com,
zhangshaokun@hisilicon.com, tanxiaojun@huawei.com,
xuwei5@hisilicon.com, sanil.kumar@hisilicon.com,
john.garry@huawei.com, gabriele.paoloni@huawei.com,
shiju.jose@huawei.com, huangdaode@hisilicon.com,
linuxarm@huawei.com, dikshit.n@huawei.com, shyju.pv@huawei.com
Subject: Re: [PATCH v6 08/11] drivers: perf: hisi: use poll method to avoid L3C counter overflow
Date: Fri, 24 Mar 2017 11:43:25 +0000 [thread overview]
Message-ID: <20170324114325.GC22771@leverpostej> (raw)
In-Reply-To: <58D4C006.2010907@gmail.com>
On Fri, Mar 24, 2017 at 12:13:18PM +0530, Anurup M wrote:
> On Tuesday 21 March 2017 10:46 PM, Mark Rutland wrote:
> >On Fri, Mar 10, 2017 at 01:28:45AM -0500, Anurup M wrote:
> >>+/* The counter overflow IRQ is not supported for some PMUs
> >>+ * use hrtimer to periodically poll and avoid overflow
> >>+ */
> >>+static enum hrtimer_restart hisi_hrtimer_callback(struct hrtimer *hrtimer)
> >>+{
> >>+ struct hisi_pmu *hisi_pmu = container_of(hrtimer,
> >>+ struct hisi_pmu, hrtimer);
> >>+ struct perf_event *event;
> >>+ struct hw_perf_event *hwc;
> >>+ unsigned long flags;
> >>+
> >>+ /* Return if no active events */
> >>+ if (!hisi_pmu->num_active)
> >>+ return HRTIMER_NORESTART;
> >>+
> >>+ local_irq_save(flags);
> >>+
> >>+ /* Update event count for each active event */
> >>+ list_for_each_entry(event, &hisi_pmu->active_list, active_entry) {
> >>+ hwc = &event->hw;
> >>+ /* Read hardware counter and update the Perf event counter */
> >>+ hisi_pmu->ops->event_update(event, hwc, GET_CNTR_IDX(hwc));
> >>+ }
> >How do we ensure that we don't take the interrupt in the middle of a
> >sequence of accesses to the HW?
>
> The L3 cache and MN PMU does not use the overflow IRQ and it does
> not occur here
> as the interrupt Mask register is by default masked in hardware.
I was referring to the timer interrupt which backs the hrtimer.
i.e. how do we guarantee that hisi_hrtimer_callback() is not called
while we are in the middle of a RMW sequence? Are interrupts disabled
for all of those seqeunces?
Thanks,
Mark.
next prev parent reply other threads:[~2017-03-24 11:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-10 6:28 [PATCH v6 08/11] drivers: perf: hisi: use poll method to avoid L3C counter overflow Anurup M
2017-03-10 6:28 ` Anurup M
2017-03-21 17:16 ` Mark Rutland
2017-03-21 17:16 ` Mark Rutland
2017-03-24 6:43 ` Anurup M
2017-03-24 6:43 ` Anurup M
2017-03-24 11:43 ` Mark Rutland [this message]
2017-03-24 11:43 ` Mark Rutland
2017-03-27 6:33 ` Anurup M
2017-03-27 6:33 ` Anurup M
2017-03-28 11:09 ` Mark Rutland
2017-03-28 11:09 ` Mark Rutland
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=20170324114325.GC22771@leverpostej \
--to=mark.rutland@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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.