linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Rich Felker <dalias@libc.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-sh@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Marc Zyngier <Marc.Zyngier@arm.com>
Subject: Re: [PATCH v6 2/2] clocksource: add J-Core timer/clocksource driver
Date: Thu, 25 Aug 2016 17:41:29 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1608251727410.5714@nanos> (raw)
In-Reply-To: <20160825145650.GA15995@brightrain.aerifal.cx>

On Thu, 25 Aug 2016, Rich Felker wrote:
> assumption that is was just a bug. Now that Mark Rutland has explained
> it well (and with your additional explanation below in your email), I
> see what the motivation was, but I still think it could be done in a
> less-confusing and more-consistent way that doesn't assume ARM-like
> irq architecture.

It's not only ARM. Some MIPS Octeon stuff has the same layout and requirements
to use a single irq number for interrupts which are delivered on a per cpu
basis.

Patches are welcome :)
 
> > If your particular hardware has the old scheme of seperate interrupt numbers
> > for per cpu interrupts, then you can simply use the normal interrupt scheme
> > and request a seperate interrupt per cpu.
> 
> Nominally it uses the same range of hardware interrupt numbers for all
> (presently both) cpus, but some of them get delivered to a specific
> cpu associated with the event (presently, IPI and timer; IPI is on a
> fixed number at synthesis time but timer is runtime configurable)
> while others are conceptually deliverable to either cpu (presently
> only delivered to cpu0, but that's treated as an implementation
> detail).

If I understand correctly, then this is the classic scheme:

   CPU0		IPI0	   IRQ-N
   CPU1		IPI1	   IRQ-M

These and the timers or whatever are strict per cpu and therefor not routable.
Regular device interrupts can be routed to any CPU by setting the
affinity. Correct?

> It currently works requesting the irq with flags that ensure the
> handler runs on the same cpu it was delivered on, without using any
> other percpu irq framework.

Which special flag are you referring to? I'm not aware of one.

IRQF_PER_CPU is just telling the core that this is a non routable per cpu
interrupt. It's excluded from affinity setting and also on cpu hot unplug the
per cpu interrupts are not touched and nothing tries to reroute them to one of
the still online cpus.

Regarding the interrupt handler. It runs on the CPU on which the interrupt is
delivered and there is nothing you can influence with a flag.

> If you have concerns about ways this could break and want me to make the
> drivers do something else, I'm open to suggestions.

If I understand the hardware halfways right, then using request_irq() with
IRQF_PER_CPU for these special interrupts is completely correct.

The handler either uses this_cpu_xxx() for accessing the per cpu data related
to the interrupt or you can hand in a percpu pointer as dev_id to
request_irq() which then is handed to the interrupt function as a cookie.

Hope that helps.

Thanks,

	tglx

  reply	other threads:[~2016-08-25 15:43 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-04  4:30 [PATCH v6 0/2] J-Core timer support Rich Felker
2016-08-04  4:30 ` [PATCH v6 1/2] of: add J-Core timer bindings Rich Felker
2016-08-04 18:16   ` Rob Herring
2016-08-04  4:30 ` [PATCH v6 2/2] clocksource: add J-Core timer/clocksource driver Rich Felker
2016-08-04  8:24   ` Alexnader Kuleshov
2016-08-04 19:42     ` Rich Felker
2016-08-24 16:42   ` Daniel Lezcano
2016-08-24 17:40     ` Rich Felker
2016-08-24 19:01       ` Marc Zyngier
2016-08-24 19:20         ` Rich Felker
2016-08-24 22:21           ` Mark Rutland
2016-08-24 20:01       ` Arnd Bergmann
2016-08-24 20:52         ` Rich Felker
2016-08-24 21:22           ` Mark Rutland
2016-08-24 21:44             ` Rich Felker
2016-08-24 21:57               ` Arnd Bergmann
2016-08-25 10:23                 ` Arnd Bergmann
2016-08-24 22:54               ` Mark Rutland
2016-08-25  8:07       ` Thomas Gleixner
2016-08-25 14:56         ` Rich Felker
2016-08-25 15:41           ` Thomas Gleixner [this message]
2016-08-25 17:45             ` Rich Felker
2016-08-25 16:38           ` Mark Rutland
2016-08-25 17:51             ` Rich Felker
2016-08-25 18:21               ` Mark Rutland
2016-08-25 19:20                 ` Rich Felker
2016-08-26  9:04       ` Daniel Lezcano
  -- strict thread matches above, loose matches on Subject: below --
2016-08-03  0:18 [PATCH v6 0/2] J-Core timer support Rich Felker
2016-03-17 23:12 ` [PATCH v6 2/2] clocksource: add J-Core timer/clocksource driver Rich Felker

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=alpine.DEB.2.20.1608251727410.5714@nanos \
    --to=tglx@linutronix.de \
    --cc=Marc.Zyngier@arm.com \
    --cc=dalias@libc.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.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 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).