* [PATCH] powerpc: mpic: minor optimization of ipi handler
@ 2007-10-19 18:51 Olof Johansson
2007-10-19 23:17 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 5+ messages in thread
From: Olof Johansson @ 2007-10-19 18:51 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev, jgarzik
Jeff Garzik pointed out that we don't actually have to lookup the mpic
instance since it's passed in as the interrupt handler data for IPIs.
Signed-off-by: Olof Johansson <olof@lixom.net>
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index e479388..6bf56f4 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -612,11 +612,10 @@ static inline void mpic_eoi(struct mpic *mpic)
}
#ifdef CONFIG_SMP
-static irqreturn_t mpic_ipi_action(int irq, void *dev_id)
+static irqreturn_t mpic_ipi_action(int irq, void *data)
{
- struct mpic *mpic;
+ struct mpic *mpic = data;
- mpic = mpic_find(irq, NULL);
smp_message_recv(mpic_irq_to_hw(irq) - mpic->ipi_vecs[0]);
return IRQ_HANDLED;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc: mpic: minor optimization of ipi handler
2007-10-19 18:51 [PATCH] powerpc: mpic: minor optimization of ipi handler Olof Johansson
@ 2007-10-19 23:17 ` Benjamin Herrenschmidt
2007-10-19 23:31 ` Olof Johansson
0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2007-10-19 23:17 UTC (permalink / raw)
To: Olof Johansson; +Cc: linuxppc-dev, paulus, jgarzik
On Fri, 2007-10-19 at 13:51 -0500, Olof Johansson wrote:
> Jeff Garzik pointed out that we don't actually have to lookup the mpic
> instance since it's passed in as the interrupt handler data for IPIs.
Note that's typically one of the annoying case where we use "irq"
for a good reasons, getting the way of Jeff attempt at removing
this argument.
I suppose a working approach would be to have 4 mpic IPI handlers...
Ben.
> Signed-off-by: Olof Johansson <olof@lixom.net>
>
> diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
> index e479388..6bf56f4 100644
> --- a/arch/powerpc/sysdev/mpic.c
> +++ b/arch/powerpc/sysdev/mpic.c
> @@ -612,11 +612,10 @@ static inline void mpic_eoi(struct mpic *mpic)
> }
>
> #ifdef CONFIG_SMP
> -static irqreturn_t mpic_ipi_action(int irq, void *dev_id)
> +static irqreturn_t mpic_ipi_action(int irq, void *data)
> {
> - struct mpic *mpic;
> + struct mpic *mpic = data;
>
> - mpic = mpic_find(irq, NULL);
> smp_message_recv(mpic_irq_to_hw(irq) - mpic->ipi_vecs[0]);
>
> return IRQ_HANDLED;
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc: mpic: minor optimization of ipi handler
2007-10-19 23:17 ` Benjamin Herrenschmidt
@ 2007-10-19 23:31 ` Olof Johansson
2007-10-19 23:49 ` Olof Johansson
0 siblings, 1 reply; 5+ messages in thread
From: Olof Johansson @ 2007-10-19 23:31 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, paulus, jgarzik
On Sat, Oct 20, 2007 at 09:17:39AM +1000, Benjamin Herrenschmidt wrote:
>
> On Fri, 2007-10-19 at 13:51 -0500, Olof Johansson wrote:
> > Jeff Garzik pointed out that we don't actually have to lookup the mpic
> > instance since it's passed in as the interrupt handler data for IPIs.
>
> Note that's typically one of the annoying case where we use "irq"
> for a good reasons, getting the way of Jeff attempt at removing
> this argument.
>
> I suppose a working approach would be to have 4 mpic IPI handlers...
We still need the _irq_, but we don't need to lookup the mpic based on it.
We knew the mpic pointer at irq setup time, and passed it in as the
argument to pass to the handler. Doing a second lookup is just extra
overhead, it should return the same controller:
void mpic_request_ipis(void)
{
struct mpic *mpic = mpic_primary;
int i, err;
static char *ipi_names[] = {
"IPI0 (call function)",
"IPI1 (reschedule)",
"IPI2 (unused)",
"IPI3 (debugger break)",
};
BUG_ON(mpic == NULL);
printk(KERN_INFO "mpic: requesting IPIs ... \n");
for (i = 0; i < 4; i++) {
unsigned int vipi = irq_create_mapping(mpic->irqhost,
mpic->ipi_vecs[0] + i);
if (vipi == NO_IRQ) {
printk(KERN_ERR "Failed to map IPI %d\n", i);
break;
}
err = request_irq(vipi, mpic_ipi_action,
IRQF_DISABLED|IRQF_PERCPU,
ipi_names[i], mpic);
if (err) {
printk(KERN_ERR "Request of irq %d for IPI %d failed\n",
vipi, i);
break;
}
}
}
-Olof
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc: mpic: minor optimization of ipi handler
2007-10-19 23:31 ` Olof Johansson
@ 2007-10-19 23:49 ` Olof Johansson
2007-10-20 1:23 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 5+ messages in thread
From: Olof Johansson @ 2007-10-19 23:49 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, paulus, jgarzik
Optimize MPIC IPIs, by passing in the IPI number as the argument to the
handler, since all we did was translate it back based on which mpic
the interrupt came though on (and that was always the primary mpic).
Signed-off-by: Olof Johansson <olof@lixom.net>
---
On Fri, Oct 19, 2007 at 06:31:34PM -0500, Olof Johansson wrote:
> On Sat, Oct 20, 2007 at 09:17:39AM +1000, Benjamin Herrenschmidt wrote:
> >
> > On Fri, 2007-10-19 at 13:51 -0500, Olof Johansson wrote:
> > > Jeff Garzik pointed out that we don't actually have to lookup the mpic
> > > instance since it's passed in as the interrupt handler data for IPIs.
> >
> > Note that's typically one of the annoying case where we use "irq"
> > for a good reasons, getting the way of Jeff attempt at removing
> > this argument.
> >
> > I suppose a working approach would be to have 4 mpic IPI handlers...
>
> We still need the _irq_, but we don't need to lookup the mpic based on it.
>
> We knew the mpic pointer at irq setup time, and passed it in as the
> argument to pass to the handler. Doing a second lookup is just extra
> overhead, it should return the same controller:
Oh, I see what you mean. You didn't make it easy to parse. :)
This should actually do the work.
-Olof
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index e479388..a8d7c68 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -614,10 +614,9 @@ static inline void mpic_eoi(struct mpic *mpic)
#ifdef CONFIG_SMP
static irqreturn_t mpic_ipi_action(int irq, void *data)
{
- struct mpic *mpic;
+ long ipi = (long)data;
- mpic = mpic_find(irq, NULL);
- smp_message_recv(mpic_irq_to_hw(irq) - mpic->ipi_vecs[0]);
+ smp_message_recv(ipi);
return IRQ_HANDLED;
}
@@ -1457,7 +1456,7 @@ unsigned int mpic_get_irq(void)
void mpic_request_ipis(void)
{
struct mpic *mpic = mpic_primary;
- int i, err;
+ long i, err;
static char *ipi_names[] = {
"IPI0 (call function)",
"IPI1 (reschedule)",
@@ -1472,14 +1471,14 @@ void mpic_request_ipis(void)
unsigned int vipi = irq_create_mapping(mpic->irqhost,
mpic->ipi_vecs[0] + i);
if (vipi == NO_IRQ) {
- printk(KERN_ERR "Failed to map IPI %d\n", i);
+ printk(KERN_ERR "Failed to map IPI %ld\n", i);
break;
}
err = request_irq(vipi, mpic_ipi_action,
IRQF_DISABLED|IRQF_PERCPU,
- ipi_names[i], mpic);
+ ipi_names[i], (void *)i);
if (err) {
- printk(KERN_ERR "Request of irq %d for IPI %d failed\n",
+ printk(KERN_ERR "Request of irq %d for IPI %ld failed\n",
vipi, i);
break;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc: mpic: minor optimization of ipi handler
2007-10-19 23:49 ` Olof Johansson
@ 2007-10-20 1:23 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2007-10-20 1:23 UTC (permalink / raw)
To: Olof Johansson; +Cc: linuxppc-dev, paulus, jgarzik
On Fri, 2007-10-19 at 18:49 -0500, Olof Johansson wrote:
> Optimize MPIC IPIs, by passing in the IPI number as the argument to the
> handler, since all we did was translate it back based on which mpic
> the interrupt came though on (and that was always the primary mpic).
>
>
> Signed-off-by: Olof Johansson <olof@lixom.net>
> Oh, I see what you mean. You didn't make it easy to parse. :)
>
> This should actually do the work.
>
> -Olof
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
> index e479388..a8d7c68 100644
> --- a/arch/powerpc/sysdev/mpic.c
> +++ b/arch/powerpc/sysdev/mpic.c
> @@ -614,10 +614,9 @@ static inline void mpic_eoi(struct mpic *mpic)
> #ifdef CONFIG_SMP
> static irqreturn_t mpic_ipi_action(int irq, void *data)
> {
> - struct mpic *mpic;
> + long ipi = (long)data;
>
> - mpic = mpic_find(irq, NULL);
> - smp_message_recv(mpic_irq_to_hw(irq) - mpic->ipi_vecs[0]);
> + smp_message_recv(ipi);
>
> return IRQ_HANDLED;
> }
> @@ -1457,7 +1456,7 @@ unsigned int mpic_get_irq(void)
> void mpic_request_ipis(void)
> {
> struct mpic *mpic = mpic_primary;
> - int i, err;
> + long i, err;
> static char *ipi_names[] = {
> "IPI0 (call function)",
> "IPI1 (reschedule)",
> @@ -1472,14 +1471,14 @@ void mpic_request_ipis(void)
> unsigned int vipi = irq_create_mapping(mpic->irqhost,
> mpic->ipi_vecs[0] + i);
> if (vipi == NO_IRQ) {
> - printk(KERN_ERR "Failed to map IPI %d\n", i);
> + printk(KERN_ERR "Failed to map IPI %ld\n", i);
> break;
> }
> err = request_irq(vipi, mpic_ipi_action,
> IRQF_DISABLED|IRQF_PERCPU,
> - ipi_names[i], mpic);
> + ipi_names[i], (void *)i);
> if (err) {
> - printk(KERN_ERR "Request of irq %d for IPI %d failed\n",
> + printk(KERN_ERR "Request of irq %d for IPI %ld failed\n",
> vipi, i);
> break;
> }
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-10-20 1:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-19 18:51 [PATCH] powerpc: mpic: minor optimization of ipi handler Olof Johansson
2007-10-19 23:17 ` Benjamin Herrenschmidt
2007-10-19 23:31 ` Olof Johansson
2007-10-19 23:49 ` Olof Johansson
2007-10-20 1:23 ` Benjamin Herrenschmidt
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).