Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1507163 > unrolled thread

[PATCH v2 5/5] ARC: MCIP: Use IDU_M_DISTRI_DEST mode if there is only 1 destination core

Started byYuriy Kolerov <yuriy.kolerov@synopsys.com>
First post2016-10-24 14:50 +0200
Last post2016-10-25 20:20 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 5/5] ARC: MCIP: Use IDU_M_DISTRI_DEST mode if there is only 1 destination core Yuriy Kolerov <yuriy.kolerov@synopsys.com> - 2016-10-24 14:50 +0200
    Re: [PATCH v2 5/5] ARC: MCIP: Use IDU_M_DISTRI_DEST mode if there is  only 1 destination core Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-10-25 20:00 +0200
      RE: [PATCH v2 5/5] ARC: MCIP: Use IDU_M_DISTRI_DEST mode if there  is only 1 destination core Yuriy Kolerov <Yuriy.Kolerov@synopsys.com> - 2016-10-25 20:20 +0200

#1507163 — [PATCH v2 5/5] ARC: MCIP: Use IDU_M_DISTRI_DEST mode if there is only 1 destination core

FromYuriy Kolerov <yuriy.kolerov@synopsys.com>
Date2016-10-24 14:50 +0200
Subject[PATCH v2 5/5] ARC: MCIP: Use IDU_M_DISTRI_DEST mode if there is only 1 destination core
Message-ID<svMRr-7EB-1@gated-at.bofh.it>
ARC linux uses 2 distribution modes for common interrupts: round robin
mode (IDU_M_DISTRI_RR) and a simple destination mode (IDU_M_DISTRI_DEST).
The first one is used when more than 1 cores may handle a common interrupt
and the second one is used when only 1 core may handle a common interrupt.

However idu_irq_set_affinity always sets IDU_M_DISTRI_RR for all affinity
values. But there is no sense in setting of such mode if only 1 core must
handle a common interrupt.

Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com>
---
 arch/arc/kernel/mcip.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/arc/kernel/mcip.c b/arch/arc/kernel/mcip.c
