public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] cpumask fallout: Initialize irq_default_affinity earlier et al.
@ 2009-01-08 22:53 David Daney
  2009-01-08 22:55 ` [PATCH 1/2] Make irq_*_affinity depend on CONFIG_GENERIC_HARDIRQS too David Daney
  2009-01-08 22:55 ` [PATCH 2/2] cpumask fallout: Initialize irq_default_affinity earlier (v2) David Daney
  0 siblings, 2 replies; 5+ messages in thread
From: David Daney @ 2009-01-08 22:53 UTC (permalink / raw)
  To: Linus Torvalds, Rusty Russell
  Cc: Linux Kernel Mailing List, Mike Travis, linux-mips


As I said in 2/2:

    Move the initialization of irq_default_affinity to early_irq_init
    as core_initcall is too late.

    irq_default_affinity can be used in init_IRQ and potentially timer
    and SMP init as well.  All of these happen before core_initcall.
    Moving the initialization to early_irq_init ensures that it is
    initialized before it is used.

Mike Travis pointed out that irq_default_affinity depends on
CONFIG_GENERIC_HARDIRQS in addition to CONFIG_SMP.  So to make things
consistent, I added 1/2 so that the irq_*_affinity functions and
irq_default_affinity are defined for the same conditions that they are
declared.

I Took Linus' suggestion to move init_irq_default_affinity over to
kernel/irq/handle.c, however due to the way that cpumask_*() are
defined, it is still necessary to have the ugly ifdefs, but now they
are localized to init_irq_default_affinity.

Mike Travis also suggested that alloc_bootmem_cpumask_var() be used in
preference to alloc_cpumask_var, so I incorporated that suggestion as
well.

I tested both with and without CONFIG_SMP, on mips/cavium_octeon, Mike
tested a similar(but not identical patch) on x86_64.

I will reply with the two patches.

David Daney (2):
  Make irq_*_affinity depend on CONFIG_GENERIC_HARDIRQS too.
  cpumask fallout: Initialize irq_default_affinity earlier (v2).

 kernel/irq/handle.c |   12 ++++++++++++
 kernel/irq/manage.c |   10 +---------
 2 files changed, 13 insertions(+), 9 deletions(-)


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

* [PATCH 1/2] Make irq_*_affinity depend on CONFIG_GENERIC_HARDIRQS too.
  2009-01-08 22:53 [PATCH 0/2] cpumask fallout: Initialize irq_default_affinity earlier et al David Daney
@ 2009-01-08 22:55 ` David Daney
  2009-01-08 22:55 ` [PATCH 2/2] cpumask fallout: Initialize irq_default_affinity earlier (v2) David Daney
  1 sibling, 0 replies; 5+ messages in thread
From: David Daney @ 2009-01-08 22:55 UTC (permalink / raw)
  To: rusty, torvalds; +Cc: linux-kernel, linux-mips, travis, David Daney

In interrupt.h these functions are declared only if
CONFIG_GENERIC_HARDIRQS is set.  We should define them under identical
conditions.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 kernel/irq/manage.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index cd0cd8d..618a64f 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -15,7 +15,7 @@
 
 #include "internals.h"
 
-#ifdef CONFIG_SMP
+#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
 cpumask_var_t irq_default_affinity;
 
 static int init_irq_default_affinity(void)
-- 
1.5.6.6


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

* [PATCH 2/2] cpumask fallout: Initialize irq_default_affinity earlier (v2).
  2009-01-08 22:53 [PATCH 0/2] cpumask fallout: Initialize irq_default_affinity earlier et al David Daney
  2009-01-08 22:55 ` [PATCH 1/2] Make irq_*_affinity depend on CONFIG_GENERIC_HARDIRQS too David Daney
@ 2009-01-08 22:55 ` David Daney
  2009-01-08 23:04   ` Ihar Hrachyshka
  2009-01-08 23:11   ` Mike Travis
  1 sibling, 2 replies; 5+ messages in thread
From: David Daney @ 2009-01-08 22:55 UTC (permalink / raw)
  To: rusty, torvalds; +Cc: linux-kernel, linux-mips, travis, David Daney

Move the initialization of irq_default_affinity to early_irq_init as
core_initcall is too late.

