From a374c57b0764432a80303abee3d1afd1939b5a0a Mon Sep 17 00:00:00 2001 From: Robin Holt Date: Mon, 13 Apr 2009 14:40:18 -0700 Subject: sgi-xpc: prevent false heartbeat failures The heartbeat timeout functionality in sgi-xpc is currently not trained to the connection time. If a connection is made and the code is in the last polling window prior to doing a timeout, the next polling window will see the heartbeat as unchanged and initiate a no-heartbeat disconnect. Signed-off-by: Robin Holt Signed-off-by: Dean Nelson Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/misc/sgi-xp/xpc_sn2.c | 44 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) (limited to 'drivers/misc/sgi-xp/xpc_sn2.c') diff --git a/drivers/misc/sgi-xp/xpc_sn2.c b/drivers/misc/sgi-xp/xpc_sn2.c index eaaa964942d..43ad2968daf 100644 --- a/drivers/misc/sgi-xp/xpc_sn2.c +++ b/drivers/misc/sgi-xp/xpc_sn2.c @@ -3,7 +3,7 @@ * License. See the file "COPYING" in the main directory of this archive * for more details. * - * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2008-2009 Silicon Graphics, Inc. All Rights Reserved. */ /* @@ -629,7 +629,7 @@ xpc_setup_rsvd_page_sn_sn2(struct xpc_rsvd_page *rp) xpc_vars_sn2 = XPC_RP_VARS(rp); - rp->sn.vars_pa = xp_pa(xpc_vars_sn2); + rp->sn.sn2.vars_pa = xp_pa(xpc_vars_sn2); /* vars_part array follows immediately after vars */ xpc_vars_part_sn2 = (struct xpc_vars_part_sn2 *)((u8 *)XPC_RP_VARS(rp) + @@ -693,6 +693,33 @@ xpc_setup_rsvd_page_sn_sn2(struct xpc_rsvd_page *rp) return 0; } +static int +xpc_hb_allowed_sn2(short partid, void *heartbeating_to_mask) +{ + return test_bit(partid, heartbeating_to_mask); +} + +static void +xpc_allow_hb_sn2(short partid) +{ + DBUG_ON(xpc_vars_sn2 == NULL); + set_bit(partid, xpc_vars_sn2->heartbeating_to_mask); +} + +static void +xpc_disallow_hb_sn2(short partid) +{ + DBUG_ON(xpc_vars_sn2 == NULL); + clear_bit(partid, xpc_vars_sn2->heartbeating_to_mask); +} + +static void +xpc_disallow_all_hbs_sn2(void) +{ + DBUG_ON(xpc_vars_sn2 == NULL); + bitmap_zero(xpc_vars_sn2->heartbeating_to_mask, xp_max_npartitions); +} + static void xpc_increment_heartbeat_sn2(void) { @@ -719,7 +746,6 @@ xpc_heartbeat_init_sn2(void) DBUG_ON(xpc_vars_sn2 == NULL); bitmap_zero(xpc_vars_sn2->heartbeating_to_mask, XP_MAX_NPARTITIONS_SN2); - xpc_heartbeating_to_mask = &xpc_vars_sn2->heartbeating_to_mask[0]; xpc_online_heartbeat_sn2(); } @@ -751,9 +777,9 @@ xpc_get_remote_heartbeat_sn2(struct xpc_partition *part) 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)) { + !remote_vars->heartbeat_offline) || + !xpc_hb_allowed_sn2(sn_partition_id, + remote_vars->heartbeating_to_mask)) { ret = xpNoHeartbeat; } else { part->last_heartbeat = remote_vars->heartbeat; @@ -972,7 +998,7 @@ xpc_identify_activate_IRQ_req_sn2(int nasid) return; } - remote_vars_pa = remote_rp->sn.vars_pa; + remote_vars_pa = remote_rp->sn.sn2.vars_pa; remote_rp_version = remote_rp->version; remote_rp_ts_jiffies = remote_rp->ts_jiffies; @@ -2325,6 +2351,10 @@ xpc_init_sn2(void) xpc_teardown_partitions_sn = xpc_teardown_partitions_sn_sn2; xpc_get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_sn2; xpc_setup_rsvd_page_sn = xpc_setup_rsvd_page_sn_sn2; + + xpc_allow_hb = xpc_allow_hb_sn2; + xpc_disallow_hb = xpc_disallow_hb_sn2; + xpc_disallow_all_hbs = xpc_disallow_all_hbs_sn2; xpc_increment_heartbeat = xpc_increment_heartbeat_sn2; xpc_offline_heartbeat = xpc_offline_heartbeat_sn2; xpc_online_heartbeat = xpc_online_heartbeat_sn2; -- cgit v1.2.3 From efdd06ed181a88a11e612238c1ac04668e665395 Mon Sep 17 00:00:00 2001 From: Robin Holt Date: Mon, 13 Apr 2009 14:40:19 -0700 Subject: sgi-xpc: implement opencomplete messaging sgi-xpc has a window of failure where an open message can be sent and a subsequent data message can get lost. We have added a new message (opencomplete) which closes that window. Signed-off-by: Robin Holt Signed-off-by: Dean Nelson Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/misc/sgi-xp/xpc_sn2.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/misc/sgi-xp/xpc_sn2.c') diff --git a/drivers/misc/sgi-xp/xpc_sn2.c b/drivers/misc/sgi-xp/xpc_sn2.c index 43ad2968daf..09bc1989f21 100644 --- a/drivers/misc/sgi-xp/xpc_sn2.c +++ b/drivers/misc/sgi-xp/xpc_sn2.c @@ -430,6 +430,13 @@ xpc_send_chctl_openreply_sn2(struct xpc_channel *ch, unsigned long *irq_flags) XPC_SEND_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_OPENREPLY, irq_flags); } +static void +xpc_send_chctl_opencomplete_sn2(struct xpc_channel *ch, + unsigned long *irq_flags) +{ + XPC_SEND_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_OPENCOMPLETE, irq_flags); +} + static void xpc_send_chctl_msgrequest_sn2(struct xpc_channel *ch) { @@ -2380,6 +2387,7 @@ xpc_init_sn2(void) xpc_send_chctl_closereply = xpc_send_chctl_closereply_sn2; xpc_send_chctl_openrequest = xpc_send_chctl_openrequest_sn2; xpc_send_chctl_openreply = xpc_send_chctl_openreply_sn2; + xpc_send_chctl_opencomplete = xpc_send_chctl_opencomplete_sn2; xpc_save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_sn2; -- cgit v1.2.3 From a7665b0a380585fbd70a2275f3120c6086e0c92d Mon Sep 17 00:00:00 2001 From: Robin Holt Date: Mon, 13 Apr 2009 14:40:19 -0700 Subject: sgi-xpc: clean up numerous globals Introduce xpc_arch_ops and eliminate numerous individual global definitions. Signed-off-by: Robin Holt Cc: Dean Nelson Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/misc/sgi-xp/xpc_sn2.c | 122 ++++++++++++++++++++++-------------------- 1 file changed, 63 insertions(+), 59 deletions(-) (limited to 'drivers/misc/sgi-xp/xpc_sn2.c') diff --git a/drivers/misc/sgi-xp/xpc_sn2.c b/drivers/misc/sgi-xp/xpc_sn2.c index 09bc1989f21..915a3b495da 100644 --- a/drivers/misc/sgi-xp/xpc_sn2.c +++ b/drivers/misc/sgi-xp/xpc_sn2.c @@ -60,14 +60,14 @@ static struct xpc_vars_sn2 *xpc_vars_sn2; static struct xpc_vars_part_sn2 *xpc_vars_part_sn2; static int -xpc_setup_partitions_sn_sn2(void) +xpc_setup_partitions_sn2(void) { /* nothing needs to be done */ return 0; } static void -xpc_teardown_partitions_sn_sn2(void) +xpc_teardown_partitions_sn2(void) { /* nothing needs to be done */ } @@ -628,7 +628,7 @@ xpc_get_partition_rsvd_page_pa_sn2(void *buf, u64 *cookie, unsigned long *rp_pa, static int -xpc_setup_rsvd_page_sn_sn2(struct xpc_rsvd_page *rp) +xpc_setup_rsvd_page_sn2(struct xpc_rsvd_page *rp) { struct amo *amos_page; int i; @@ -1162,7 +1162,7 @@ xpc_process_activate_IRQ_rcvd_sn2(void) * Setup the channel structures that are sn2 specific. */ static enum xp_retval -xpc_setup_ch_structures_sn_sn2(struct xpc_partition *part) +xpc_setup_ch_structures_sn2(struct xpc_partition *part) { struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2; struct xpc_channel_sn2 *ch_sn2; @@ -1284,7 +1284,7 @@ out_1: * Teardown the channel structures that are sn2 specific. */ static void -xpc_teardown_ch_structures_sn_sn2(struct xpc_partition *part) +xpc_teardown_ch_structures_sn2(struct xpc_partition *part) { struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2; short partid = XPC_PARTID(part); @@ -2348,66 +2348,70 @@ xpc_received_payload_sn2(struct xpc_channel *ch, void *payload) xpc_acknowledge_msgs_sn2(ch, get, msg->flags); } +static struct xpc_arch_operations xpc_arch_ops_sn2 = { + .setup_partitions = xpc_setup_partitions_sn2, + .teardown_partitions = xpc_teardown_partitions_sn2, + .process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_sn2, + .get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_sn2, + .setup_rsvd_page = xpc_setup_rsvd_page_sn2, + + .allow_hb = xpc_allow_hb_sn2, + .disallow_hb = xpc_disallow_hb_sn2, + .disallow_all_hbs = xpc_disallow_all_hbs_sn2, + .increment_heartbeat = xpc_increment_heartbeat_sn2, + .offline_heartbeat = xpc_offline_heartbeat_sn2, + .online_heartbeat = xpc_online_heartbeat_sn2, + .heartbeat_init = xpc_heartbeat_init_sn2, + .heartbeat_exit = xpc_heartbeat_exit_sn2, + .get_remote_heartbeat = xpc_get_remote_heartbeat_sn2, + + .request_partition_activation = + xpc_request_partition_activation_sn2, + .request_partition_reactivation = + xpc_request_partition_reactivation_sn2, + .request_partition_deactivation = + xpc_request_partition_deactivation_sn2, + .cancel_partition_deactivation_request = + xpc_cancel_partition_deactivation_request_sn2, + + .setup_ch_structures = xpc_setup_ch_structures_sn2, + .teardown_ch_structures = xpc_teardown_ch_structures_sn2, + + .make_first_contact = xpc_make_first_contact_sn2, + + .get_chctl_all_flags = xpc_get_chctl_all_flags_sn2, + .send_chctl_closerequest = xpc_send_chctl_closerequest_sn2, + .send_chctl_closereply = xpc_send_chctl_closereply_sn2, + .send_chctl_openrequest = xpc_send_chctl_openrequest_sn2, + .send_chctl_openreply = xpc_send_chctl_openreply_sn2, + .send_chctl_opencomplete = xpc_send_chctl_opencomplete_sn2, + .process_msg_chctl_flags = xpc_process_msg_chctl_flags_sn2, + + .save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_sn2, + + .setup_msg_structures = xpc_setup_msg_structures_sn2, + .teardown_msg_structures = xpc_teardown_msg_structures_sn2, + + .indicate_partition_engaged = xpc_indicate_partition_engaged_sn2, + .indicate_partition_disengaged = xpc_indicate_partition_disengaged_sn2, + .partition_engaged = xpc_partition_engaged_sn2, + .any_partition_engaged = xpc_any_partition_engaged_sn2, + .assume_partition_disengaged = xpc_assume_partition_disengaged_sn2, + + .n_of_deliverable_payloads = xpc_n_of_deliverable_payloads_sn2, + .send_payload = xpc_send_payload_sn2, + .get_deliverable_payload = xpc_get_deliverable_payload_sn2, + .received_payload = xpc_received_payload_sn2, + .notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_sn2, +}; + int xpc_init_sn2(void) { int ret; size_t buf_size; - xpc_setup_partitions_sn = xpc_setup_partitions_sn_sn2; - xpc_teardown_partitions_sn = xpc_teardown_partitions_sn_sn2; - xpc_get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_sn2; - xpc_setup_rsvd_page_sn = xpc_setup_rsvd_page_sn_sn2; - - xpc_allow_hb = xpc_allow_hb_sn2; - xpc_disallow_hb = xpc_disallow_hb_sn2; - xpc_disallow_all_hbs = xpc_disallow_all_hbs_sn2; - xpc_increment_heartbeat = xpc_increment_heartbeat_sn2; - xpc_offline_heartbeat = xpc_offline_heartbeat_sn2; - xpc_online_heartbeat = xpc_online_heartbeat_sn2; - xpc_heartbeat_init = xpc_heartbeat_init_sn2; - xpc_heartbeat_exit = xpc_heartbeat_exit_sn2; - xpc_get_remote_heartbeat = xpc_get_remote_heartbeat_sn2; - - xpc_request_partition_activation = xpc_request_partition_activation_sn2; - xpc_request_partition_reactivation = - xpc_request_partition_reactivation_sn2; - xpc_request_partition_deactivation = - xpc_request_partition_deactivation_sn2; - xpc_cancel_partition_deactivation_request = - xpc_cancel_partition_deactivation_request_sn2; - - xpc_process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_sn2; - xpc_setup_ch_structures_sn = xpc_setup_ch_structures_sn_sn2; - xpc_teardown_ch_structures_sn = xpc_teardown_ch_structures_sn_sn2; - xpc_make_first_contact = xpc_make_first_contact_sn2; - - xpc_get_chctl_all_flags = xpc_get_chctl_all_flags_sn2; - xpc_send_chctl_closerequest = xpc_send_chctl_closerequest_sn2; - xpc_send_chctl_closereply = xpc_send_chctl_closereply_sn2; - xpc_send_chctl_openrequest = xpc_send_chctl_openrequest_sn2; - xpc_send_chctl_openreply = xpc_send_chctl_openreply_sn2; - xpc_send_chctl_opencomplete = xpc_send_chctl_opencomplete_sn2; - - xpc_save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_sn2; - - xpc_setup_msg_structures = xpc_setup_msg_structures_sn2; - xpc_teardown_msg_structures = xpc_teardown_msg_structures_sn2; - - xpc_notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_sn2; - xpc_process_msg_chctl_flags = xpc_process_msg_chctl_flags_sn2; - xpc_n_of_deliverable_payloads = xpc_n_of_deliverable_payloads_sn2; - xpc_get_deliverable_payload = xpc_get_deliverable_payload_sn2; - - xpc_indicate_partition_engaged = xpc_indicate_partition_engaged_sn2; - xpc_indicate_partition_disengaged = - xpc_indicate_partition_disengaged_sn2; - xpc_partition_engaged = xpc_partition_engaged_sn2; - xpc_any_partition_engaged = xpc_any_partition_engaged_sn2; - xpc_assume_partition_disengaged = xpc_assume_partition_disengaged_sn2; - - xpc_send_payload = xpc_send_payload_sn2; - xpc_received_payload = xpc_received_payload_sn2; + xpc_arch_ops = xpc_arch_ops_sn2; if (offsetof(struct xpc_msg_sn2, payload) > XPC_MSG_HDR_MAX_SIZE) { dev_err(xpc_part, "header portion of struct xpc_msg_sn2 is " -- cgit v1.2.3