[openib-general] [PATCH] SDP warnings on x86_64

Libor Michalek libor at topspin.com
Fri Feb 11 18:40:58 PST 2005


  If no one objects, a patch to clean up compile warnings on x86_64. Most
of the warnings are a result of print format mismatches, the most common
being the need to use %Zu for size_t/sizeof.

  For the curious, I'm seeing about 720 MB/s and 17us latency on a pair
of dual 3.4 GHz 64bit Xeon PCIe systems.

-Libor

Index: sdp_send.c
===================================================================
--- sdp_send.c	(revision 1781)
+++ sdp_send.c	(working copy)
@@ -2014,15 +2014,17 @@
 	 * attempt to find the IOCB for this key. we don't have an indication
 	 * whether this is a read or write.
 	 */
-	iocb = (struct sdpc_iocb *)sdp_desc_q_lookup(&conn->send_queue,
-						     _sdp_write_src_lookup,
-						     (void *)req->ki_key);
+	iocb = (struct sdpc_iocb *)sdp_desc_q_lookup
+		(&conn->send_queue,
+		 _sdp_write_src_lookup,
+		 (void *)(unsigned long)req->ki_key);
+
 	if (NULL != iocb) {
 		/*
 		 * always remove the IOCB.
 		 * If active, then place it into the correct active queue
 		 */
-		result = sdp_desc_q_remove((struct sdpc_desc *) iocb);
+		result = sdp_desc_q_remove((struct sdpc_desc *)iocb);
 		SDP_EXPECT(!(0 > result));
 		
 		if (0 < (SDP_IOCB_F_ACTIVE & iocb->flags)) {
@@ -2073,9 +2075,11 @@
 	 * check the sink queue, not much to do, since the operation is
 	 * already in flight.
 	 */
-	iocb = (struct sdpc_iocb *)sdp_desc_q_lookup(&conn->w_snk,
-						     _sdp_write_src_lookup,
-						     (void *)req->ki_key);
+	iocb = (struct sdpc_iocb *)sdp_desc_q_lookup
+		(&conn->w_snk,
+		 _sdp_write_src_lookup,
+		 (void *)(unsigned long)req->ki_key);
+
 	if (NULL != iocb) {
 
 		iocb->flags |= SDP_IOCB_F_CANCEL;
@@ -2439,7 +2443,7 @@
 		iocb = sdp_iocb_create();
 		if (NULL == iocb) {
 			
-			sdp_dbg_warn(conn, "Failed to allocate IOCB <%d:%d>",
+			sdp_dbg_warn(conn, "Failed to allocate IOCB <%Zu:%d>",
 				     size, copied);
 			result = -ENOMEM;
 			break;
@@ -2457,7 +2461,7 @@
 		result = sdp_iocb_lock(iocb);
 		if (0 > result) {
 				
-			sdp_dbg_warn(conn, "Error <%d> locking IOCB <%d:%d>", 
+			sdp_dbg_warn(conn, "Error <%d> locking IOCB <%Zu:%d>", 
 				     result, size, copied);
         
 			(void)sdp_iocb_destroy(iocb);
Index: sdp_conn.c
===================================================================
--- sdp_conn.c	(revision 1778)
+++ sdp_conn.c	(working copy)
@@ -1085,7 +1085,8 @@
 		conn->send_cq = ib_create_cq(conn->ca,
 					     sdp_cq_event_handler,
 					     NULL,
-					     (void *)conn->hashent,
+					     (void *)
+					     (unsigned long)conn->hashent,
 					     conn->send_cq_size);
 		if (IS_ERR(conn->send_cq)) {
 
@@ -1110,7 +1111,8 @@
 		conn->recv_cq = ib_create_cq(conn->ca,
 					     sdp_cq_event_handler,
 					     NULL,
-					     (void *)conn->hashent,
+					     (void *)
+					     (unsigned long)conn->hashent,
 					     conn->recv_cq_size);
 
 		if (IS_ERR(conn->recv_cq)) {
Index: sdp_actv.c
===================================================================
--- sdp_actv.c	(revision 1778)
+++ sdp_actv.c	(working copy)
@@ -201,7 +201,7 @@
 	 */
 	if (hello_ack->bsdh.size != sizeof(struct msg_hello_ack)) {
 
-		sdp_dbg_warn(NULL, "hello ack, size mismatch. (2) <%d:%d>",
+		sdp_dbg_warn(NULL, "hello ack, size mismatch. (2) <%d:%Zu>",
 			     hello_ack->bsdh.size,
 			     sizeof(struct msg_hello_ack));
 		return -EINVAL;
@@ -518,7 +518,7 @@
 	path->packet_life = 13;
 #endif
 	conn->cm_id = ib_create_cm_id(sdp_cm_event_handler,
-				      (void *)conn->hashent);
+				      (void *)(unsigned long)conn->hashent);
 	if (NULL == conn->cm_id) {
 
 		sdp_dbg_warn(conn, "Failed to create CM handle, %d",
@@ -571,7 +571,7 @@
 	 */
 	if (sizeof(struct msg_hello) > conn->recv_size) {
 
-		sdp_dbg_warn(conn, "buffer size <%d> too small. <%d>",
+		sdp_dbg_warn(conn, "buffer size <%d> too small. <%Zu>",
 			     conn->recv_size, sizeof(struct msg_hello));
 		result = -ENOBUFS;
 		goto error;
Index: sdp_recv.c
===================================================================
--- sdp_recv.c	(revision 1781)
+++ sdp_recv.c	(working copy)
@@ -799,8 +799,9 @@
 	result = _sdp_read_buff_iocb(iocb, buff);
 	if (0 > result) {
 
-		sdp_dbg_warn(conn, "Error <%d> data copy <%d:%d> to IOCB",
-			     result, iocb->len, (buff->tail - buff->data));
+		sdp_dbg_warn(conn, "Error <%d> data copy <%d:%u> to IOCB",
+			     result, iocb->len, 
+			     (unsigned)(buff->tail - buff->data));
 
 		(void)sdp_iocb_q_put_head(&conn->r_snk, iocb);
 		return result;
@@ -850,8 +851,9 @@
 	result = _sdp_read_buff_iocb(iocb, buff);
 	if (0 > result) {
 
-		sdp_dbg_warn(conn, "Error <%d> data copy <%d:%d> to IOCB",
-			     result, iocb->len, (buff->tail - buff->data));
+		sdp_dbg_warn(conn, "Error <%d> data copy <%d:%u> to IOCB",
+			     result, iocb->len, 
+			     (unsigned)(buff->tail - buff->data));
 		return result;
 	}
 	/*
@@ -1109,9 +1111,10 @@
 	 * check the source queue, not much to do, since the operation is
 	 * already in flight.
 	 */
-	iocb = (struct sdpc_iocb *)sdp_desc_q_lookup(&conn->r_src,
-						     _sdp_read_src_lookup,
-						     (void *)req->ki_key);
+	iocb = (struct sdpc_iocb *)sdp_desc_q_lookup
+		(&conn->r_src,
+		 _sdp_read_src_lookup,
+		 (void *)(unsigned long)req->ki_key);
 	if (NULL != iocb) {
 
 		iocb->flags |= SDP_IOCB_F_CANCEL;
@@ -1623,7 +1626,7 @@
 			if (NULL == iocb) {
         
 				sdp_dbg_warn(conn, 
-					     "Failed to allocate IOCB <%d:%d>",
+					     "Error allocating IOCB <%Zu:%d>",
 					     size, copied);
 				result = -ENOMEM;
 				break;
@@ -1642,7 +1645,7 @@
 			if (0 > result) {
         
 				sdp_dbg_warn(conn, 
-					     "Error <%d> IOCB lock <%d:%d>", 
+					     "Error <%d> IOCB lock <%Zu:%d>", 
 					     result, size, copied);
 				
 				(void)sdp_iocb_destroy(iocb);
@@ -1655,7 +1658,7 @@
 			if (0 > result) {
 				
 				sdp_dbg_warn(conn, 
-					     "Error <%d> IOCB queue <%d:%d>",
+					     "Error <%d> IOCB queue <%Zu:%d>",
 					     result, size, copied);
 				
 				(void)sdp_iocb_destroy(iocb);
Index: sdp_proc.c
===================================================================
--- sdp_proc.c	(revision 1778)
+++ sdp_proc.c	(working copy)
@@ -169,7 +169,7 @@
 	 */
 	if (0 && sizeof(s32) != sizeof(char *)) {
 
-		sdp_warn("integers and pointers of a different size. <%d:%d>",
+		sdp_warn("integers and pointers of a different size <%Zu:%Zu>",
 			 sizeof(s32), sizeof(char *));
 		return -EFAULT;
 	}
Index: sdp_pass.c
===================================================================
--- sdp_pass.c	(revision 1778)
+++ sdp_pass.c	(working copy)
@@ -41,7 +41,7 @@
 	 */
 	if (sizeof(struct msg_hello_ack) > conn->recv_size) {
 
-		sdp_dbg_warn(conn, "buffer size <%d> too small. <%d>",
+		sdp_dbg_warn(conn, "buffer size <%d> too small. <%Zu>",
 			     conn->recv_size, sizeof(struct msg_hello_ack));
 		result = -ENOBUFS;
 		goto error;
@@ -311,7 +311,7 @@
 	 */
 	if (msg_hello->bsdh.size != sizeof(struct msg_hello)) {
 
-		sdp_dbg_warn(NULL, "hello msg size mismatch. (2) <%d:%d>",
+		sdp_dbg_warn(NULL, "hello msg size mismatch. (2) <%d:%Zu>",
 			     msg_hello->bsdh.size, sizeof(struct msg_hello));
 		return -EINVAL;
 	}
Index: sdp_iocb.c
===================================================================
--- sdp_iocb.c	(revision 1778)
+++ sdp_iocb.c	(working copy)
@@ -44,7 +44,7 @@
 	vma = find_vma(iocb->mm, (iocb->addr & PAGE_MASK));
 	if (NULL == vma) {
 		
-		sdp_warn("No VMA for IOCB <%lx:%d> unlock",
+		sdp_warn("No VMA for IOCB <%lx:%Zu> unlock",
 			 iocb->addr, iocb->size);
 	}
 
@@ -286,7 +286,7 @@
 	 */
 	if (result) {
 
-		sdp_dbg_err("VMA lock <%lx:%d> error <%d> <%d:%lu:%lu>",
+		sdp_dbg_err("VMA lock <%lx:%Zu> error <%d> <%d:%lu:%lu>",
 			    iocb->addr, iocb->size, result, 
 			    iocb->page_count, iocb->mm->locked_vm, limit);
 		goto err_lock;
@@ -300,7 +300,7 @@
 		/*
 		 * sanity check.
 		 */
-		sdp_warn("No VMA for IOCB! <%lx:%d> lock",
+		sdp_warn("No VMA for IOCB! <%lx:%Zu> lock",
 			 iocb->addr, iocb->size);
 	}
 
@@ -342,7 +342,7 @@
 	result = _sdp_iocb_page_save(iocb);
 	if (result) {
 
-		sdp_dbg_err("Error <%d> saving pages for IOCB <%lx:%d>", 
+		sdp_dbg_err("Error <%d> saving pages for IOCB <%lx:%Zu>", 
 			    result, iocb->addr, iocb->size);
 		goto err_save;
 	}
@@ -584,7 +584,7 @@
 	result = sdp_iocb_destroy(iocb);
 	if (0 > result) {
 
-		sdp_dbg_err("Error <%d> deleting IOCB <%d> of status <%d>",
+		sdp_dbg_err("Error <%d> deleting IOCB <%d> of status <%Zu>",
 			    result, iocb->key, iocb->status);
 	}
 
@@ -924,8 +924,8 @@
 
 		if (0 < (mask & iocb->flags) || SDP_IOCB_F_ALL == mask) {
 
-			sdp_dbg_err("IOCB <%d> cancel <%d> flag <%04x> "
-				    "size <%d:%d:%d>",
+			sdp_dbg_err("IOCB <%d> cancel <%Zu> flag <%04x> "
+				    "size <%Zu:%d:%d>",
 				    iocb->key, comp, iocb->flags, iocb->size,
 				    iocb->post, iocb->len);
 



More information about the general mailing list