All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] FRV: Improve FRV's use of generic IRQ handling
@ 2006-09-08 15:32 David Howells
  2006-09-08 15:32 ` [PATCH 2/3] FRV: Permit __do_IRQ() to be dispensed with David Howells
  2006-09-08 15:32 ` [PATCH 3/3] FRV: Mark __do_IRQ() deprecated David Howells
  0 siblings, 2 replies; 11+ messages in thread
From: David Howells @ 2006-09-08 15:32 UTC (permalink / raw)
  To: torvalds, akpm, mingo, benh; +Cc: linux-kernel, uclinux-dev, dhowells

From: David Howells <dhowells@redhat.com>

Improve FRV's use of generic IRQ handling:

 (*) Use generic_handle_irq() rather than __do_IRQ() as the latter is obsolete.

 (*) Don't implement enable() and disable() ops as these will fall back to
     using unmask() and mask().

 (*) Provide mask_ack() functions to avoid a call each to mask() and ack().

 (*) Make the cascade handlers always return IRQ_HANDLED.

 (*) Implement the mask() and unmask() functions in the same order as they're
     listed in the ops table.

Signed-Off-By: David Howells <dhowells@redhat.com>
---

 arch/frv/kernel/irq-mb93091.c |   36 +++++++++++++++++++-----------------
 arch/frv/kernel/irq-mb93093.c |   36 +++++++++++++++++++-----------------
 arch/frv/kernel/irq-mb93493.c |   35 ++++++++++++++---------------------
 arch/frv/kernel/irq.c         |   15 +--------------
 4 files changed, 53 insertions(+), 69 deletions(-)

diff --git a/arch/frv/kernel/irq-mb93091.c b/arch/frv/kernel/irq-mb93091.c
index 635d234..369bc0a 100644
--- a/arch/frv/kernel/irq-mb93091.c
+++ b/arch/frv/kernel/irq-mb93091.c
@@ -36,41 +36,45 @@ #define __clr_IFR(M)	do { __reg16(0xffc0
 /*
  * on-motherboard FPGA PIC operations
  */
-static void frv_fpga_enable(unsigned int irq)
+static void frv_fpga_mask(unsigned int irq)
 {
 	uint16_t imr = __get_IMR();
 
-	imr &= ~(1 << (irq - IRQ_BASE_FPGA));
+	imr |= 1 << (irq - IRQ_BASE_FPGA);
 
 	__set_IMR(imr);
 }
 
-static void frv_fpga_disable(unsigned int irq)
+static void frv_fpga_ack(unsigned int irq)
+{
+	__clr_IFR(1 << (irq - IRQ_BASE_FPGA));
+}
+
+static void frv_fpga_mask_ack(unsigned int irq)
 {
 	uint16_t imr = __get_IMR();
 
 	imr |= 1 << (irq - IRQ_BASE_FPGA);
-
 	__set_IMR(imr);
-}
 
-static void frv_fpga_ack(unsigned int irq)
-{
 	__clr_IFR(1 << (irq - IRQ_BASE_FPGA));
 }
 
-static void frv_fpga_end(unsigned int irq)
+static void frv_fpga_unmask(unsigned int irq)
 {
+	uint16_t imr = __get_IMR();
+
+	imr &= ~(1 << (irq - IRQ_BASE_FPGA));
+
+	__set_IMR(imr);
 }
 
 static struct irq_chip frv_fpga_pic = {
 	.name		= "mb93091",
-	.enable		= frv_fpga_enable,
-	.disable	= frv_fpga_disable,
 	.ack		= frv_fpga_ack,
-	.mask		= frv_fpga_disable,
-	.unmask		= frv_fpga_enable,
-	.end		= frv_fpga_end,
+	.mask		= frv_fpga_mask,
+	.mask_ack	= frv_fpga_mask_ack,
+	.unmask		= frv_fpga_unmask,
 };
 
 /*
@@ -79,7 +83,6 @@ static struct irq_chip frv_fpga_pic = {
 static irqreturn_t fpga_interrupt(int irq, void *_mask, struct pt_regs *regs)
 {
 	uint16_t imr, mask = (unsigned long) _mask;
-	irqreturn_t iret = 0;
 
 	imr = __get_IMR();
 	mask = mask & ~imr & __get_IFR();
@@ -92,11 +95,10 @@ static irqreturn_t fpga_interrupt(int ir
 		irq = 31 - irq;
 		mask &= ~(1 << irq);
 
-		if (__do_IRQ(IRQ_BASE_FPGA + irq, regs))
-			iret |= IRQ_HANDLED;
+		generic_handle_irq(IRQ_BASE_FPGA + irq, regs);
 	}
 
-	return iret;
+	return IRQ_HANDLED;
 }
 
 /*
diff --git a/arch/frv/kernel/irq-mb93093.c b/arch/frv/kernel/irq-mb93093.c
index f60db79..a43a221 100644
--- a/arch/frv/kernel/irq-mb93093.c
+++ b/arch/frv/kernel/irq-mb93093.c
@@ -35,40 +35,44 @@ #define __clr_IFR(M)	do { __reg16(0x02) 
 /*
  * off-CPU FPGA PIC operations
  */
