[SSI] openssi/kernel/ipc msg.c,1.17,1.18 msgutil.c,1.1,1.2

Roger Tsang <[email protected]> Sat, 03 Apr 2010 19:34:45 +0000
Newsgroups gmane.linux.cluster.ssic.cvs
Message-ID <[email protected]>
Update of /cvsroot/ssic-linux/openssi/kernel/ipc
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29204/kernel/ipc

Modified Files:
      Tag: OPENSSI-FC
	msg.c msgutil.c 
Log Message:
IPC Messages:
- Fix msg_get_svr_node() race with msg_set_svr_node() as not all code paths hold msg_ids.sem mutex. Use msg_nodehint_lock read/write spinlock.
- Consolidate redundant code into new function msg_find_svr_node().
- Remove redundant in ssi_msgsnd(). Most of the code is from sys_msgsnd().
- Fix sys_msgsnd()
  - Unhandled ssi_msgpack() error -ENOMEM.
  - Dereferencing freed "packedsegs" object.
  - Handle cli_ripc_msgsnd() error -EAGAIN.
- Remove redundant in ssi_msgrcv(). Most of the code is from sys_msgrcv().
- Fix sys_msgctl(MSG_INFO)
  - Might populate user buffer with bogus info on RPC error -EREMOTE.
  - Did not account for remote nodes when calculating max_id.
  - Deadlock with destination node when both nodes are doing RPC.
- Move remote code paths to new functions ssi_remote_msgctl(), ssi_msgctl_info(), ssi_remote_msgrcv(), ssi_remote_msgsnd().
- sys_msgctl() handle cli_ripc_msgctl() error -EAGAIN.
- sys_msgrcv() handle cli_ripc_msgrcv() error -EAGAIN.

 cluster/ssi/ipc/ipcmsg_svr.c |    8 
 include/linux/msg.h          |    3 
 ipc/msg.c                    |  762 +++++++++++++++--------------------
 ipc/msgutil.c                |   13 
 4 files changed, 356 insertions(+), 430 deletions(-)


Index: msgutil.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/ipc/msgutil.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- msgutil.c	20 Oct 2004 03:23:38 -0000	1.1
+++ msgutil.c	3 Apr 2010 19:34:43 -0000	1.2
@@ -14,10 +14,23 @@
 #include <linux/slab.h>
 #include <linux/ipc.h>
 #include <asm/uaccess.h>
+#ifdef CONFIG_SSI
 #include <linux/msg.h>
+#endif
 
 #include "util.h"
 
+#ifndef CONFIG_SSI
+/* Moved to include/linux/msg.h */
+struct msg_msgseg {
+	struct msg_msgseg* next;
+	/* the next part of the message follows immediately */
+};
+
+#define DATALEN_MSG	(PAGE_SIZE-sizeof(struct msg_msg))
+#define DATALEN_SEG	(PAGE_SIZE-sizeof(struct msg_msgseg))
+#endif
+
 struct msg_msg *load_msg(const void __user *src, int len)
 {
 	struct msg_msg *msg;

Index: msg.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/ipc/msg.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- msg.c	5 Mar 2010 06:30:21 -0000	1.17
+++ msg.c	3 Apr 2010 19:34:43 -0000	1.18
@@ -84,6 +84,7 @@
 #ifdef CONFIG_SSI
 struct ipc_ids msg_ids;
 clusternode_t *msg_nodehint;
+static __cacheline_aligned_in_smp DEFINE_RWLOCK(msg_nodehint_lock);
 int msg_nodehint_sz = 0;
 #else
 static struct ipc_ids msg_ids;
@@ -102,6 +103,8 @@
 static int newque (key_t key, int msgflg, int newid);
 static clusternode_t msg_get_svr_node(int);
 static void msg_set_svr_node(int, clusternode_t);
[...973 lines suppressed...]
-	*rettyp = msg->m_type;
-	if (ssi_store_msg(msgtxt, msg, msgsz)) {
+#ifdef CONFIG_SSI
+	if (rettyp) {
+		*rettyp = msg->m_type;
+		if (ssi_store_msg(msgtxt, msg, msgsz))
+			msgsz = -EFAULT;
+	} else
+#endif /* CONFIG_SSI */
+	if (put_user (msg->m_type, &msgp->mtype) ||
+	    store_msg(msgp->mtext, msg, msgsz)) {
 		    msgsz = -EFAULT;
 	}
 	free_msg(msg);
 	return msgsz;
 }
-#endif  /*  CONFIG_SSI  */
 
 #ifdef CONFIG_PROC_FS  
 static int sysvipc_msg_read_proc(char *buffer, char **start, off_t offset, int length, int *eof, void *data)


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev