diff options
-rw-r--r-- | drivers/misc/sgi-xp/xpc.h | 2 | ||||
-rw-r--r-- | drivers/misc/sgi-xp/xpc_main.c | 34 | ||||
-rw-r--r-- | drivers/misc/sgi-xp/xpc_sn2.c | 70 |
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); | |||
632 | extern void (*xpc_increment_heartbeat) (void); | 632 | extern void (*xpc_increment_heartbeat) (void); |
633 | extern void (*xpc_offline_heartbeat) (void); | 633 | extern void (*xpc_offline_heartbeat) (void); |
634 | extern void (*xpc_online_heartbeat) (void); | 634 | extern void (*xpc_online_heartbeat) (void); |
635 | extern void (*xpc_check_remote_hb) (void); | 635 | extern enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *); |
636 | extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *); | 636 | extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *); |
637 | extern u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *); | 637 | extern u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *); |
638 | extern enum xp_retval (*xpc_allocate_msgqueues) (struct xpc_channel *); | 638 | extern 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); | |||
178 | void (*xpc_increment_heartbeat) (void); | 178 | void (*xpc_increment_heartbeat) (void); |
179 | void (*xpc_offline_heartbeat) (void); | 179 | void (*xpc_offline_heartbeat) (void); |
180 | void (*xpc_online_heartbeat) (void); | 180 | void (*xpc_online_heartbeat) (void); |
181 | void (*xpc_check_remote_hb) (void); | 181 | enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *part); |
182 | 182 | ||
183 | enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *part); | 183 | enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *part); |
184 | void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *ch); | 184 | void (*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 | */ | ||
276 | static void | ||
277 | xpc_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 | /* | 707 | static enum xp_retval |
708 | * At periodic intervals, scan through all active partitions and ensure | 708 | xpc_get_remote_heartbeat_sn2(struct xpc_partition *part) |
709 | * their heartbeat is still active. If not, the partition is deactivated. | ||
710 | */ | ||
711 | static void | ||
712 | xpc_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 = |