Some SGI XPC Updates
cover Some SGI XPC Updates
Andrew,
This set of patches applies on top of the patches applies on top of the set you just sent to Linus. They should have already been submitted to you, but they fell through the cracks.
Thanks,
Robin Holt
PATCH 1/3 Update SGI XP/XPC/XPNET maintainer.
Dean has moved on to other work. His responsibilities for XP/XPC/XPNET have been handed to me.
--- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
MAINTAINERS +2 -2
@@ -3983,8 +3983,8 @@ W: http://linux-visws.sf.net S: Maintained for 2.6. SGI XP/XPC/XPNET DRIVER -P: Dean Nelson -M: [email protected] +P: Robin Holt +M: [email protected] S: Maintained SHARP LH SUPPORT (LH7952X & LH7A40X)
PATCH 2/3 Prevent false sgi-xpc heartbeat failures.
In reply to [email protected]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.
---
drivers/misc/sgi-xp/xpc.h | 104 +++++++++++++--------------------- drivers/misc/sgi-xp/xpc_main.c | 8 +- drivers/misc/sgi-xp/xpc_sn2.c | 44 ++++++++++++-- drivers/misc/sgi-xp/xpc_uv.c | 123 ++++++++++++++--------------------------- 4 files changed, 125 insertions(+), 154 deletions(-)
drivers/misc/sgi-xp/xpc.h +40 -64
@@ -90,18 +90,21 @@ struct xpc_rsvd_page {short max_npartitions;/* value of XPC_MAX_PARTITIONS */ u8 version;u8 pad1[3 ];/* align to next u64 in 1st 64-byte cacheline */ +unsigned long ts_jiffies;/* timestamp when rsvd pg was setup by XPC */ union { -unsigned long vars_pa;/* phys address of struct xpc_vars */ -unsigned long activate_gru_mq_desc_gpa;/* phys addr of */ -/* activate mq's */ -/* gru mq descriptor */ +struct { +unsigned long vars_pa;/* phys addr */ + } sn2; +struct { +unsigned long heartbeat_gpa;/* phys addr */ +unsigned long activate_gru_mq_desc_gpa;/* phys addr */ + } uv; } sn; -unsigned long ts_jiffies;/* timestamp when rsvd pg was setup by XPC */ -u64 pad2[10 ];/* align to last u64 in 2nd 64-byte cacheline */ +u64 pad2[9 ];/* align to last u64 in 2nd 64-byte cacheline */ u64 SAL_nasids_size;/* SAL: size of each nasid mask in bytes */ }; -#define XPC_RP_VERSION _XPC_VERSION(2, 0)/* version 2.0 of the reserved page */ +#define XPC_RP_VERSION _XPC_VERSION(3, 0)/* version 3.0 of the reserved page */ /* * Define the structures by which XPC variables can be exported to other
@@ -182,6 +185,17 @@ struct xpc_vars_part_sn2 { (XPC_RP_MACH_NASIDS(_rp) + \ xpc_nasid_mask_nlongs)) + +/* +* The following structure describes the partition's heartbeat info which +* will be periodically read by other partitions to determine whether this +* XPC is still 'alive'. +*/ +struct xpc_heartbeat_uv { +unsigned long value; +unsigned long offline;/* if 0, heartbeat should be changing */ +}; +/* * Info pertinent to a GRU message queue using a watch list for irq generation. */
@@ -198,7 +212,7 @@ struct xpc_gru_mq_uv {/* * The activate_mq is used to send/receive GRU messages that affect XPC's -* heartbeat, partition active state, and channel state. This is UV only. +* partition active state and channel state. This is uv only. */ struct xpc_activate_mq_msghdr_uv {unsigned int gru_msg_hdr;/* FOR GRU INTERNAL USE ONLY */
@@ -210,33 +224,26 @@ struct xpc_activate_mq_msghdr_uv {/* activate_mq defined message types */ #define XPC_ACTIVATE_MQ_MSG_SYNC_ACT_STATE_UV 0 -#define XPC_ACTIVATE_MQ_MSG_INC_HEARTBEAT_UV 1 -#define XPC_ACTIVATE_MQ_MSG_OFFLINE_HEARTBEAT_UV 2 -#define XPC_ACTIVATE_MQ_MSG_ONLINE_HEARTBEAT_UV 3 - -#define XPC_ACTIVATE_MQ_MSG_ACTIVATE_REQ_UV 4 -#define XPC_ACTIVATE_MQ_MSG_DEACTIVATE_REQ_UV 5 - -#define XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREQUEST_UV 6 -#define XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV 7 -#define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV 8 -#define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV 9 -#define XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV 10 -#define XPC_ACTIVATE_MQ_MSG_MARK_DISENGAGED_UV 11 +#define XPC_ACTIVATE_MQ_MSG_ACTIVATE_REQ_UV 1 +#define XPC_ACTIVATE_MQ_MSG_DEACTIVATE_REQ_UV 2 -struct xpc_activate_mq_msg_uv { -struct xpc_activate_mq_msghdr_uv hdr; -}; +#define XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREQUEST_UV 3 +#define XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV 4 +#define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV 5 +#define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV 6 + +#define XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV 7 +#define XPC_ACTIVATE_MQ_MSG_MARK_DISENGAGED_UV 8 -struct xpc_activate_mq_msg_heartbeat_req_uv { +struct xpc_activate_mq_msg_uv {struct xpc_activate_mq_msghdr_uv hdr; -u64 heartbeat; };struct xpc_activate_mq_msg_activate_req_uv {struct xpc_activate_mq_msghdr_uv hdr;unsigned long rp_gpa; +unsigned long heartbeat_gpa;unsigned long activate_gru_mq_desc_gpa; };
@@ -687,6 +694,9 @@ struct xpc_partition_sn2 { };struct xpc_partition_uv { +unsigned long heartbeat_gpa;/* phys addr of partition's heartbeat */ +struct xpc_heartbeat_uv cached_heartbeat;/* cached copy of */ +/* partition's heartbeat */ unsigned long activate_gru_mq_desc_gpa;/* phys addr of parititon's */ /* activate mq's gru mq */ /* descriptor */
@@ -698,14 +708,12 @@ struct xpc_partition_uv {u8 remote_act_state;/* remote partition's act_state */ u8 act_state_req;/* act_state request from remote partition */ enum xp_retval reason;/* reason for deactivate act_state request */ -u64 heartbeat;/* incremented by remote partition */ };/* struct xpc_partition_uv flags */ -#define XPC_P_HEARTBEAT_OFFLINE_UV 0x00000001 +#define XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV 0x00000001#define XPC_P_ENGAGED_UV 0x00000002 -#define XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV 0x00000004/* struct xpc_partition_uv act_state change requests */
@@ -807,7 +815,6 @@ extern int xpc_disengage_timedout;extern int xpc_activate_IRQ_rcvd;extern spinlock_t xpc_activate_IRQ_rcvd_lock;extern wait_queue_head_t xpc_activate_IRQ_wq; -extern void *xpc_heartbeating_to_mask;extern void *xpc_kzalloc_cacheline_aligned (size_t ,gfp_t ,void **);extern void xpc_activate_partition (struct xpc_partition *);extern void xpc_activate_kthreads (struct xpc_channel *,int );
@@ -825,6 +832,9 @@ extern void (*xpc_increment_heartbeat) (extern void (*xpc_offline_heartbeat) (void );extern void (*xpc_online_heartbeat) (void );extern enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *); +extern void (*xpc_allow_hb) (short ); +extern void (*xpc_disallow_hb) (short ); +extern void (*xpc_disallow_all_hbs) (void );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_setup_msg_structures) (struct xpc_channel *);
@@ -909,40 +919,6 @@ extern void xpc_disconnect_channel(constextern void xpc_disconnect_callout (struct xpc_channel *,enum xp_retval );extern void xpc_partition_going_down (struct xpc_partition *,enum xp_retval ); -static inline int -xpc_hb_allowed (short partid,void *heartbeating_to_mask) -{ -return test_bit (partid, heartbeating_to_mask); -} - -static inline int -xpc_any_hbs_allowed (void ) -{ -DBUG_ON (xpc_heartbeating_to_mask ==NULL ); -return !bitmap_empty (xpc_heartbeating_to_mask, xp_max_npartitions); -} - -static inline void -xpc_allow_hb (short partid) -{ -DBUG_ON (xpc_heartbeating_to_mask ==NULL ); -set_bit (partid, xpc_heartbeating_to_mask); -} - -static inline void -xpc_disallow_hb (short partid) -{ -DBUG_ON (xpc_heartbeating_to_mask ==NULL ); -clear_bit (partid, xpc_heartbeating_to_mask); -} - -static inline void -xpc_disallow_all_hbs (void ) -{ -DBUG_ON (xpc_heartbeating_to_mask ==NULL ); -bitmap_zero (xpc_heartbeating_to_mask, xp_max_npartitions); -} -static inline void xpc_wakeup_channel_mgr (struct xpc_partition *part) {
drivers/misc/sgi-xp/xpc_main.c +5 -3
@@ -3,7 +3,7 @@* License. See the file "COPYING" in the main directory of this archive * for more details. * -* Copyright (c) 2004-2008 Silicon Graphics, Inc. All Rights Reserved. +* Copyright (c) 2004-2009 Silicon Graphics, Inc. All Rights Reserved. */ /*
@@ -150,7 +150,6 @@ DECLARE_WAIT_QUEUE_HEAD(xpc_activate_IRQstatic unsigned long xpc_hb_check_timeout;static struct timer_list xpc_hb_timer; -void *xpc_heartbeating_to_mask;/* notification that the xpc_hb_checker thread has exited */ static DECLARE_COMPLETION (xpc_hb_checker_exited);
@@ -176,6 +175,10 @@ enum xp_retval (*xpc_get_partition_rsvd_unsigned long *rp_pa, size_t *len);int (*xpc_setup_rsvd_page_sn) (struct xpc_rsvd_page *rp); + +void (*xpc_allow_hb) (short partid); +void (*xpc_disallow_hb) (short partid); +void (*xpc_disallow_all_hbs) (void );void (*xpc_heartbeat_init) (void );void (*xpc_heartbeat_exit) (void );void (*xpc_increment_heartbeat) (void );
@@ -1087,7 +1090,6 @@ xpc_do_exit(enum xp_retval reason) }while (1 );DBUG_ON (xpc_any_partition_engaged ()); -DBUG_ON (xpc_any_hbs_allowed () !=0 );xpc_teardown_rsvd_page ();
drivers/misc/sgi-xp/xpc_sn2.c +37 -7
86 lines not on this page · raw message
drivers/misc/sgi-xp/xpc_uv.c +43 -80
215 lines not on this page · raw message
Re: [Patch 2/3] Prevent false sgi-xpc heartbeat failures.
drivers/misc/sgi-xp/xpc_main.c enum xp_retval (*xpc_get_partition_rsvd_ · line 184
Quoted 6 lines · On Fri, 03 Apr 2009 11:04:42 -0500 [email protected] wrote:
drivers/misc/sgi-xp/xpc_main.c +3
-0+void (*xpc_allow_hb) (short partid); +void (*xpc_disallow_hb) (short partid); +void (*xpc_disallow_all_hbs) (void );void (*xpc_heartbeat_init) (void );void (*xpc_heartbeat_exit) (void );void (*xpc_increment_heartbeat) (void );
The driver adds a huge number of globals.
As a pointless cleanup it might be nice to convert all this:
: int (*xpc_setup_partitions_sn) (void);
: void (*xpc_teardown_partitions_sn) (void);
: enum xp_retval (*xpc_get_partition_rsvd_page_pa) (void *buf, u64 *cookie,
: unsigned long *rp_pa,
: size_t *len);
: int (*xpc_setup_rsvd_page_sn) (struct xpc_rsvd_page *rp);
:
: void (*xpc_allow_hb) (short partid);
: void (*xpc_disallow_hb) (short partid);
: void (*xpc_disallow_all_hbs) (void);
: void (*xpc_heartbeat_init) (void);
: void (*xpc_heartbeat_exit) (void);
: void (*xpc_increment_heartbeat) (void);
: void (*xpc_offline_heartbeat) (void);
: void (*xpc_online_heartbeat) (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); : u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *part);
: enum xp_retval (*xpc_setup_msg_structures) (struct xpc_channel *ch); : void (*xpc_teardown_msg_structures) (struct xpc_channel *ch);
: void (*xpc_process_msg_chctl_flags) (struct xpc_partition *part, int ch_number); : int (*xpc_n_of_deliverable_payloads) (struct xpc_channel *ch);
: void *(*xpc_get_deliverable_payload) (struct xpc_channel *ch);
:
: void (*xpc_request_partition_activation) (struct xpc_rsvd_page *remote_rp,
: unsigned long remote_rp_pa,
: int nasid);
: void (*xpc_request_partition_reactivation) (struct xpc_partition *part); : void (*xpc_request_partition_deactivation) (struct xpc_partition *part); : void (*xpc_cancel_partition_deactivation_request) (struct xpc_partition *part); :
: void (*xpc_process_activate_IRQ_rcvd) (void);
: enum xp_retval (*xpc_setup_ch_structures_sn) (struct xpc_partition *part); : void (*xpc_teardown_ch_structures_sn) (struct xpc_partition *part); :
: void (*xpc_indicate_partition_engaged) (struct xpc_partition *part); : int (*xpc_partition_engaged) (short partid);
: int (*xpc_any_partition_engaged) (void);
: void (*xpc_indicate_partition_disengaged) (struct xpc_partition *part); : void (*xpc_assume_partition_disengaged) (short partid);
:
: void (*xpc_send_chctl_closerequest) (struct xpc_channel *ch,
: unsigned long *irq_flags);
: void (*xpc_send_chctl_closereply) (struct xpc_channel *ch,
: unsigned long *irq_flags);
: void (*xpc_send_chctl_openrequest) (struct xpc_channel *ch,
: unsigned long *irq_flags);
: void (*xpc_send_chctl_openreply) (struct xpc_channel *ch,
: unsigned long *irq_flags);
:
: enum xp_retval (*xpc_save_remote_msgqueue_pa) (struct xpc_channel *ch,
: unsigned long msgqueue_pa);
:
: enum xp_retval (*xpc_send_payload) (struct xpc_channel *ch, u32 flags,
: void *payload, u16 payload_size, : u8 notify_type, xpc_notify_func func, : void *key);
: void (*xpc_received_payload) (struct xpc_channel *ch, void *payload);
into
struct xpc_operations {
int (*setup_partitions_sn)(void);
...
void (*xpc_received_payload)(struct xpc_channel *ch, void *payload);
} xpc_operations;Or not ;)
Re: [Patch 2/3] Prevent false sgi-xpc heartbeat failures.
Quoted 12 lines · Andrew Morton
Review
Quoted 6 lines · On Fri, 03 Apr 2009 11:04:42 -0500 [email protected] wrote:
(quoted diff) +3
-0+void (*xpc_allow_hb) (short partid); +void (*xpc_disallow_hb) (short partid); +void (*xpc_disallow_all_hbs) (void); void (*xpc_heartbeat_init) (void); void (*xpc_heartbeat_exit) (void); void (*xpc_increment_heartbeat) (void);The driver adds a huge number of globals.
Quoted 1 line
As a pointless cleanup it might be nice to convert all this:
Andrew,
Was this what you were thinking? I just slapped this together. It is not ready for inclusion yet. I need to review the patch and test it first.
drivers/misc/sgi-xp/xpc.h +62 -55
@@ -780,6 +780,67 @@ struct xpc_partition { }____cacheline_aligned ; +struct xpc_arch_operations { +int (*setup_partitions) (void ); +void (*teardown_partitions) (void ); +void (*process_activate_IRQ_rcvd) (void ); +enum xp_retval (*get_partition_rsvd_page_pa) + (void *,u64 *,unsigned long *,size_t *); +int (*setup_rsvd_page) (struct xpc_rsvd_page *); + +void (*allow_hb) (short ); +void (*disallow_hb) (short ); +void (*disallow_all_hbs) (void ); +void (*increment_heartbeat) (void ); +void (*offline_heartbeat) (void ); +void (*online_heartbeat) (void ); +void (*heartbeat_init) (void ); +void (*heartbeat_exit) (void ); +enum xp_retval (*get_remote_heartbeat) (struct xpc_partition *); + +void (*request_partition_activation) (struct xpc_rsvd_page *, +unsigned long ,int ); +void (*request_partition_reactivation) (struct xpc_partition *); +void (*request_partition_deactivation) (struct xpc_partition *); +void (*cancel_partition_deactivation_request) ( +struct xpc_partition *); +enum xp_retval (*setup_ch_structures) (struct xpc_partition *); +void (*teardown_ch_structures) (struct xpc_partition *); + +enum xp_retval (*make_first_contact) (struct xpc_partition *); + +u64 (*get_chctl_all_flags) (struct xpc_partition *); +void (*send_chctl_closerequest) (struct xpc_channel *, +unsigned long *); +void (*send_chctl_closereply) (struct xpc_channel *, +unsigned long *); +void (*send_chctl_openrequest) (struct xpc_channel *, +unsigned long *); +void (*send_chctl_openreply) (struct xpc_channel *,unsigned long *); +void (*send_chctl_opencomplete) (struct xpc_channel *, +unsigned long *); +void (*process_msg_chctl_flags) (struct xpc_partition *,int ); + +enum xp_retval (*save_remote_msgqueue_pa) (struct xpc_channel *, +unsigned long ); + +enum xp_retval (*setup_msg_structures) (struct xpc_channel *); +void (*teardown_msg_structures) (struct xpc_channel *); + +void (*indicate_partition_engaged) (struct xpc_partition *); +void (*indicate_partition_disengaged) (struct xpc_partition *); +void (*assume_partition_disengaged) (short ); +int (*partition_engaged) (short ); +int (*any_partition_engaged) (void ); + +int (*n_of_deliverable_payloads) (struct xpc_channel *); +enum xp_retval (*send_payload) (struct xpc_channel *,u32 ,void *, +u16 ,u8 ,xpc_notify_func ,void *); +void *(*get_deliverable_payload) (struct xpc_channel *); +void (*received_payload) (struct xpc_channel *,void *); +void (*notify_senders_of_disconnect) (struct xpc_channel *); +}; +/* struct xpc_partition act_state values (for XPC HB) */ #define XPC_P_AS_INACTIVE 0x00/* partition is not active */
@@ -820,6 +881,7 @@ extern struct xpc_registration xpc_regis/* found in xpc_main.c */ extern struct device *xpc_part;extern struct device *xpc_chan; +extern struct xpc_arch_operations *xpc_arch_ops;extern int xpc_disengage_timelimit;extern int xpc_disengage_timedout;extern int xpc_activate_IRQ_rcvd;
@@ -830,61 +892,6 @@ extern void xpc_activate_partition(strucextern void xpc_activate_kthreads (struct xpc_channel *,int );extern void xpc_create_kthreads (struct xpc_channel *,int ,int );extern void xpc_disconnect_wait (int ); -extern int (*xpc_setup_partitions_sn) (void ); -extern void (*xpc_teardown_partitions_sn) (void ); -extern enum xp_retval (*xpc_get_partition_rsvd_page_pa) (void *,u64 *, -unsigned long *, -size_t *); -extern int (*xpc_setup_rsvd_page_sn) (struct xpc_rsvd_page *); -extern void (*xpc_heartbeat_init) (void ); -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 enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *); -extern void (*xpc_allow_hb) (short ); -extern void (*xpc_disallow_hb) (short ); -extern void (*xpc_disallow_all_hbs) (void ); -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_setup_msg_structures) (struct xpc_channel *); -extern void (*xpc_teardown_msg_structures) (struct xpc_channel *); -extern void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *); -extern void (*xpc_process_msg_chctl_flags) (struct xpc_partition *,int ); -extern int (*xpc_n_of_deliverable_payloads) (struct xpc_channel *); -extern void *(*xpc_get_deliverable_payload) (struct xpc_channel *); -extern void (*xpc_request_partition_activation) (struct xpc_rsvd_page *, -unsigned long ,int ); -extern void (*xpc_request_partition_reactivation) (struct xpc_partition *); -extern void (*xpc_request_partition_deactivation) (struct xpc_partition *); -extern void (*xpc_cancel_partition_deactivation_request) ( -struct xpc_partition *); -extern void (*xpc_process_activate_IRQ_rcvd) (void ); -extern enum xp_retval (*xpc_setup_ch_structures_sn) (struct xpc_partition *); -extern void (*xpc_teardown_ch_structures_sn) (struct xpc_partition *); - -extern void (*xpc_indicate_partition_engaged) (struct xpc_partition *); -extern int (*xpc_partition_engaged) (short ); -extern int (*xpc_any_partition_engaged) (void ); -extern void (*xpc_indicate_partition_disengaged) (struct xpc_partition *); -extern void (*xpc_assume_partition_disengaged) (short ); - -extern void (*xpc_send_chctl_closerequest) (struct xpc_channel *, -unsigned long *); -extern void (*xpc_send_chctl_closereply) (struct xpc_channel *, -unsigned long *); -extern void (*xpc_send_chctl_openrequest) (struct xpc_channel *, -unsigned long *); -extern void (*xpc_send_chctl_openreply) (struct xpc_channel *,unsigned long *); -extern void (*xpc_send_chctl_opencomplete) (struct xpc_channel *, -unsigned long *); - -extern enum xp_retval (*xpc_save_remote_msgqueue_pa) (struct xpc_channel *, -unsigned long ); - -extern enum xp_retval (*xpc_send_payload) (struct xpc_channel *,u32 ,void *, -u16 ,u8 ,xpc_notify_func ,void *); -extern void (*xpc_received_payload) (struct xpc_channel *,void *);/* found in xpc_sn2.c */ extern int xpc_init_sn2 (void );
drivers/misc/sgi-xp/xpc_main.c +37 -92
306 lines not on this page · raw message
drivers/misc/sgi-xp/xpc_partition.c +9 -9
@@ -79,8 +79,8 @@ xpc_get_rsvd_page_pa(int nasid)* ??? function or have two versions? Rename rp_pa for UV to * ??? rp_gpa? */ - ret =xpc_get_partition_rsvd_page_pa (buf, &cookie, &rp_pa, - &len); + ret = xpc_arch_ops->get_partition_rsvd_page_pa ( + buf, &cookie, &rp_pa, &len); dev_dbg(xpc_part, "SAL returned with ret=%d, cookie=0x%016lx, " "address=0x%016lx, len=0x%016lx\n", ret,
@@ -172,7 +172,7 @@ xpc_setup_rsvd_page(void) xpc_part_nasids =XPC_RP_PART_NASIDS (rp); xpc_mach_nasids =XPC_RP_MACH_NASIDS (rp); - ret =xpc_setup_rsvd_page_sn (rp); + ret = xpc_arch_ops->setup_rsvd_page (rp);if (ret !=0 )return ret;
@@ -264,7 +264,7 @@ xpc_partition_disengaged(struct xpc_partshort partid =XPC_PARTID (part);int disengaged; - disengaged = !xpc_partition_engaged (partid); + disengaged = !xpc_arch_ops->partition_engaged (partid);if (part->disengage_timeout) {if (!disengaged) {if (time_is_after_jiffies (part->disengage_timeout)) {
@@ -280,7 +280,7 @@ xpc_partition_disengaged(struct xpc_partdev_info (xpc_part,"deactivate request to remote " "partition %d timed out\n" , partid); xpc_disengage_timedout =1 ; -xpc_assume_partition_disengaged (partid); + xpc_arch_ops->assume_partition_disengaged (partid); disengaged =1 ; } part->disengage_timeout =0 ;
@@ -294,7 +294,7 @@ xpc_partition_disengaged(struct xpc_partif (part->act_state !=XPC_P_AS_INACTIVE )xpc_wakeup_channel_mgr (part); -xpc_cancel_partition_deactivation_request (part); + xpc_arch_ops->cancel_partition_deactivation_request (part); }return disengaged; }
@@ -339,7 +339,7 @@ xpc_deactivate_partition(const int line,spin_unlock_irqrestore (&part->act_lock, irq_flags);if (reason == xpReactivating) {/* we interrupt ourselves to reactivate partition */ -xpc_request_partition_reactivation (part); + xpc_arch_ops->request_partition_reactivation (part); }return ; }
@@ -358,7 +358,7 @@ xpc_deactivate_partition(const int line,spin_unlock_irqrestore (&part->act_lock, irq_flags);/* ask remote partition to deactivate with regard to us */ -xpc_request_partition_deactivation (part); + xpc_arch_ops->request_partition_deactivation (part);/* set a timelimit on the disengage phase of the deactivation request */ part->disengage_timeout = jiffies + (xpc_disengage_timelimit *HZ );
@@ -496,7 +496,7 @@ xpc_discovery(void)continue ; } -xpc_request_partition_activation (remote_rp, + xpc_arch_ops->request_partition_activation (remote_rp, remote_rp_pa, nasid); } }
drivers/misc/sgi-xp/xpc_sn2.c +63 -59
164 lines not on this page · raw message
drivers/misc/sgi-xp/xpc_uv.c +63 -59
161 lines not on this page · raw message
drivers/misc/sgi-xp/xpc_channel.c +22 -21
145 lines not on this page · raw message
Re: [Patch 2/3] Prevent false sgi-xpc heartbeat failures.
Quoted 26 lines · On Tue, 7 Apr 2009 20:04:49 -0500 Robin Holt <[email protected]> wrote:
Quoted 12 lines · Andrew Morton
Review
Quoted 6 lines · On Fri, 03 Apr 2009 11:04:42 -0500 [email protected] wrote:
(quoted diff) +3
-0+void (*xpc_allow_hb) (short partid); +void (*xpc_disallow_hb) (short partid); +void (*xpc_disallow_all_hbs) (void); void (*xpc_heartbeat_init) (void); void (*xpc_heartbeat_exit) (void); void (*xpc_increment_heartbeat) (void);The driver adds a huge number of globals.
Quoted 1 line
As a pointless cleanup it might be nice to convert all this:
Andrew,
Was this what you were thinking? I just slapped this together. It is not ready for inclusion yet. I need to review the patch and test it first.
Index:
20090407-dcn-fixes/drivers/misc/sgi-xp/xpc.h
===================================================================
drivers/misc/sgi-xp/xpc.h struct xpc_partition {
Quoted 10 lines
drivers/misc/sgi-xp/xpc.h +3
-0@@ -780,6 +780,67 @@ struct xpc_partition { }____cacheline_aligned ; +struct xpc_arch_operations { +}; +extern struct xpc_arch_operations *xpc_arch_ops;
That adds an extra pointer dereference for each call. I was thinking
extern struct xpc_arch_operations xpc_arch_ops;
static void
xpc_start_hb_beater(void)
{
xpc_heartbeat_init();
xpc_arch_ops.heartbeat_init();which should generate the same code - it's just syntactic sugar.
PATCH 3/3 Implement sgi-xpc opencomplete messaging.
In reply to [email protected]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.
---
drivers/misc/sgi-xp/xpc.h | 58 +++++++++++++--------- drivers/misc/sgi-xp/xpc_channel.c | 97 ++++++++++++++++++++++---------------- drivers/misc/sgi-xp/xpc_main.c | 2 drivers/misc/sgi-xp/xpc_sn2.c | 8 +++ drivers/misc/sgi-xp/xpc_uv.c | 22 ++++++++ 5 files changed, 125 insertions(+), 62 deletions(-)
drivers/misc/sgi-xp/xpc.h +35 -23
@@ -232,9 +232,10 @@ struct xpc_activate_mq_msghdr_uv {#define XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV 4#define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV 5#define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV 6 +#define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENCOMPLETE_UV 7 -#define XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV 7 -#define XPC_ACTIVATE_MQ_MSG_MARK_DISENGAGED_UV 8 +#define XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV 8 +#define XPC_ACTIVATE_MQ_MSG_MARK_DISENGAGED_UV 9struct xpc_activate_mq_msg_uv {struct xpc_activate_mq_msghdr_uv hdr;
@@ -278,6 +279,11 @@ struct xpc_activate_mq_msg_chctl_openrepunsigned long notify_gru_mq_desc_gpa; }; +struct xpc_activate_mq_msg_chctl_opencomplete_uv { +struct xpc_activate_mq_msghdr_uv hdr; +short ch_number; +}; +/* * Functions registered by add_timer() or called by kernel_thread() only * allow for a single 64-bit argument. The following macros can be used to
@@ -583,30 +589,32 @@ struct xpc_channel {#define XPC_C_WASCONNECTED 0x00000001/* channel was connected */ -#define XPC_C_ROPENREPLY 0x00000002/* remote open channel reply */ -#define XPC_C_OPENREPLY 0x00000004/* local open channel reply */ -#define XPC_C_ROPENREQUEST 0x00000008/* remote open channel request */ -#define XPC_C_OPENREQUEST 0x00000010/* local open channel request */ +#define XPC_C_ROPENCOMPLETE 0x00000002/* remote open channel complete */ +#define XPC_C_OPENCOMPLETE 0x00000004/* local open channel complete */ +#define XPC_C_ROPENREPLY 0x00000008/* remote open channel reply */ +#define XPC_C_OPENREPLY 0x00000010/* local open channel reply */ +#define XPC_C_ROPENREQUEST 0x00000020/* remote open channel request */ +#define XPC_C_OPENREQUEST 0x00000040/* local open channel request */ -#define XPC_C_SETUP 0x00000020/* channel's msgqueues are alloc'd */ -#define XPC_C_CONNECTEDCALLOUT 0x00000040/* connected callout initiated */ +#define XPC_C_SETUP 0x00000080/* channel's msgqueues are alloc'd */ +#define XPC_C_CONNECTEDCALLOUT 0x00000100/* connected callout initiated */ #define XPC_C_CONNECTEDCALLOUT_MADE \ - 0x00000080/* connected callout completed */ -#define XPC_C_CONNECTED 0x00000100/* local channel is connected */ -#define XPC_C_CONNECTING 0x00000200/* channel is being connected */ - -#define XPC_C_RCLOSEREPLY 0x00000400/* remote close channel reply */ -#define XPC_C_CLOSEREPLY 0x00000800/* local close channel reply */ -#define XPC_C_RCLOSEREQUEST 0x00001000/* remote close channel request */ -#define XPC_C_CLOSEREQUEST 0x00002000/* local close channel request */ + 0x00000200/* connected callout completed */ +#define XPC_C_CONNECTED 0x00000400/* local channel is connected */ +#define XPC_C_CONNECTING 0x00000800/* channel is being connected */ + +#define XPC_C_RCLOSEREPLY 0x00001000/* remote close channel reply */ +#define XPC_C_CLOSEREPLY 0x00002000/* local close channel reply */ +#define XPC_C_RCLOSEREQUEST 0x00004000/* remote close channel request */ +#define XPC_C_CLOSEREQUEST 0x00008000/* local close channel request */ -#define XPC_C_DISCONNECTED 0x00004000/* channel is disconnected */ -#define XPC_C_DISCONNECTING 0x00008000/* channel is being disconnected */ +#define XPC_C_DISCONNECTED 0x00010000/* channel is disconnected */ +#define XPC_C_DISCONNECTING 0x00020000/* channel is being disconnected */ #define XPC_C_DISCONNECTINGCALLOUT \ - 0x00010000/* disconnecting callout initiated */ + 0x00040000/* disconnecting callout initiated */ #define XPC_C_DISCONNECTINGCALLOUT_MADE \ - 0x00020000/* disconnecting callout completed */ -#define XPC_C_WDISCONNECT 0x00040000/* waiting for channel disconnect */ + 0x00080000/* disconnecting callout completed */ +#define XPC_C_WDISCONNECT 0x00100000/* waiting for channel disconnect */ /* * The channel control flags (chctl) union consists of a 64-bit variable which
@@ -625,11 +633,13 @@ union xpc_channel_ctl_flags {#define XPC_CHCTL_CLOSEREPLY 0x02#define XPC_CHCTL_OPENREQUEST 0x04#define XPC_CHCTL_OPENREPLY 0x08 -#define XPC_CHCTL_MSGREQUEST 0x10 +#define XPC_CHCTL_OPENCOMPLETE 0x10 +#define XPC_CHCTL_MSGREQUEST 0x20#define XPC_OPENCLOSE_CHCTL_FLAGS \ (XPC_CHCTL_CLOSEREQUEST | XPC_CHCTL_CLOSEREPLY | \ - XPC_CHCTL_OPENREQUEST | XPC_CHCTL_OPENREPLY) + XPC_CHCTL_OPENREQUEST | XPC_CHCTL_OPENREPLY | \ + XPC_CHCTL_OPENCOMPLETE)#define XPC_MSG_CHCTL_FLAGS XPC_CHCTL_MSGREQUEST static inline int
@@ -866,6 +876,8 @@ extern void (*xpc_send_chctl_closereply)extern void (*xpc_send_chctl_openrequest) (struct xpc_channel *,unsigned long *);extern void (*xpc_send_chctl_openreply) (struct xpc_channel *,unsigned long *); +extern void (*xpc_send_chctl_opencomplete) (struct xpc_channel *, +unsigned long *);extern enum xp_retval (*xpc_save_remote_msgqueue_pa) (struct xpc_channel *,unsigned long );
drivers/misc/sgi-xp/xpc_channel.c +58 -39
212 lines not on this page · raw message
drivers/misc/sgi-xp/xpc_main.c +2 -0
@@ -220,6 +220,8 @@ void (*xpc_send_chctl_openrequest) (stru unsigned long *irq_flags);void (*xpc_send_chctl_openreply) (struct xpc_channel *ch,unsigned long *irq_flags); +void (*xpc_send_chctl_opencomplete) (struct xpc_channel *ch, +unsigned long *irq_flags);enum xp_retval (*xpc_save_remote_msgqueue_pa) (struct xpc_channel *ch,unsigned long msgqueue_pa);
drivers/misc/sgi-xp/xpc_sn2.c +8 -0
@@ -431,6 +431,13 @@ xpc_send_chctl_openreply_sn2(struct xpc_ }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) {XPC_SEND_NOTIFY_IRQ_SN2 (ch,XPC_CHCTL_MSGREQUEST ,NULL );
@@ -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;
drivers/misc/sgi-xp/xpc_uv.c +22 -0
@@ -534,6 +534,17 @@ xpc_handle_activate_mq_msg_uv(struct xpcxpc_wakeup_channel_mgr (part);break ; } +case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENCOMPLETE_UV : { +struct xpc_activate_mq_msg_chctl_opencomplete_uv *msg; + + msg = container_of(msg_hdr, struct + xpc_activate_mq_msg_chctl_opencomplete_uv, hdr); +spin_lock_irqsave (&part->chctl_lock, irq_flags); + part->chctl.flags[msg->ch_number] |=XPC_CHCTL_OPENCOMPLETE ; +spin_unlock_irqrestore (&part->chctl_lock, irq_flags); + +xpc_wakeup_channel_mgr (part); + }case XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV :spin_lock_irqsave (&part_uv->flags_lock, irq_flags); part_uv->flags |=XPC_P_ENGAGED_UV ;
@@ -1202,6 +1213,16 @@ xpc_send_chctl_openreply_uv(struct xpc_c }static void +xpc_send_chctl_opencomplete_uv (struct xpc_channel *ch,unsigned long *irq_flags) +{ +struct xpc_activate_mq_msg_chctl_opencomplete_uv msg; + + msg.ch_number = ch->number; +xpc_send_activate_IRQ_ch_uv (ch, irq_flags, &msg,sizeof (msg), +XPC_ACTIVATE_MQ_MSG_CHCTL_OPENCOMPLETE_UV ); +} + +static void xpc_send_chctl_local_msgrequest_uv (struct xpc_partition *part,int ch_number) {unsigned long irq_flags;
@@ -1665,6 +1686,7 @@ xpc_init_uv(void) xpc_send_chctl_closereply = xpc_send_chctl_closereply_uv; xpc_send_chctl_openrequest = xpc_send_chctl_openrequest_uv; xpc_send_chctl_openreply = xpc_send_chctl_openreply_uv; + xpc_send_chctl_opencomplete = xpc_send_chctl_opencomplete_uv; xpc_save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_uv;