]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/misc/sgi-xp/xpc_main.c
sgi-xp: move xpc_check_remote_hb() to support both SN2 and UV
[linux-2.6-omap-h63xx.git] / drivers / misc / sgi-xp / xpc_main.c
index dc686110aef70b1d4bdecb3fca18051b6664b20a..f4d866113f2aa146f5ebab1a54293e46888fac05 100644 (file)
@@ -178,7 +178,7 @@ void (*xpc_heartbeat_exit) (void);
 void (*xpc_increment_heartbeat) (void);
 void (*xpc_offline_heartbeat) (void);
 void (*xpc_online_heartbeat) (void);
-void (*xpc_check_remote_hb) (void);
+enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *part);
 
 enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *part);
 void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *ch);
@@ -269,6 +269,38 @@ xpc_stop_hb_beater(void)
        xpc_heartbeat_exit();
 }
 
+/*
+ * At periodic intervals, scan through all active partitions and ensure
+ * their heartbeat is still active.  If not, the partition is deactivated.
+ */
+static void
+xpc_check_remote_hb(void)
+{
+       struct xpc_partition *part;
+       short partid;
+       enum xp_retval ret;
+
+       for (partid = 0; partid < xp_max_npartitions; partid++) {
+
+               if (xpc_exiting)
+                       break;
+
+               if (partid == xp_partition_id)
+                       continue;
+
+               part = &xpc_partitions[partid];
+
+               if (part->act_state == XPC_P_INACTIVE ||
+                   part->act_state == XPC_P_DEACTIVATING) {
+                       continue;
+               }
+
+               ret = xpc_get_remote_heartbeat(part);
+               if (ret != xpSuccess)
+                       XPC_DEACTIVATE_PARTITION(part, ret);
+       }
+}
+
 /*
  * This thread is responsible for nearly all of the partition
  * activation/deactivation.