-static void frv_fpga_enable(unsigned int irq)
+static void frv_fpga_mask(unsigned int irq)
 {
 	uint16_t imr = __get_IMR();
 
-	imr &= ~(1 << (irq - IRQ_BASE_FPGA));
-
+	imr |= 1 << (irq - IRQ_BASE_FPGA);
 	__set_IMR(imr);
 }
 
-static void frv_fpga_disable(unsigned int irq)
+static void frv_fpga_ack(unsigned int irq)
+{
+	__clr_IFR(1 << (irq - IRQ_BASE_FPGA));
+}
+
+static void frv_fpga_mask_ack(unsigned int irq)
 {
 	uint16_t imr = __get_IMR();
 
 	imr |= 1 << (irq - IRQ_BASE_FPGA);
-
 	__set_IMR(imr);
-}
 
-static void frv_fpga_ack(unsigned int irq)
-{
 	__clr_IFR(1 << (irq - IRQ_BASE_FPGA));
 }
 
-static void frv_fpga_end(unsigned int irq)
+static void frv_fpga_unmask(unsigned int irq)
 {
+	uint16_t imr = __get_IMR();
+
+	imr &= ~(1 << (irq - IRQ_BASE_FPGA));
+
+	__set_IMR(imr);
 }
 
 static struct irq_chip frv_fpga_pic = {
 	.name		= "mb93093",
-	.enable		= frv_fpga_enable,
-	.disable	= frv_fpga_disable,
 	.ack		= frv_fpga_ack,
-	.mask		= frv_fpga_disable,
-	.unmask		= frv_fpga_enable,
+	.mask		= frv_fpga_mask,
+	.mask_ack	= frv_fpga_mask_ack,
+	.unmask		= frv_fpga_unmask,
 	.end		= frv_fpga_end,
 };
 
