Skip to contentSkip to conversation

ARM: S5PV310: Optimize interrupt source searching code

PATCH Superseded Kukjin Kim 3 participants 5 messages Sep 28, 2010

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Kukjin Kim

author
#0 lore raw

PATCH 1/1 ARM: S5PV310: Optimize interrupt source searching code

From: Changhwan Youn <[email protected]>

It is reported by Junseok Jung that using clz instruction is better instead of using for-loop to find the interrupt source. This patch modifies interrupt source searching code using __fls(). The __fls() is implemented using clz instruction.

---
 arch/arm/mach-s5pv310/irq-combiner.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
arch/arm/mach-s5pv310/irq-combiner.c +1 -5
index 0f70521..39e3647 100644
@@ -66,11 +66,7 @@ static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
 	if (status == 0)
 		goto out;
 
-	for (combiner_irq = 0; combiner_irq < 32; combiner_irq++) {
-		if (status & 0x1)
-			break;
-		status >>= 1;
-	}
+	combiner_irq = __fls(status);
 
 	cascade_irq = combiner_irq + (chip_data->irq_offset & ~31);
 	if (unlikely(cascade_irq >= NR_IRQS))
Signature · 1 line
1.6.2.5
#1 lore raw

PATCH 1/1 ARM: S5PV310: Optimize interrupt source searching code

Hello.

Quoted 19 lines · Kukjin Kim

From: Changhwan Youn<[email protected]>

It is reported by Junseok Jung that using clz instruction is better instead of using for-loop to find the interrupt source. This patch modifies interrupt source searching code using __fls(). The __fls() is implemented using clz instruction.

---
  arch/arm/mach-s5pv310/irq-combiner.c |    6 +-----
  1 files changed, 1 insertions(+), 5 deletions(-)
arch/arm/mach-s5pv310/irq-combiner.c +0 -0
index 0f70521..39e3647 100644

arch/arm/mach-s5pv310/irq-combiner.c static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc) · line 69

Quoted 9 lines
arch/arm/mach-s5pv310/irq-combiner.c +1 -5
@@ -66,11 +66,7 @@ static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
  	if (status == 0)
  		goto out;
 
-	for (combiner_irq = 0; combiner_irq<  32; combiner_irq++) {
-		if (status & 0x1)
-			break;
-		status>>= 1;
-	}
+	combiner_irq = __fls(status);

But the loop finds the *first* set bit, not the last...

WBR, Sergei

#2 lore raw

PATCH 1/1 ARM: S5PV310: Optimize interrupt source searching code

Quoted 26 lines · Sergei Shtylyov

Hello.

Quoted 22 lines · Kukjin Kim

From: Changhwan Youn<[email protected]>

It is reported by Junseok Jung that using clz instruction is better instead of using for-loop to find the interrupt source. This patch modifies interrupt source searching code using __fls(). The __fls() is implemented using clz instruction.

---
  arch/arm/mach-s5pv310/irq-combiner.c |    6 +-----
  1 files changed, 1 insertions(+), 5 deletions(-)
arch/arm/mach-s5pv310/irq-combiner.c +0 -0
index 0f70521..39e3647 100644
@@ -66,11 +66,7 @@ static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
  	if (status == 0)
  		goto out;
 
Quoted 8 lines

arch/arm/mach-s5pv310/irq-combiner.c static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc) · line 69

Quoted 6 lines
arch/arm/mach-s5pv310/irq-combiner.c +1 -5
-	for (combiner_irq = 0; combiner_irq<  32; combiner_irq++) {
-		if (status & 0x1)
-			break;
-		status>>= 1;
-	}
+	combiner_irq = __fls(status);

But the loop finds the *first* set bit, not the last...

__ffs than?

Signature · 4 lines
Best regards,                                        _     _
| Humble Liege of Serenely Enlightened Majesty of  o' \,=./ `o
| Computer Science,  Michał "mina86" Nazarewicz       (o o)
+----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)--Ooo--
author
#3 lore raw

