[patch 10/21] Adding kcomd debug control macros

Florian Delizy <[email protected]> Wed, 01 Nov 2006 05:11:31 +0100
Newsgroups gmane.linux.cluster.openmosix.devel
Message-ID <[email protected]>
Adding OMDEBUG_KCOMD for debugging the protocol informations as well

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
openMosix-devel mailing list
openMosix-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/openmosix-devel
add_kcom_debug_macros.patch (text/x-patch, 5.7 KB)
Subject: [patch @num@/@total@] Adding kcomd debug control macros

Adding OMDEBUG_KCOMD for debugging the protocol informations as well


Index: linux/hpc/debugfs.c
===================================================================
--- linux.orig/hpc/debugfs.c	2006-10-26 15:35:48.000000000 +0200
+++ linux/hpc/debugfs.c	2006-10-27 22:10:11.000000000 +0200
@@ -1,5 +1,6 @@
 /*
  *	Copyright (C) 2006 Vincent Hanquez <vincent-mTI/[email protected]>
+ *	Copyright (C) 2006 Florian Delizy  <[email protected]>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published
@@ -27,9 +28,10 @@
 	{ "syscall", 0644, &om_opts.debug_sys },
 	{ "rinode", 0644, &om_opts.debug_rino },
 	{ "copyuser", 0644, &om_opts.debug_copyuser },
+	{ "kcomd", 0644, &om_opts.debug_kcomd },
 };
 
-static struct dentry * dfs_dentries[4];
+static struct dentry * dfs_dentries[ARRAY_SIZE(file_entries)];
 
 int __init om_debugfs_init(void)
 {
@@ -59,4 +61,4 @@
 module_init(om_debugfs_init);
 module_exit(om_debugfs_exit);
 MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Vincent Hanquez");
+MODULE_AUTHOR("Vincent Hanquez\n Florian Delizy");
Index: linux/include/hpc/debug.h
===================================================================
--- linux.orig/include/hpc/debug.h	2006-10-26 15:35:48.000000000 +0200
+++ linux/include/hpc/debug.h	2006-10-27 22:10:11.000000000 +0200
@@ -1,6 +1,7 @@
 /*
  *	Copyright (C) 2002-2004 Moshe Bar <moshe-ay74M1d3r6RWk0Htik3J/[email protected]>
  *	Copyright (C) 2005-2006 Vincent Hanquez <vincent-mTI/[email protected]>
+ *	Copyright (C) 2006 Florian Delizy <[email protected]>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published
@@ -52,5 +53,6 @@
 #define OMDEBUG_SYS(lim, fmt...)	OMDEBUG(om_opts.debug_sys, lim, fmt)
 #define OMDEBUG_RINO(lim, fmt...)	OMDEBUG(om_opts.debug_rino, lim, fmt)
 #define OMDEBUG_CPYUSER(lim, fmt...)	OMDEBUG(om_opts.debug_copyuser, lim, fmt)
+#define OMDEBUG_KCOMD(lim, fmt... )	OMDEBUG(om_opts.debug_kcomd, lim, fmt )
 
 #endif /* _HPC_DEBUG_H */
