diff options
author | Yinghai Lu <yinghai@kernel.org> | 2009-04-27 20:57:18 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-28 06:21:14 -0400 |
commit | 9ec4fa271faf2db3b8e1419c998da1ca6b094eb6 (patch) | |
tree | 2dd817bd41526fc1d1252e50b0b1a0714ae34a7f /include/linux | |
parent | e25c2c873f59c57cf1c2b1979cc8fb01958305ef (diff) |
irq, cpumask: correct CPUMASKS_OFFSTACK typo and fix fallout
CPUMASKS_OFFSTACK is not defined anywhere (it is CPUMASK_OFFSTACK).
It is a typo and init_allocate_desc_masks() is called before it set
affinity to all cpus...
Split init_alloc_desc_masks() into all_desc_masks() and init_desc_masks().
Also use CPUMASK_OFFSTACK in alloc_desc_masks().
[ Impact: fix smp_affinity copying/setup when moving irq_desc between CPUs ]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
LKML-Reference: <49F6546E.3040406@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/irq.h | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h index b7cbeed972e4..c4953cf27e5e 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -424,27 +424,25 @@ extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); | |||
424 | 424 | ||
425 | #ifdef CONFIG_SMP | 425 | #ifdef CONFIG_SMP |
426 | /** | 426 | /** |
427 | * init_alloc_desc_masks - allocate cpumasks for irq_desc | 427 | * alloc_desc_masks - allocate cpumasks for irq_desc |
428 | * @desc: pointer to irq_desc struct | 428 | * @desc: pointer to irq_desc struct |
429 | * @cpu: cpu which will be handling the cpumasks | 429 | * @cpu: cpu which will be handling the cpumasks |
430 | * @boot: true if need bootmem | 430 | * @boot: true if need bootmem |
431 | * | 431 | * |
432 | * Allocates affinity and pending_mask cpumask if required. | 432 | * Allocates affinity and pending_mask cpumask if required. |
433 | * Returns true if successful (or not required). | 433 | * Returns true if successful (or not required). |
434 | * Side effect: affinity has all bits set, pending_mask has all bits clear. | ||
435 | */ | 434 | */ |
436 | static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu, | 435 | static inline bool alloc_desc_masks(struct irq_desc *desc, int cpu, |
437 | bool boot) | 436 | bool boot) |
438 | { | 437 | { |
438 | #ifdef CONFIG_CPUMASK_OFFSTACK | ||
439 | int node; | 439 | int node; |
440 | 440 | ||
441 | if (boot) { | 441 | if (boot) { |
442 | alloc_bootmem_cpumask_var(&desc->affinity); | 442 | alloc_bootmem_cpumask_var(&desc->affinity); |
443 | cpumask_setall(desc->affinity); | ||
444 | 443 | ||
445 | #ifdef CONFIG_GENERIC_PENDING_IRQ | 444 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
446 | alloc_bootmem_cpumask_var(&desc->pending_mask); | 445 | alloc_bootmem_cpumask_var(&desc->pending_mask); |
447 | cpumask_clear(desc->pending_mask); | ||
448 | #endif | 446 | #endif |
449 | return true; | 447 | return true; |
450 | } | 448 | } |
@@ -453,18 +451,25 @@ static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu, | |||
453 | 451 | ||
454 | if (!alloc_cpumask_var_node(&desc->affinity, GFP_ATOMIC, node)) | 452 | if (!alloc_cpumask_var_node(&desc->affinity, GFP_ATOMIC, node)) |
455 | return false; | 453 | return false; |
456 | cpumask_setall(desc->affinity); | ||
457 | 454 | ||
458 | #ifdef CONFIG_GENERIC_PENDING_IRQ | 455 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
459 | if (!alloc_cpumask_var_node(&desc->pending_mask, GFP_ATOMIC, node)) { | 456 | if (!alloc_cpumask_var_node(&desc->pending_mask, GFP_ATOMIC, node)) { |
460 | free_cpumask_var(desc->affinity); | 457 | free_cpumask_var(desc->affinity); |
461 | return false; | 458 | return false; |
462 | } | 459 | } |
463 | cpumask_clear(desc->pending_mask); | 460 | #endif |
464 | #endif | 461 | #endif |
465 | return true; | 462 | return true; |
466 | } | 463 | } |
467 | 464 | ||
465 | static inline void init_desc_masks(struct irq_desc *desc) | ||
466 | { | ||
467 | cpumask_setall(desc->affinity); | ||
468 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
469 | cpumask_clear(desc->pending_mask); | ||
470 | #endif | ||
471 | } | ||
472 | |||
468 | /** | 473 | /** |
469 | * init_copy_desc_masks - copy cpumasks for irq_desc | 474 | * init_copy_desc_masks - copy cpumasks for irq_desc |
470 | * @old_desc: pointer to old irq_desc struct | 475 | * @old_desc: pointer to old irq_desc struct |
@@ -478,7 +483,7 @@ static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu, | |||
478 | static inline void init_copy_desc_masks(struct irq_desc *old_desc, | 483 | static inline void init_copy_desc_masks(struct irq_desc *old_desc, |
479 | struct irq_desc *new_desc) | 484 | struct irq_desc *new_desc) |
480 | { | 485 | { |
481 | #ifdef CONFIG_CPUMASKS_OFFSTACK | 486 | #ifdef CONFIG_CPUMASK_OFFSTACK |
482 | cpumask_copy(new_desc->affinity, old_desc->affinity); | 487 | cpumask_copy(new_desc->affinity, old_desc->affinity); |
483 | 488 | ||
484 | #ifdef CONFIG_GENERIC_PENDING_IRQ | 489 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
@@ -499,12 +504,16 @@ static inline void free_desc_masks(struct irq_desc *old_desc, | |||
499 | 504 | ||
500 | #else /* !CONFIG_SMP */ | 505 | #else /* !CONFIG_SMP */ |
501 | 506 | ||
502 | static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu, | 507 | static inline bool alloc_desc_masks(struct irq_desc *desc, int cpu, |
503 | bool boot) | 508 | bool boot) |
504 | { | 509 | { |
505 | return true; | 510 | return true; |
506 | } | 511 | } |
507 | 512 | ||
513 | static inline void init_desc_masks(struct irq_desc *desc) | ||
514 | { | ||
515 | } | ||
516 | |||
508 | static inline void init_copy_desc_masks(struct irq_desc *old_desc, | 517 | static inline void init_copy_desc_masks(struct irq_desc *old_desc, |
509 | struct irq_desc *new_desc) | 518 | struct irq_desc *new_desc) |
510 | { | 519 | { |