PATCH 1/1 ARM: S5PV310: Optimize interrupt source searching code

Quoted 1 line · Michal Nazarewicz

Hi :-)

Quoted 40 lines
Quoted 11 lines · Sergei Shtylyov

Hello.

Quoted 6 lines · Kukjin Kim

From: Changhwan Youn<[email protected]>

It is reported by Junseok Jung that using clz instruction is better instead of using for-loop to find the interrupt source. This patch modifies interrupt source searching code using __fls(). The __fls() is implemented using clz instruction.

Quoted 8 lines

arch/arm/mach-s5pv310/irq-

Quoted 8 lines
---
  arch/arm/mach-s5pv310/irq-combiner.c |    6 +-----
  1 files changed, 1 insertions(+), 5 deletions(-)
arch/arm/mach-s5pv310/irq- renamed from arch/arm/mach-s5pv310/irq-combiner.c +0 -0

combiner.c

Quoted 4 lines

arch/arm/mach-s5pv310/irq-combiner.c static void combiner_handle_cascade_irq(unsigned int

Quoted 4 lines

index 0f70521..39e3647 100644

arch/arm/mach-s5pv310/irq-combiner.c +0 -0
@@ -66,11 +66,7 @@ static void combiner_handle_cascade_irq(unsigned int

irq, struct irq_desc *desc)

Quoted 11 lines

arch/arm/mach-s5pv310/irq-combiner.c static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc) · line 69

Quoted 9 lines
arch/arm/mach-s5pv310/irq-combiner.c +1 -5
  	if (status == 0)
  		goto out;
 
-	for (combiner_irq = 0; combiner_irq<  32; combiner_irq++) {
-		if (status & 0x1)
-			break;
-		status>>= 1;
-	}
+	combiner_irq = __fls(status);

But the loop finds the *first* set bit, not the last...

Quoted 2 lines

__ffs than?

Yes, already re-submitted.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

author
#4 lore raw

PATCH 1/1 ARM: S5PV310: Optimize interrupt source searching code

In reply to Sergei Shtylyov
Quoted 3 lines · Sergei Shtylyov

Hello.

Hi ;-)

Quoted 9 lines · Kukjin Kim
Quoted 7 lines

From: Changhwan Youn<[email protected]>

It is reported by Junseok Jung that using clz instruction is better instead of using for-loop to find the interrupt source. This patch modifies interrupt source searching code using __fls(). The __fls() is implemented using clz instruction.

Quoted 8 lines

Review

Quoted 8 lines
---
  arch/arm/mach-s5pv310/irq-combiner.c |    6 +-----
  1 files changed, 1 insertions(+), 5 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-s5pv310/irq-

Quoted 5 lines

combiner.c

arch/arm/mach-s5pv310/irq-combiner.c static void combiner_handle_cascade_irq(unsigned int

Quoted 4 lines

index 0f70521..39e3647 100644

arch/arm/mach-s5pv310/irq-combiner.c +0 -0
@@ -66,11 +66,7 @@ static void combiner_handle_cascade_irq(unsigned int

irq,

Quoted 4 lines

struct irq_desc *desc)

Quoted 3 lines
arch/arm/mach-s5pv310/irq-combiner.c +0 -0
  	if (status == 0)
  		goto out;
 
Quoted 9 lines

arch/arm/mach-s5pv310/irq-combiner.c static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc) · line 69

Quoted 6 lines
arch/arm/mach-s5pv310/irq-combiner.c +1 -5
-	for (combiner_irq = 0; combiner_irq<  32; combiner_irq++) {
-		if (status & 0x1)
-			break;
-		status>>= 1;
-	}
+	combiner_irq = __fls(status);

But the loop finds the *first* set bit, not the last...

Yes, you're right.
So I already re-submitted like following :-)

http://lists.infradead.org/pipermail/linux-arm-kernel/2010-September/027071.
html

Thanks for your pointing out.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.