smpboot.c (42249094f79422fbf5ed4b54eeb48ff096809b8f) | smpboot.c (5d2068da8d339e4dff8f9b9a1246e6a79e2949d8) |
---|---|
1/* 2 * SMP boot-related support 3 * 4 * Copyright (C) 1998-2003, 2005 Hewlett-Packard Co 5 * David Mosberger-Tang <davidm@hpl.hp.com> 6 * Copyright (C) 2001, 2004-2005 Intel Corp 7 * Rohit Seth <rohit.seth@intel.com> 8 * Suresh Siddha <suresh.b.siddha@intel.com> --- 420 unchanged lines hidden (view full) --- 429 last_cpuinfo->archrev != this_cpuinfo->archrev || 430 last_cpuinfo->model != this_cpuinfo->model) 431 calibrate_delay(); 432 local_cpu_data->loops_per_jiffy = loops_per_jiffy; 433 434 /* 435 * Allow the master to continue. 436 */ | 1/* 2 * SMP boot-related support 3 * 4 * Copyright (C) 1998-2003, 2005 Hewlett-Packard Co 5 * David Mosberger-Tang <davidm@hpl.hp.com> 6 * Copyright (C) 2001, 2004-2005 Intel Corp 7 * Rohit Seth <rohit.seth@intel.com> 8 * Suresh Siddha <suresh.b.siddha@intel.com> --- 420 unchanged lines hidden (view full) --- 429 last_cpuinfo->archrev != this_cpuinfo->archrev || 430 last_cpuinfo->model != this_cpuinfo->model) 431 calibrate_delay(); 432 local_cpu_data->loops_per_jiffy = loops_per_jiffy; 433 434 /* 435 * Allow the master to continue. 436 */ |
437 cpu_set(cpuid, cpu_callin_map); | 437 cpumask_set_cpu(cpuid, &cpu_callin_map); |
438 Dprintk("Stack on CPU %d at about %p\n",cpuid, &cpuid); 439} 440 441 442/* 443 * Activate a secondary processor. head.S calls this. 444 */ 445int --- 24 unchanged lines hidden (view full) --- 470 set_brendez_area(cpu); 471 platform_send_ipi(cpu, ap_wakeup_vector, IA64_IPI_DM_INT, 0); 472 473 /* 474 * Wait 10s total for the AP to start 475 */ 476 Dprintk("Waiting on callin_map ..."); 477 for (timeout = 0; timeout < 100000; timeout++) { | 438 Dprintk("Stack on CPU %d at about %p\n",cpuid, &cpuid); 439} 440 441 442/* 443 * Activate a secondary processor. head.S calls this. 444 */ 445int --- 24 unchanged lines hidden (view full) --- 470 set_brendez_area(cpu); 471 platform_send_ipi(cpu, ap_wakeup_vector, IA64_IPI_DM_INT, 0); 472 473 /* 474 * Wait 10s total for the AP to start 475 */ 476 Dprintk("Waiting on callin_map ..."); 477 for (timeout = 0; timeout < 100000; timeout++) { |
478 if (cpu_isset(cpu, cpu_callin_map)) | 478 if (cpumask_test_cpu(cpu, &cpu_callin_map)) |
479 break; /* It has booted */ 480 udelay(100); 481 } 482 Dprintk("\n"); 483 | 479 break; /* It has booted */ 480 udelay(100); 481 } 482 Dprintk("\n"); 483 |
484 if (!cpu_isset(cpu, cpu_callin_map)) { | 484 if (!cpumask_test_cpu(cpu, &cpu_callin_map)) { |
485 printk(KERN_ERR "Processor 0x%x/0x%x is stuck.\n", cpu, sapicid); 486 ia64_cpu_to_sapicid[cpu] = -1; 487 set_cpu_online(cpu, false); /* was set in smp_callin() */ 488 return -EINVAL; 489 } 490 return 0; 491} 492 --- 43 unchanged lines hidden (view full) --- 536 int boot_cpu_id = hard_smp_processor_id(); 537 538 /* 539 * Initialize the per-CPU profiling counter/multiplier 540 */ 541 542 smp_setup_percpu_timer(); 543 | 485 printk(KERN_ERR "Processor 0x%x/0x%x is stuck.\n", cpu, sapicid); 486 ia64_cpu_to_sapicid[cpu] = -1; 487 set_cpu_online(cpu, false); /* was set in smp_callin() */ 488 return -EINVAL; 489 } 490 return 0; 491} 492 --- 43 unchanged lines hidden (view full) --- 536 int boot_cpu_id = hard_smp_processor_id(); 537 538 /* 539 * Initialize the per-CPU profiling counter/multiplier 540 */ 541 542 smp_setup_percpu_timer(); 543 |
544 cpu_set(0, cpu_callin_map); | 544 cpumask_set_cpu(0, &cpu_callin_map); |
545 546 local_cpu_data->loops_per_jiffy = loops_per_jiffy; 547 ia64_cpu_to_sapicid[0] = boot_cpu_id; 548 549 printk(KERN_INFO "Boot processor id 0x%x/0x%x\n", 0, boot_cpu_id); 550 551 current_thread_info()->cpu = 0; 552 --- 7 unchanged lines hidden (view full) --- 560 init_cpu_possible(cpumask_of(0)); 561 return; 562 } 563} 564 565void smp_prepare_boot_cpu(void) 566{ 567 set_cpu_online(smp_processor_id(), true); | 545 546 local_cpu_data->loops_per_jiffy = loops_per_jiffy; 547 ia64_cpu_to_sapicid[0] = boot_cpu_id; 548 549 printk(KERN_INFO "Boot processor id 0x%x/0x%x\n", 0, boot_cpu_id); 550 551 current_thread_info()->cpu = 0; 552 --- 7 unchanged lines hidden (view full) --- 560 init_cpu_possible(cpumask_of(0)); 561 return; 562 } 563} 564 565void smp_prepare_boot_cpu(void) 566{ 567 set_cpu_online(smp_processor_id(), true); |
568 cpu_set(smp_processor_id(), cpu_callin_map); | 568 cpumask_set_cpu(smp_processor_id(), &cpu_callin_map); |
569 set_numa_node(cpu_to_node_map[smp_processor_id()]); 570 per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE; 571 paravirt_post_smp_prepare_boot_cpu(); 572} 573 574#ifdef CONFIG_HOTPLUG_CPU 575static inline void 576clear_cpu_sibling_map(int cpu) 577{ 578 int i; 579 | 569 set_numa_node(cpu_to_node_map[smp_processor_id()]); 570 per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE; 571 paravirt_post_smp_prepare_boot_cpu(); 572} 573 574#ifdef CONFIG_HOTPLUG_CPU 575static inline void 576clear_cpu_sibling_map(int cpu) 577{ 578 int i; 579 |
580 for_each_cpu_mask(i, per_cpu(cpu_sibling_map, cpu)) 581 cpu_clear(cpu, per_cpu(cpu_sibling_map, i)); 582 for_each_cpu_mask(i, cpu_core_map[cpu]) 583 cpu_clear(cpu, cpu_core_map[i]); | 580 for_each_cpu(i, &per_cpu(cpu_sibling_map, cpu)) 581 cpumask_clear_cpu(cpu, &per_cpu(cpu_sibling_map, i)); 582 for_each_cpu(i, &cpu_core_map[cpu]) 583 cpumask_clear_cpu(cpu, &cpu_core_map[i]); |
584 585 per_cpu(cpu_sibling_map, cpu) = cpu_core_map[cpu] = CPU_MASK_NONE; 586} 587 588static void 589remove_siblinginfo(int cpu) 590{ 591 int last = 0; 592 593 if (cpu_data(cpu)->threads_per_core == 1 && 594 cpu_data(cpu)->cores_per_socket == 1) { | 584 585 per_cpu(cpu_sibling_map, cpu) = cpu_core_map[cpu] = CPU_MASK_NONE; 586} 587 588static void 589remove_siblinginfo(int cpu) 590{ 591 int last = 0; 592 593 if (cpu_data(cpu)->threads_per_core == 1 && 594 cpu_data(cpu)->cores_per_socket == 1) { |
595 cpu_clear(cpu, cpu_core_map[cpu]); 596 cpu_clear(cpu, per_cpu(cpu_sibling_map, cpu)); | 595 cpumask_clear_cpu(cpu, &cpu_core_map[cpu]); 596 cpumask_clear_cpu(cpu, &per_cpu(cpu_sibling_map, cpu)); |
597 return; 598 } 599 | 597 return; 598 } 599 |
600 last = (cpus_weight(cpu_core_map[cpu]) == 1 ? 1 : 0); | 600 last = (cpumask_weight(&cpu_core_map[cpu]) == 1 ? 1 : 0); |
601 602 /* remove it from all sibling map's */ 603 clear_cpu_sibling_map(cpu); 604} 605 606extern void fixup_irqs(void); 607 608int migrate_platform_irqs(unsigned int cpu) --- 59 unchanged lines hidden (view full) --- 668 if (migrate_platform_irqs(cpu)) { 669 set_cpu_online(cpu, true); 670 return -EBUSY; 671 } 672 673 remove_siblinginfo(cpu); 674 fixup_irqs(); 675 local_flush_tlb_all(); | 601 602 /* remove it from all sibling map's */ 603 clear_cpu_sibling_map(cpu); 604} 605 606extern void fixup_irqs(void); 607 608int migrate_platform_irqs(unsigned int cpu) --- 59 unchanged lines hidden (view full) --- 668 if (migrate_platform_irqs(cpu)) { 669 set_cpu_online(cpu, true); 670 return -EBUSY; 671 } 672 673 remove_siblinginfo(cpu); 674 fixup_irqs(); 675 local_flush_tlb_all(); |
676 cpu_clear(cpu, cpu_callin_map); | 676 cpumask_clear_cpu(cpu, &cpu_callin_map); |
677 return 0; 678} 679 680void __cpu_die(unsigned int cpu) 681{ 682 unsigned int i; 683 684 for (i = 0; i < 100; i++) { --- 28 unchanged lines hidden (view full) --- 713} 714 715static inline void set_cpu_sibling_map(int cpu) 716{ 717 int i; 718 719 for_each_online_cpu(i) { 720 if ((cpu_data(cpu)->socket_id == cpu_data(i)->socket_id)) { | 677 return 0; 678} 679 680void __cpu_die(unsigned int cpu) 681{ 682 unsigned int i; 683 684 for (i = 0; i < 100; i++) { --- 28 unchanged lines hidden (view full) --- 713} 714 715static inline void set_cpu_sibling_map(int cpu) 716{ 717 int i; 718 719 for_each_online_cpu(i) { 720 if ((cpu_data(cpu)->socket_id == cpu_data(i)->socket_id)) { |
721 cpu_set(i, cpu_core_map[cpu]); 722 cpu_set(cpu, cpu_core_map[i]); | 721 cpumask_set_cpu(i, &cpu_core_map[cpu]); 722 cpumask_set_cpu(cpu, &cpu_core_map[i]); |
723 if (cpu_data(cpu)->core_id == cpu_data(i)->core_id) { | 723 if (cpu_data(cpu)->core_id == cpu_data(i)->core_id) { |
724 cpu_set(i, per_cpu(cpu_sibling_map, cpu)); 725 cpu_set(cpu, per_cpu(cpu_sibling_map, i)); | 724 cpumask_set_cpu(i, 725 &per_cpu(cpu_sibling_map, cpu)); 726 cpumask_set_cpu(cpu, 727 &per_cpu(cpu_sibling_map, i)); |
726 } 727 } 728 } 729} 730 731int 732__cpu_up(unsigned int cpu, struct task_struct *tidle) 733{ 734 int ret; 735 int sapicid; 736 737 sapicid = ia64_cpu_to_sapicid[cpu]; 738 if (sapicid == -1) 739 return -EINVAL; 740 741 /* 742 * Already booted cpu? not valid anymore since we dont 743 * do idle loop tightspin anymore. 744 */ | 728 } 729 } 730 } 731} 732 733int 734__cpu_up(unsigned int cpu, struct task_struct *tidle) 735{ 736 int ret; 737 int sapicid; 738 739 sapicid = ia64_cpu_to_sapicid[cpu]; 740 if (sapicid == -1) 741 return -EINVAL; 742 743 /* 744 * Already booted cpu? not valid anymore since we dont 745 * do idle loop tightspin anymore. 746 */ |
745 if (cpu_isset(cpu, cpu_callin_map)) | 747 if (cpumask_test_cpu(cpu, &cpu_callin_map)) |
746 return -EINVAL; 747 748 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; 749 /* Processor goes to start_secondary(), sets online flag */ 750 ret = do_boot_cpu(sapicid, cpu, tidle); 751 if (ret < 0) 752 return ret; 753 754 if (cpu_data(cpu)->threads_per_core == 1 && 755 cpu_data(cpu)->cores_per_socket == 1) { | 748 return -EINVAL; 749 750 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; 751 /* Processor goes to start_secondary(), sets online flag */ 752 ret = do_boot_cpu(sapicid, cpu, tidle); 753 if (ret < 0) 754 return ret; 755 756 if (cpu_data(cpu)->threads_per_core == 1 && 757 cpu_data(cpu)->cores_per_socket == 1) { |
756 cpu_set(cpu, per_cpu(cpu_sibling_map, cpu)); 757 cpu_set(cpu, cpu_core_map[cpu]); | 758 cpumask_set_cpu(cpu, &per_cpu(cpu_sibling_map, cpu)); 759 cpumask_set_cpu(cpu, &cpu_core_map[cpu]); |
758 return 0; 759 } 760 761 set_cpu_sibling_map(cpu); 762 763 return 0; 764} 765 --- 93 unchanged lines hidden --- | 760 return 0; 761 } 762 763 set_cpu_sibling_map(cpu); 764 765 return 0; 766} 767 --- 93 unchanged lines hidden --- |