@@ -78,7 +82,6 @@ static struct irq_chip frv_fpga_pic = {
 static irqreturn_t fpga_interrupt(int irq, void *_mask, struct pt_regs *regs)
 {
 	uint16_t imr, mask = (unsigned long) _mask;
-	irqreturn_t iret = 0;
 
 	imr = __get_IMR();
 	mask = mask & ~imr & __get_IFR();
@@ -91,11 +94,10 @@ static irqreturn_t fpga_interrupt(int ir
 		irq = 31 - irq;
 		mask &= ~(1 << irq);
 
-		if (__do_IRQ(IRQ_BASE_FPGA + irq, regs))
-			iret |= IRQ_HANDLED;
+		generic_irq_handle(IRQ_BASE_FPGA + irq, regs);
 	}
 
-	return iret;
+	return IRQ_HANDLED;
 }
 
 /*
diff --git a/arch/frv/kernel/irq-mb93493.c b/arch/frv/kernel/irq-mb93493.c
index 8ad9abf..39c0188 100644
--- a/arch/frv/kernel/irq-mb93493.c
+++ b/arch/frv/kernel/irq-mb93493.c
@@ -43,8 +43,9 @@ #define IRQ_ROUTING					\
 
 /*
  * daughter board PIC operations
+ * - there is no way to ACK interrupts in the MB93493 chip
  */
-static void frv_mb93493_enable(unsigned int irq)
+static void frv_mb93493_mask(unsigned int irq)
 {
 	uint32_t iqsr;
 	volatile void *piqsr;
@@ -55,11 +56,15 @@ static void frv_mb93493_enable(unsigned 
 		piqsr = __addr_MB93493_IQSR(0);
 
 	iqsr = readl(piqsr);
-	iqsr |= 1 << (irq - IRQ_BASE_MB93493 + 16);
+	iqsr &= ~(1 << (irq - IRQ_BASE_MB93493 + 16));
 	writel(iqsr, piqsr);
 }
 
-static void frv_mb93493_disable(unsigned int irq)
+static void frv_mb93493_ack(unsigned int irq)
+{
+}
+
+static void frv_mb93493_unmask(unsigned int irq)
 {
 	uint32_t iqsr;
 	volatile void *piqsr;
@@ -70,26 +75,16 @@ static void frv_mb93493_disable(unsigned
 		piqsr = __addr_MB93493_IQSR(0);
 
 	iqsr = readl(piqsr);
-	iqsr &= ~(1 << (irq - IRQ_BASE_MB93493 + 16));
+	iqsr |= 1 << (irq - IRQ_BASE_MB93493 + 16);
 	writel(iqsr, piqsr);
 }
 
-static void frv_mb93493_ack(unsigned int irq)
-{
-}
-
-static void frv_mb93493_end(unsigned int irq)
-{
-}
-
 static struct irq_chip frv_mb93493_pic = {
 	.name		= "mb93093",
-	.enable		= frv_mb93493_enable,
-	.disable	= frv_mb93493_disable,
 	.ack		= frv_mb93493_ack,
-	.mask		= frv_mb93493_disable,
-	.unmask		= frv_mb93493_enable,
-	.end		= frv_mb93493_end,
+	.mask		= frv_mb93493_mask,
+	.mask_ack	= frv_mb93493_mask,
+	.unmask		= frv_mb93493_unmask,
 };
 
 /*
@@ -98,7 +93,6 @@ static struct irq_chip frv_mb93493_pic =
 static irqreturn_t mb93493_interrupt(int irq, void *_piqsr, struct pt_regs *regs)
 {
 	volatile void *piqsr = _piqsr;
-	irqreturn_t iret = 0;
 	uint32_t iqsr;
 
 	iqsr = readl(piqsr);
@@ -112,11 +106,10 @@ static irqreturn_t mb93493_interrupt(int
 		irq = 31 - irq;
 		iqsr &= ~(1 << irq);
 
-		if (__do_IRQ(IRQ_BASE_MB93493 + irq, regs))
-			iret |= IRQ_HANDLED;
+		generic_handle_irq(IRQ_BASE_MB93493 + irq, regs);
 	}
 
-	return iret;
+	return IRQ_HANDLED;
 }
 
 /*
diff --git a/arch/frv/kernel/irq.c b/arch/frv/kernel/irq.c
index e1ab9f2..5ac041c 100644
--- a/arch/frv/kernel/irq.c
+++ b/arch/frv/kernel/irq.c
@@ -97,19 +97,8 @@ int show_interrupts(struct seq_file *p, 
 /*
  * on-CPU PIC operations
  */
-static void frv_cpupic_enable(unsigned int irqlevel)
-{
-	__clr_MASK(irqlevel);
-}
-
-static void frv_cpupic_disable(unsigned int irqlevel)
-{
-	__set_MASK(irqlevel);
-}
-
 static void frv_cpupic_ack(unsigned int irqlevel)
 {
-	__set_MASK(irqlevel);
 	__clr_RC(irqlevel);
 	__clr_IRL();
 }
@@ -138,8 +127,6 @@ static void frv_cpupic_end(unsigned int 
 
 static struct irq_chip frv_cpu_pic = {
 	.name		= "cpu",
-	.enable		= frv_cpupic_enable,
-	.disable	= frv_cpupic_disable,
 	.ack		= frv_cpupic_ack,
 	.mask		= frv_cpupic_mask,
 	.mask_ack	= frv_cpupic_mask_ack,
@@ -156,7 +143,7 @@ static struct irq_chip frv_cpu_pic = {
 asmlinkage void do_IRQ(void)
 {
 	irq_enter();
-	__do_IRQ(__get_IRL(), __frame);
+	generic_handle_irq(__get_IRL(), __frame);
 	irq_exit();
 }
 

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/3] FRV: Permit __do_IRQ() to be dispensed with
  2006-09-08 15:32 [PATCH 1/3] FRV: Improve FRV's use of generic IRQ handling David Howells
@ 2006-09-08 15:32 ` David Howells
  2006-09-09  5:12   ` Ingo Molnar
  2006-09-11  9:47   ` David Howells
  2006-09-08 15:32 ` [PATCH 3/3] FRV: Mark __do_IRQ() deprecated David Howells
  1 sibling, 2 replies; 11+ messages in thread
From: David Howells @ 2006-09-08 15:32 UTC (permalink / raw)
  To: torvalds, akpm, mingo, benh; +Cc: linux-kernel, uclinux-dev, dhowells

From: David Howells <dhowells@redhat.com>

Permit __do_IRQ() to be dispensed with based on a configuration option.

Signed-Off-By: David Howells <dhowells@redhat.com>
---

 arch/frv/Kconfig    |    4 ++++
 include/linux/irq.h |    6 ++++++
 kernel/irq/handle.c |    2 ++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index 130fe8f..69f9846 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -29,6 +29,10 @@ config GENERIC_HARDIRQS
 	bool
 	default y
 
+config GENERIC_HARDIRQS_NO__DO_IRQ
+	bool
+	default y
+
 config GENERIC_TIME
 	bool
 	default y
diff --git a/include/linux/irq.h b/include/linux/irq.h
index fbf6d90..48d3cb3 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -320,7 +320,9 @@ handle_irq_name(void fastcall (*handle)(
  * Monolithic do_IRQ implementation.
  * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly)
  */
+#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
 extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
+#endif
 
 /*
  * Architectures call this to let the generic IRQ layer
@@ -332,10 +334,14 @@ static inline void generic_handle_irq(un
 {
 	struct irq_desc *desc = irq_desc + irq;
 
+#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
+	desc->handle_irq(irq, desc, regs);
+#else
 	if (likely(desc->handle_irq))
 		desc->handle_irq(irq, desc, regs);
 	else
 		__do_IRQ(irq, regs);
+#endif
 }
 
 /* Handling of unhandled and spurious interrupts: */
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index fc4e906..2e9e800 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -149,6 +149,7 @@ irqreturn_t handle_IRQ_event(unsigned in
 	return retval;
 }
 
+#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
 /**
  * __do_IRQ - original all in one highlevel IRQ handler
  * @irq:	the interrupt number
@@ -248,6 +249,7 @@ out:
 
 	return 1;
 }
+#endif
 
 #ifdef CONFIG_TRACE_IRQFLAGS
 

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/3] FRV: Mark __do_IRQ() deprecated
  2006-09-08 15:32 [PATCH 1/3] FRV: Improve FRV's use of generic IRQ handling David Howells
  2006-09-08 15:32 ` [PATCH 2/3] FRV: Permit __do_IRQ() to be dispensed with David Howells
@ 2006-09-08 15:32 ` David Howells
  1 sibling, 0 replies; 11+ messages in thread
From: David Howells @ 2006-09-08 15:32 UTC (permalink / raw)
  To: torvalds, akpm, mingo, benh; +Cc: linux-kernel, uclinux-dev, dhowells

From: David Howells <dhowells@redhat.com>

Mark __do_IRQ() as being deprecated (as Ben Herrenschmidt says it is).

Rename the real __do_IRQ() to __do_IRQ_deprecated() and wrap this in an inline
function called __do_IRQ() that is deprecated to prevent generic_handle_irq()
from giving deprecation warnings on every file.

Signed-Off-By: David Howells <dhowells@redhat.com>
---

 include/linux/irq.h |   11 +++++++++--
 kernel/irq/handle.c |    6 ++++--
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/include/linux/irq.h b/include/linux/irq.h
index 48d3cb3..83bf988 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -319,9 +319,16 @@ handle_irq_name(void fastcall (*handle)(
 /*
  * Monolithic do_IRQ implementation.
  * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly)
+ * - This is obsolete; generic_handle_irq() should be used instead.
  */
 #ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
-extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
+extern fastcall unsigned int __do_IRQ_deprecated(unsigned int irq, struct pt_regs *regs);
+
+static inline __deprecated fastcall
+unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs)
+{
+	return __do_IRQ_deprecated(irq, regs);
+}
 #endif
 
 /*
@@ -340,7 +347,7 @@ #else
 	if (likely(desc->handle_irq))
 		desc->handle_irq(irq, desc, regs);
 	else
-		__do_IRQ(irq, regs);
+		__do_IRQ_deprecated(irq, regs);
 #endif
 }
 
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 2e9e800..f3b1615 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -151,7 +151,7 @@ irqreturn_t handle_IRQ_event(unsigned in
 
 #ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
 /**
- * __do_IRQ - original all in one highlevel IRQ handler
+ * __do_IRQ_deprecated - original all in one highlevel IRQ handler
  * @irq:	the interrupt number
  * @regs:	pointer to a register structure
  *
@@ -161,8 +161,10 @@ #ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_I
  *
  * This is the original x86 implementation which is used for every
  * interrupt type.
+ *
+ * This is obsolete; generic_handle_irq() should be used instead.
  */
-fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs)
+fastcall unsigned int __do_IRQ_deprecated(unsigned int irq, struct pt_regs *regs)
 {
 	struct irq_desc *desc = irq_desc + irq;
 	struct irqaction *action;

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] FRV: Permit __do_IRQ() to be dispensed with
  2006-09-08 15:32 ` [PATCH 2/3] FRV: Permit __do_IRQ() to be dispensed with David Howells
@ 2006-09-09  5:12   ` Ingo Molnar
  2006-09-09  7:26     ` Benjamin Herrenschmidt
                       ` (2 more replies)
  2006-09-11  9:47   ` David Howells
  1 sibling, 3 replies; 11+ messages in thread
From: Ingo Molnar @ 2006-09-09  5:12 UTC (permalink / raw)
  To: David Howells; +Cc: torvalds, akpm, benh, linux-kernel, uclinux-dev


* David Howells <dhowells@redhat.com> wrote:

> +#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ

> +#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ

> +#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ

I think the myriad of arch switches and the resulting #ifdef noise, just 
to get rid of a _single_ unused global function, is pretty lame. (and 
that's of course not your fault)

The real solution would be to use gcc -ffunction-sections plus ld 
--gc-sections to automatically get rid of unused global functions, at 
link time. I'm wondering how hard it would be to enhance kbuild to do 
that - x86_64 already uses -ffunction-sections (if CONFIG_REORDER), so 
the big question is how usable is ld --gc-sections. Such a feature would 
be quite important for embedded systems (and for RAM footprint in 
general) as it would save a significant amount of .text and .data.

	Ingo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] FRV: Permit __do_IRQ() to be dispensed with
  2006-09-09  5:12   ` Ingo Molnar
@ 2006-09-09  7:26     ` Benjamin Herrenschmidt
  2006-09-10 14:34     ` Daniel Walker
  2006-09-21 13:12     ` David Howells
  2 siblings, 0 replies; 11+ messages in thread
From: Benjamin Herrenschmidt @ 2006-09-09  7:26 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: David Howells, torvalds, akpm, linux-kernel, uclinux-dev

On Sat, 2006-09-09 at 07:12 +0200, Ingo Molnar wrote:
> * David Howells <dhowells@redhat.com> wrote:
> 
> > +#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
> 
> > +#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
> 
> > +#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
> 
> I think the myriad of arch switches and the resulting #ifdef noise, just 
> to get rid of a _single_ unused global function, is pretty lame. (and 
> that's of course not your fault)
> 
> The real solution would be to use gcc -ffunction-sections plus ld 
> --gc-sections to automatically get rid of unused global functions, at 
> link time. I'm wondering how hard it would be to enhance kbuild to do 
> that - x86_64 already uses -ffunction-sections (if CONFIG_REORDER), so 
> the big question is how usable is ld --gc-sections. Such a feature would 
> be quite important for embedded systems (and for RAM footprint in 
> general) as it would save a significant amount of .text and .data.

It can't optimize __do_IRQ() out in any case if one uses
generic_handle_irq() because of the test in there which can't be
predicted at compile time. My fault ... Maybe we should go back to
having generic_handle_irq() not do the NULL test and not call __do_IRQ()
and have another generic_handle_irq_compat() or some stupid name like
that do what the current generic_handle_irq() does. I added that to
handle the case of partial conversion (which we still have to deal with
on powerpc as arch/ppc hasn't been converted).

Ben.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] FRV: Permit __do_IRQ() to be dispensed with
  2006-09-09  5:12   ` Ingo Molnar
  2006-09-09  7:26     ` Benjamin Herrenschmidt
@ 2006-09-10 14:34     ` Daniel Walker
  2006-09-11  5:33       ` Ingo Molnar
  2006-09-21 13:12     ` David Howells
  2 siblings, 1 reply; 11+ messages in thread
From: Daniel Walker @ 2006-09-10 14:34 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: David Howells, torvalds, akpm, benh, linux-kernel, uclinux-dev

On Sat, 2006-09-09 at 07:12 +0200, Ingo Molnar wrote:

> The real solution would be to use gcc -ffunction-sections plus ld 
> --gc-sections to automatically get rid of unused global functions, at 
> link time. I'm wondering how hard it would be to enhance kbuild to do 
> that - x86_64 already uses -ffunction-sections (if CONFIG_REORDER), so 
> the big question is how usable is ld --gc-sections. Such a feature would 
> be quite important for embedded systems (and for RAM footprint in 
> general) as it would save a significant amount of .text and .data.

A patch to do this was submitted already by Marcelo Tosatti ..

http://lkml.org/lkml/2006/6/4/169

Daniel


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] FRV: Permit __do_IRQ() to be dispensed with
  2006-09-10 14:34     ` Daniel Walker
@ 2006-09-11  5:33       ` Ingo Molnar
  0 siblings, 0 replies; 11+ messages in thread
From: Ingo Molnar @ 2006-09-11  5:33 UTC (permalink / raw)
  To: Daniel Walker
  Cc: David Howells, torvalds, akpm, benh, linux-kernel, uclinux-dev,
	Marcelo Tosatti, kai, sam


* Daniel Walker <dwalker@mvista.com> wrote:

> On Sat, 2006-09-09 at 07:12 +0200, Ingo Molnar wrote:
> 
> > The real solution would be to use gcc -ffunction-sections plus ld 
> > --gc-sections to automatically get rid of unused global functions, at 
> > link time. I'm wondering how hard it would be to enhance kbuild to do 
> > that - x86_64 already uses -ffunction-sections (if CONFIG_REORDER), so 
> > the big question is how usable is ld --gc-sections. Such a feature would 
> > be quite important for embedded systems (and for RAM footprint in 
> > general) as it would save a significant amount of .text and .data.
> 
> A patch to do this was submitted already by Marcelo Tosatti ..
> 
> http://lkml.org/lkml/2006/6/4/169

ah, i missed that patch in the June lock validator frenzy. The results 
are astounding:

>> vmlinux shrinks from 1090389 to 983933 bytes, or 106k (~= 10%).

Andrew, Linus, Kai, Sam: a must-have feature! This saves more kernel 
kernel image RAM than all the other kernel shrinking efforts of the past 
2 years combined - at zero cost.

	Ingo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] FRV: Permit __do_IRQ() to be dispensed with
  2006-09-08 15:32 ` [PATCH 2/3] FRV: Permit __do_IRQ() to be dispensed with David Howells
  2006-09-09  5:12   ` Ingo Molnar
@ 2006-09-11  9:47   ` David Howells
  2006-09-11 15:33     ` Daniel Walker
  1 sibling, 1 reply; 11+ messages in thread
From: David Howells @ 2006-09-11  9:47 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: David Howells, torvalds, akpm, benh, linux-kernel, uclinux-dev

Ingo Molnar <mingo@elte.hu> wrote:

> The real solution would be to use gcc -ffunction-sections plus ld 
> --gc-sections to automatically get rid of unused global functions, at 
> link time.

It's easy.  It's already possible with FRV.  Just add the attached patch and
enable the new option.  However, you also need to compile without debugging
code, otherwise it has little effect.  I think stabs links bring stuff in or
something.

David
---
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index 5e6583a..0dc3730 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -342,6 +342,14 @@ menu "Power management options"
 source kernel/power/Kconfig
 endmenu
 
+config GC_SECTIONS
+       bool "Garbage collect unused functions and data"
+       default y
+       help
+         Tell the compiler to place all functions and variables in their own
+         sections and then tell the linker to discard any section that aren't
+         referred to.
+
 endmenu
 
 

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] FRV: Permit __do_IRQ() to be dispensed with
  2006-09-11  9:47   ` David Howells
@ 2006-09-11 15:33     ` Daniel Walker
  0 siblings, 0 replies; 11+ messages in thread
From: Daniel Walker @ 2006-09-11 15:33 UTC (permalink / raw)
  To: David Howells; +Cc: Ingo Molnar, torvalds, akpm, benh, linux-kernel

On Mon, 2006-09-11 at 10:47 +0100, David Howells wrote:
> Ingo Molnar <mingo@elte.hu> wrote:
> 
> > The real solution would be to use gcc -ffunction-sections plus ld 
> > --gc-sections to automatically get rid of unused global functions, at 
> > link time.
> 
> It's easy.  It's already possible with FRV.  Just add the attached patch and
> enable the new option.  However, you also need to compile without debugging
> code, otherwise it has little effect.  I think stabs links bring stuff in or
> something.
> 

It's a wide spread problem so I think something more generic is
appropriate.

Does the code in Marcelo's patch make sense for FRV, or vis-versa?

Daniel


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] FRV: Permit __do_IRQ() to be dispensed with
  2006-09-09  5:12   ` Ingo Molnar
  2006-09-09  7:26     ` Benjamin Herrenschmidt
  2006-09-10 14:34     ` Daniel Walker
@ 2006-09-21 13:12     ` David Howells
  2006-09-21 21:59       ` Benjamin Herrenschmidt
  2 siblings, 1 reply; 11+ messages in thread
From: David Howells @ 2006-09-21 13:12 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Ingo Molnar, David Howells, torvalds, akpm, linux-kernel, uclinux-dev

Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> It can't optimize __do_IRQ() out in any case if one uses
> generic_handle_irq() because of the test in there which can't be
> predicted at compile time.

Do you realise that powerpc still uses __do_IRQ if CONFIG_IRQSTACKS=y?  You
should probably fix that.

David

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] FRV: Permit __do_IRQ() to be dispensed with
  2006-09-21 13:12     ` David Howells
