diff options
author | David S. Miller <davem@davemloft.net> | 2011-08-05 05:38:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-08-05 05:38:27 -0400 |
commit | 961f65fc41cdc1f9099a6075258816c0db98e390 (patch) | |
tree | 867a00c32303c8aeaaef35ae9b49d93b7cacf8e9 /arch | |
parent | 9076d0e7e02b98f7a65df10d1956326c8d8ba61a (diff) |
sparc: Size mondo queues more sanely.
There is currently no upper limit on the mondo queue sizes we'll use,
which guarentees that we'll eventually his page allocation limits, and
thus allocation failures, due to MAX_ORDER.
Cap the sizes sanely, current limits are:
CPU MONDO 2 * max_possible_cpus
DEV MONDO 256 (basically NR_IRQS)
RES MONDO 128
NRES MONDO 4
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sparc/kernel/mdesc.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c index 42f28c7420e1..acaebb63c4fd 100644 --- a/arch/sparc/kernel/mdesc.c +++ b/arch/sparc/kernel/mdesc.c | |||
@@ -508,6 +508,8 @@ const char *mdesc_node_name(struct mdesc_handle *hp, u64 node) | |||
508 | } | 508 | } |
509 | EXPORT_SYMBOL(mdesc_node_name); | 509 | EXPORT_SYMBOL(mdesc_node_name); |
510 | 510 | ||
511 | static u64 max_cpus = 64; | ||
512 | |||
511 | static void __init report_platform_properties(void) | 513 | static void __init report_platform_properties(void) |
512 | { | 514 | { |
513 | struct mdesc_handle *hp = mdesc_grab(); | 515 | struct mdesc_handle *hp = mdesc_grab(); |
@@ -543,8 +545,10 @@ static void __init report_platform_properties(void) | |||
543 | if (v) | 545 | if (v) |
544 | printk("PLATFORM: watchdog-max-timeout [%llu ms]\n", *v); | 546 | printk("PLATFORM: watchdog-max-timeout [%llu ms]\n", *v); |
545 | v = mdesc_get_property(hp, pn, "max-cpus", NULL); | 547 | v = mdesc_get_property(hp, pn, "max-cpus", NULL); |
546 | if (v) | 548 | if (v) { |
547 | printk("PLATFORM: max-cpus [%llu]\n", *v); | 549 | max_cpus = *v; |
550 | printk("PLATFORM: max-cpus [%llu]\n", max_cpus); | ||
551 | } | ||
548 | 552 | ||
549 | #ifdef CONFIG_SMP | 553 | #ifdef CONFIG_SMP |
550 | { | 554 | { |
@@ -715,7 +719,7 @@ static void __cpuinit set_proc_ids(struct mdesc_handle *hp) | |||
715 | } | 719 | } |
716 | 720 | ||
717 | static void __cpuinit get_one_mondo_bits(const u64 *p, unsigned int *mask, | 721 | static void __cpuinit get_one_mondo_bits(const u64 *p, unsigned int *mask, |
718 | unsigned char def) | 722 | unsigned long def, unsigned long max) |
719 | { | 723 | { |
720 | u64 val; | 724 | u64 val; |
721 | 725 | ||
@@ -726,6 +730,9 @@ static void __cpuinit get_one_mondo_bits(const u64 *p, unsigned int *mask, | |||
726 | if (!val || val >= 64) | 730 | if (!val || val >= 64) |
727 | goto use_default; | 731 | goto use_default; |
728 | 732 | ||
733 | if (val > max) | ||
734 | val = max; | ||
735 | |||
729 | *mask = ((1U << val) * 64U) - 1U; | 736 | *mask = ((1U << val) * 64U) - 1U; |
730 | return; | 737 | return; |
731 | 738 | ||
@@ -736,19 +743,28 @@ use_default: | |||
736 | static void __cpuinit get_mondo_data(struct mdesc_handle *hp, u64 mp, | 743 | static void __cpuinit get_mondo_data(struct mdesc_handle *hp, u64 mp, |
737 | struct trap_per_cpu *tb) | 744 | struct trap_per_cpu *tb) |
738 | { | 745 | { |
746 | static int printed; | ||
739 | const u64 *val; | 747 | const u64 *val; |
740 | 748 | ||
741 | val = mdesc_get_property(hp, mp, "q-cpu-mondo-#bits", NULL); | 749 | val = mdesc_get_property(hp, mp, "q-cpu-mondo-#bits", NULL); |
742 | get_one_mondo_bits(val, &tb->cpu_mondo_qmask, 7); | 750 | get_one_mondo_bits(val, &tb->cpu_mondo_qmask, 7, ilog2(max_cpus * 2)); |
743 | 751 | ||
744 | val = mdesc_get_property(hp, mp, "q-dev-mondo-#bits", NULL); | 752 | val = mdesc_get_property(hp, mp, "q-dev-mondo-#bits", NULL); |
745 | get_one_mondo_bits(val, &tb->dev_mondo_qmask, 7); | 753 | get_one_mondo_bits(val, &tb->dev_mondo_qmask, 7, 8); |
746 | 754 | ||
747 | val = mdesc_get_property(hp, mp, "q-resumable-#bits", NULL); | 755 | val = mdesc_get_property(hp, mp, "q-resumable-#bits", NULL); |
748 | get_one_mondo_bits(val, &tb->resum_qmask, 6); | 756 | get_one_mondo_bits(val, &tb->resum_qmask, 6, 7); |
749 | 757 | ||
750 | val = mdesc_get_property(hp, mp, "q-nonresumable-#bits", NULL); | 758 | val = mdesc_get_property(hp, mp, "q-nonresumable-#bits", NULL); |
751 | get_one_mondo_bits(val, &tb->nonresum_qmask, 2); | 759 | get_one_mondo_bits(val, &tb->nonresum_qmask, 2, 2); |
760 | if (!printed++) { | ||
761 | pr_info("SUN4V: Mondo queue sizes " | ||
762 | "[cpu(%u) dev(%u) r(%u) nr(%u)]\n", | ||
763 | tb->cpu_mondo_qmask + 1, | ||
764 | tb->dev_mondo_qmask + 1, | ||
765 | tb->resum_qmask + 1, | ||
766 | tb->nonresum_qmask + 1); | ||
767 | } | ||
752 | } | 768 | } |
753 | 769 | ||
754 | static void * __cpuinit mdesc_iterate_over_cpus(void *(*func)(struct mdesc_handle *, u64, int, void *), void *arg, cpumask_t *mask) | 770 | static void * __cpuinit mdesc_iterate_over_cpus(void *(*func)(struct mdesc_handle *, u64, int, void *), void *arg, cpumask_t *mask) |