8
8
*/
9
9
10
10
#include <linux/kvm_para.h>
11
+ #include <linux/rcu_notifier.h>
11
12
12
13
//////////////////////////////////////////////////////////////////////////////
13
14
//
@@ -770,6 +771,7 @@ static void check_cpu_stall(struct rcu_data *rdp)
770
771
if (kvm_check_and_clear_guest_paused ())
771
772
return ;
772
773
774
+ rcu_stall_notifier_call_chain (RCU_STALL_NOTIFY_NORM , (void * )j - gps );
773
775
if (self_detected ) {
774
776
/* We haven't checked in, so go dump stack. */
775
777
print_cpu_stall (gps );
@@ -790,7 +792,7 @@ static void check_cpu_stall(struct rcu_data *rdp)
790
792
791
793
//////////////////////////////////////////////////////////////////////////////
792
794
//
793
- // RCU forward-progress mechanisms, including of callback invocation.
795
+ // RCU forward-progress mechanisms, including for callback invocation.
794
796
795
797
796
798
/*
@@ -1042,3 +1044,58 @@ static int __init rcu_sysrq_init(void)
1042
1044
return 0 ;
1043
1045
}
1044
1046
early_initcall (rcu_sysrq_init );
1047
+
1048
+
1049
+ //////////////////////////////////////////////////////////////////////////////
1050
+ //
1051
+ // RCU CPU stall-warning notifiers
1052
+
1053
+ static ATOMIC_NOTIFIER_HEAD (rcu_cpu_stall_notifier_list );
1054
+
1055
+ /**
1056
+ * rcu_stall_chain_notifier_register - Add an RCU CPU stall notifier
1057
+ * @n: Entry to add.
1058
+ *
1059
+ * Adds an RCU CPU stall notifier to an atomic notifier chain.
1060
+ * The @action passed to a notifier will be @RCU_STALL_NOTIFY_NORM or
1061
+ * friends. The @data will be the duration of the stalled grace period,
1062
+ * in jiffies, coerced to a void* pointer.
1063
+ *
1064
+ * Returns 0 on success, %-EEXIST on error.
1065
+ */
1066
+ int rcu_stall_chain_notifier_register (struct notifier_block * n )
1067
+ {
1068
+ return atomic_notifier_chain_register (& rcu_cpu_stall_notifier_list , n );
1069
+ }
1070
+ EXPORT_SYMBOL_GPL (rcu_stall_chain_notifier_register );
1071
+
1072
+ /**
1073
+ * rcu_stall_chain_notifier_unregister - Remove an RCU CPU stall notifier
1074
+ * @n: Entry to add.
1075
+ *
1076
+ * Removes an RCU CPU stall notifier from an atomic notifier chain.
1077
+ *
1078
+ * Returns zero on success, %-ENOENT on failure.
1079
+ */
1080
+ int rcu_stall_chain_notifier_unregister (struct notifier_block * n )
1081
+ {
1082
+ return atomic_notifier_chain_unregister (& rcu_cpu_stall_notifier_list , n );
1083
+ }
1084
+ EXPORT_SYMBOL_GPL (rcu_stall_chain_notifier_unregister );
1085
+
1086
+ /*
1087
+ * rcu_stall_notifier_call_chain - Call functions in an RCU CPU stall notifier chain
1088
+ * @val: Value passed unmodified to notifier function
1089
+ * @v: Pointer passed unmodified to notifier function
1090
+ *
1091
+ * Calls each function in the RCU CPU stall notifier chain in turn, which
1092
+ * is an atomic call chain. See atomic_notifier_call_chain() for more
1093
+ * information.
1094
+ *
1095
+ * This is for use within RCU, hence the omission of the extra asterisk
1096
+ * to indicate a non-kerneldoc format header comment.
1097
+ */
1098
+ int rcu_stall_notifier_call_chain (unsigned long val , void * v )
1099
+ {
1100
+ return atomic_notifier_call_chain (& rcu_cpu_stall_notifier_list , val , v );
1101
+ }
0 commit comments