All of lore.kernel.org
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 3/4] perf: xgene: Add APM X-Gene SoC Performance Monitoring Unit driver
Date: Tue, 28 Jun 2016 17:59:41 +0100	[thread overview]
Message-ID: <20160628165941.GS31744@leverpostej> (raw)
In-Reply-To: <CACgAJHzNe68wDxkk5Uc8M8vHsjL5XoppmPys=37LqBWR5m5zxw@mail.gmail.com>

On Tue, Jun 28, 2016 at 09:39:36AM -0700, Tai Tri Nguyen wrote:
> Hi Mark,
> 
> On Tue, Jun 28, 2016 at 7:14 AM, Mark Rutland <mark.rutland@arm.com> wrote:
> > On Tue, Jun 28, 2016 at 02:21:38PM +0100, Marc Zyngier wrote:
> >> On 28/06/16 12:13, Mark Rutland wrote:
> >> > Marc, is there a sensible way to prevent irq balancers from changing the
> >> > affinity of an IRQ, e.g. a kernel-side pinning mechanism, or some way we
> >> > can be notified and reject changes?
> >>
> >> You can get notified (see irq_set_affinity_notifier), but there no way
> >> to veto the change.
> >
> > :(
> >
> >> What should probably be done is to set the affinity hint
> >> (irq_set_affinity_hint), and use the notifier to migrate the context
> >> if possible. Note that you'll be called in process context, which will
> >> race against interrupts being delivered on the new CPU.
> >
> > I'll have to go digging into what exactly perf_pmu_migrate_context
> > requires. Given the race, I'm not sure if that's going to work. It's
> > certainly not going to be self contained.
> >
> > That also won't work for CPU PMUs, where it makes no sense to migrate
> > context or IRQs.  For those we appear to already be using have
> > IRQF_NOBALANCING, which sounds like exactly what we want.
> >
> > That appears to influence irq_can_set_affinity(), which the procfs
> > helpers check.
> >
> > Tai, can you try requesting the IRQ with the IRQF_NOBALANCING flag?
> 
> This seems to work.
> I also tried to change smp_affinity through procfs and it returns write error.
> The interrupt seems to be excluded from irq balancing.
> Should I make the change?

Yes please. I believe you also need IRQF_NO_THREAD per the CPU PMU
drivers, so please add both flags. I'll do the same for the CCN and CCI
PMU drivers.

Thanks,
Mark.

WARNING: multiple messages have this Message-ID (diff)
From: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
To: Tai Tri Nguyen <ttnguyen-qTEPVZfXA3Y@public.gmane.org>
Cc: Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>,
	Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>,
	catalin.marinas-5wv7dgnIgG8@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	patches <patches-qTEPVZfXA3Y@public.gmane.org>
Subject: Re: [PATCH v4 3/4] perf: xgene: Add APM X-Gene SoC Performance Monitoring Unit driver
Date: Tue, 28 Jun 2016 17:59:41 +0100	[thread overview]
Message-ID: <20160628165941.GS31744@leverpostej> (raw)
In-Reply-To: <CACgAJHzNe68wDxkk5Uc8M8vHsjL5XoppmPys=37LqBWR5m5zxw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Tue, Jun 28, 2016 at 09:39:36AM -0700, Tai Tri Nguyen wrote:
> Hi Mark,
> 
> On Tue, Jun 28, 2016 at 7:14 AM, Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org> wrote:
> > On Tue, Jun 28, 2016 at 02:21:38PM +0100, Marc Zyngier wrote:
> >> On 28/06/16 12:13, Mark Rutland wrote:
> >> > Marc, is there a sensible way to prevent irq balancers from changing the
> >> > affinity of an IRQ, e.g. a kernel-side pinning mechanism, or some way we
> >> > can be notified and reject changes?
> >>
> >> You can get notified (see irq_set_affinity_notifier), but there no way
> >> to veto the change.
> >
> > :(
> >
> >> What should probably be done is to set the affinity hint
> >> (irq_set_affinity_hint), and use the notifier to migrate the context
> >> if possible. Note that you'll be called in process context, which will
> >> race against interrupts being delivered on the new CPU.
> >
> > I'll have to go digging into what exactly perf_pmu_migrate_context
> > requires. Given the race, I'm not sure if that's going to work. It's
> > certainly not going to be self contained.
> >
> > That also won't work for CPU PMUs, where it makes no sense to migrate
> > context or IRQs.  For those we appear to already be using have
> > IRQF_NOBALANCING, which sounds like exactly what we want.
> >
> > That appears to influence irq_can_set_affinity(), which the procfs
> > helpers check.
> >
> > Tai, can you try requesting the IRQ with the IRQF_NOBALANCING flag?
> 
> This seems to work.
> I also tried to change smp_affinity through procfs and it returns write error.
> The interrupt seems to be excluded from irq balancing.
> Should I make the change?

Yes please. I believe you also need IRQF_NO_THREAD per the CPU PMU
drivers, so please add both flags. I'll do the same for the CCN and CCI
PMU drivers.

Thanks,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Mark Rutland <mark.rutland@arm.com>
To: Tai Tri Nguyen <ttnguyen@apm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	catalin.marinas@arm.com, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	patches <patches@apm.com>
Subject: Re: [PATCH v4 3/4] perf: xgene: Add APM X-Gene SoC Performance Monitoring Unit driver
Date: Tue, 28 Jun 2016 17:59:41 +0100	[thread overview]
Message-ID: <20160628165941.GS31744@leverpostej> (raw)
In-Reply-To: <CACgAJHzNe68wDxkk5Uc8M8vHsjL5XoppmPys=37LqBWR5m5zxw@mail.gmail.com>

On Tue, Jun 28, 2016 at 09:39:36AM -0700, Tai Tri Nguyen wrote:
> Hi Mark,
> 
> On Tue, Jun 28, 2016 at 7:14 AM, Mark Rutland <mark.rutland@arm.com> wrote:
> > On Tue, Jun 28, 2016 at 02:21:38PM +0100, Marc Zyngier wrote:
> >> On 28/06/16 12:13, Mark Rutland wrote:
> >> > Marc, is there a sensible way to prevent irq balancers from changing the
> >> > affinity of an IRQ, e.g. a kernel-side pinning mechanism, or some way we
> >> > can be notified and reject changes?
> >>
> >> You can get notified (see irq_set_affinity_notifier), but there no way
> >> to veto the change.
> >
> > :(
> >
> >> What should probably be done is to set the affinity hint
> >> (irq_set_affinity_hint), and use the notifier to migrate the context
> >> if possible. Note that you'll be called in process context, which will
> >> race against interrupts being delivered on the new CPU.
> >
> > I'll have to go digging into what exactly perf_pmu_migrate_context
> > requires. Given the race, I'm not sure if that's going to work. It's
> > certainly not going to be self contained.
> >
> > That also won't work for CPU PMUs, where it makes no sense to migrate
> > context or IRQs.  For those we appear to already be using have
> > IRQF_NOBALANCING, which sounds like exactly what we want.
> >
> > That appears to influence irq_can_set_affinity(), which the procfs
> > helpers check.
> >
> > Tai, can you try requesting the IRQ with the IRQF_NOBALANCING flag?
> 
> This seems to work.
> I also tried to change smp_affinity through procfs and it returns write error.
> The interrupt seems to be excluded from irq balancing.
> Should I make the change?

Yes please. I believe you also need IRQF_NO_THREAD per the CPU PMU
drivers, so please add both flags. I'll do the same for the CCN and CCI
PMU drivers.

Thanks,
Mark.

  reply	other threads:[~2016-06-28 16:59 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-22 18:06 [PATCH v4 0/4] perf: Add APM X-Gene SoC Performance Monitoring Unit driver Tai Nguyen
2016-06-22 18:06 ` Tai Nguyen
2016-06-22 18:06 ` Tai Nguyen
2016-06-22 18:06 ` [PATCH v4 1/4] MAINTAINERS: Add entry for APM X-Gene SoC PMU driver Tai Nguyen
2016-06-22 18:06   ` Tai Nguyen
2016-06-22 18:06 ` [PATCH v4 2/4] Documentation: Add documentation for APM X-Gene SoC PMU DTS binding Tai Nguyen
2016-06-22 18:06   ` Tai Nguyen
2016-06-22 18:06 ` [PATCH v4 3/4] perf: xgene: Add APM X-Gene SoC Performance Monitoring Unit driver Tai Nguyen
2016-06-22 18:06   ` Tai Nguyen
2016-06-23 14:32   ` Mark Rutland
2016-06-23 14:32     ` Mark Rutland
2016-06-25 17:54     ` Tai Tri Nguyen
2016-06-25 17:54       ` Tai Tri Nguyen
2016-06-27 16:00       ` Mark Rutland
2016-06-27 16:00         ` Mark Rutland
2016-06-27 16:00         ` Mark Rutland
2016-06-27 17:54         ` Tai Tri Nguyen
2016-06-27 17:54           ` Tai Tri Nguyen
2016-06-28 11:13           ` Mark Rutland
2016-06-28 11:13             ` Mark Rutland
2016-06-28 11:13             ` Mark Rutland
2016-06-28 13:21             ` Marc Zyngier
2016-06-28 13:21               ` Marc Zyngier
2016-06-28 13:21               ` Marc Zyngier
2016-06-28 14:14               ` Mark Rutland
2016-06-28 14:14                 ` Mark Rutland
2016-06-28 16:39                 ` Tai Tri Nguyen
2016-06-28 16:39                   ` Tai Tri Nguyen
2016-06-28 16:39                   ` Tai Tri Nguyen
2016-06-28 16:59                   ` Mark Rutland [this message]
2016-06-28 16:59                     ` Mark Rutland
2016-06-28 16:59                     ` Mark Rutland
2016-06-28 18:05                     ` Tai Tri Nguyen
2016-06-28 18:05                       ` Tai Tri Nguyen
2016-06-28 18:05                       ` Tai Tri Nguyen
2016-06-22 18:06 ` [PATCH v4 4/4] arm64: dts: apm: Add APM X-Gene SoC PMU DTS entries Tai Nguyen
2016-06-22 18:06   ` Tai Nguyen

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=20160628165941.GS31744@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.