Index: linux/include/hpc/hpc.h
===================================================================
--- linux.orig/include/hpc/hpc.h	2006-10-26 15:35:48.000000000 +0200
+++ linux/include/hpc/hpc.h	2006-10-27 22:10:11.000000000 +0200
@@ -1,6 +1,7 @@
 /*
  *	Copyright (C) 2002-2004 Moshe Bar <moshe-ay74M1d3r6RWk0Htik3J/[email protected]>
  *	Copyright (C) 2005-2006 Vincent Hanquez <vincent-mTI/[email protected]>
+ *	Copyright (C) 2006 Florian Delizy <[email protected]>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published
@@ -55,6 +56,7 @@
 	int debug_sys;
 	int debug_rino;
 	int debug_copyuser;
+	int debug_kcomd;
 #endif
 };
 
Index: linux/hpc/kcom.c
===================================================================
--- linux.orig/hpc/kcom.c	2006-10-26 16:00:28.000000000 +0200
+++ linux/hpc/kcom.c	2006-10-27 22:10:24.000000000 +0200
@@ -25,6 +25,8 @@
 #include <hpc/kcom.h>
 #include <hpc/prototype.h>
 
+#include <hpc/debug.h>
+
 
 /**
  * pkt_data_read
@@ -47,6 +49,7 @@
 	iov.iov_base = data;
 	iov.iov_len = len;
 
+	OMDEBUG_KCOMD(3, "KCOMD: %s:%d reading data (%dB)... \n", __FUNCTION__, __LINE__, len );
 	// Too small of a packet gets delayed before being sent. Even with TCP_NODELAY
 	if (len < 32) {
 		iov.iov_base = &buf;
@@ -115,10 +118,10 @@
 	iov.iov_base = recv_kcom_pkt;
 	iov.iov_len = sizeof( struct kcom_pkt );
 
+	OMDEBUG_KCOMD(3, "KCOMD: %s:%d reading headers ... \n", __FUNCTION__, __LINE__ );
 	oldfs = get_fs();
 	set_fs(KERNEL_DS);
 
-
 receive_fragment:
 
 	i = sock_recvmsg(sock, &msg, iov.iov_len, msg.msg_flags);
@@ -140,7 +143,7 @@
 	if ( iov.iov_len > 0 ) goto receive_fragment;
 
 
-	if (iov.iov_len != 0) goto receive_incomplete;
+	if ( iov.iov_len != 0 ) goto receive_incomplete;
 
 
 	set_fs(oldfs);
@@ -226,6 +229,7 @@
 {
 	struct kcom_pkt *pkt;
 
+	OMDEBUG_KCOMD(3, "KCOMD: %s:%d creating packet (len %d type %d ack %d)... \n", __FUNCTION__, __LINE__, len, type, ack );
 	pkt=kmem_cache_alloc(kcom_pkt_cachep, SLAB_KERNEL);
 	if (pkt) {
 		pkt->len = len;
Index: linux/hpc/kcomd.c
===================================================================
--- linux.orig/hpc/kcomd.c	2006-10-26 16:00:28.000000000 +0200
+++ linux/hpc/kcomd.c	2006-10-27 22:10:30.000000000 +0200
@@ -27,6 +27,7 @@
 #include <linux/inet.h>
 #include <hpc/kcom.h>
 #include <hpc/prototype.h>
+#include <hpc/debug.h>
 
 static int kcomd_done=0;
 
@@ -346,6 +347,8 @@
 
 	OMDEBUG_KCOMD( 2, "KCOMD: %s:%d Receiving packet \n", __FUNCTION__, __LINE__);
 
+	OMDEBUG_KCOMD( 2, "KCOMD: %s:%d Receiving packet \n", __FUNCTION__, __LINE__);
+
 	// read in hdr
 	recv_kcom_pkt = pkt_hdr_read(node);
 
@@ -371,14 +374,17 @@
 	if ((recv_kcom_pkt->type & MSG_MASK) == PKT_NEW_MSG) {
 		switch (recv_kcom_pkt->type & MIG_MASK) {
 			case MIG_INIT:
+				OMDEBUG_KCOMD(2, "KCOMD: %s:%d it's a MIG_INIT packet ... \n", __FUNCTION__, __LINE__ );
 				mig_do_receive_init(node, recv_kcom_pkt);
 				break;
 			case MIG_GO_HOME:
+				OMDEBUG_KCOMD(2, "KCOMD: %s:%d it's a MIG_GO_HOME packet ... \n", __FUNCTION__, __LINE__ );
 				mig_do_receive_home(node, recv_kcom_pkt);
 				break;
 			case MIG_COME_HOME:
 			{
 				task_t *sltsk;
+				OMDEBUG_KCOMD(2, "KCOMD: %s:%d it's a MIG_COME_HOME packet ... \n", __FUNCTION__, __LINE__ );
 				sltsk = find_task_by_pid(recv_kcom_pkt->rpid);
 				if ( !sltsk ) {
 				    printk( KERN_ERR "openMosix: %s Unable to find the task %d ", __FUNCTION__, recv_kcom_pkt->rpid );