From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
Jason Cooper <jason@lakedaemon.net>,
Peter Zijlstra <peterz@infradead.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
arcml <linux-snps-arc@lists.infradead.org>,
lkml <linux-kernel@vger.kernel.org>,
"maxime.ripard@free-electrons.com"
<maxime.ripard@free-electrons.com>
Subject: Re: percpu irq APIs and perf
Date: Fri, 11 Dec 2015 17:50:22 +0530 [thread overview]
Message-ID: <566ABF86.9030308@synopsys.com> (raw)
In-Reply-To: <566AB24C.3040407@arm.com>
Hi Marc,
On Friday 11 December 2015 04:53 PM, Marc Zyngier wrote:
> On Fri, 11 Dec 2015 05:26:02 +0000
>> I think we can make percpu irq API a bit easier to use.
>>
>> (1) First thing which request_percpu_irq() does is check for
>> irq_settings_is_per_cpu_devid(). Thus irq_set_percpu_devid() can be built into the
>> API itself eliding the need to set it apriori.
>
> I don't think we can. At least in the case I'm concerned about (GIC's
> PPIs), this is a hardware requirement. You cannot turn a global
> interrupt into a per-CPU one, nor the other way around.
Understood.
> We also have
> drivers (at least our PMUs) that do test the state of that interrupt
> (per-CPU or not) to find out how they should be requested.
But they call request_percpu_irq() only after determining that irq is percpu.
Otherwise they will call vanilla request_irq()
e.g. drivers/perf/arm/arc_pmu.c
Which means that request_percpu_irq() can safely assume that caller absolutely
wants percpu semantics and hence do equivalent of irq_set_percpu_devid()
internally - NO. I'm sure I'm missing something.
> I agree that the API is probably not the ideal one, but there is HW
> constraints that we cannot just ignore.
The API is pretty nice :-) there are these quirks which I want to avoid.
My naive'ity in this area of code fails me to see how the hardware constraint is
coming into play.
>> (2) It seems that disabling autoen by default for percpu irq makes sense as
>> evident from drivers/net/ethernet/marvell/mvneta.c where users want to control
>> this. However the comment there is misleading
>>
>> /* Even though the documentation says that request_percpu_irq
>> * doesn't enable the interrupts automatically, it actually
>> * does so on the local CPU.
>> *
>> * Make sure it's disabled.
>> */
>>
>> Either sme core code is clearing NOAUTOEN or calling enable_precpu_irq() making
>> request_percpu_irq() enable it.
>
> If that's the case, this is a bug. Nobody should enable that interrupt
> until the driver has chosen to do so.
Perhaps Maxim can shed more light as this seems to be his comment.
>> IMHO it makes more sense to make autoen explicit in the API.
>> Perhaps introduce a API flavour, which takes the autoen as arg.
>> It could take flags to make it more extensible / future safe but that will be an
>> overkill I think.
>
> But auto-enabling cannot be done from a single CPU. It can only be done
> from the core that is going to be delivered that interrupt. This
> requires access to registers that are simply not available to other CPUs.
I'm not talking about eliminating enable_percpu_irq() call from all cores and
still getting the auto-enable semantics. What I mean is doing the equivalent of
irq_set_status_flags(irq, IRQ_NOAUTOEN);
from within request_percpu_irq_xxx() based on an additional arg (vs. doing it
aprioiri outside).
OTOH, thinking a bit more abt this, I think the current semantics of auto-disable
w/o any arg is just fine. Most percpu irqs in general purpose drivers would want
the auto-disable anyways. Only for core irws such as timer / IPI etc do we want
auto-enable.
Thx,
-Vineet
next prev parent reply other threads:[~2015-12-11 12:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-10 9:25 percpu irq APIs and perf Vineet Gupta
2015-12-10 9:55 ` Marc Zyngier
2015-12-11 5:26 ` Vineet Gupta
2015-12-11 11:23 ` Marc Zyngier
2015-12-11 12:20 ` Vineet Gupta [this message]
2015-12-11 17:58 ` Marc Zyngier
2015-12-14 5:50 ` Vineet Gupta
2015-12-14 8:43 ` maxime.ripard
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=566ABF86.9030308@synopsys.com \
--to=vineet.gupta1@synopsys.com \
--cc=daniel.lezcano@linaro.org \
--cc=jason@lakedaemon.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=marc.zyngier@arm.com \
--cc=maxime.ripard@free-electrons.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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