[PATCH] s390: additional_cpus parameter

Introduce additional_cpus command line option. By default no additional cpu
can be attached to the system anymore. Only the cpus present at IPL time can
be switched on/off. If it is desired that additional cpus can be attached to
the system the maximum number of additional cpus needs to be specified with
this option.

This change is necessary in order to limit the waste of per_cpu data
structures.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Heiko Carstens and committed by Linus Torvalds 255acee7 1fca251f

+49 -23
+5 -5
Documentation/cpu-hotplug.txt
··· 11 11 Joel Schopp <jschopp@austin.ibm.com> 12 12 ia64/x86_64: 13 13 Ashok Raj <ashok.raj@intel.com> 14 + s390: 15 + Heiko Carstens <heiko.carstens@de.ibm.com> 14 16 15 17 Authors: Ashok Raj <ashok.raj@intel.com> 16 18 Lots of feedback: Nathan Lynch <nathanl@austin.ibm.com>, ··· 46 44 maxcpus=2 will only boot 2. You can choose to bring the 47 45 other cpus later online, read FAQ's for more info. 48 46 49 - additional_cpus*=n Use this to limit hotpluggable cpus. This option sets 50 - cpu_possible_map = cpu_present_map + additional_cpus 51 - 52 - (*) Option valid only for following architectures 53 - - x86_64, ia64 47 + additional_cpus=n [x86_64, s390 only] use this to limit hotpluggable cpus. 48 + This option sets 49 + cpu_possible_map = cpu_present_map + additional_cpus 54 50 55 51 ia64 and x86_64 use the number of disabled local apics in ACPI tables MADT 56 52 to determine the number of potentially hot-pluggable cpus. The implementation
+2
arch/s390/kernel/setup.c
··· 600 600 init_mm.brk = (unsigned long) &_end; 601 601 602 602 parse_cmdline_early(cmdline_p); 603 + parse_early_param(); 603 604 604 605 setup_memory(); 605 606 setup_resources(); ··· 608 607 609 608 cpu_init(); 610 609 __cpu_logical_map[0] = S390_lowcore.cpu_data.cpu_addr; 610 + smp_setup_cpu_possible_map(); 611 611 612 612 /* 613 613 * Create kernel page tables and switch to virtual addressing.
+40 -18
arch/s390/kernel/smp.c
··· 1 1 /* 2 2 * arch/s390/kernel/smp.c 3 3 * 4 - * S390 version 5 - * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation 4 + * Copyright (C) IBM Corp. 1999,2006 6 5 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), 7 6 * Martin Schwidefsky (schwidefsky@de.ibm.com) 8 7 * Heiko Carstens (heiko.carstens@de.ibm.com) ··· 40 41 #include <asm/cpcmd.h> 41 42 #include <asm/tlbflush.h> 42 43 43 - /* prototypes */ 44 - 45 44 extern volatile int __cpu_logical_map[]; 46 45 47 46 /* ··· 48 51 49 52 struct _lowcore *lowcore_ptr[NR_CPUS]; 50 53 51 - cpumask_t cpu_online_map; 52 - cpumask_t cpu_possible_map = CPU_MASK_ALL; 54 + cpumask_t cpu_online_map = CPU_MASK_NONE; 55 + cpumask_t cpu_possible_map = CPU_MASK_NONE; 53 56 54 57 static struct task_struct *current_set[NR_CPUS]; 55 - 56 - EXPORT_SYMBOL(cpu_online_map); 57 58 58 59 /* 59 60 * Reboot, halt and power_off routines for SMP. ··· 485 490 * Lets check how many CPUs we have. 486 491 */ 487 492 488 - void 489 - __init smp_check_cpus(unsigned int max_cpus) 493 + static unsigned int 494 + __init smp_count_cpus(void) 490 495 { 491 - int cpu, num_cpus; 496 + unsigned int cpu, num_cpus; 492 497 __u16 boot_cpu_addr; 493 498 494 499 /* ··· 498 503 boot_cpu_addr = S390_lowcore.cpu_data.cpu_addr; 499 504 current_thread_info()->cpu = 0; 500 505 num_cpus = 1; 501 - for (cpu = 0; cpu <= 65535 && num_cpus < max_cpus; cpu++) { 506 + for (cpu = 0; cpu <= 65535; cpu++) { 502 507 if ((__u16) cpu == boot_cpu_addr) 503 508 continue; 504 - __cpu_logical_map[num_cpus] = (__u16) cpu; 505 - if (signal_processor(num_cpus, sigp_sense) == 509 + __cpu_logical_map[1] = (__u16) cpu; 510 + if (signal_processor(1, sigp_sense) == 506 511 sigp_not_operational) 507 512 continue; 508 - cpu_set(num_cpus, cpu_present_map); 509 513 num_cpus++; 510 514 } 511 515 512 516 printk("Detected %d CPU's\n",(int) num_cpus); 513 517 printk("Boot cpu address %2X\n", boot_cpu_addr); 518 + 519 + return num_cpus; 514 520 } 515 521 516 522 /* ··· 672 676 return 0; 673 677 } 674 678 679 + static unsigned int __initdata additional_cpus; 680 + 681 + void __init smp_setup_cpu_possible_map(void) 682 + { 683 + unsigned int pcpus, cpu; 684 + 685 + pcpus = smp_count_cpus() + additional_cpus; 686 + 687 + if (pcpus > NR_CPUS) 688 + pcpus = NR_CPUS; 689 + 690 + for (cpu = 0; cpu < pcpus; cpu++) 691 + cpu_set(cpu, cpu_possible_map); 692 + 693 + cpu_present_map = cpu_possible_map; 694 + } 695 + 696 + #ifdef CONFIG_HOTPLUG_CPU 697 + 698 + static int __init setup_additional_cpus(char *s) 699 + { 700 + additional_cpus = simple_strtoul(s, NULL, 0); 701 + return 0; 702 + } 703 + early_param("additional_cpus", setup_additional_cpus); 704 + 675 705 int 676 706 __cpu_disable(void) 677 707 { ··· 766 744 for(;;); 767 745 } 768 746 747 + #endif /* CONFIG_HOTPLUG_CPU */ 748 + 769 749 /* 770 750 * Cycle through the processors and setup structures. 771 751 */ ··· 781 757 /* request the 0x1201 emergency signal external interrupt */ 782 758 if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0) 783 759 panic("Couldn't request external interrupt 0x1201"); 784 - smp_check_cpus(max_cpus); 785 760 memset(lowcore_ptr,0,sizeof(lowcore_ptr)); 786 761 /* 787 762 * Initialize prefix pages and stacks for all possible cpus ··· 829 806 BUG_ON(smp_processor_id() != 0); 830 807 831 808 cpu_set(0, cpu_online_map); 832 - cpu_set(0, cpu_present_map); 833 809 S390_lowcore.percpu_offset = __per_cpu_offset[0]; 834 810 current_set[0] = current; 835 811 } 836 812 837 813 void smp_cpus_done(unsigned int max_cpus) 838 814 { 839 - cpu_present_map = cpu_possible_map; 840 815 } 841 816 842 817 /* ··· 866 845 867 846 subsys_initcall(topology_init); 868 847 848 + EXPORT_SYMBOL(cpu_online_map); 869 849 EXPORT_SYMBOL(cpu_possible_map); 870 850 EXPORT_SYMBOL(lowcore_ptr); 871 851 EXPORT_SYMBOL(smp_ctl_set_bit);
+2
include/asm-s390/smp.h
··· 31 31 __u16 cpu; 32 32 } sigp_info; 33 33 34 + extern void smp_setup_cpu_possible_map(void); 34 35 extern int smp_call_function_on(void (*func) (void *info), void *info, 35 36 int nonatomic, int wait, int cpu); 36 37 #define NO_PROC_ID 0xFF /* No processor magic marker */ ··· 105 104 #define smp_cpu_not_running(cpu) 1 106 105 #define smp_get_cpu(cpu) ({ 0; }) 107 106 #define smp_put_cpu(cpu) ({ 0; }) 107 + #define smp_setup_cpu_possible_map() 108 108 #endif 109 109 110 110 #endif