irq_default_affinity can be used in init_IRQ and potentially timer and
SMP init as well.  All of these happen before core_initcall.  Moving
the initialization to early_irq_init ensures that it is initialized
before it is used.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 kernel/irq/handle.c |   12 ++++++++++++
 kernel/irq/manage.c |    8 --------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index c20db0b..a9fbb01 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -39,6 +39,14 @@ void handle_bad_irq(unsigned int irq, struct irq_desc *desc)
 	ack_bad_irq(irq);
 }
 
+static inline void __init init_irq_default_affinity(void)
+{
+#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
+	alloc_bootmem_cpumask_var(&irq_default_affinity);
+	cpumask_setall(irq_default_affinity);
+#endif
+}
+
 /*
  * Linux has a controller-independent interrupt architecture.
  * Every controller has a 'controller-template', that is used
@@ -134,6 +142,8 @@ int __init early_irq_init(void)
 	int legacy_count;
 	int i;
 
+	init_irq_default_affinity();
+
 	desc = irq_desc_legacy;
 	legacy_count = ARRAY_SIZE(irq_desc_legacy);
 
@@ -219,6 +229,8 @@ int __init early_irq_init(void)
 	int count;
 	int i;
 
+	init_irq_default_affinity();
+
 	desc = irq_desc;
 	count = ARRAY_SIZE(irq_desc);
 
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 618a64f..291f036 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -18,14 +18,6 @@
 #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
 cpumask_var_t irq_default_affinity;
 
-static int init_irq_default_affinity(void)
-{
-	alloc_cpumask_var(&irq_default_affinity, GFP_KERNEL);
-	cpumask_setall(irq_default_affinity);
-	return 0;
-}
-core_initcall(init_irq_default_affinity);
-
 /**
  *	synchronize_irq - wait for pending IRQ handlers (on other CPUs)
  *	@irq: interrupt number to wait for
-- 
1.5.6.6


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

* Re: [PATCH 2/2] cpumask fallout: Initialize irq_default_affinity earlier (v2).
  2009-01-08 22:55 ` [PATCH 2/2] cpumask fallout: Initialize irq_default_affinity earlier (v2) David Daney
@ 2009-01-08 23:04   ` Ihar Hrachyshka
  2009-01-08 23:11   ` Mike Travis
  1 sibling, 0 replies; 5+ messages in thread
From: Ihar Hrachyshka @ 2009-01-08 23:04 UTC (permalink / raw)
  To: David Daney; +Cc: rusty, torvalds, linux-kernel, linux-mips, travis

#ifdef X
void func(args)
{
  operation();
}
#else
void func(args)
{
}
#endif

is better than:

void func(args)
{
#ifdef X
  operation();
#endif
}

IMHO.

On Fri, Jan 9, 2009 at 12:55 AM, David Daney <ddaney@caviumnetworks.com> wrote:
> Move the initialization of irq_default_affinity to early_irq_init as
> core_initcall is too late.
>
> irq_default_affinity can be used in init_IRQ and potentially timer and
> SMP init as well.  All of these happen before core_initcall.  Moving
> the initialization to early_irq_init ensures that it is initialized
> before it is used.
>
> Signed-off-by: David Daney <ddaney@caviumnetworks.com>
> ---
>  kernel/irq/handle.c |   12 ++++++++++++
>  kernel/irq/manage.c |    8 --------
>  2 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
> index c20db0b..a9fbb01 100644
> --- a/kernel/irq/handle.c
> +++ b/kernel/irq/handle.c
> @@ -39,6 +39,14 @@ void handle_bad_irq(unsigned int irq, struct irq_desc *desc)
>        ack_bad_irq(irq);
>  }
>
> +static inline void __init init_irq_default_affinity(void)
> +{
> +#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
> +       alloc_bootmem_cpumask_var(&irq_default_affinity);
> +       cpumask_setall(irq_default_affinity);
> +#endif
> +}
> +
>  /*
>  * Linux has a controller-independent interrupt architecture.
>  * Every controller has a 'controller-template', that is used
> @@ -134,6 +142,8 @@ int __init early_irq_init(void)
>        int legacy_count;
>        int i;
>
> +       init_irq_default_affinity();
> +
>        desc = irq_desc_legacy;
>        legacy_count = ARRAY_SIZE(irq_desc_legacy);
>
> @@ -219,6 +229,8 @@ int __init early_irq_init(void)
>        int count;
>        int i;
>
> +       init_irq_default_affinity();
> +
>        desc = irq_desc;
>        count = ARRAY_SIZE(irq_desc);
>
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index 618a64f..291f036 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -18,14 +18,6 @@
>  #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
>  cpumask_var_t irq_default_affinity;
>
> -static int init_irq_default_affinity(void)
> -{
> -       alloc_cpumask_var(&irq_default_affinity, GFP_KERNEL);
> -       cpumask_setall(irq_default_affinity);
> -       return 0;
> -}
> -core_initcall(init_irq_default_affinity);
> -
>  /**
>  *     synchronize_irq - wait for pending IRQ handlers (on other CPUs)
>  *     @irq: interrupt number to wait for
> --
> 1.5.6.6
>
>
>

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

* Re: [PATCH 2/2] cpumask fallout: Initialize irq_default_affinity earlier (v2).
  2009-01-08 22:55 ` [PATCH 2/2] cpumask fallout: Initialize irq_default_affinity earlier (v2) David Daney
  2009-01-08 23:04   ` Ihar Hrachyshka
@ 2009-01-08 23:11   ` Mike Travis
  1 sibling, 0 replies; 5+ messages in thread
From: Mike Travis @ 2009-01-08 23:11 UTC (permalink / raw)
  To: David Daney; +Cc: rusty, torvalds, linux-kernel, linux-mips, Ingo Molnar

It's essentially the same as I tested on x86_64 so you can add my

	Acked-by: Mike Travis <travis@sgi.com>

Thanks!
Mike

David Daney wrote:
> Move the initialization of irq_default_affinity to early_irq_init as
> core_initcall is too late.
> 
> irq_default_affinity can be used in init_IRQ and potentially timer and
> SMP init as well.  All of these happen before core_initcall.  Moving
> the initialization to early_irq_init ensures that it is initialized
> before it is used.
> 
> Signed-off-by: David Daney <ddaney@caviumnetworks.com>
> ---
>  kernel/irq/handle.c |   12 ++++++++++++
>  kernel/irq/manage.c |    8 --------
>  2 files changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
> index c20db0b..a9fbb01 100644
> --- a/kernel/irq/handle.c
> +++ b/kernel/irq/handle.c
> @@ -39,6 +39,14 @@ void handle_bad_irq(unsigned int irq, struct irq_desc *desc)
>  	ack_bad_irq(irq);
>  }
>  
> +static inline void __init init_irq_default_affinity(void)
> +{
> +#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
> +	alloc_bootmem_cpumask_var(&irq_default_affinity);
> +	cpumask_setall(irq_default_affinity);
> +#endif
> +}
> +
>  /*
>   * Linux has a controller-independent interrupt architecture.
>   * Every controller has a 'controller-template', that is used
> @@ -134,6 +142,8 @@ int __init early_irq_init(void)
>  	int legacy_count;
>  	int i;
>  
> +	init_irq_default_affinity();
> +
>  	desc = irq_desc_legacy;
>  	legacy_count = ARRAY_SIZE(irq_desc_legacy);
>  
> @@ -219,6 +229,8 @@ int __init early_irq_init(void)
>  	int count;
>  	int i;
>  
> +	init_irq_default_affinity();
> +
>  	desc = irq_desc;
>  	count = ARRAY_SIZE(irq_desc);
>  
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index 618a64f..291f036 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -18,14 +18,6 @@
>  #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
>  cpumask_var_t irq_default_affinity;
>  
> -static int init_irq_default_affinity(void)
> -{
> -	alloc_cpumask_var(&irq_default_affinity, GFP_KERNEL);
> -	cpumask_setall(irq_default_affinity);
> -	return 0;
> -}
> -core_initcall(init_irq_default_affinity);
> -
>  /**
>   *	synchronize_irq - wait for pending IRQ handlers (on other CPUs)
>   *	@irq: interrupt number to wait for


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

end of thread, other threads:[~2009-01-08 23:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-08 22:53 [PATCH 0/2] cpumask fallout: Initialize irq_default_affinity earlier et al David Daney
2009-01-08 22:55 ` [PATCH 1/2] Make irq_*_affinity depend on CONFIG_GENERIC_HARDIRQS too David Daney
2009-01-08 22:55 ` [PATCH 2/2] cpumask fallout: Initialize irq_default_affinity earlier (v2) David Daney
2009-01-08 23:04   ` Ihar Hrachyshka
2009-01-08 23:11   ` Mike Travis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox