[patch 48/56] Change printk to use OMBUG macro

Florian Delizy <[email protected]> Thu, 02 Nov 2006 22:57:22 +0100
Newsgroups gmane.linux.cluster.openmosix.devel
Message-ID <[email protected]>
changed printk( KERN_ERR * into OMBUG macro call ...
added a stack dump on the OMBUG 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
use-ombug-macro.patch (text/x-patch, 6.9 KB)
Subject: [patch @num@/@total@] Change printk to use OMBUG macro

changed printk( KERN_ERR * into OMBUG macro call ... 
added a stack dump on the OMBUG as well ... 

Index: linux/hpc/migrecv.c
===================================================================
--- linux.orig/hpc/migrecv.c	2006-11-02 22:52:53.000000000 +0100
+++ linux/hpc/migrecv.c	2006-11-02 22:52:55.000000000 +0100
@@ -500,7 +500,7 @@
  		OMDEBUG_MIG(3, "pid %d waiting kcomd to do his work ! %d HZ\n", p->pid, waiting_time);
 		/* Preventing infinite loops */
 		if (60000 < waiting_time) {
-			printk(KERN_ERR "openMosix: kcomd task creation timeout exceeded, dying ... \n");
+ 			OMBUG("kcomd task creation timeout exceeded, dying ... \n");
 			ret = -1;
 			goto protocol_exit;
 		}
@@ -562,7 +562,7 @@
 					break;
 
 				default:
-					printk(KERN_ERR "openMosix: (receive) [pid: %u] Unknown packet type 0x%x received.\n", p->pid, pkt->type);
+					OMBUG("(receive) [pid: %u] Unknown packet type 0x%x received.\n", p->pid, pkt->type);
 
 					ret = -1; /* Should exit on unknown packet !! */
 					break;
@@ -634,7 +634,7 @@
 	arch_kickstart(p);
 	/*NOTREACHED*/
 
-	printk(KERN_ERR "process %u, waking up. YOU SHOULD NOT SEE THIS!!!!!\n", p->pid);
+	OMBUG("process %u, waking up. YOU SHOULD NOT SEE THIS!!!!!\n", p->pid);
 	while (1) {
 		set_current_state(TASK_INTERRUPTIBLE);
 		schedule();
@@ -642,7 +642,7 @@
 
 
 fail:
-	printk(KERN_ERR "mig_handle_migration failed with %d\n", error);
+	OMBUG(KERN_ERR "mig_handle_migration failed with %d\n", error);
 	OMBUG("failed\n");
 	do_exit(SIGKILL);
 	/*NOTREACHED*/
Index: linux/include/hpc/prototype.h
===================================================================
--- linux.orig/include/hpc/prototype.h	2006-11-02 22:52:37.000000000 +0100
+++ linux/include/hpc/prototype.h	2006-11-02 22:52:55.000000000 +0100
@@ -20,13 +20,18 @@
 #ifndef _HPC_PROTOTYPE_H
 #define _HPC_PROTOTYPE_H
 
+#include <linux/kernel.h>
+
 #ifdef CONFIG_OPENMOSIX_MIGRATION_VERBOSE
 #define OM_VERBOSE_MIG(fmt...)	printk(KERN_NOTICE fmt)
 #else
 #define OM_VERBOSE_MIG(fmt...)	do { } while (0)
 #endif
 
-#define OMBUG(f, a...)	printk(KERN_ERR "[OMBUG] %s: " f, __FUNCTION__, ## a)
+#define OMBUG(f, a...)	do { \
+			    printk(KERN_ERR "[OMBUG] %s: " f, __FUNCTION__, ## a); \
+			    dump_stack(); \
+			} while (0)
 
 #include <linux/in.h>
 #include <hpc/kcom.h>
@@ -91,6 +96,7 @@
 
 struct kcom_pkt *kcom_pkt_create(int, int, int, char *);
 
+int kcom_add_packet(struct kcom_task *tsk, struct kcom_pkt *pkt);
 int kcom_send(int, int, char *, unsigned long, struct sockaddr_in *);
 int kcom_send_with_ack(int, int, char *, unsigned long, struct sockaddr_in *);
 int kcom_send_with_response(int, int, char *, unsigned long, char *, struct sockaddr_in *);
Index: linux/hpc/kcomd.c
===================================================================
--- linux.orig/hpc/kcomd.c	2006-11-02 22:52:53.000000000 +0100
+++ linux/hpc/kcomd.c	2006-11-02 22:52:55.000000000 +0100
@@ -110,7 +110,7 @@
 
 	sock = sock_alloc();
 	if (!sock) {
-		printk(KERN_ERR "openMosix: Unable to allocate socket.\n");
+		OMBUG("openMosix: Unable to allocate socket.\n");
 		return -1;
 	}
 
@@ -119,7 +119,7 @@
 
 	ret = lsock->ops->accept(lsock, sock, 0);
 	if (ret) {
-		printk(KERN_ERR "openMosix: Error accepting connection\n");
+		OMBUG("openMosix: Error accepting connection\n");
 		goto err_accept;
 	}
 
@@ -129,13 +129,13 @@
 
 	fd = sock_map_fd(sock);
 	if (fd < 0) {
-		printk(KERN_ERR "openMosix: Error mapping socket to file descriptor\n");
+ 		OMBUG("openMosix: Error mapping socket to file descriptor\n");
 		goto err_accept;
 	}
 
  	node = kcom_node_add(sock);
  	if (node==NULL) {
-		printk(KERN_ERR "openMosix: Error adding new node\n");
+ 		OMBUG("openMosix: Error adding new node\n");
 		goto errfd;
 	}
  	// Store the IP addr.
@@ -183,13 +183,13 @@
 	while (iov.iov_len > 0) {
 		i = sock_sendmsg(sock, &msg, iov.iov_len);
 		if ((i == -ENOSPC) || (i == -EAGAIN)) {
-			printk(KERN_ERR "Retrying hdr...error %d\n", i);
+			OMBUG("Retrying hdr...error %d\n", i);
 			schedule_timeout(HZ/1000);
 			continue;
 		}
 		if (i == -EFAULT) {
-			printk(KERN_ERR "Error %d sending data. Unable to access data.\n", i);
-			printk(KERN_ERR "Data may need to be copied into a temporary buffer to be sent.\n");
+			OMBUG("Error %d sending data. Unable to access data.\n", i);
+			OMBUG("Data may need to be copied into a temporary buffer to be sent.\n");
 		}
 
 		if (i < 0) {
@@ -222,7 +222,7 @@
 			continue;
 		}
 		if (i < 0) {
-			printk(KERN_ERR"openMosix: ERROR %d sending data\n", i);
+			OMBUG("openMosix: ERROR %d sending data\n", i);
 			set_fs(oldfs);
 			return -1;
 		}
@@ -279,7 +279,7 @@
 			list_add_tail(&recv_kcom_pkt->list, &tsk->in_packs);
 			write_unlock(&tsk->in_packs_lock);
 		} else {
-			printk(KERN_ERR "unable to find remote pid %u\n", recv_kcom_pkt->rpid);
+			OMBUG("unable to find remote pid %u\n", recv_kcom_pkt->rpid);
 			return -1;
 
 		}
@@ -289,7 +289,7 @@
 		if (sltsk) {
 			wake_up_process(sltsk);
 		} else {
-			printk(KERN_ERR "Unable to find remote pid %u to wake up\n", recv_kcom_pkt->rpid);
+			OMBUG("Unable to find remote pid %u to wake up\n", recv_kcom_pkt->rpid);
 			return -1;
 		}
 
@@ -300,7 +300,7 @@
 			list_add_tail(&recv_kcom_pkt->list, &tsk->in_packs);
 			write_unlock(&tsk->in_packs_lock);
 		} else {
-			printk(KERN_ERR "unable to find home pid %u\n", recv_kcom_pkt->hpid);
+			OMBUG("unable to find home pid %u\n", recv_kcom_pkt->hpid);
 			return -1;
 		}
 		read_lock(&tasklist_lock);
@@ -309,7 +309,7 @@
 		if (sltsk) {
 			wake_up_process(sltsk);
 		} else {
-			printk(KERN_ERR "Unable to find home pid %u to wake up\n", recv_kcom_pkt->hpid);
+			OMBUG("Unable to find home pid %u to wake up\n", recv_kcom_pkt->hpid);
 			return -1;
 		}
 	}
@@ -348,7 +348,7 @@
 		}
 
 		if (i < recv_kcom_pkt->len) {
-			printk(KERN_ERR "ERROR: incomplete data pkt\n");
+			OMBUG("ERROR: incomplete data pkt\n");
 			goto error_recv;
 		}
 	}
@@ -370,7 +370,7 @@
 				OMDEBUG_KCOMD(2, "KCOMD: it's a MIG_COME_HOME packet ... \n");
 				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);
+ 				    OMBUG("openMosix: Unable to find the task %d\n", recv_kcom_pkt->rpid);
 				    goto error_recv;
 				}
 				task_register_migration(sltsk);
@@ -471,7 +471,6 @@
 
 	read_lock(&kcom_nodes_lock);
 	list_for_each_entry(node, &kcom_nodes, list) {
-		/* printk("node->fd=%d\n", node->fd);*/
 
 		if (node->fd == -1 || node->fd > maxfds) {
 			read_unlock(&kcom_nodes_lock);
@@ -574,7 +573,6 @@
 	daemonize("kcomd", 0);
 	sigfillset(&current->blocked);
 
-	/* kcom_pid=current->pid;*/
 	kcomd_task=current;
 
 retry_listen:
@@ -651,7 +649,7 @@
 			if (test_bit(node->fd, sockets_fds.res_in)) {
 				err=pkt_read(node);
 				if (err!=0) {
-					OMBUG(KERN_ERR "ERROR receiving data => ignoring packet.\n");
+					OMBUG("ERROR receiving data => ignoring packet.\n");
 					continue;
 				}
 			}