@ 2006-09-21 21:59       ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 11+ messages in thread
From: Benjamin Herrenschmidt @ 2006-09-21 21:59 UTC (permalink / raw)
  To: David Howells; +Cc: Ingo Molnar, torvalds, akpm, linux-kernel, uclinux-dev

On Thu, 2006-09-21 at 14:12 +0100, David Howells wrote:
> Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> 
> > It can't optimize __do_IRQ() out in any case if one uses
> > generic_handle_irq() because of the test in there which can't be
> > predicted at compile time.
> 
> Do you realise that powerpc still uses __do_IRQ if CONFIG_IRQSTACKS=y?  You
> should probably fix that.

At the moment, there is no hurry as this code is shared with arch/ppc
which hasn't been ported to genirq, so we need to handle both cases.
(Though I'm not sure we ever get CONFIG_IRQSTACKS with arch/ppc ... I
should probably check). The code uses desc->handle_irq and falls back to
__do_IRQ() if that is NULL.

Ben.



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2006-09-21 22:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-08 15:32 [PATCH 1/3] FRV: Improve FRV's use of generic IRQ handling David Howells
2006-09-08 15:32 ` [PATCH 2/3] FRV: Permit __do_IRQ() to be dispensed with David Howells
2006-09-09  5:12   ` Ingo Molnar
2006-09-09  7:26     ` Benjamin Herrenschmidt
2006-09-10 14:34     ` Daniel Walker
2006-09-11  5:33       ` Ingo Molnar
2006-09-21 13:12     ` David Howells
2006-09-21 21:59       ` Benjamin Herrenschmidt
2006-09-11  9:47   ` David Howells
2006-09-11 15:33     ` Daniel Walker
2006-09-08 15:32 ` [PATCH 3/3] FRV: Mark __do_IRQ() deprecated David Howells

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.