diff options
Diffstat (limited to 'kernel/rcutree.c')
-rw-r--r-- | kernel/rcutree.c | 268 |
1 files changed, 134 insertions, 134 deletions
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 53ae9598f798..3ec8160fc75f 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <linux/cpu.h> | 46 | #include <linux/cpu.h> |
47 | #include <linux/mutex.h> | 47 | #include <linux/mutex.h> |
48 | #include <linux/time.h> | 48 | #include <linux/time.h> |
49 | #include <linux/kernel_stat.h> | ||
50 | 49 | ||
51 | #include "rcutree.h" | 50 | #include "rcutree.h" |
52 | 51 | ||
@@ -66,11 +65,11 @@ static struct lock_class_key rcu_node_class[NUM_RCU_LVLS]; | |||
66 | .signaled = RCU_GP_IDLE, \ | 65 | .signaled = RCU_GP_IDLE, \ |
67 | .gpnum = -300, \ | 66 | .gpnum = -300, \ |
68 | .completed = -300, \ | 67 | .completed = -300, \ |
69 | .onofflock = __SPIN_LOCK_UNLOCKED(&name.onofflock), \ | 68 | .onofflock = __RAW_SPIN_LOCK_UNLOCKED(&name.onofflock), \ |
70 | .orphan_cbs_list = NULL, \ | 69 | .orphan_cbs_list = NULL, \ |
71 | .orphan_cbs_tail = &name.orphan_cbs_list, \ | 70 | .orphan_cbs_tail = &name.orphan_cbs_list, \ |
72 | .orphan_qlen = 0, \ | 71 | .orphan_qlen = 0, \ |
73 | .fqslock = __SPIN_LOCK_UNLOCKED(&name.fqslock), \ | 72 | .fqslock = __RAW_SPIN_LOCK_UNLOCKED(&name.fqslock), \ |
74 | .n_force_qs = 0, \ | 73 | .n_force_qs = 0, \ |
75 | .n_force_qs_ngp = 0, \ | 74 | .n_force_qs_ngp = 0, \ |
76 | } | 75 | } |
@@ -81,9 +80,6 @@ DEFINE_PER_CPU(struct rcu_data, rcu_sched_data); | |||
81 | struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh_state); | 80 | struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh_state); |
82 | DEFINE_PER_CPU(struct rcu_data, rcu_bh_data); | 81 | DEFINE_PER_CPU(struct rcu_data, rcu_bh_data); |
83 | 82 | ||
84 | static int rcu_scheduler_active __read_mostly; | ||
85 | |||
86 | |||
87 | /* | 83 | /* |
88 | * Return true if an RCU grace period is in progress. The ACCESS_ONCE()s | 84 | * Return true if an RCU grace period is in progress. The ACCESS_ONCE()s |
89 | * permit this function to be invoked without holding the root rcu_node | 85 | * permit this function to be invoked without holding the root rcu_node |
@@ -157,6 +153,24 @@ long rcu_batches_completed_bh(void) | |||
157 | EXPORT_SYMBOL_GPL(rcu_batches_completed_bh); | 153 | EXPORT_SYMBOL_GPL(rcu_batches_completed_bh); |
158 | 154 | ||
159 | /* | 155 | /* |
156 | * Force a quiescent state for RCU BH. | ||
157 | */ | ||
158 | void rcu_bh_force_quiescent_state(void) | ||
159 | { | ||
160 | force_quiescent_state(&rcu_bh_state, 0); | ||
161 | } | ||
162 | EXPORT_SYMBOL_GPL(rcu_bh_force_quiescent_state); | ||
163 | |||
164 | /* | ||
165 | * Force a quiescent state for RCU-sched. | ||
166 | */ | ||
167 | void rcu_sched_force_quiescent_state(void) | ||
168 | { | ||
169 | force_quiescent_state(&rcu_sched_state, 0); | ||
170 | } | ||
171 | EXPORT_SYMBOL_GPL(rcu_sched_force_quiescent_state); | ||
172 | |||
173 | /* | ||
160 | * Does the CPU have callbacks ready to be invoked? | 174 | * Does the CPU have callbacks ready to be invoked? |
161 | */ | 175 | */ |
162 | static int | 176 | static int |
@@ -439,10 +453,10 @@ static void print_other_cpu_stall(struct rcu_state *rsp) | |||
439 | 453 | ||
440 | /* Only let one CPU complain about others per time interval. */ | 454 | /* Only let one CPU complain about others per time interval. */ |
441 | 455 | ||
442 | spin_lock_irqsave(&rnp->lock, flags); | 456 | raw_spin_lock_irqsave(&rnp->lock, flags); |
443 | delta = jiffies - rsp->jiffies_stall; | 457 | delta = jiffies - rsp->jiffies_stall; |
444 | if (delta < RCU_STALL_RAT_DELAY || !rcu_gp_in_progress(rsp)) { | 458 | if (delta < RCU_STALL_RAT_DELAY || !rcu_gp_in_progress(rsp)) { |
445 | spin_unlock_irqrestore(&rnp->lock, flags); | 459 | raw_spin_unlock_irqrestore(&rnp->lock, flags); |
446 | return; | 460 | return; |
447 | } | 461 | } |
448 | rsp->jiffies_stall = jiffies + RCU_SECONDS_TILL_STALL_RECHECK; | 462 | rsp->jiffies_stall = jiffies + RCU_SECONDS_TILL_STALL_RECHECK; |
@@ -452,13 +466,15 @@ static void print_other_cpu_stall(struct rcu_state *rsp) | |||
452 | * due to CPU offlining. | 466 | * due to CPU offlining. |
453 | */ | 467 | */ |
454 | rcu_print_task_stall(rnp); | 468 | rcu_print_task_stall(rnp); |
455 | spin_unlock_irqrestore(&rnp->lock, flags); | 469 | raw_spin_unlock_irqrestore(&rnp->lock, flags); |
456 | 470 | ||
457 | /* OK, time to rat on our buddy... */ | 471 | /* OK, time to rat on our buddy... */ |
458 | 472 | ||
459 | printk(KERN_ERR "INFO: RCU detected CPU stalls:"); | 473 | printk(KERN_ERR "INFO: RCU detected CPU stalls:"); |
460 | rcu_for_each_leaf_node(rsp, rnp) { | 474 | rcu_for_each_leaf_node(rsp, rnp) { |
475 | raw_spin_lock_irqsave(&rnp->lock, flags); | ||
461 | rcu_print_task_stall(rnp); | 476 | rcu_print_task_stall(rnp); |
477 | raw_spin_unlock_irqrestore(&rnp->lock, flags); | ||
462 | if (rnp->qsmask == 0) | 478 | if (rnp->qsmask == 0) |
463 | continue; | 479 | continue; |
464 | for (cpu = 0; cpu <= rnp->grphi - rnp->grplo; cpu++) | 480 | for (cpu = 0; cpu <= rnp->grphi - rnp->grplo; cpu++) |
@@ -469,6 +485,10 @@ static void print_other_cpu_stall(struct rcu_state *rsp) | |||
469 | smp_processor_id(), (long)(jiffies - rsp->gp_start)); | 485 | smp_processor_id(), (long)(jiffies - rsp->gp_start)); |
470 | trigger_all_cpu_backtrace(); | 486 | trigger_all_cpu_backtrace(); |
471 | 487 | ||
488 | /* If so configured, complain about tasks blocking the grace period. */ | ||
489 | |||
490 | rcu_print_detail_task_stall(rsp); | ||
491 | |||
472 | force_quiescent_state(rsp, 0); /* Kick them all. */ | 492 | force_quiescent_state(rsp, 0); /* Kick them all. */ |
473 | } | 493 | } |
474 | 494 | ||
@@ -481,11 +501,11 @@ static void print_cpu_stall(struct rcu_state *rsp) | |||
481 | smp_processor_id(), jiffies - rsp->gp_start); | 501 | smp_processor_id(), jiffies - rsp->gp_start); |
482 | trigger_all_cpu_backtrace(); | 502 | trigger_all_cpu_backtrace(); |
483 | 503 | ||
484 | spin_lock_irqsave(&rnp->lock, flags); | 504 | raw_spin_lock_irqsave(&rnp->lock, flags); |
485 | if ((long)(jiffies - rsp->jiffies_stall) >= 0) | 505 | if (ULONG_CMP_GE(jiffies, rsp->jiffies_stall)) |
486 | rsp->jiffies_stall = | 506 | rsp->jiffies_stall = |
487 | jiffies + RCU_SECONDS_TILL_STALL_RECHECK; | 507 | jiffies + RCU_SECONDS_TILL_STALL_RECHECK; |
488 | spin_unlock_irqrestore(&rnp->lock, flags); | 508 | raw_spin_unlock_irqrestore(&rnp->lock, flags); |
489 | 509 | ||
490 | set_need_resched(); /* kick ourselves to get things going. */ | 510 | set_need_resched(); /* kick ourselves to get things going. */ |
491 | } | 511 | } |
@@ -545,12 +565,12 @@ static void note_new_gpnum(struct rcu_state *rsp, struct rcu_data *rdp) | |||
545 | local_irq_save(flags); | 565 | local_irq_save(flags); |
546 | rnp = rdp->mynode; | 566 | rnp = rdp->mynode; |
547 | if (rdp->gpnum == ACCESS_ONCE(rnp->gpnum) || /* outside lock. */ | 567 | if (rdp->gpnum == ACCESS_ONCE(rnp->gpnum) || /* outside lock. */ |
548 | !spin_trylock(&rnp->lock)) { /* irqs already off, retry later. */ | 568 | !raw_spin_trylock(&rnp->lock)) { /* irqs already off, so later. */ |
549 | local_irq_restore(flags); | 569 | local_irq_restore(flags); |
550 | return; | 570 | return; |
551 | } | 571 | } |
552 | __note_new_gpnum(rsp, rnp, rdp); | 572 | __note_new_gpnum(rsp, rnp, rdp); |
553 | spin_unlock_irqrestore(&rnp->lock, flags); | 573 | raw_spin_unlock_irqrestore(&rnp->lock, flags); |
554 | } | 574 | } |
555 | 575 | ||
556 | /* | 576 | /* |
@@ -609,12 +629,12 @@ rcu_process_gp_end(struct rcu_state *rsp, struct rcu_data *rdp) | |||
609 | local_irq_save(flags); | 629 | local_irq_save(flags); |
610 | rnp = rdp->mynode; | 630 | rnp = rdp->mynode; |
611 | if (rdp->completed == ACCESS_ONCE(rnp->completed) || /* outside lock. */ | 631 | if (rdp->completed == ACCESS_ONCE(rnp->completed) || /* outside lock. */ |
612 | !spin_trylock(&rnp->lock)) { /* irqs already off, retry later. */ | 632 | !raw_spin_trylock(&rnp->lock)) { /* irqs already off, so later. */ |
613 | local_irq_restore(flags); | 633 | local_irq_restore(flags); |
614 | return; | 634 | return; |
615 | } | 635 | } |
616 | __rcu_process_gp_end(rsp, rnp, rdp); | 636 | __rcu_process_gp_end(rsp, rnp, rdp); |
617 | spin_unlock_irqrestore(&rnp->lock, flags); | 637 | raw_spin_unlock_irqrestore(&rnp->lock, flags); |
618 | } | 638 | } |
619 | 639 | ||
620 | /* | 640 | /* |
@@ -659,12 +679,14 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags) | |||
659 | struct rcu_data *rdp = rsp->rda[smp_processor_id()]; | 679 | struct rcu_data *rdp = rsp->rda[smp_processor_id()]; |
660 | struct rcu_node *rnp = rcu_get_root(rsp); | 680 | struct rcu_node *rnp = rcu_get_root(rsp); |
661 | 681 | ||
662 | if (!cpu_needs_another_gp(rsp, rdp)) { | 682 | if (!cpu_needs_another_gp(rsp, rdp) || rsp->fqs_active) { |
683 | if (cpu_needs_another_gp(rsp, rdp)) | ||
684 | rsp->fqs_need_gp = 1; | ||
663 | if (rnp->completed == rsp->completed) { | 685 | if (rnp->completed == rsp->completed) { |
664 | spin_unlock_irqrestore(&rnp->lock, flags); | 686 | raw_spin_unlock_irqrestore(&rnp->lock, flags); |
665 | return; | 687 | return; |
666 | } | 688 | } |
667 | spin_unlock(&rnp->lock); /* irqs remain disabled. */ | 689 | raw_spin_unlock(&rnp->lock); /* irqs remain disabled. */ |
668 | 690 | ||
669 | /* | 691 | /* |
670 | * Propagate new ->completed value to rcu_node structures | 692 | * Propagate new ->completed value to rcu_node structures |
@@ -672,9 +694,9 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags) | |||
672 | * of the next grace period to process their callbacks. | 694 | * of the next grace period to process their callbacks. |
673 | */ | 695 | */ |
674 | rcu_for_each_node_breadth_first(rsp, rnp) { | 696 | rcu_for_each_node_breadth_first(rsp, rnp) { |
675 | spin_lock(&rnp->lock); /* irqs already disabled. */ | 697 | raw_spin_lock(&rnp->lock); /* irqs already disabled. */ |
676 | rnp->completed = rsp->completed; | 698 | rnp->completed = rsp->completed; |
677 | spin_unlock(&rnp->lock); /* irqs remain disabled. */ | 699 | raw_spin_unlock(&rnp->lock); /* irqs remain disabled. */ |
678 | } | 700 | } |
679 | local_irq_restore(flags); | 701 | local_irq_restore(flags); |
680 | return; | 702 | return; |
@@ -695,15 +717,15 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags) | |||
695 | rnp->completed = rsp->completed; | 717 | rnp->completed = rsp->completed; |
696 | rsp->signaled = RCU_SIGNAL_INIT; /* force_quiescent_state OK. */ | 718 | rsp->signaled = RCU_SIGNAL_INIT; /* force_quiescent_state OK. */ |
697 | rcu_start_gp_per_cpu(rsp, rnp, rdp); | 719 | rcu_start_gp_per_cpu(rsp, rnp, rdp); |
698 | spin_unlock_irqrestore(&rnp->lock, flags); | 720 | raw_spin_unlock_irqrestore(&rnp->lock, flags); |
699 | return; | 721 | return; |
700 | } | 722 | } |
701 | 723 | ||
702 | spin_unlock(&rnp->lock); /* leave irqs disabled. */ | 724 | raw_spin_unlock(&rnp->lock); /* leave irqs disabled. */ |
703 | 725 | ||
704 | 726 | ||
705 | /* Exclude any concurrent CPU-hotplug operations. */ | 727 | /* Exclude any concurrent CPU-hotplug operations. */ |
706 | spin_lock(&rsp->onofflock); /* irqs already disabled. */ | 728 | raw_spin_lock(&rsp->onofflock); /* irqs already disabled. */ |
707 | 729 | ||
708 | /* | 730 | /* |
709 | * Set the quiescent-state-needed bits in all the rcu_node | 731 | * Set the quiescent-state-needed bits in all the rcu_node |
@@ -723,21 +745,21 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags) | |||
723 | * irqs disabled. | 745 | * irqs disabled. |
724 | */ | 746 | */ |
725 | rcu_for_each_node_breadth_first(rsp, rnp) { | 747 | rcu_for_each_node_breadth_first(rsp, rnp) { |
726 | spin_lock(&rnp->lock); /* irqs already disabled. */ | 748 | raw_spin_lock(&rnp->lock); /* irqs already disabled. */ |
727 | rcu_preempt_check_blocked_tasks(rnp); | 749 | rcu_preempt_check_blocked_tasks(rnp); |
728 | rnp->qsmask = rnp->qsmaskinit; | 750 | rnp->qsmask = rnp->qsmaskinit; |
729 | rnp->gpnum = rsp->gpnum; | 751 | rnp->gpnum = rsp->gpnum; |
730 | rnp->completed = rsp->completed; | 752 | rnp->completed = rsp->completed; |
731 | if (rnp == rdp->mynode) | 753 | if (rnp == rdp->mynode) |
732 | rcu_start_gp_per_cpu(rsp, rnp, rdp); | 754 | rcu_start_gp_per_cpu(rsp, rnp, rdp); |
733 | spin_unlock(&rnp->lock); /* irqs remain disabled. */ | 755 | raw_spin_unlock(&rnp->lock); /* irqs remain disabled. */ |
734 | } | 756 | } |
735 | 757 | ||
736 | rnp = rcu_get_root(rsp); | 758 | rnp = rcu_get_root(rsp); |
737 | spin_lock(&rnp->lock); /* irqs already disabled. */ | 759 | raw_spin_lock(&rnp->lock); /* irqs already disabled. */ |
738 | rsp->signaled = RCU_SIGNAL_INIT; /* force_quiescent_state now OK. */ | 760 | rsp->signaled = RCU_SIGNAL_INIT; /* force_quiescent_state now OK. */ |
739 | spin_unlock(&rnp->lock); /* irqs remain disabled. */ | 761 | raw_spin_unlock(&rnp->lock); /* irqs remain disabled. */ |
740 | spin_unlock_irqrestore(&rsp->onofflock, flags); | 762 | raw_spin_unlock_irqrestore(&rsp->onofflock, flags); |
741 | } | 763 | } |
742 | 764 | ||
743 | /* | 765 | /* |
@@ -776,14 +798,14 @@ rcu_report_qs_rnp(unsigned long mask, struct rcu_state *rsp, | |||
776 | if (!(rnp->qsmask & mask)) { | 798 | if (!(rnp->qsmask & mask)) { |
777 | 799 | ||
778 | /* Our bit has already been cleared, so done. */ | 800 | /* Our bit has already been cleared, so done. */ |
779 | spin_unlock_irqrestore(&rnp->lock, flags); | 801 | raw_spin_unlock_irqrestore(&rnp->lock, flags); |
780 | return; | 802 | return; |
781 | } | 803 | } |
782 | rnp->qsmask &= ~mask; | 804 | rnp->qsmask &= ~mask; |
783 | if (rnp->qsmask != 0 || rcu_preempted_readers(rnp)) { | 805 | if (rnp->qsmask != 0 || rcu_preempted_readers(rnp)) { |
784 | 806 | ||
785 | /* Other bits still set at this level, so done. */ | 807 | /* Other bits still set at this level, so done. */ |
786 | spin_unlock_irqrestore(&rnp->lock, flags); | 808 | raw_spin_unlock_irqrestore(&rnp->lock, flags); |
787 | return; | 809 | return; |
788 | } | 810 | } |
789 | mask = rnp->grpmask; | 811 | mask = rnp->grpmask; |
@@ -793,10 +815,10 @@ rcu_report_qs_rnp(unsigned long mask, struct rcu_state *rsp, | |||
793 | 815 | ||
794 | break; | 816 | break; |
795 | } | 817 | } |
796 | spin_unlock_irqrestore(&rnp->lock, flags); | 818 | raw_spin_unlock_irqrestore(&rnp->lock, flags); |
797 | rnp_c = rnp; | 819 | rnp_c = rnp; |
798 | rnp = rnp->parent; | 820 | rnp = rnp->parent; |
799 | spin_lock_irqsave(&rnp->lock, flags); | 821 | raw_spin_lock_irqsave(&rnp->lock, flags); |
800 | WARN_ON_ONCE(rnp_c->qsmask); | 822 | WARN_ON_ONCE(rnp_c->qsmask); |
801 | } | 823 | } |
802 | 824 | ||
@@ -825,7 +847,7 @@ rcu_report_qs_rdp(int cpu, struct rcu_state *rsp, struct rcu_data *rdp, long las | |||
825 | struct rcu_node *rnp; | 847 | struct rcu_node *rnp; |
826 | 848 | ||
827 | rnp = rdp->mynode; | 849 | rnp = rdp->mynode; |
828 | spin_lock_irqsave(&rnp->lock, flags); | 850 | raw_spin_lock_irqsave(&rnp->lock, flags); |
829 | if (lastcomp != rnp->completed) { | 851 | if (lastcomp != rnp->completed) { |
830 | 852 | ||
831 | /* | 853 | /* |
@@ -837,12 +859,12 @@ rcu_report_qs_rdp(int cpu, struct rcu_state *rsp, struct rcu_data *rdp, long las | |||
837 | * race occurred. | 859 | * race occurred. |
838 | */ | 860 | */ |
839 | rdp->passed_quiesc = 0; /* try again later! */ | 861 | rdp->passed_quiesc = 0; /* try again later! */ |
840 | spin_unlock_irqrestore(&rnp->lock, flags); | 862 | raw_spin_unlock_irqrestore(&rnp->lock, flags); |
841 | return; | 863 | return; |
842 | } | 864 | } |
843 | mask = rdp->grpmask; | 865 | mask = rdp->grpmask; |
844 | if ((rnp->qsmask & mask) == 0) { | 866 | if ((rnp->qsmask & mask) == 0) { |
845 | spin_unlock_irqrestore(&rnp->lock, flags); | 867 | raw_spin_unlock_irqrestore(&rnp->lock, flags); |
846 | } else { | 868 | } else { |
847 | rdp->qs_pending = 0; | 869 | rdp->qs_pending = 0; |
848 | 870 | ||
@@ -906,7 +928,7 @@ static void rcu_send_cbs_to_orphanage(struct rcu_state *rsp) | |||
906 | 928 | ||
907 | if (rdp->nxtlist == NULL) | 929 | if (rdp->nxtlist == NULL) |
908 | return; /* irqs disabled, so comparison is stable. */ | 930 | return; /* irqs disabled, so comparison is stable. */ |
909 | spin_lock(&rsp->onofflock); /* irqs already disabled. */ | 931 | raw_spin_lock(&rsp->onofflock); /* irqs already disabled. */ |
910 | *rsp->orphan_cbs_tail = rdp->nxtlist; | 932 | *rsp->orphan_cbs_tail = rdp->nxtlist; |
911 | rsp->orphan_cbs_tail = rdp->nxttail[RCU_NEXT_TAIL]; | 933 | rsp->orphan_cbs_tail = rdp->nxttail[RCU_NEXT_TAIL]; |
912 | rdp->nxtlist = NULL; | 934 | rdp->nxtlist = NULL; |
@@ -914,7 +936,7 @@ static void rcu_send_cbs_to_orphanage(struct rcu_state *rsp) | |||
914 | rdp->nxttail[i] = &rdp->nxtlist; | 936 | rdp->nxttail[i] = &rdp->nxtlist; |
915 | rsp->orphan_qlen += rdp->qlen; | 937 | rsp->orphan_qlen += rdp->qlen; |
916 | rdp->qlen = 0; | 938 | rdp->qlen = 0; |
917 | spin_unlock(&rsp->onofflock); /* irqs remain disabled. */ | 939 | raw_spin_unlock(&rsp->onofflock); /* irqs remain disabled. */ |
918 | } | 940 | } |
919 | 941 | ||
920 | /* | 942 | /* |
@@ -925,10 +947,10 @@ static void rcu_adopt_orphan_cbs(struct rcu_state *rsp) | |||
925 | unsigned long flags; | 947 | unsigned long flags; |
926 | struct rcu_data *rdp; | 948 | struct rcu_data *rdp; |
927 | 949 | ||
928 | spin_lock_irqsave(&rsp->onofflock, flags); | 950 | raw_spin_lock_irqsave(&rsp->onofflock, flags); |
929 | rdp = rsp->rda[smp_processor_id()]; | 951 | rdp = rsp->rda[smp_processor_id()]; |
930 | if (rsp->orphan_cbs_list == NULL) { | 952 | if (rsp->orphan_cbs_list == NULL) { |
931 | spin_unlock_irqrestore(&rsp->onofflock, flags); | 953 | raw_spin_unlock_irqrestore(&rsp->onofflock, flags); |
932 | return; | 954 | return; |
933 | } | 955 | } |
934 | *rdp->nxttail[RCU_NEXT_TAIL] = rsp->orphan_cbs_list; | 956 | *rdp->nxttail[RCU_NEXT_TAIL] = rsp->orphan_cbs_list; |
@@ -937,7 +959,7 @@ static void rcu_adopt_orphan_cbs(struct rcu_state *rsp) | |||
937 | rsp->orphan_cbs_list = NULL; | 959 | rsp->orphan_cbs_list = NULL; |
938 | rsp->orphan_cbs_tail = &rsp->orphan_cbs_list; | 960 | rsp->orphan_cbs_tail = &rsp->orphan_cbs_list; |
939 | rsp->orphan_qlen = 0; | 961 | rsp->orphan_qlen = 0; |
940 | spin_unlock_irqrestore(&rsp->onofflock, flags); | 962 | raw_spin_unlock_irqrestore(&rsp->onofflock, flags); |
941 | } | 963 | } |
942 | 964 | ||
943 | /* | 965 | /* |
@@ -953,23 +975,23 @@ static void __rcu_offline_cpu(int cpu, struct rcu_state *rsp) | |||
953 | struct rcu_node *rnp; | 975 | struct rcu_node *rnp; |
954 | 976 | ||
955 | /* Exclude any attempts to start a new grace period. */ | 977 | /* Exclude any attempts to start a new grace period. */ |
956 | spin_lock_irqsave(&rsp->onofflock, flags); | 978 | raw_spin_lock_irqsave(&rsp->onofflock, flags); |
957 | 979 | ||
958 | /* Remove the outgoing CPU from the masks in the rcu_node hierarchy. */ | 980 | /* Remove the outgoing CPU from the masks in the rcu_node hierarchy. */ |
959 | rnp = rdp->mynode; /* this is the outgoing CPU's rnp. */ | 981 | rnp = rdp->mynode; /* this is the outgoing CPU's rnp. */ |
960 | mask = rdp->grpmask; /* rnp->grplo is constant. */ | 982 | mask = rdp->grpmask; /* rnp->grplo is constant. */ |
961 | do { | 983 | do { |
962 | spin_lock(&rnp->lock); /* irqs already disabled. */ | 984 | raw_spin_lock(&rnp->lock); /* irqs already disabled. */ |
963 | rnp->qsmaskinit &= ~mask; | 985 | rnp->qsmaskinit &= ~mask; |
964 | if (rnp->qsmaskinit != 0) { | 986 | if (rnp->qsmaskinit != 0) { |
965 | if (rnp != rdp->mynode) | 987 | if (rnp != rdp->mynode) |
966 | spin_unlock(&rnp->lock); /* irqs remain disabled. */ | 988 | raw_spin_unlock(&rnp->lock); /* irqs remain disabled. */ |
967 | break; | 989 | break; |
968 | } | 990 | } |
969 | if (rnp == rdp->mynode) | 991 | if (rnp == rdp->mynode) |
970 | need_report = rcu_preempt_offline_tasks(rsp, rnp, rdp); | 992 | need_report = rcu_preempt_offline_tasks(rsp, rnp, rdp); |
971 | else | 993 | else |
972 | spin_unlock(&rnp->lock); /* irqs remain disabled. */ | 994 | raw_spin_unlock(&rnp->lock); /* irqs remain disabled. */ |
973 | mask = rnp->grpmask; | 995 | mask = rnp->grpmask; |
974 | rnp = rnp->parent; | 996 | rnp = rnp->parent; |
975 | } while (rnp != NULL); | 997 | } while (rnp != NULL); |
@@ -980,12 +1002,12 @@ static void __rcu_offline_cpu(int cpu, struct rcu_state *rsp) | |||
980 | * because invoking rcu_report_unblock_qs_rnp() with ->onofflock | 1002 | * because invoking rcu_report_unblock_qs_rnp() with ->onofflock |
981 | * held leads to deadlock. | 1003 | * held leads to deadlock. |
982 | */ | 1004 | */ |
983 | spin_unlock(&rsp->onofflock); /* irqs remain disabled. */ | 1005 | raw_spin_unlock(&rsp->onofflock); /* irqs remain disabled. */ |
984 | rnp = rdp->mynode; | 1006 | rnp = rdp->mynode; |
985 | if (need_report & RCU_OFL_TASKS_NORM_GP) | 1007 | if (need_report & RCU_OFL_TASKS_NORM_GP) |
986 | rcu_report_unblock_qs_rnp(rnp, flags); | 1008 | rcu_report_unblock_qs_rnp(rnp, flags); |
987 | else | 1009 | else |
988 | spin_unlock_irqrestore(&rnp->lock, flags); | 1010 | raw_spin_unlock_irqrestore(&rnp->lock, flags); |
989 | if (need_report & RCU_OFL_TASKS_EXP_GP) | 1011 | if (need_report & RCU_OFL_TASKS_EXP_GP) |
990 | rcu_report_exp_rnp(rsp, rnp); | 1012 | rcu_report_exp_rnp(rsp, rnp); |
991 | 1013 | ||
@@ -1144,11 +1166,9 @@ void rcu_check_callbacks(int cpu, int user) | |||
1144 | /* | 1166 | /* |
1145 | * Scan the leaf rcu_node structures, processing dyntick state for any that | 1167 | * Scan the leaf rcu_node structures, processing dyntick state for any that |
1146 | * have not yet encountered a quiescent state, using the function specified. | 1168 | * have not yet encountered a quiescent state, using the function specified. |
1147 | * Returns 1 if the current grace period ends while scanning (possibly | 1169 | * The caller must have suppressed start of new grace periods. |
1148 | * because we made it end). | ||
1149 | */ | 1170 | */ |
1150 | static int rcu_process_dyntick(struct rcu_state *rsp, long lastcomp, | 1171 | static void force_qs_rnp(struct rcu_state *rsp, int (*f)(struct rcu_data *)) |
1151 | int (*f)(struct rcu_data *)) | ||
1152 | { | 1172 | { |
1153 | unsigned long bit; | 1173 | unsigned long bit; |
1154 | int cpu; | 1174 | int cpu; |
@@ -1158,13 +1178,13 @@ static int rcu_process_dyntick(struct rcu_state *rsp, long lastcomp, | |||
1158 | 1178 | ||
1159 | rcu_for_each_leaf_node(rsp, rnp) { | 1179 | rcu_for_each_leaf_node(rsp, rnp) { |
1160 | mask = 0; | 1180 | mask = 0; |
1161 | spin_lock_irqsave(&rnp->lock, flags); | 1181 | raw_spin_lock_irqsave(&rnp->lock, flags); |
1162 | if (rnp->completed != lastcomp) { | 1182 | if (!rcu_gp_in_progress(rsp)) { |
1163 | spin_unlock_irqrestore(&rnp->lock, flags); | 1183 | raw_spin_unlock_irqrestore(&rnp->lock, flags); |
1164 | return 1; | 1184 | return; |
1165 | } | 1185 | } |
1166 | if (rnp->qsmask == 0) { | 1186 | if (rnp->qsmask == 0) { |
1167 | spin_unlock_irqrestore(&rnp->lock, flags); | 1187 | raw_spin_unlock_irqrestore(&rnp->lock, flags); |
1168 | continue; | 1188 | continue; |
1169 | } | 1189 | } |
1170 | cpu = rnp->grplo; | 1190 | cpu = rnp->grplo; |
@@ -1173,15 +1193,14 @@ static int rcu_process_dyntick(struct rcu_state *rsp, long lastcomp, | |||
1173 | if ((rnp->qsmask & bit) != 0 && f(rsp->rda[cpu])) | 1193 | if ((rnp->qsmask & bit) != 0 && f(rsp->rda[cpu])) |
1174 | mask |= bit; | 1194 | mask |= bit; |
1175 | } | 1195 | } |
1176 | if (mask != 0 && rnp->completed == lastcomp) { | 1196 | if (mask != 0) { |
1177 | 1197 | ||
1178 | /* rcu_report_qs_rnp() releases rnp->lock. */ | 1198 | /* rcu_report_qs_rnp() releases rnp->lock. */ |
1179 | rcu_report_qs_rnp(mask, rsp, rnp, flags); | 1199 | rcu_report_qs_rnp(mask, rsp, rnp, flags); |
1180 | continue; | 1200 | continue; |
1181 | } | 1201 | } |
1182 | spin_unlock_irqrestore(&rnp->lock, flags); | 1202 | raw_spin_unlock_irqrestore(&rnp->lock, flags); |
1183 | } | 1203 | } |
1184 | return 0; | ||
1185 | } | 1204 | } |
1186 | 1205 | ||
1187 | /* | 1206 | /* |
@@ -1191,32 +1210,26 @@ static int rcu_process_dyntick(struct rcu_state *rsp, long lastcomp, | |||
1191 | static void force_quiescent_state(struct rcu_state *rsp, int relaxed) | 1210 | static void force_quiescent_state(struct rcu_state *rsp, int relaxed) |
1192 | { | 1211 | { |
1193 | unsigned long flags; | 1212 | unsigned long flags; |
1194 | long lastcomp; | ||
1195 | struct rcu_node *rnp = rcu_get_root(rsp); | 1213 | struct rcu_node *rnp = rcu_get_root(rsp); |
1196 | u8 signaled; | ||
1197 | u8 forcenow; | ||
1198 | 1214 | ||
1199 | if (!rcu_gp_in_progress(rsp)) | 1215 | if (!rcu_gp_in_progress(rsp)) |
1200 | return; /* No grace period in progress, nothing to force. */ | 1216 | return; /* No grace period in progress, nothing to force. */ |
1201 | if (!spin_trylock_irqsave(&rsp->fqslock, flags)) { | 1217 | if (!raw_spin_trylock_irqsave(&rsp->fqslock, flags)) { |
1202 | rsp->n_force_qs_lh++; /* Inexact, can lose counts. Tough! */ | 1218 | rsp->n_force_qs_lh++; /* Inexact, can lose counts. Tough! */ |
1203 | return; /* Someone else is already on the job. */ | 1219 | return; /* Someone else is already on the job. */ |
1204 | } | 1220 | } |
1205 | if (relaxed && | 1221 | if (relaxed && ULONG_CMP_GE(rsp->jiffies_force_qs, jiffies)) |
1206 | (long)(rsp->jiffies_force_qs - jiffies) >= 0) | 1222 | goto unlock_fqs_ret; /* no emergency and done recently. */ |
1207 | goto unlock_ret; /* no emergency and done recently. */ | ||
1208 | rsp->n_force_qs++; | 1223 | rsp->n_force_qs++; |
1209 | spin_lock(&rnp->lock); | 1224 | raw_spin_lock(&rnp->lock); /* irqs already disabled */ |
1210 | lastcomp = rsp->gpnum - 1; | ||
1211 | signaled = rsp->signaled; | ||
1212 | rsp->jiffies_force_qs = jiffies + RCU_JIFFIES_TILL_FORCE_QS; | 1225 | rsp->jiffies_force_qs = jiffies + RCU_JIFFIES_TILL_FORCE_QS; |
1213 | if(!rcu_gp_in_progress(rsp)) { | 1226 | if(!rcu_gp_in_progress(rsp)) { |
1214 | rsp->n_force_qs_ngp++; | 1227 | rsp->n_force_qs_ngp++; |
1215 | spin_unlock(&rnp->lock); | 1228 | raw_spin_unlock(&rnp->lock); /* irqs remain disabled */ |
1216 | goto unlock_ret; /* no GP in progress, time updated. */ | 1229 | goto unlock_fqs_ret; /* no GP in progress, time updated. */ |
1217 | } | 1230 | } |
1218 | spin_unlock(&rnp->lock); | 1231 | rsp->fqs_active = 1; |
1219 | switch (signaled) { | 1232 | switch (rsp->signaled) { |
1220 | case RCU_GP_IDLE: | 1233 | case RCU_GP_IDLE: |
1221 | case RCU_GP_INIT: | 1234 | case RCU_GP_INIT: |
1222 | 1235 | ||
@@ -1224,45 +1237,38 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed) | |||
1224 | 1237 | ||
1225 | case RCU_SAVE_DYNTICK: | 1238 | case RCU_SAVE_DYNTICK: |
1226 | 1239 | ||
1240 | raw_spin_unlock(&rnp->lock); /* irqs remain disabled */ | ||
1227 | if (RCU_SIGNAL_INIT != RCU_SAVE_DYNTICK) | 1241 | if (RCU_SIGNAL_INIT != RCU_SAVE_DYNTICK) |
1228 | break; /* So gcc recognizes the dead code. */ | 1242 | break; /* So gcc recognizes the dead code. */ |
1229 | 1243 | ||
1230 | /* Record dyntick-idle state. */ | 1244 | /* Record dyntick-idle state. */ |
1231 | if (rcu_process_dyntick(rsp, lastcomp, | 1245 | force_qs_rnp(rsp, dyntick_save_progress_counter); |
1232 | dyntick_save_progress_counter)) | 1246 | raw_spin_lock(&rnp->lock); /* irqs already disabled */ |
1233 | goto unlock_ret; | 1247 | if (rcu_gp_in_progress(rsp)) |
1234 | /* fall into next case. */ | ||
1235 | |||
1236 | case RCU_SAVE_COMPLETED: | ||
1237 | |||
1238 | /* Update state, record completion counter. */ | ||
1239 | forcenow = 0; | ||
1240 | spin_lock(&rnp->lock); | ||
1241 | if (lastcomp + 1 == rsp->gpnum && | ||
1242 | lastcomp == rsp->completed && | ||
1243 | rsp->signaled == signaled) { | ||
1244 | rsp->signaled = RCU_FORCE_QS; | 1248 | rsp->signaled = RCU_FORCE_QS; |
1245 | rsp->completed_fqs = lastcomp; | 1249 | break; |
1246 | forcenow = signaled == RCU_SAVE_COMPLETED; | ||
1247 | } | ||
1248 | spin_unlock(&rnp->lock); | ||
1249 | if (!forcenow) | ||
1250 | break; | ||
1251 | /* fall into next case. */ | ||
1252 | 1250 | ||
1253 | case RCU_FORCE_QS: | 1251 | case RCU_FORCE_QS: |
1254 | 1252 | ||
1255 | /* Check dyntick-idle state, send IPI to laggarts. */ | 1253 | /* Check dyntick-idle state, send IPI to laggarts. */ |
1256 | if (rcu_process_dyntick(rsp, rsp->completed_fqs, | 1254 | raw_spin_unlock(&rnp->lock); /* irqs remain disabled */ |
1257 | rcu_implicit_dynticks_qs)) | 1255 | force_qs_rnp(rsp, rcu_implicit_dynticks_qs); |
1258 | goto unlock_ret; | ||
1259 | 1256 | ||
1260 | /* Leave state in case more forcing is required. */ | 1257 | /* Leave state in case more forcing is required. */ |
1261 | 1258 | ||
1259 | raw_spin_lock(&rnp->lock); /* irqs already disabled */ | ||
1262 | break; | 1260 | break; |
1263 | } | 1261 | } |
1264 | unlock_ret: | 1262 | rsp->fqs_active = 0; |
1265 | spin_unlock_irqrestore(&rsp->fqslock, flags); | 1263 | if (rsp->fqs_need_gp) { |
1264 | raw_spin_unlock(&rsp->fqslock); /* irqs remain disabled */ | ||
1265 | rsp->fqs_need_gp = 0; | ||
1266 | rcu_start_gp(rsp, flags); /* releases rnp->lock */ | ||
1267 | return; | ||
1268 | } | ||
1269 | raw_spin_unlock(&rnp->lock); /* irqs remain disabled */ | ||
1270 | unlock_fqs_ret: | ||
1271 | raw_spin_unlock_irqrestore(&rsp->fqslock, flags); | ||
1266 | } | 1272 | } |
1267 | 1273 | ||
1268 | #else /* #ifdef CONFIG_SMP */ | 1274 | #else /* #ifdef CONFIG_SMP */ |
@@ -1290,7 +1296,7 @@ __rcu_process_callbacks(struct rcu_state *rsp, struct rcu_data *rdp) | |||
1290 | * If an RCU GP has gone long enough, go check for dyntick | 1296 | * If an RCU GP has gone long enough, go check for dyntick |
1291 | * idle CPUs and, if needed, send resched IPIs. | 1297 | * idle CPUs and, if needed, send resched IPIs. |
1292 | */ | 1298 | */ |
1293 | if ((long)(ACCESS_ONCE(rsp->jiffies_force_qs) - jiffies) < 0) | 1299 | if (ULONG_CMP_LT(ACCESS_ONCE(rsp->jiffies_force_qs), jiffies)) |
1294 | force_quiescent_state(rsp, 1); | 1300 | force_quiescent_state(rsp, 1); |
1295 | 1301 | ||
1296 | /* | 1302 | /* |
@@ -1304,7 +1310,7 @@ __rcu_process_callbacks(struct rcu_state *rsp, struct rcu_data *rdp) | |||
1304 | 1310 | ||
1305 | /* Does this CPU require a not-yet-started grace period? */ | 1311 | /* Does this CPU require a not-yet-started grace period? */ |
1306 | if (cpu_needs_another_gp(rsp, rdp)) { | 1312 | if (cpu_needs_another_gp(rsp, rdp)) { |
1307 | spin_lock_irqsave(&rcu_get_root(rsp)->lock, flags); | 1313 | raw_spin_lock_irqsave(&rcu_get_root(rsp)->lock, flags); |
1308 | rcu_start_gp(rsp, flags); /* releases above lock */ | 1314 | rcu_start_gp(rsp, flags); /* releases above lock */ |
1309 | } | 1315 | } |
1310 | 1316 | ||
@@ -1335,6 +1341,9 @@ static void rcu_process_callbacks(struct softirq_action *unused) | |||
1335 | * grace-period manipulations above. | 1341 | * grace-period manipulations above. |
1336 | */ | 1342 | */ |
1337 | smp_mb(); /* See above block comment. */ | 1343 | smp_mb(); /* See above block comment. */ |
1344 | |||
1345 | /* If we are last CPU on way to dyntick-idle mode, accelerate it. */ | ||
1346 | rcu_needs_cpu_flush(); | ||
1338 | } | 1347 | } |
1339 | 1348 | ||
1340 | static void | 1349 | static void |
@@ -1369,7 +1378,7 @@ __call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu), | |||
1369 | unsigned long nestflag; | 1378 | unsigned long nestflag; |
1370 | struct rcu_node *rnp_root = rcu_get_root(rsp); | 1379 | struct rcu_node *rnp_root = rcu_get_root(rsp); |
1371 | 1380 | ||
1372 | spin_lock_irqsave(&rnp_root->lock, nestflag); | 1381 | raw_spin_lock_irqsave(&rnp_root->lock, nestflag); |
1373 | rcu_start_gp(rsp, nestflag); /* releases rnp_root->lock. */ | 1382 | rcu_start_gp(rsp, nestflag); /* releases rnp_root->lock. */ |
1374 | } | 1383 | } |
1375 | 1384 | ||
@@ -1387,7 +1396,7 @@ __call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu), | |||
1387 | force_quiescent_state(rsp, 0); | 1396 | force_quiescent_state(rsp, 0); |
1388 | rdp->n_force_qs_snap = rsp->n_force_qs; | 1397 | rdp->n_force_qs_snap = rsp->n_force_qs; |
1389 | rdp->qlen_last_fqs_check = rdp->qlen; | 1398 | rdp->qlen_last_fqs_check = rdp->qlen; |
1390 | } else if ((long)(ACCESS_ONCE(rsp->jiffies_force_qs) - jiffies) < 0) | 1399 | } else if (ULONG_CMP_LT(ACCESS_ONCE(rsp->jiffies_force_qs), jiffies)) |
1391 | force_quiescent_state(rsp, 1); | 1400 | force_quiescent_state(rsp, 1); |
1392 | local_irq_restore(flags); | 1401 | local_irq_restore(flags); |
1393 | } | 1402 | } |
@@ -1520,7 +1529,7 @@ static int __rcu_pending(struct rcu_state *rsp, struct rcu_data *rdp) | |||
1520 | 1529 | ||
1521 | /* Has an RCU GP gone long enough to send resched IPIs &c? */ | 1530 | /* Has an RCU GP gone long enough to send resched IPIs &c? */ |
1522 | if (rcu_gp_in_progress(rsp) && | 1531 | if (rcu_gp_in_progress(rsp) && |
1523 | ((long)(ACCESS_ONCE(rsp->jiffies_force_qs) - jiffies) < 0)) { | 1532 | ULONG_CMP_LT(ACCESS_ONCE(rsp->jiffies_force_qs), jiffies)) { |
1524 | rdp->n_rp_need_fqs++; | 1533 | rdp->n_rp_need_fqs++; |
1525 | return 1; | 1534 | return 1; |
1526 | } | 1535 | } |
@@ -1545,10 +1554,9 @@ static int rcu_pending(int cpu) | |||
1545 | /* | 1554 | /* |
1546 | * Check to see if any future RCU-related work will need to be done | 1555 | * Check to see if any future RCU-related work will need to be done |
1547 | * by the current CPU, even if none need be done immediately, returning | 1556 | * by the current CPU, even if none need be done immediately, returning |
1548 | * 1 if so. This function is part of the RCU implementation; it is -not- | 1557 | * 1 if so. |
1549 | * an exported member of the RCU API. | ||
1550 | */ | 1558 | */ |
1551 | int rcu_needs_cpu(int cpu) | 1559 | static int rcu_needs_cpu_quick_check(int cpu) |
1552 | { | 1560 | { |
1553 | /* RCU callbacks either ready or pending? */ | 1561 | /* RCU callbacks either ready or pending? */ |
1554 | return per_cpu(rcu_sched_data, cpu).nxtlist || | 1562 | return per_cpu(rcu_sched_data, cpu).nxtlist || |
@@ -1556,21 +1564,6 @@ int rcu_needs_cpu(int cpu) | |||
1556 | rcu_preempt_needs_cpu(cpu); | 1564 | rcu_preempt_needs_cpu(cpu); |
1557 | } | 1565 | } |
1558 | 1566 | ||
1559 | /* | ||
1560 | * This function is invoked towards the end of the scheduler's initialization | ||
1561 | * process. Before this is called, the idle task might contain | ||
1562 | * RCU read-side critical sections (during which time, this idle | ||
1563 | * task is booting the system). After this function is called, the | ||
1564 | * idle tasks are prohibited from containing RCU read-side critical | ||
1565 | * sections. | ||
1566 | */ | ||
1567 | void rcu_scheduler_starting(void) | ||
1568 | { | ||
1569 | WARN_ON(num_online_cpus() != 1); | ||
1570 | WARN_ON(nr_context_switches() > 0); | ||
1571 | rcu_scheduler_active = 1; | ||
1572 | } | ||
1573 | |||
1574 | static DEFINE_PER_CPU(struct rcu_head, rcu_barrier_head) = {NULL}; | 1567 | static DEFINE_PER_CPU(struct rcu_head, rcu_barrier_head) = {NULL}; |
1575 | static atomic_t rcu_barrier_cpu_count; | 1568 | static atomic_t rcu_barrier_cpu_count; |
1576 | static DEFINE_MUTEX(rcu_barrier_mutex); | 1569 | static DEFINE_MUTEX(rcu_barrier_mutex); |
@@ -1659,7 +1652,7 @@ rcu_boot_init_percpu_data(int cpu, struct rcu_state *rsp) | |||
1659 | struct rcu_node *rnp = rcu_get_root(rsp); | 1652 | struct rcu_node *rnp = rcu_get_root(rsp); |
1660 | 1653 | ||
1661 | /* Set up local state, ensuring consistent view of global state. */ | 1654 | /* Set up local state, ensuring consistent view of global state. */ |
1662 | spin_lock_irqsave(&rnp->lock, flags); | 1655 | raw_spin_lock_irqsave(&rnp->lock, flags); |
1663 | rdp->grpmask = 1UL << (cpu - rdp->mynode->grplo); | 1656 | rdp->grpmask = 1UL << (cpu - rdp->mynode->grplo); |
1664 | rdp->nxtlist = NULL; | 1657 | rdp->nxtlist = NULL; |
1665 | for (i = 0; i < RCU_NEXT_SIZE; i++) | 1658 | for (i = 0; i < RCU_NEXT_SIZE; i++) |
@@ -1669,7 +1662,7 @@ rcu_boot_init_percpu_data(int cpu, struct rcu_state *rsp) | |||
1669 | rdp->dynticks = &per_cpu(rcu_dynticks, cpu); | 1662 | rdp->dynticks = &per_cpu(rcu_dynticks, cpu); |
1670 | #endif /* #ifdef CONFIG_NO_HZ */ | 1663 | #endif /* #ifdef CONFIG_NO_HZ */ |
1671 | rdp->cpu = cpu; | 1664 | rdp->cpu = cpu; |
1672 | spin_unlock_irqrestore(&rnp->lock, flags); | 1665 | raw_spin_unlock_irqrestore(&rnp->lock, flags); |
1673 | } | 1666 | } |
1674 | 1667 | ||
1675 | /* | 1668 | /* |
@@ -1687,7 +1680,7 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptable) | |||
1687 | struct rcu_node *rnp = rcu_get_root(rsp); | 1680 | struct rcu_node *rnp = rcu_get_root(rsp); |
1688 | 1681 | ||
1689 | /* Set up local state, ensuring consistent view of global state. */ | 1682 | /* Set up local state, ensuring consistent view of global state. */ |
1690 | spin_lock_irqsave(&rnp->lock, flags); | 1683 | raw_spin_lock_irqsave(&rnp->lock, flags); |
1691 | rdp->passed_quiesc = 0; /* We could be racing with new GP, */ | 1684 | rdp->passed_quiesc = 0; /* We could be racing with new GP, */ |
1692 | rdp->qs_pending = 1; /* so set up to respond to current GP. */ | 1685 | rdp->qs_pending = 1; /* so set up to respond to current GP. */ |
1693 | rdp->beenonline = 1; /* We have now been online. */ | 1686 | rdp->beenonline = 1; /* We have now been online. */ |
@@ -1695,7 +1688,7 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptable) | |||
1695 | rdp->qlen_last_fqs_check = 0; | 1688 | rdp->qlen_last_fqs_check = 0; |
1696 | rdp->n_force_qs_snap = rsp->n_force_qs; | 1689 | rdp->n_force_qs_snap = rsp->n_force_qs; |
1697 | rdp->blimit = blimit; | 1690 | rdp->blimit = blimit; |
1698 | spin_unlock(&rnp->lock); /* irqs remain disabled. */ | 1691 | raw_spin_unlock(&rnp->lock); /* irqs remain disabled. */ |
1699 | 1692 | ||
1700 | /* | 1693 | /* |
1701 | * A new grace period might start here. If so, we won't be part | 1694 | * A new grace period might start here. If so, we won't be part |
@@ -1703,14 +1696,14 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptable) | |||
1703 | */ | 1696 | */ |
1704 | 1697 | ||
1705 | /* Exclude any attempts to start a new GP on large systems. */ | 1698 | /* Exclude any attempts to start a new GP on large systems. */ |
1706 | spin_lock(&rsp->onofflock); /* irqs already disabled. */ | 1699 | raw_spin_lock(&rsp->onofflock); /* irqs already disabled. */ |
1707 | 1700 | ||
1708 | /* Add CPU to rcu_node bitmasks. */ | 1701 | /* Add CPU to rcu_node bitmasks. */ |
1709 | rnp = rdp->mynode; | 1702 | rnp = rdp->mynode; |
1710 | mask = rdp->grpmask; | 1703 | mask = rdp->grpmask; |
1711 | do { | 1704 | do { |
1712 | /* Exclude any attempts to start a new GP on small systems. */ | 1705 | /* Exclude any attempts to start a new GP on small systems. */ |
1713 | spin_lock(&rnp->lock); /* irqs already disabled. */ | 1706 | raw_spin_lock(&rnp->lock); /* irqs already disabled. */ |
1714 | rnp->qsmaskinit |= mask; | 1707 | rnp->qsmaskinit |= mask; |
1715 | mask = rnp->grpmask; | 1708 | mask = rnp->grpmask; |
1716 | if (rnp == rdp->mynode) { | 1709 | if (rnp == rdp->mynode) { |
@@ -1718,11 +1711,11 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptable) | |||
1718 | rdp->completed = rnp->completed; | 1711 | rdp->completed = rnp->completed; |
1719 | rdp->passed_quiesc_completed = rnp->completed - 1; | 1712 | rdp->passed_quiesc_completed = rnp->completed - 1; |
1720 | } | 1713 | } |
1721 | spin_unlock(&rnp->lock); /* irqs already disabled. */ | 1714 | raw_spin_unlock(&rnp->lock); /* irqs already disabled. */ |
1722 | rnp = rnp->parent; | 1715 | rnp = rnp->parent; |
1723 | } while (rnp != NULL && !(rnp->qsmaskinit & mask)); | 1716 | } while (rnp != NULL && !(rnp->qsmaskinit & mask)); |
1724 | 1717 | ||
1725 | spin_unlock_irqrestore(&rsp->onofflock, flags); | 1718 | raw_spin_unlock_irqrestore(&rsp->onofflock, flags); |
1726 | } | 1719 | } |
1727 | 1720 | ||
1728 | static void __cpuinit rcu_online_cpu(int cpu) | 1721 | static void __cpuinit rcu_online_cpu(int cpu) |
@@ -1806,11 +1799,17 @@ static void __init rcu_init_levelspread(struct rcu_state *rsp) | |||
1806 | */ | 1799 | */ |
1807 | static void __init rcu_init_one(struct rcu_state *rsp) | 1800 | static void __init rcu_init_one(struct rcu_state *rsp) |
1808 | { | 1801 | { |
1802 | static char *buf[] = { "rcu_node_level_0", | ||
1803 | "rcu_node_level_1", | ||
1804 | "rcu_node_level_2", | ||
1805 | "rcu_node_level_3" }; /* Match MAX_RCU_LVLS */ | ||
1809 | int cpustride = 1; | 1806 | int cpustride = 1; |
1810 | int i; | 1807 | int i; |
1811 | int j; | 1808 | int j; |
1812 | struct rcu_node *rnp; | 1809 | struct rcu_node *rnp; |
1813 | 1810 | ||
1811 | BUILD_BUG_ON(MAX_RCU_LVLS > ARRAY_SIZE(buf)); /* Fix buf[] init! */ | ||
1812 | |||
1814 | /* Initialize the level-tracking arrays. */ | 1813 | /* Initialize the level-tracking arrays. */ |
1815 | 1814 | ||
1816 | for (i = 1; i < NUM_RCU_LVLS; i++) | 1815 | for (i = 1; i < NUM_RCU_LVLS; i++) |
@@ -1823,8 +1822,9 @@ static void __init rcu_init_one(struct rcu_state *rsp) | |||
1823 | cpustride *= rsp->levelspread[i]; | 1822 | cpustride *= rsp->levelspread[i]; |
1824 | rnp = rsp->level[i]; | 1823 | rnp = rsp->level[i]; |
1825 | for (j = 0; j < rsp->levelcnt[i]; j++, rnp++) { | 1824 | for (j = 0; j < rsp->levelcnt[i]; j++, rnp++) { |
1826 | spin_lock_init(&rnp->lock); | 1825 | raw_spin_lock_init(&rnp->lock); |
1827 | lockdep_set_class(&rnp->lock, &rcu_node_class[i]); | 1826 | lockdep_set_class_and_name(&rnp->lock, |
1827 | &rcu_node_class[i], buf[i]); | ||
1828 | rnp->gpnum = 0; | 1828 | rnp->gpnum = 0; |
1829 | rnp->qsmask = 0; | 1829 | rnp->qsmask = 0; |
1830 | rnp->qsmaskinit = 0; | 1830 | rnp->qsmaskinit = 0; |
@@ -1876,7 +1876,7 @@ do { \ | |||
1876 | 1876 | ||
1877 | void __init rcu_init(void) | 1877 | void __init rcu_init(void) |
1878 | { | 1878 | { |
1879 | int i; | 1879 | int cpu; |
1880 | 1880 | ||
1881 | rcu_bootup_announce(); | 1881 | rcu_bootup_announce(); |
1882 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR | 1882 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR |
@@ -1896,8 +1896,8 @@ void __init rcu_init(void) | |||
1896 | * or the scheduler are operational. | 1896 | * or the scheduler are operational. |
1897 | */ | 1897 | */ |
1898 | cpu_notifier(rcu_cpu_notify, 0); | 1898 | cpu_notifier(rcu_cpu_notify, 0); |
1899 | for_each_online_cpu(i) | 1899 | for_each_online_cpu(cpu) |
1900 | rcu_cpu_notify(NULL, CPU_UP_PREPARE, (void *)(long)i); | 1900 | rcu_cpu_notify(NULL, CPU_UP_PREPARE, (void *)(long)cpu); |
1901 | } | 1901 | } |
1902 | 1902 | ||
1903 | #include "rcutree_plugin.h" | 1903 | #include "rcutree_plugin.h" |