[patch 1/4] openmosix/kcomd_thread-verbose-functionning.patch Verbose messages for kcomd_thread
Florian Delizy <[email protected]> Thu, 16 Nov 2006 23:09:09 +0100
| Newsgroups | gmane.linux.cluster.openmosix.devel |
|---|---|
| Message-ID | <[email protected]> |
This adds verbose debug messages for kcomd_thread (this is quite useful to debug it) Messages are controlled using the debugfs system (OMDEBUG_KCOMD) as usual ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ openMosix-devel mailing list openMosix-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/openmosix-devel
kcomd_thread-verbose-functionning.patch
(text/x-patch, 5.1 KB)
Subject: [patch @num@/@total@] @name@ Verbose messages for kcomd_thread
This adds verbose debug messages for kcomd_thread (this is quite useful to debug it)
Messages are control using the debugfs system (OMDEBUG_KCOMD) as usual
Index: linux/hpc/kcomd.c
===================================================================
--- linux.orig/hpc/kcomd.c 2006-11-13 16:02:03.000000000 +0100
+++ linux/hpc/kcomd.c 2006-11-13 16:02:53.000000000 +0100
@@ -480,6 +480,7 @@
struct kcom_task *task;
/* for each nodes (set fds.in && fds.out) and reset the waiting fds */
+ OMDEBUG_KCOMD( 3, "Resetting select fdsets (%d fdsets)\n", n);
zero_fd_set(n, sockets_fds.in);
zero_fd_set(n, sockets_fds.out);
zero_fd_set(n, sockets_fds.ex);
@@ -488,11 +489,13 @@
list_for_each_entry(node, &kcom_nodes, list) {
if (node->fd == -1 || node->fd > maxfds) {
- read_unlock(&kcom_nodes_lock);
+ OMDEBUG_KCOMD( 3, "KCOMD found invalid fd ?\n");
+ schedule_timeout_interruptible(HZ);
continue;
}
/* if a file descriptor is open, we want select to pay attention.*/
+ OMDEBUG_KCOMD( 3, "Setting fd %d\n", node->fd );
set_bit(node->fd, sockets_fds.in);
set_bit(node->fd, sockets_fds.ex);
@@ -500,6 +503,7 @@
read_lock(&node->tasks_lock);
list_for_each_entry(task, &node->tasks, list)
if (!list_empty(&task->out_packs)) {
+ OMDEBUG_KCOMD(3, "Setting out flag for fd %d\n", node->fd );
set_bit(node->fd, sockets_fds.out);
}
read_unlock(&node->tasks_lock);
@@ -572,7 +576,6 @@
int ret;
struct kcom_node *node, *node_next;
s64 timeout = -1;
- int n = -1;
siginfo_t info; /* matt*/
int sig;
int err;
@@ -591,6 +594,8 @@
kcomd_task=current;
retry_listen:
+ OMDEBUG_KCOMD( 3, "KCOMD: Creating (retrying) sockets\n" );
+
fd4 = socket_listen_ip4(DAEMON_IP4_PORT, &lsock4);
fd6 = socket_listen_ip6(DAEMON_IP6_PORT, &lsock6);
@@ -600,13 +605,18 @@
}
- n=alloc_fd_bitmap(max(fd4, fd6));
+ alloc_fd_bitmap(max(fd4, fd6));
while (kcomd_done==0)
{
- n = maxfds;
+ OMDEBUG_KCOMD( 3, "KCOMD: Entering (restarting) loop\n" );
+
+ /* Check if we must leave ... */
+ if (kcomd_module_exit) {
+ if (0 == kcomd_leave_cluster()) kcomd_done = 1;
+ }
- kcomd_thread_set_fds(n);
+ kcomd_thread_set_fds( maxfds );
/* add listening sockets to the set */
if (fd4!=-1)
@@ -619,12 +629,19 @@
allow_signal (SIGHUP);
timeout = -1;
- ret = do_select(n + 1, &sockets_fds, &timeout);
- disallow_signal (SIGHUP);
- /* SIGHUP is sent by kcom_send to wake up kcomd so it can send the packet*/
- while (signal_pending (current)) {
- sig = dequeue_signal (current, ¤t->blocked, &info);
+ OMDEBUG_KCOMD( 3, "KCOMD: Waiting for events ...\n");
+ ret = do_select(maxfds + 1, &sockets_fds, &timeout);
+ if (0 == ret && !signal_pending(current)) {
+ OMBUG( "KCOMD: do_select returned 0 but no signal pending !\n" );
+ continue;
+ } else {
+ /* SIGHUP is sent by kcom_send to wake up kcomd so it can send the packet*/
+ sig = dequeue_signal (current, ¤t->blocked, &info);
+ OMDEBUG_KCOMD( 3, "KCOMD: got signal %d\n", sig);
}
+
+ disallow_signal (SIGHUP);
+
if (ret == 0) { /* -1=error; 0=signal*/
/* New kernel security, prohibits sharing file descriptors between kernel threads.*/
/* We have to allocate them here.*/
@@ -633,6 +650,7 @@
read_lock(&kcom_nodes_lock);
list_for_each_entry(node, &kcom_nodes, list)
if (node->fd==0) { /* unmapped*/
+ OMDEBUG_KCOMD( 3, "Found unmapped fd %d\n", node->fd );
node->fd = sock_map_fd(node->sock);
alloc_fd_bitmap(node->fd);
}
@@ -641,7 +659,7 @@
continue;
} else if (ret < 0) {/* -1=error; 0=signal*/
- OMBUG("do_select returned an error. \n");
+ OMBUG("do_select returned an error (%d). \n", ret);
schedule_timeout_interruptible(HZ);
}
@@ -662,9 +680,10 @@
list_for_each_entry_safe(node, node_next, &kcom_nodes, list) {
if (test_bit(node->fd, sockets_fds.res_in)) {
+ OMDEBUG_KCOMD( 3, "KCOMD: receiving on fd %d\n", node->fd );
err=pkt_read(node);
if (err!=0) {
- OMBUG("ERROR receiving data => ignoring packet.\n");
+ printk(KERN_ERR "ERROR receiving data => ignoring packet.\n");
continue;
}
}
@@ -674,23 +693,16 @@
}
write_unlock(&kcom_nodes_lock);
- /* Check if we must leave ... */
- if (kcomd_module_exit) {
- if (0 == kcomd_leave_cluster()) kcomd_done = 1;
- }
}
/* DONE*/
printk(KERN_INFO "kcomd: openMosix kernel communication daemon cleaning up.\n");
- if (fd4!=-1) {
- if (lsock4) sock_release(lsock4);
+
+ if (fd4!=-1)
sys_close(fd4);
- }
- if (fd6!=-1) {
- if (lsock6) sock_release(lsock6);
+ if (fd6!=-1)
sys_close(fd6);
- }
kcomd_thread_free_ressources();
Index: linux/hpc/kcom.c
===================================================================
--- linux.orig/hpc/kcom.c 2006-11-13 16:01:58.000000000 +0100
+++ linux/hpc/kcom.c 2006-11-13 16:02:53.000000000 +0100
@@ -615,6 +615,8 @@
{
struct kcom_node *node;
+ OMDEBUG_KCOMD( 3, "Adding new socket node\n");
+
node=kmem_cache_alloc(kcom_node_cachep, SLAB_KERNEL);
if (!node) {
OMBUG("Unable to allocate node space.\n");