Skip to contentSkip to conversation

x86: UV BAU fix for non-consecutive nasids

PATCH Superseded Cliff Wickman 2 participants 3 messages May 9, 2011 – May 10, 2011

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: UV BAU fix for non-consecutive nasids

From: Cliff Wickman <[email protected]>

This is a fix for the SGI Altix-UV Broadcast Assist Unit code, which is used for TLB flushing.

This patch allows nasids (numa address space id's) to be non-consecutive, as is the case when using nasid striding or in some certain hardware configurations. It also provides a table in local memory for each cpu to translate target cpu number to target pnode and nasid.

Diffed against 2.6.39-rc6

---
 arch/x86/include/asm/uv/uv_bau.h |   17 +++++--
 arch/x86/platform/uv/tlb_uv.c    |   93 ++++++++++++++++++++++++++-------------
 2 files changed, 77 insertions(+), 33 deletions(-)
arch/x86/include/asm/uv/uv_bau.h +13 -4
Index: linux/arch/x86/include/asm/uv/uv_bau.h
===================================================================
@@ -94,6 +94,8 @@
 /* after this # consecutive successes, bump up the throttle if it was lowered */
 #define COMPLETE_THRESHOLD 5
 
+#define UV_LB_SUBNODEID 0x10
+
 /*
  * number of entries in the destination side payload queue
  */
@@ -124,7 +126,7 @@
  * The distribution specification (32 bytes) is interpreted as a 256-bit
  * distribution vector. Adjacent bits correspond to consecutive even numbered
  * nodeIDs. The result of adding the index of a given bit to the 15-bit
- * 'base_dest_nodeid' field of the header corresponds to the
+ * 'base_dest_nasid' field of the header corresponds to the
  * destination nodeID associated with that specified bit.
  */
 struct bau_target_uvhubmask {
@@ -176,7 +178,7 @@ struct bau_msg_payload {
 struct bau_msg_header {
 	unsigned int dest_subnodeid:6;	/* must be 0x10, for the LB */
 	/* bits 5:0 */
-	unsigned int base_dest_nodeid:15; /* nasid of the */
+	unsigned int base_dest_nasid:15; /* nasid of the */
 	/* bits 20:6 */			  /* first bit in uvhub map */
 	unsigned int command:8;	/* message type */
 	/* bits 28:21 */
@@ -378,6 +380,10 @@ struct ptc_stats {
 	unsigned long d_rcanceled; /* number of messages canceled by resets */
 };
 
+struct hub_and_pnode {
+	short uvhub;
+	short pnode;
+};
 /*
  * one per-cpu; to locate the software tables
  */
@@ -399,10 +405,12 @@ struct bau_control {
 	int baudisabled;
 	int set_bau_off;
 	short cpu;
+	short osnode;
 	short uvhub_cpu;
 	short uvhub;
 	short cpus_in_socket;
 	short cpus_in_uvhub;
+	short partition_base_pnode;
 	unsigned short message_number;
 	unsigned short uvhub_quiesce;
 	short socket_acknowledge_count[DEST_Q_SIZE];
@@ -422,15 +430,16 @@ struct bau_control {
 	int congested_period;
 	cycles_t period_time;
 	long period_requests;
+	struct hub_and_pnode *target_hub_and_pnode;
 };
 
 static inline int bau_uvhub_isset(int uvhub, struct bau_target_uvhubmask *dstp)
 {
 	return constant_test_bit(uvhub, &dstp->bits[0]);
 }
-static inline void bau_uvhub_set(int uvhub, struct bau_target_uvhubmask *dstp)
+static inline void bau_uvhub_set(int pnode, struct bau_target_uvhubmask *dstp)
 {
-	__set_bit(uvhub, &dstp->bits[0]);
+	__set_bit(pnode, &dstp->bits[0]);
 }
 static inline void bau_uvhubs_clear(struct bau_target_uvhubmask *dstp,
 				    int nbits)
arch/x86/platform/uv/tlb_uv.c +64 -29

199 lines not on this page · raw message

#1 lore raw
Quoted 9 lines · Cliff Wickman

From: Cliff Wickman <[email protected]>

This is a fix for the SGI Altix-UV Broadcast Assist Unit code, which is used for TLB flushing.

This patch allows nasids (numa address space id's) to be non-consecutive, as is the case when using nasid striding or in some certain hardware configurations. It also provides a table in local memory for each cpu to translate target cpu number to target pnode and nasid.

This changelog is missing one or more of the following essential pieces of information:

- what user-visible problem is the patch solving
- how was the problem triggered, how was the bug found
- what/how many systems are affected
- why should maintainers apply this patch right now

Thanks,

Ingo

#2 lore raw
In reply to Cliff Wickman
Quoted 9 lines · Cliff Wickman
arch/x86/platform/uv/tlb_uv.c +2 -3
@@ -1365,12 +1373,14 @@ uv_activation_descriptor_init(int node,
 		memset(bd2, 0, sizeof(struct bau_desc));
 		bd2->header.sw_ack_flag = 1;
 		/*
-		 * base_dest_nodeid is the nasid of the first uvhub
-		 * in the partition. The bit map will indicate uvhub numbers,
-		 * which are 0-N in a partition. Pnodes are unique system-wide.
+		 * The base_dest_nasid set in the message header is the nasid
+		 * of the first uvhub in the partition. The bit map will

arch/x86/platform/uv/tlb_uv.c uv_activation_descriptor_init(int node, · line 1385

Quoted 10 lines
arch/x86/platform/uv/tlb_uv.c +5 -2
+		 * indicate destination pnode numbers relative to that base.
+		 * They may not be consecutive if nasid striding is being used.
 		 */
-		bd2->header.base_dest_nodeid = UV_PNODE_TO_NASID(uv_partition_base_pnode);
-		bd2->header.dest_subnodeid = 0x10; /* the LB */
+		bd2->header.base_dest_nasid =
+					UV_PNODE_TO_NASID(part_base_pnode);
+		bd2->header.dest_subnodeid = UV_LB_SUBNODEID;
 		bd2->header.command = UV_NET_ENDPOINT_INTD;
 		bd2->header.int_both = 1;

This code is sick. Illness: too long lines.

checkpatch warned you but you applied the wrong cure and broke the lines in an ugly way.

Can you think of another cure? One of the many options:

- eliminate many repetitive strings
- reduce indentation by the introduction of helper inlines
- sensible shortening of variable/field/definition names

... applies to this particular case and will solve the problem.

arch/x86/platform/uv/tlb_uv.c static int __init uv_init_per_cpu(int nu · line 1546

Quoted 9 lines
arch/x86/platform/uv/tlb_uv.c +5 -0
@@ -1528,6 +1539,15 @@ static int __init uv_init_per_cpu(int nu
 		bcp = &per_cpu(bau_control, cpu);
 		memset(bcp, 0, sizeof(struct bau_control));
 		pnode = uv_cpu_hub_info(cpu)->pnode;
+		if ((pnode - base_part_pnode) >= UV_DISTRIBUTION_SIZE) {
+			printk(KERN_EMERG
+				"cpu %d pnode %d-%d beyond %d; BAU disabled\n",
+				cpu, pnode, base_part_pnode,
+				UV_DISTRIBUTION_SIZE);

See my points above.

Quoted 8 lines
arch/x86/platform/uv/tlb_uv.c +4 -0
@@ -1585,6 +1605,20 @@ static int __init uv_init_per_cpu(int nu
 nextsocket:
 			socket++;
 			socket_mask = (socket_mask >> 1);
+			/* each socket gets a local array of pnodes/hubs */
+			bcp = smaster;
+			bcp->target_hub_and_pnode = kmalloc_node(
+				sizeof(struct hub_and_pnode) *

arch/x86/platform/uv/tlb_uv.c static int __init uv_init_per_cpu(int nu · line 1621

Quoted 10 lines
arch/x86/platform/uv/tlb_uv.c +10 -0
+				num_possible_cpus(), GFP_KERNEL, bcp->osnode);
+			memset(bcp->target_hub_and_pnode, 0,
+				sizeof(struct hub_and_pnode) *
+				num_possible_cpus());
+			for_each_present_cpu(tcpu) {
+				bcp->target_hub_and_pnode[tcpu].pnode =
+					uv_cpu_hub_info(tcpu)->pnode;
+				bcp->target_hub_and_pnode[tcpu].uvhub =
+					uv_cpu_hub_info(tcpu)->numa_blade_id;
+			}

See my points above.

Thanks,

Ingo