[patch 8/21] openmosix/migration_verbose_traces.patch
Florian Delizy <[email protected]> Wed, 01 Nov 2006 05:11:25 +0100
| Newsgroups | gmane.linux.cluster.openmosix.devel |
|---|---|
| Message-ID | <[email protected]> |
Add some interesting traces using OMDEBUG* macros ------------------------------------------------------------------------- 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
migration_verbose_traces.patch
(text/x-patch, 16.9 KB)
Index: linux/hpc/migsend.c =================================================================== --- linux.orig/hpc/migsend.c 2006-10-23 19:28:47.000000000 +0200 +++ linux/hpc/migsend.c 2006-10-26 16:20:35.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 @@ -14,6 +15,7 @@ * Original Mosix code Copyright (C) Amnon Barak, Amnon Shiloh * * Changes for 2.6 by Vincent Hanquez and Alexander Nyberg + * - kcomd thread by Matt Dew and Florian Delizy * */ @@ -45,6 +47,7 @@ struct omp_mig_handshake hshake, hshake_recv; int error; + OMDEBUG_MIG( 2, "%s sending process %d\n", __FUNCTION__, p->pid ); hshake.type = type; hshake.version = OPENMOSIX_VERSION; hshake.personality = p->personality; @@ -81,6 +84,8 @@ struct omp_mig_fp m; struct sockaddr_in *dest_ptr; + OMDEBUG_MIG( 2, "%s sending process %d\n", __FUNCTION__, p->pid ); + dest_ptr=(void *)p->om.whereto; if (!used_math()) { return 0; @@ -107,6 +112,8 @@ struct sockaddr_in *dest_ptr; int ret; + OMDEBUG_MIG( 2, "%s sending process %d\n", __FUNCTION__, p->pid ); + dest_ptr=(void *)p->om.whereto; if (task_test_dflags(p, DREMOTE)) ret=kcom_send_with_ack(MIG_MM | REM_FLG, sizeof(struct omp_mig_mm), (char *)&p->mm->start_code, 0, dest_ptr); @@ -157,6 +164,8 @@ int ret = 0; struct sockaddr_in *dest_ptr; + OMDEBUG_MIG( 2, "%s sending process %d\n", __FUNCTION__, p->pid ); + dest_ptr=(void *)p->om.whereto; for (vma = p->mm->mmap; vma; vma = vma->vm_next) { @@ -175,7 +184,7 @@ ret=kcom_send_with_ack(MIG_VMA | DEP_FLG, sizeof(m), (char *)&m, 0, dest_ptr); if (ret != 0) { - printk(KERN_ERR "ERROR sending vmas\n"); + OMBUG("ERROR sending vmas\n"); return -1; } } @@ -197,6 +206,8 @@ struct sockaddr_in *dest_ptr; int type = MIG_PAGE; + OMDEBUG_MIG( 2, "%s sending process %d\n", __FUNCTION__, p->pid ); + dest_ptr=(void *)p->om.whereto; if ( task_test_dflags( p, DREMOTE ) ) @@ -206,11 +217,17 @@ for (vma = p->mm->mmap; vma; vma = vma->vm_next) { + OMDEBUG_MIG( 3, "%s + checking vma %d\n", __FUNCTION__, p->pid ); + if (!(vma->vm_flags & VM_READ)) continue; - for (addr = vma->vm_start; addr < vma->vm_end; addr += PAGE_SIZE) + OMDEBUG_MIG( 3, "%s + VM_READ! %d\n", __FUNCTION__, p->pid ); + + for (addr = vma->vm_start; addr < vma->vm_end; addr += PAGE_SIZE) { + OMDEBUG_MIG( 3, "%s ++ sending page %d\n", __FUNCTION__, p->pid ); kcom_send_with_ack( type, PAGE_SIZE, (char *)addr, addr, dest_ptr); + } } return 0; } @@ -228,6 +245,7 @@ struct omp_mig_task m; struct sockaddr_in* dest_ptr; + OMDEBUG_MIG( 2, "%s sending process %d\n", __FUNCTION__, p->pid ); dest_ptr=(void *)p->om.whereto; m.ptrace = p->ptrace; @@ -286,6 +304,10 @@ struct sockaddr_in* dest_ptr=(void *)p->om.whereto; arch_mig_send_pre(p); + if (!p) goto fail_mig; + + OMDEBUG_MIG( 1, "mig_do_send migration of process %d\n", p->pid ); + if (task_test_dflags(p, DREMOTE)) { if (kcom_send_with_ack(MIG_GO_HOME | REM_FLG, 0, NULL, 0, dest_ptr)) goto fail_mig; @@ -294,19 +316,31 @@ goto fail_mig; } + OMDEBUG_MIG( 3, "%s:%d sending process %d\n", __FUNCTION__, __LINE__, p->pid ); if (mig_send_mm(p)) goto fail_mig; + + OMDEBUG_MIG( 3, "%s:%d sending process %d\n", __FUNCTION__, __LINE__, p->pid ); if (mig_send_vmas(p)) goto fail_mig; + + OMDEBUG_MIG( 3, "%s:%d sending process %d\n", __FUNCTION__, __LINE__, p->pid ); if (mig_send_pages(p)) goto fail_mig; + + OMDEBUG_MIG( 3, "%s:%d sending process %d\n", __FUNCTION__, __LINE__, p->pid ); if (mig_send_fp(p)) goto fail_mig; + + OMDEBUG_MIG( 3, "%s:%d sending process %d\n", __FUNCTION__, __LINE__, p->pid ); if (arch_mig_send_specific(p)) goto fail_mig; + + OMDEBUG_MIG( 3, "%s:%d sending process %d\n", __FUNCTION__, __LINE__, p->pid ); if (mig_send_proc_context(p)) goto fail_mig; + OMDEBUG_MIG( 3, "%s:%d sending process %d\n", __FUNCTION__, __LINE__, p->pid ); + arch_mig_send_post(p); return 0; fail_mig: - printk(KERN_ERR "error FUNCTION: mig_do_send\n"); OMBUG("failed\n"); return -1; } Index: linux/hpc/migctrl.c =================================================================== --- linux.orig/hpc/migctrl.c 2006-10-23 20:40:50.000000000 +0200 +++ linux/hpc/migctrl.c 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 @@ -14,6 +15,7 @@ * Original Mosix code Copyright (C) Amnon Barak, Amnon Shiloh * * Changes for 2.6 by Vincent Hanquez and Alexander Nyberg + * - kcomd thread by Matt Dew and Florian Delizy * */ @@ -43,6 +45,7 @@ int task_remote_expel(task_t *p) { BUG_ON(!task_test_dflags(p, DREMOTE)); + OMDEBUG_MIG( 3, "%s:%d pid %d task expeled !!!\n", __FUNCTION__, __LINE__, p->pid); if (mig_do_send(p)) { goto failed; @@ -79,6 +82,7 @@ static int task_local_send(task_t *p, struct sockaddr *whereto, int reason) { int error = 0; + OMDEBUG_MIG( 3, "%s:%d pid %d Sending task for reason %d, let's rock!\n", __FUNCTION__, __LINE__, p->pid, reason ); if (task_test_dflags(p, DDEPUTY)) return 0; @@ -111,6 +115,7 @@ static int task_local_bring(task_t *p, int reason) { int error; + OMDEBUG_MIG( 3, "%s:%d pid %d Receiving task for reason %d, let's rock!\n", __FUNCTION__, __LINE__, p->pid, reason ); if (!task_test_dflags(p, DDEPUTY)) return 0; @@ -167,6 +172,7 @@ int reason) { + OMDEBUG_MIG( 3, "%s:%d pid %d Moving task, let's rock!!!\n", __FUNCTION__, __LINE__, p->pid ); task_set_dflags(p, DPASSING); /* @@ -194,6 +200,7 @@ int task_move_to_node(struct task_struct *p, struct sockaddr * whereto, int reason) { + OMDEBUG_MIG( 3, "%s:%d pid %d Moving task?\n", __FUNCTION__, __LINE__, p->pid ); if (task_test_stay(p, DSTAY)) { printk(KERN_DEBUG "oM: Task can't move. check stay reason\n"); return -1; @@ -213,6 +220,7 @@ **/ int task_go_home(task_t *p) { + OMDEBUG_MIG( 3, "%s:%d pid %d Moving task home!\n", __FUNCTION__, __LINE__, p->pid ); if (!task_test_dflags(p, DMIGRATED)) { printk(KERN_INFO "oM: task %d at home: ignoring request.\n", p->pid); @@ -237,6 +245,7 @@ int task_go_home_for_reason(task_t *p, int reason) { int ret; + OMDEBUG_MIG( 3, "%s:%d pid %d task must go home :( for reason %d!\n", __FUNCTION__, __LINE__, p->pid, reason ); if (task_test_stay(p, reason) && task_test_dflags(p, DMIGRATED)) printk(KERN_ERR "oM: task should had migrated back earlier\n"); Index: linux/hpc/proc.c =================================================================== --- linux.orig/hpc/proc.c 2006-10-23 20:20:16.000000000 +0200 +++ linux/hpc/proc.c 2006-10-27 22:10:55.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 @@ -14,6 +15,7 @@ * Original Mosix code Copyright (C) Amnon Barak, Amnon Shiloh * * Changes for 2.6 by Vincent Hanquez and Alexander Nyberg + * - kcomd thread by Matt Dew and Florian Delizy * */ @@ -45,9 +47,9 @@ struct sockaddr_in *cur_addr; struct kcom_task *tsk; struct kcom_node *node; - /* task_t *kcomd_task;*/ + OMDEBUG_MIG( 2, "%s asking process %d migration ?\n", __FUNCTION__, p->pid ); if (!dest_ptr) { printk( KERN_ERR "openmosix: openmosix internal structure is not initialized for pid %d\n", p->pid ); return -EFAULT; @@ -56,31 +58,32 @@ buf[size-1]='\0'; /* ensures no trailing crap in 'where' file*/ if (size >= 4 && strnicmp(buf, "home", 4) == 0) { - /* p->om.whereto=NULL;*/ - /* ret = task_register_migration(p, NULL);*/ + if (task_test_dflags(p, DDEPUTY)) { /* if already migrated and this is home node*/ + + OMDEBUG_MIG( 3, "%s:%d asking process %d to migrate home ?\n", __FUNCTION__, __LINE__, p->pid ); node=kcom_node_find((struct sockaddr *)dest_ptr); if (node==NULL) return 1; tsk=kcom_task_find(p->pid); if (tsk==NULL) return 1; + + OMDEBUG_MIG( 3, "%s:%d asking process %d to migrate home (ready)?\n", __FUNCTION__, __LINE__, p->pid ); + kcom_task_send(tsk, MIG_COME_HOME | PKT_NEW_MSG | DEP_FLG, 0, NULL, NULL, 0); - #if 0 - read_lock(&tasklist_lock); - kcomd_task = find_task_by_pid(kcom_pid); - read_unlock(&tasklist_lock); - #endif - - if (kcomd_task != NULL) - send_sig(SIGHUP,kcomd_task,0); - /* kcom_send(MIG_COME_HOME | PKT_NEW_MSG | DEP_FLG, 0, NULL, 0, dest_ptr);*/ + + if (kcomd_task != NULL) send_sig(SIGHUP,kcomd_task,0); } else { + + OMDEBUG_MIG( 3, "%s:%d asking process %d to migrate home (not a DDEPUTY)?\n", __FUNCTION__, __LINE__, p->pid ); task_register_migration(p); } } else { if (task_test_dflags(p, DDEPUTY)) { + + OMDEBUG_MIG( 3, "%s:%d asking process %d to migrate to another place (DDEPUTY)?\n", __FUNCTION__, __LINE__, p->pid ); tsk=kcom_task_find(p->pid); if (tsk) { cur_addr=(struct sockaddr_in *)&tsk->node->addr; @@ -91,6 +94,8 @@ } } else { + OMDEBUG_MIG( 3, "%s:%d asking process %d to migrate to another place (Initial)?\n", __FUNCTION__, __LINE__, p->pid ); + dest_ptr->sin_family=AF_INET; dest_ptr->sin_port=htons(DAEMON_IP4_PORT); dest_ptr->sin_addr.s_addr=in_aton(buf); Index: linux/hpc/task.c =================================================================== --- linux.orig/hpc/task.c 2006-10-23 20:39:48.000000000 +0200 +++ linux/hpc/task.c 2006-10-24 11:46:51.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 @@ -26,6 +27,7 @@ #include <hpc/hpc.h> #include <hpc/kcom.h> #include <hpc/prototype.h> +#include <hpc/debug.h> /** * task_set_comm - swap openMosix link for a process (return old one) @@ -57,6 +59,7 @@ mode_t mode; int stay = 0; + OMDEBUG_MIG( 3, "%s:%d Checking task stay reason\n", __FUNCTION__, __LINE__ ); inode = vma->vm_file->f_dentry->d_inode; if (!inode) return 0; @@ -126,6 +129,7 @@ void task_request_move(task_t *p) { struct sockaddr *dest_ptr=p->om.whereto; + OMDEBUG_MIG( 3, "%s:%d pid %d clearing bits, moving to node\n", __FUNCTION__, __LINE__, p->pid ); /* * FIXME: @@ -222,6 +226,8 @@ **/ int task_register_migration(task_t *p) { + OMDEBUG_MIG( 3, "%s:%d pid %d registering process migration ?\n", __FUNCTION__, __LINE__, p->pid ); + task_set_dreqs(p, DREQ_MOVE); wake_up_process(p); set_ti_thread_flag(p->thread_info, TIF_NEED_RESCHED); Index: linux/hpc/migrecv.c =================================================================== --- linux.orig/hpc/migrecv.c 2006-10-23 20:46:14.000000000 +0200 +++ linux/hpc/migrecv.c 2006-10-27 22:10:24.000000000 +0200 @@ -1,7 +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-2007 Florian Delizy <[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 @@ -50,6 +50,7 @@ int error; struct omp_mig_handshake hshake; + OMDEBUG_MIG( 3, "%s:%d receiving handshake ^^\n", __FUNCTION__, __LINE__); /* receive request of whatever */ error = comm_recv(mlink, &hshake, sizeof(hshake)); if (error < 0) { @@ -87,6 +88,8 @@ task_t *sltsk; + OMDEBUG_MIG( 2, "%s:%d receiving program home (home sweat home) ^^\n", __FUNCTION__, __LINE__); + if ((recv_kcom_pkt->type & MSG_MASK)==PKT_NEW_MSG) { recv_tsk=kcom_task_find(recv_kcom_pkt->hpid); @@ -138,6 +141,8 @@ struct sockaddr_in *saddr; const unsigned int LO_IP=in_aton("127.0.0.1"); + OMDEBUG_MIG( 3, "%s:%d receiving init packet\n", __FUNCTION__, __LINE__); + if ((recv_kcom_pkt->type & MSG_MASK)==PKT_NEW_MSG) { /* incoming process*/ rpid=0; @@ -212,7 +217,7 @@ KCOMD_NSTATIC int mig_do_receive_mm(task_t *p, struct kcom_pkt *pkt) { - OMDEBUG_MIG(2, "MIG_MM\n"); + OMDEBUG_MIG( 3, "%s:%d pid %d receiving mm struct packet\n", __FUNCTION__, __LINE__, p->pid); if ( !pkt || sizeof( struct omp_mig_mm ) != pkt->len ) goto error_packet; @@ -250,12 +255,12 @@ int ret = 0; + OMDEBUG_MIG( 3, "%s:%d pid %d receiving vmas struct packet\n", __FUNCTION__, __LINE__, p->pid); + if ( !pkt || sizeof(struct omp_mig_vma) != pkt->len) goto error_packet; a = (struct omp_mig_vma *)pkt->data; - OMDEBUG_MIG(2, "MIG_VMA [%lx, %ld]\n", a->vm_start, a->vm_size); - /* FIXME : Temporary disabled */ if (0 && a->vm_file) { file = (task_test_dflags(p, DREMOTE)) @@ -331,6 +336,8 @@ Must be done from process context. */ + OMDEBUG_MIG( 3, "%s:%d pid %d receiving pages struct packet\n", __FUNCTION__, __LINE__, p->pid); + if ( !pkt || PAGE_SIZE != pkt->len ) goto error_packet_size; addr=pkt->addr; @@ -382,6 +389,8 @@ { struct omp_mig_fp *fp; + OMDEBUG_MIG( 3, "%s:%d pid %d receiving fp struct packet\n", __FUNCTION__, __LINE__, p->pid); + if ( !pkt || sizeof(struct omp_mig_fp) != pkt->len ) goto error_packet; fp=(void *)pkt->data; @@ -417,6 +426,7 @@ { struct omp_mig_task *m; + OMDEBUG_MIG( 3, "%s:%d pid %d receiving proc_context\n", __FUNCTION__, __LINE__, p->pid); if ( !pkt || sizeof( struct omp_mig_task ) != pkt->len ) goto error_packet; m=(struct omp_mig_task *)pkt->data; @@ -478,6 +488,8 @@ int waiting_time = 0; + OMDEBUG_MIG( 2, "%s:%d pid %d receiving process ??\n", __FUNCTION__, __LINE__, p->pid); + task_set_dflags(p, DINCOMING); /* clear_used_math();*/ @@ -486,8 +498,9 @@ waiting_time++; schedule_timeout_interruptible(HZ/1000); mytsk=kcom_task_find(p->pid); + OMDEBUG_MIG( 3, "%s:%d pid %d waiting kcomd to do his work ! %d HZ\n", __FUNCTION__, __LINE__, p->pid, waiting_time); /* Preventing infinite loops */ - if ( 1000000 < waiting_time ) { + if ( 60 < waiting_time ) { printk( KERN_ERR "openMosix: kcomd task creation timeout exceeded, dying ... \n" ); ret = -1; goto init_exit; @@ -500,6 +513,7 @@ memcpy(p->om.whereto, &mytsk->node->addr, sizeof(mytsk->node->addr)); } + OMDEBUG_MIG( 3, "%s:%d pid %d kcomd did his work, all fine !\n", __FUNCTION__, __LINE__, p->pid); set_current_state(TASK_INTERRUPTIBLE); write_lock( &mytsk->spinlock); @@ -532,6 +546,7 @@ /* this is the last thing we do in the chain of receiving, * so return 0 after we're done */ case MIG_TASK: + OMDEBUG_MIG( 3, "%s:%d pid %d last packet received (context)!\n", __FUNCTION__, __LINE__, p->pid); ret=mig_do_receive_proc_context(p, pkt); task_clear_dflags(p, DINCOMING); @@ -572,6 +587,7 @@ protocol_exit: write_unlock( &mytsk->spinlock ); + OMDEBUG_MIG( 3, "%s:%d pid %d unlocking and returning, ret=%d!\n", __FUNCTION__, __LINE__, p->pid, ret); init_exit: Index: linux/hpc/kcomd.c =================================================================== --- linux.orig/hpc/kcomd.c 2006-10-23 21:32:19.000000000 +0200 +++ linux/hpc/kcomd.c 2006-10-27 22:11:14.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 @@ -10,6 +11,8 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * + * kcomd thread by Matt Dew and Florian Delizy + * */ #include <linux/sched.h> @@ -529,7 +532,7 @@ fd4=-1; fd6=-1; kcomd_done=0; - printk(KERN_INFO "kcomd: init\n"); + printk(KERN_INFO "HPC: openMosix Communication Kernel Daemon Start\n"); kcomd_thread_initialize();