aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorDean Nelson <dcn@sgi.com>2008-07-30 01:34:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-30 12:41:50 -0400
commit61deb86e98f51151b225f7563ee1cf2b50857d10 (patch)
tree0196f0748fed77b100476067ca31254517e939b1 /drivers/misc
parenta812dcc3a298eef650c381e094e2cf41a4ecc9ad (diff)
sgi-xp: move xpc_check_remote_hb() to support both SN2 and UV
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>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/sgi-xp/xpc.h2
-rw-r--r--drivers/misc/sgi-xp/xpc_main.c34
-rw-r--r--drivers/misc/sgi-xp/xpc_sn2.c70
3 files changed, 57 insertions, 49 deletions
diff --git a/drivers/misc/sgi-xp/xpc.h b/drivers/misc/sgi-xp/xpc.h
index 49e26993345b..f258f89b8d3c 100644
--- a/drivers/misc/sgi-xp/xpc.h
+++ b/drivers/misc/sgi-xp/xpc.h
@@ -632,7 +632,7 @@ extern void (*xpc_heartbeat_exit) (void);
632extern void (*xpc_increment_heartbeat) (void); 632extern void (*xpc_increment_heartbeat) (void);
633extern void (*xpc_offline_heartbeat) (void); 633extern void (*xpc_offline_heartbeat) (void);
634extern void (*xpc_online_heartbeat) (void); 634extern void (*xpc_online_heartbeat) (void);
635extern void (*xpc_check_remote_hb) (void); 635extern enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *);
636extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *); 636extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *);
637extern u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *); 637extern u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *);
638extern enum xp_retval (*xpc_allocate_msgqueues) (struct xpc_channel *); 638extern enum xp_retval (*xpc_allocate_msgqueues) (struct xpc_channel *);
diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c
index dc686110aef7..f4d866113f2a 100644
--- a/drivers/misc/sgi-xp/xpc_main.c
+++ b/drivers/misc/sgi-xp/xpc_main.c
@@ -178,7 +178,7 @@ void (*xpc_heartbeat_exit) (void);
178void (*xpc_increment_heartbeat) (void); 178void (*xpc_increment_heartbeat) (void);
179void (*xpc_offline_heartbeat) (void); 179void (*xpc_offline_heartbeat) (void);
180void (*xpc_online_heartbeat) (void); 180void (*xpc_online_heartbeat) (void);
181void (*xpc_check_remote_hb) (void); 181enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *part);
182 182
183enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *part); 183enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *part);
184void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *ch); 184void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *ch);
@@ -270,6 +270,38 @@ xpc_stop_hb_beater(void)
270} 270}
271 271
272/* 272/*
273 * At periodic intervals, scan through all active partitions and ensure
274 * their heartbeat is still active. If not, the partition is deactivated.
275 */
276static void
277xpc_check_remote_hb(void)
278{
279 struct xpc_partition *part;
280 short partid;
281 enum xp_retval ret;
282
283 for (partid = 0; partid < xp_max_npartitions; partid++) {
284
285 if (xpc_exiting)
286 break;
287
288 if (partid == xp_partition_id)
289 continue;
290
291 part = &xpc_partitions[partid];
292
293 if (part->act_state == XPC_P_INACTIVE ||
294 part->act_state == XPC_P_DEACTIVATING) {
295 continue;
296 }
297
298 ret = xpc_get_remote_heartbeat(part);
299 if (ret != xpSuccess)
300 XPC_DEACTIVATE_PARTITION(part, ret);
301 }
302}
303
304/*
273 * This thread is responsible for nearly all of the partition 305 * This thread is responsible for nearly all of the partition
274 * activation/deactivation. 306 * activation/deactivation.
275 */ 307 */
diff --git a/drivers/misc/sgi-xp/xpc_sn2.c b/drivers/misc/sgi-xp/xpc_sn2.c
index 1571a7cdf9d0..d34cdd533a9a 100644
--- a/drivers/misc/sgi-xp/xpc_sn2.c
+++ b/drivers/misc/sgi-xp/xpc_sn2.c
@@ -704,61 +704,37 @@ xpc_heartbeat_exit_sn2(void)
704 xpc_offline_heartbeat_sn2(); 704 xpc_offline_heartbeat_sn2();
705} 705}
706 706
707/* 707static enum xp_retval
708 * At periodic intervals, scan through all active partitions and ensure 708xpc_get_remote_heartbeat_sn2(struct xpc_partition *part)
709 * their heartbeat is still active. If not, the partition is deactivated.
710 */
711static void
712xpc_check_remote_hb_sn2(void)
713{ 709{
714 struct xpc_vars_sn2 *remote_vars; 710 struct xpc_vars_sn2 *remote_vars;
715 struct xpc_partition *part;
716 short partid;
717 enum xp_retval ret; 711 enum xp_retval ret;
718 712
719 remote_vars = (struct xpc_vars_sn2 *)xpc_remote_copy_buffer_sn2; 713 remote_vars = (struct xpc_vars_sn2 *)xpc_remote_copy_buffer_sn2;
720 714
721 for (partid = 0; partid < XP_MAX_NPARTITIONS_SN2; partid++) { 715 /* pull the remote vars structure that contains the heartbeat */
722 716 ret = xp_remote_memcpy(xp_pa(remote_vars),
723 if (xpc_exiting) 717 part->sn.sn2.remote_vars_pa,
724 break; 718 XPC_RP_VARS_SIZE);
725 719 if (ret != xpSuccess)
726 if (partid == sn_partition_id) 720 return ret;
727 continue;
728
729 part = &xpc_partitions[partid];
730
731 if (part->act_state == XPC_P_INACTIVE ||
732 part->act_state == XPC_P_DEACTIVATING) {
733 continue;
734 }
735
736 /* pull the remote_hb cache line */
737 ret = xp_remote_memcpy(xp_pa(remote_vars),
738 part->sn.sn2.remote_vars_pa,
739 XPC_RP_VARS_SIZE);
740 if (ret != xpSuccess) {
741 XPC_DEACTIVATE_PARTITION(part, ret);
742 continue;
743 }
744
745 dev_dbg(xpc_part, "partid = %d, heartbeat = %ld, last_heartbeat"
746 " = %ld, heartbeat_offline = %ld, HB_mask[0] = 0x%lx\n",
747 partid, remote_vars->heartbeat, part->last_heartbeat,
748 remote_vars->heartbeat_offline,
749 remote_vars->heartbeating_to_mask[0]);
750
751 if (((remote_vars->heartbeat == part->last_heartbeat) &&
752 (remote_vars->heartbeat_offline == 0)) ||
753 !xpc_hb_allowed(sn_partition_id,
754 &remote_vars->heartbeating_to_mask)) {
755
756 XPC_DEACTIVATE_PARTITION(part, xpNoHeartbeat);
757 continue;
758 }
759 721
722 dev_dbg(xpc_part, "partid=%d, heartbeat=%ld, last_heartbeat=%ld, "
723 "heartbeat_offline=%ld, HB_mask[0]=0x%lx\n", XPC_PARTID(part),
724 remote_vars->heartbeat, part->last_heartbeat,
725 remote_vars->heartbeat_offline,
726 remote_vars->heartbeating_to_mask[0]);
727
728 if ((remote_vars->heartbeat == part->last_heartbeat &&
729 remote_vars->heartbeat_offline == 0) ||
730 !xpc_hb_allowed(sn_partition_id,
731 &remote_vars->heartbeating_to_mask)) {
732 ret = xpNoHeartbeat;
733 } else {
760 part->last_heartbeat = remote_vars->heartbeat; 734 part->last_heartbeat = remote_vars->heartbeat;
761 } 735 }
736
737 return ret;
762} 738}
763 739
764/* 740/*
@@ -2416,7 +2392,7 @@ xpc_init_sn2(void)
2416 xpc_online_heartbeat = xpc_online_heartbeat_sn2; 2392 xpc_online_heartbeat = xpc_online_heartbeat_sn2;
2417 xpc_heartbeat_init = xpc_heartbeat_init_sn2; 2393 xpc_heartbeat_init = xpc_heartbeat_init_sn2;
2418 xpc_heartbeat_exit = xpc_heartbeat_exit_sn2; 2394 xpc_heartbeat_exit = xpc_heartbeat_exit_sn2;
2419 xpc_check_remote_hb = xpc_check_remote_hb_sn2; 2395 xpc_get_remote_heartbeat = xpc_get_remote_heartbeat_sn2;
2420 2396
2421 xpc_request_partition_activation = xpc_request_partition_activation_sn2; 2397 xpc_request_partition_activation = xpc_request_partition_activation_sn2;
2422 xpc_request_partition_reactivation = 2398 xpc_request_partition_reactivation =