index 090f0a1..75e6d73 100644
--- a/arch/arc/kernel/mcip.c
+++ b/arch/arc/kernel/mcip.c
@@ -197,6 +197,7 @@ idu_irq_set_affinity(struct irq_data *data, const struct cpumask *cpumask,
 {
 	unsigned long flags;
 	cpumask_t online;
+	unsigned long dest_bits;
 
 	/* errout if no online cpu per @cpumask */
 	if (!cpumask_and(&online, cpumask, cpu_online_mask))
@@ -204,8 +205,14 @@ idu_irq_set_affinity(struct irq_data *data, const struct cpumask *cpumask,
 
 	raw_spin_lock_irqsave(&mcip_lock, flags);
 
-	idu_set_dest(data->hwirq, cpumask_bits(&online)[0]);
-	idu_set_mode(data->hwirq, IDU_M_TRIG_LEVEL, IDU_M_DISTRI_RR);
+	dest_bits = cpumask_bits(&online)[0];
+	idu_set_dest(data->hwirq, dest_bits);
+
+	if (ffs(dest_bits) == fls(dest_bits)) {
+		idu_set_mode(data->hwirq, IDU_M_TRIG_LEVEL, IDU_M_DISTRI_DEST);
+	} else {
+		idu_set_mode(data->hwirq, IDU_M_TRIG_LEVEL, IDU_M_DISTRI_RR);
+	}
 
 	raw_spin_unlock_irqrestore(&mcip_lock, flags);
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1508526 — Re: [PATCH v2 5/5] ARC: MCIP: Use IDU_M_DISTRI_DEST mode if there is only 1 destination core

FromVineet Gupta <Vineet.Gupta1@synopsys.com>
Date2016-10-25 20:00 +0200
SubjectRe: [PATCH v2 5/5] ARC: MCIP: Use IDU_M_DISTRI_DEST mode if there is only 1 destination core
Message-ID<sweb0-mN-5@gated-at.bofh.it>
In reply to#1507163
On 10/24/2016 05:46 AM, Yuriy Kolerov wrote:
> ARC linux uses 2 distribution modes for common interrupts: round robin
> mode (IDU_M_DISTRI_RR) and a simple destination mode (IDU_M_DISTRI_DEST).
> The first one is used when more than 1 cores may handle a common interrupt
> and the second one is used when only 1 core may handle a common interrupt.
> 
> However idu_irq_set_affinity always sets IDU_M_DISTRI_RR for all affinity
> values. But there is no sense in setting of such mode if only 1 core must
> handle a common interrupt.
> 
> Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com>
> ---
>  arch/arc/kernel/mcip.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arc/kernel/mcip.c b/arch/arc/kernel/mcip.c
> index 090f0a1..75e6d73 100644
> --- a/arch/arc/kernel/mcip.c
> +++ b/arch/arc/kernel/mcip.c
> @@ -197,6 +197,7 @@ idu_irq_set_affinity(struct irq_data *data, const struct cpumask *cpumask,
>  {
>  	unsigned long flags;
>  	cpumask_t online;
> +	unsigned long dest_bits;
>  
>  	/* errout if no online cpu per @cpumask */
>  	if (!cpumask_and(&online, cpumask, cpu_online_mask))
> @@ -204,8 +205,14 @@ idu_irq_set_affinity(struct irq_data *data, const struct cpumask *cpumask,
>  
>  	raw_spin_lock_irqsave(&mcip_lock, flags);
>  
> -	idu_set_dest(data->hwirq, cpumask_bits(&online)[0]);
> -	idu_set_mode(data->hwirq, IDU_M_TRIG_LEVEL, IDU_M_DISTRI_RR);
> +	dest_bits = cpumask_bits(&online)[0];
> +	idu_set_dest(data->hwirq, dest_bits);
> +
> +	if (ffs(dest_bits) == fls(dest_bits)) {
> +		idu_set_mode(data->hwirq, IDU_M_TRIG_LEVEL, IDU_M_DISTRI_DEST);
> +	} else {
> +		idu_set_mode(data->hwirq, IDU_M_TRIG_LEVEL, IDU_M_DISTRI_RR);
> +	}

Better to use a local variable to assign IDU_M_xxx and then call idu_set_mode()
outside the if. I know the compiler would do that anyways, but that looks simpler
to read !

But on the other hand, adding all of this here - isn't there some sort of
duplication of code now between here and in the idu_irq_xlate() ?
Do we need the same stuff in 2 places ?

>  
>  	raw_spin_unlock_irqrestore(&mcip_lock, flags);
>  
> 

[toc] | [prev] | [next] | [standalone]


#1508539 — RE: [PATCH v2 5/5] ARC: MCIP: Use IDU_M_DISTRI_DEST mode if there is only 1 destination core

FromYuriy Kolerov <Yuriy.Kolerov@synopsys.com>
Date2016-10-25 20:20 +0200
SubjectRE: [PATCH v2 5/5] ARC: MCIP: Use IDU_M_DISTRI_DEST mode if there is only 1 destination core
Message-ID<sweul-Lo-9@gated-at.bofh.it>
In reply to#1508526
> -----Original Message-----
> From: Vineet Gupta [mailto:vgupta@synopsys.com]
> Sent: Tuesday, October 25, 2016 8:53 PM
> To: Yuriy Kolerov <yuriy.kolerov@synopsys.com>; linux-snps-
> arc@lists.infradead.org
> Cc: marc.zyngier@arm.com; Vineet.Gupta1@synopsys.com;
> Alexey.Brodkin@synopsys.com; linux-kernel@vger.kernel.org;
> tglx@linutronix.de
> Subject: Re: [PATCH v2 5/5] ARC: MCIP: Use IDU_M_DISTRI_DEST mode if
> there is only 1 destination core
> 
> On 10/24/2016 05:46 AM, Yuriy Kolerov wrote:
> > ARC linux uses 2 distribution modes for common interrupts: round robin
> > mode (IDU_M_DISTRI_RR) and a simple destination mode
> (IDU_M_DISTRI_DEST).
> > The first one is used when more than 1 cores may handle a common
> > interrupt and the second one is used when only 1 core may handle a
> common interrupt.
> >
> > However idu_irq_set_affinity always sets IDU_M_DISTRI_RR for all
> > affinity values. But there is no sense in setting of such mode if only
> > 1 core must handle a common interrupt.
> >
> > Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com>
> > ---
> >  arch/arc/kernel/mcip.c | 11 +++++++++--
> >  1 file changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arc/kernel/mcip.c b/arch/arc/kernel/mcip.c index
> > 090f0a1..75e6d73 100644
> > --- a/arch/arc/kernel/mcip.c
> > +++ b/arch/arc/kernel/mcip.c
> > @@ -197,6 +197,7 @@ idu_irq_set_affinity(struct irq_data *data, const
> > struct cpumask *cpumask,  {
> >  	unsigned long flags;
> >  	cpumask_t online;
> > +	unsigned long dest_bits;
> >
> >  	/* errout if no online cpu per @cpumask */
> >  	if (!cpumask_and(&online, cpumask, cpu_online_mask)) @@ -204,8
> > +205,14 @@ idu_irq_set_affinity(struct irq_data *data, const struct
> > cpumask *cpumask,
> >
> >  	raw_spin_lock_irqsave(&mcip_lock, flags);
> >
> > -	idu_set_dest(data->hwirq, cpumask_bits(&online)[0]);
> > -	idu_set_mode(data->hwirq, IDU_M_TRIG_LEVEL,
> IDU_M_DISTRI_RR);
> > +	dest_bits = cpumask_bits(&online)[0];
> > +	idu_set_dest(data->hwirq, dest_bits);
> > +
> > +	if (ffs(dest_bits) == fls(dest_bits)) {
> > +		idu_set_mode(data->hwirq, IDU_M_TRIG_LEVEL,
> IDU_M_DISTRI_DEST);
> > +	} else {
> > +		idu_set_mode(data->hwirq, IDU_M_TRIG_LEVEL,
> IDU_M_DISTRI_RR);
> > +	}
> 
> Better to use a local variable to assign IDU_M_xxx and then call
> idu_set_mode() outside the if. I know the compiler would do that anyways,
> but that looks simpler to read !

Yep.

> But on the other hand, adding all of this here - isn't there some sort of
> duplication of code now between here and in the idu_irq_xlate() ?
> Do we need the same stuff in 2 places ?

I tried to explain in in [PATCH v2 4/5]. In short I moved logic for setting affinity to idu_irq_set_affinity because xlate function is not the best place where it must be done (see commit message for that patch).

> >
> >  	raw_spin_unlock_irqrestore(&mcip_lock, flags);
> >
> >

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web