]> err.no Git - linux-2.6/commitdiff
sgi-xp: move xpc_check_remote_hb() to support both SN2 and UV
authorDean Nelson <dcn@sgi.com>
Wed, 30 Jul 2008 05:34:17 +0000 (22:34 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 30 Jul 2008 16:41:50 +0000 (09:41 -0700)
Move xpc_check_remote_hb() so it can support both SN2 and UV.

Signed-off-by: Dean Nelson <dcn@sgi.com>
Cc: Jack Steiner <steiner@sgi.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/misc/sgi-xp/xpc.h
drivers/misc/sgi-xp/xpc_main.c
drivers/misc/sgi-xp/xpc_sn2.c

index 49e26993345be3365ec9d7aedf00a3442af5826c..f258f89b8d3c77fde4407e6bb1506447d39a8e7d 100644 (file)
@@ -632,7 +632,7 @@ extern void (*xpc_heartbeat_exit) (void);
 extern void (*xpc_increment_heartbeat) (void);
 extern void (*xpc_offline_heartbeat) (void);
 extern void (*xpc_online_heartbeat) (void);
-extern void (*xpc_check_remote_hb) (void);
+extern enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *);
 extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *);
 extern u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *);
 extern enum xp_retval (*xpc_allocate_msgqueues) (struct xpc_channel *);
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.
index 1571a7cdf9d03808a0e68ffcc05027979d0d6aae..d34cdd533a9a1c22b71a5c7e3b224632ff050673 100644 (file)
@@ -704,61 +704,37 @@ xpc_heartbeat_exit_sn2(void)
        xpc_offline_heartbeat_sn2();
 }
 
-/*
- * 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_sn2(void)
+static enum xp_retval
+xpc_get_remote_heartbeat_sn2(struct xpc_partition *part)
 {
        struct xpc_vars_sn2 *remote_vars;
-       struct xpc_partition *part;
-       short partid;
        enum xp_retval ret;
 
        remote_vars = (struct xpc_vars_sn2 *)xpc_remote_copy_buffer_sn2;
 
-       for (partid = 0; partid < XP_MAX_NPARTITIONS_SN2; partid++) {
-
-               if (xpc_exiting)
-                       break;
-
-               if (partid == sn_partition_id)
-                       continue;
-
-               part = &xpc_partitions[partid];
-
-               if (part->act_state == XPC_P_INACTIVE ||
-                   part->act_state == XPC_P_DEACTIVATING) {
-                       continue;
-               }
-
-               /* pull the remote_hb cache line */
-               ret = xp_remote_memcpy(xp_pa(remote_vars),
-                                      part->sn.sn2.remote_vars_pa,
-                                      XPC_RP_VARS_SIZE);
-               if (ret != xpSuccess) {
-                       XPC_DEACTIVATE_PARTITION(part, ret);
-                       continue;
-               }
-
-               dev_dbg(xpc_part, "partid = %d, heartbeat = %ld, last_heartbeat"
-                       " = %ld, heartbeat_offline = %ld, HB_mask[0] = 0x%lx\n",
-                       partid, remote_vars->heartbeat, part->last_heartbeat,
-                       remote_vars->heartbeat_offline,
-                       remote_vars->heartbeating_to_mask[0]);
-
-               if (((remote_vars->heartbeat == part->last_heartbeat) &&
-                    (remote_vars->heartbeat_offline == 0)) ||
-                   !xpc_hb_allowed(sn_partition_id,
-                                   &remote_vars->heartbeating_to_mask)) {
-
-                       XPC_DEACTIVATE_PARTITION(part, xpNoHeartbeat);
-                       continue;
-               }
+       /* pull the remote vars structure that contains the heartbeat */
+       ret = xp_remote_memcpy(xp_pa(remote_vars),
+                              part->sn.sn2.remote_vars_pa,
+                              XPC_RP_VARS_SIZE);
+       if (ret != xpSuccess)
+               return ret;
 
+       dev_dbg(xpc_part, "partid=%d, heartbeat=%ld, last_heartbeat=%ld, "
+               "heartbeat_offline=%ld, HB_mask[0]=0x%lx\n", XPC_PARTID(part),
+               remote_vars->heartbeat, part->last_heartbeat,
+               remote_vars->heartbeat_offline,
+               remote_vars->heartbeating_to_mask[0]);
+
+       if ((remote_vars->heartbeat == part->last_heartbeat &&
+           remote_vars->heartbeat_offline == 0) ||
+           !xpc_hb_allowed(sn_partition_id,
+                           &remote_vars->heartbeating_to_mask)) {
+               ret = xpNoHeartbeat;
+       } else {
                part->last_heartbeat = remote_vars->heartbeat;
        }
+
+       return ret;
 }
 
 /*
@@ -2416,7 +2392,7 @@ xpc_init_sn2(void)
        xpc_online_heartbeat = xpc_online_heartbeat_sn2;
        xpc_heartbeat_init = xpc_heartbeat_init_sn2;
        xpc_heartbeat_exit = xpc_heartbeat_exit_sn2;
-       xpc_check_remote_hb = xpc_check_remote_hb_sn2;
+       xpc_get_remote_heartbeat = xpc_get_remote_heartbeat_sn2;
 
        xpc_request_partition_activation = xpc_request_partition_activation_sn2;
        xpc_request_partition_reactivation =