Requeue error
authorakshay <akshay87@vt.edu>
Mon, 9 Jun 2014 16:19:06 +0000 (12:19 -0400)
committerakshay <akshay87@vt.edu>
Mon, 9 Jun 2014 16:19:06 +0000 (12:19 -0400)
kernel/exit.c
kernel/futex.c
kernel/futex_remote.c
kernel/futex_remote.h
kernel/global_spinlock.c
kernel/sched.c
kernel/signal.c

index 56c66ff..9609276 100644 (file)
@@ -1006,20 +1006,8 @@ NORET_TYPE void do_exit(long code)
                                preempt_count());
 
        //cleanup global worker thread only for the thread group leader
-       if(tsk->tgroup_distributed && tsk->pid == tsk->tgroup_home_id){
-       _global_value * gvp = hashgroup(tsk);
-       printk(KERN_INFO "GVP EXISTS{%s} tgid{%d} pid{%d} \n",tsk->comm,tsk->tgroup_home_id,tsk->pid);
-
-       if(gvp != NULL){
-
-               printk(KERN_INFO"Inside GVP");
-               gvp->thread_group_leader = NULL;
-               gvp->free = 0;
-               gvp->global_wq = NULL;
-               gvp->worker_task =NULL;
-               printk(KERN_INFO "cleaned up \n");
-       }
-       }
+       futex_global_worker_cleanup(tsk);
+       
        acct_update_integrals(tsk);
        /* sync mm's RSS info before statistics gathering */
        if (tsk->mm)
index bd52d42..756a5bb 100644 (file)
@@ -95,7 +95,9 @@ const struct futex_q futex_q_init = {
        /* list gets initialized in queue_me()*/
        .key = FUTEX_KEY_INIT,
        .bitset = FUTEX_BITSET_MATCH_ANY,
-       .rem_pid = -1
+       .rem_pid = -1,
+       .rem_requeue_key = FUTEX_KEY_INIT,
+       .req_addr = 0
 };
 
 
@@ -971,8 +973,10 @@ inline void __spin_key_init (struct spin_key *st) {
  */
 static inline int global_queue_wait_lock(struct futex_q *q,u32 __user * uaddr, struct futex_hash_bucket *hb,unsigned int fn_flag,
                unsigned int val, int fshared, int rw,  u32 bitset)
+__acquires(&value->_sp)
 {
        int ret;
+       u32 dval;
        int localticket_value;
 
        struct spin_key sk;
@@ -983,6 +987,7 @@ static inline int global_queue_wait_lock(struct futex_q *q,u32 __user * uaddr, s
        _spin_value *value = hashspinkey(&sk);
 
        //Get the request id
+       spin_lock(&value->_sp);
        localticket_value = xadd_sync(&value->_ticket, 1);
 
        _local_rq_t *rq_ptr= add_request_node(localticket_value,current->pid,&value->_lrq_head);
@@ -1009,14 +1014,15 @@ static inline int global_queue_wait_lock(struct futex_q *q,u32 __user * uaddr, s
        smp_mb();
 
        if(ret){
-               printk(KERN_ALERT "%s: check if there is wake up {%d} - {%d} \n",__func__,rq_ptr->wake_st,ret);
+               FPRINTK(KERN_ALERT "%s: check if there is wake up {%d} - {%d} \n",__func__,rq_ptr->wake_st,ret);
                if(rq_ptr->wake_st == 1) //no need to queue it.
                {
                        ret = 0;
                }
        }
        else if (!ret){
-               printk(KERN_ALERT"%s: check if there is wake up on ret=0 {%d} \n",__func__,rq_ptr->wake_st,ret);
+               get_user(dval,uaddr);
+               FPRINTK(KERN_ALERT"%s: check if there is wake up on ret=0 {%d} davl{%d}  \n",__func__,rq_ptr->wake_st,ret,dval);
                if(rq_ptr->wake_st == 1)//no neew to queue
                {
                        ret = -EWOULDBLOCK;
@@ -1028,7 +1034,8 @@ static inline int global_queue_wait_lock(struct futex_q *q,u32 __user * uaddr, s
 }
 
 static inline int global_queue_wake_lock(union futex_key *key,u32 __user * uaddr, unsigned int flags, int nr_wake,
-               u32 bitset, int rflag, unsigned int fn_flags, u32 __user *uaddr2, int nr_requeue, int cmpval)
+               u32 bitset, int rflag, unsigned int fn_flags, unsigned long uaddr2, int nr_requeue, int cmpval)
+__acquires(&value->_sp)
 {
        int ret;
        int localticket_value;
@@ -1041,6 +1048,7 @@ static inline int global_queue_wake_lock(union futex_key *key,u32 __user * uaddr
        _spin_value *value = hashspinkey(&sk);
 
        //Get the request id
+       spin_lock(&value->_sp);
        localticket_value = xadd_sync(&value->_ticket, 1);
 
        _local_rq_t *rq_ptr= add_request_node(localticket_value,current->pid,&value->_lrq_head);
@@ -1054,7 +1062,7 @@ static inline int global_queue_wake_lock(union futex_key *key,u32 __user * uaddr
        data_.rflag =rflag;
        data_.nr_wake= nr_wake;
        data_.nr_requeue =nr_requeue;
-       data_.uaddr2 =uaddr2;
+       data_.uaddr2 =(unsigned long) uaddr2;
        data_.bitset =bitset;
        data_.cmpval =cmpval;
        data_.ops=1;
@@ -1087,7 +1095,7 @@ futex_wake(u32 __user *uaddr, unsigned int flags, int nr_wake, u32 bitset,unsign
        unsigned long bp = stack_frame(current,NULL);
 
 
-       printk(KERN_ALERT " FUTEX_WAKE:current{%d} uaddr {%lx} get_user{%d} comm{%s}  lockval{%d} fn_flags{%d} cpu{%d} \n",current->pid,uaddr,x,current->comm,y,fn_flags,smp_processor_id());
+       FPRINTK(KERN_ALERT " FUTEX_WAKE:current{%d} uaddr {%lx} get_user{%d} comm{%s}  lockval{%d} fn_flags{%d} cpu{%d} \n",current->pid,uaddr,x,current->comm,y,fn_flags,smp_processor_id());
 
        fn_flags |= FLAGS_WAKECALL;
 
@@ -1134,9 +1142,10 @@ cont:
                         wake_futex(this);
                        else
                        {
-                               FPRINTK(KERN_ALERT " %s:sending it to remote after decision; ret{%d} nr_wake{%d} \n",__func__,ret,nr_wake);
-                               ret = remote_futex_wakeup(uaddr, flags & FLAGS_SHARED,nr_wake, bitset,&key,this->rem_pid, fn_flags, 0,0,0);
-                               this->rem_pid=NULL;
+                               FPRINTK(KERN_ALERT " %s:sending it to remote after decision; ret{%d} nr_wake{%d} has_req_addr{%lx} \n",__func__,ret,nr_wake,(this->req_addr != 0) ? this->req_addr : 0);
+                               ret = remote_futex_wakeup(uaddr, flags & FLAGS_SHARED,nr_wake, bitset,&key,this->rem_pid, fn_flags, (this->req_addr != 0) ? this->req_addr : 0,0,0);
+                               this->rem_pid = NULL;
+                               this->req_addr = 0;
                                __unqueue_futex(this);
                                smp_wmb();
                                this->lock_ptr = NULL;
@@ -1173,7 +1182,7 @@ int futex_wake_op(u32 __user *uaddr1, unsigned int flags, u32 __user *uaddr2,
        int g_errno=0;
 
        fn_flags |= FLAGS_WAKEOPCALL;
-       printk(KERN_ALERT " FUTEX_WAKE_OP: entry{%pB} pid {%d} comm{%s} uaddr1{%lx} uaddr2{%lx}  op(%d} \n",(void*) &bp,current->pid,current->comm,uaddr1,uaddr2,op);
+       FPRINTK(KERN_ALERT " FUTEX_WAKE_OP: entry{%pB} pid {%d} comm{%s} uaddr1{%lx} uaddr2{%lx}  op(%d} \n",(void*) &bp,current->pid,current->comm,uaddr1,uaddr2,op);
 retry:
        ret = get_futex_key(uaddr1, flags & FLAGS_SHARED, &key1, VERIFY_READ);
 
@@ -1218,7 +1227,7 @@ retry_private:
                }
 
                ret = ((fn_flags & FLAGS_REMOTECALL) && or_task)? fault_in_user_writeable_task(uaddr2,or_task):fault_in_user_writeable(uaddr2);
-               FPRINTK(KERN_ALERT "%s: faultinuaddr2 {%d}\n",__func__,ret);
+               FPRINTK(KERN_ALERT "%s: faultinuaddr2 {%d} tsk{%d} comm{%s} \n",__func__,ret,or_task->pid,or_task->comm);
                if (ret)
                        goto out_put_keys;
 
@@ -1323,6 +1332,16 @@ void requeue_futex(struct futex_q *q, struct futex_hash_bucket *hb1,
        q->key = *key2;
 }
 
+static inline
+void rem_requeue_futex(struct futex_q *q, union futex_key *key2, unsigned long uaddr)
+{
+
+       q->req_addr = uaddr;
+       q->rem_requeue_key = *key2;
+}
+
+
+
 /**
  * requeue_pi_wake_futex() - Wake a task that acquired the lock during requeue
  * @q:         the futex_q
@@ -1454,7 +1473,7 @@ int futex_requeue(u32 __user *uaddr1, unsigned int flags,
 
        fn_flags |= FLAGS_REQCALL;
 
-       printk(KERN_ALERT " FUTEX_REQUEUE: entry{%pB} nr_wake{%d} nr_requeue{%d} pid{%d} comm{%s} uaddr1{%lx} uaddr2{%lx} fn_flags{%lx} \n",(void*) &bp,nr_wake,nr_requeue,current->pid,current->comm,uaddr1,uaddr2,fn_flags);
+       FPRINTK(KERN_ALERT " FUTEX_REQUEUE: cmp{%lx} nr_wake{%d} nr_requeue{%d} pid{%d} comm{%s} uaddr1{%lx} uaddr2{%lx} fn_flags{%lx} \n",*cmpval,nr_wake,nr_requeue,current->pid,current->comm,uaddr1,uaddr2,fn_flags);
        if (requeue_pi) {
                /*
                 * requeue_pi requires a pi_state, try to allocate it now
@@ -1503,12 +1522,12 @@ cont:
 
 retry_private:
 
-    FPRINTK(KERN_ALERT " %s: spinlock  futex_requeue\n",__func__);
+    FPRINTK(KERN_ALERT " %s: spinlock  futex_requeue uaddr2{%lx} \n",__func__,uaddr2);
 
 
     if(current->tgroup_distributed  && !(fn_flags & FLAGS_REMOTECALL) && !(flags & FLAGS_SHARED)){
                g_errno= global_queue_wake_lock(&key1,uaddr1, flags & FLAGS_SHARED, nr_wake, 1,
-                                0, fn_flags,uaddr2,nr_requeue,cmpval);
+                                0, fn_flags,uaddr2,nr_requeue,(int)*cmpval);
                FPRINTK(KERN_ALERT " %s: err {%d}\n",__func__,g_errno);
                ret = g_errno;
                goto out;
@@ -1628,7 +1647,7 @@ retry_private:
                        else
                        {       u32 bitset=1;
                        if(!requeued)
-                               ret = remote_futex_wakeup(uaddr1, flags & FLAGS_SHARED,nr_wake, bitset,&key1,this->rem_pid, fn_flags, 0,0,0);
+                               ret = remote_futex_wakeup(uaddr1, flags & FLAGS_SHARED,nr_wake, bitset,&key1,this->rem_pid, fn_flags,0,0,0);
                        else
                                ret = remote_futex_wakeup(uaddr2, flags & FLAGS_SHARED,nr_wake, bitset,&key2,this->rem_pid, fn_flags, 0,0,0);
                        this->rem_pid=NULL;
@@ -1668,7 +1687,11 @@ retry_private:
                                goto out_unlock;
                        }
                }
+               FPRINTK(KERN_ALERT"%s: b4 requeue\n");
                requeue_futex(this, hb1, hb2, &key2);
+               if(this->rem_pid != -1){
+                       rem_requeue_futex(this,&key1,(unsigned long) uaddr1);
+               }
                requeued=1;
                drop_count++;
        }
@@ -2237,7 +2260,7 @@ int futex_wait(u32 __user *uaddr, unsigned int flags, u32 val,
        struct pt_regs * regs;
        unsigned long bp = stack_frame(current,NULL);
 
-       printk(KERN_ALERT "FUTEX_WAIT:current {%pB} pid{%d} uaddr{%lx} get_user{%d} comm{%s}  syscall{%d} cpu{%d}\n",(void*) &bp,current->pid,uaddr,x,current->comm,fn_flag,smp_processor_id());
+       FPRINTK(KERN_ALERT "FUTEX_WAIT:current {%pB} pid{%d} uaddr{%lx} get_user{%d} comm{%s}  syscall{%d} cpu{%d}\n",(void*) &bp,current->pid,uaddr,x,current->comm,fn_flag,smp_processor_id());
 
 //     printPTE(uaddr);
        if (!bitset)
@@ -2289,7 +2312,7 @@ retry:
        if (!signal_pending(current))
                goto retry;
 
-       printk(KERN_ALERT" up for restart abs{%d} \n",(!abs_time)?0:1);
+       FPRINTK(KERN_ALERT" up for restart abs{%d} \n",(!abs_time)?0:1);
 
        ret = -ERESTARTSYS;
        if (!abs_time)
index c88e23c..a35fc7e 100644 (file)
@@ -29,7 +29,7 @@
 #define MODULE "GRQ-"
 #include <popcorn/global_spinlock.h>
 
-#define FUTEX_REMOTE_VERBOSE 1
+#define FUTEX_REMOTE_VERBOSE 1 
 #if FUTEX_REMOTE_VERBOSE
 #define FRPRINTK(...) printk(__VA_ARGS__)
 #else
@@ -267,7 +267,7 @@ struct task_struct* gettask(pid_t origin_pid, pid_t tghid) {
 }
 
 int global_futex_wake(u32 __user *uaddr, unsigned int flags, int nr_wake,
-               u32 bitset, pid_t pid) {
+               u32 bitset, pid_t pid, unsigned long uaddr2) {
        struct futex_hash_bucket *hb;
        struct futex_q *this, *next;
        struct plist_head *head;
@@ -276,7 +276,7 @@ int global_futex_wake(u32 __user *uaddr, unsigned int flags, int nr_wake,
        struct mm_struct *cmm = NULL;
        struct task_struct *temp;
        int ret;
-       FRPRINTK(KERN_ALERT "%s: entry response {%d} uaddr{%lx} comm{%s} flags{%u} \n",__func__,pid,uaddr,current->comm,flags);
+       FRPRINTK(KERN_ALERT "%s: entry response {%d} uaddr{%lx} comm{%s} flags{%u} uaddr2{%lx} \n",__func__,pid,uaddr,current->comm,flags,uaddr2);
        if (!bitset)
                return -EINVAL;
 
@@ -288,13 +288,13 @@ int global_futex_wake(u32 __user *uaddr, unsigned int flags, int nr_wake,
                cmm = current->mm;
                current->mm = tsk->mm;
        }
-       getKey((unsigned long )uaddr, &sk,(!tsk)?current->tgroup_home_id:tsk->tgroup_home_id);
+       getKey((uaddr2 == 0) ? (unsigned long)uaddr : (unsigned long) uaddr2, &sk,(!tsk)?current->tgroup_home_id:tsk->tgroup_home_id);
        _spin_value *value = hashspinkey(&sk);
        _local_rq_t * l= find_request_by_pid(pid, &value->_lrq_head);
        
        FRPRINTK(KERN_ALERT "%s: set wake up \n",__func__);
 
-       ret = get_futex_key(uaddr,
+       ret = get_futex_key((uaddr2 == 0) ?uaddr : (u32 __user*) uaddr2,
                        ((flags & FLAGS_DESTROY == 256) ?
                                        (0 & FLAGS_SHARED) : (flags & FLAGS_SHARED)), &key, VERIFY_READ);
 
@@ -359,9 +359,13 @@ int global_futex_wait(unsigned long uaddr, unsigned int flags, u32 val,
        struct task_struct *rem_struct = NULL;
        struct futex_q *q = (struct futex_q *) kmalloc(sizeof(struct futex_q),
                        GFP_ATOMIC); //futex_q_init;
+       
        q->key = FUTEX_KEY_INIT;
        q->bitset = FUTEX_BITSET_MATCH_ANY;
        q->rem_pid = -1;
+       q->req_addr = 0;
+       q->rem_requeue_key = FUTEX_KEY_INIT;
+
        u32 uval;
        int ret;
        int sig;
@@ -395,12 +399,9 @@ fault:
 
                        if(ret == -EFAULT){
                                if((ret = fix_user_page((u32 __user *)uaddr,tsk)) ==  0){
-                                       FRPRINTK(KERN_ALERT"%s:ret {%d} \n",__func__,ret);
-                                       //spin_lock(&hb->lock);
-                                       //goto fault;
+                                       printk(KERN_ALERT"%s:ret {%d} \n",__func__,ret);
                                }
 
-                               //goto out;
                        }
 
                        ret = get_user(uval, (u32 __user *)uaddr);
@@ -524,9 +525,8 @@ mm_exit:
                                                                msg->fn_flag);
 
                                        else if (msg->fn_flag & FLAGS_REQCALL)
-                                               ret = futex_requeue(msg->uaddr, msg->flags, msg->uaddr2, msg->nr_wake,
-                                                               msg->nr_wake2,
-                                                               NULL, msg->cmpval, msg->fn_flag);
+                                               ret = futex_requeue(msg->uaddr, msg->flags, (unsigned long)  (msg->uaddr2 & ((1600*PAGE_SIZE)-1)), msg->nr_wake,
+                                                               msg->nr_wake2, &(msg->cmpval),0, msg->fn_flag);
 
                                        else if (msg->fn_flag & FLAGS_WAKEOPCALL)
                                                ret = futex_wake_op((u32 __user*)msg->uaddr, msg->flags,(u32 __user*)msg->uaddr2, msg->nr_wake,
@@ -606,7 +606,8 @@ exit:
 
 static int handle_remote_futex_wake_response(struct pcn_kmsg_message* inc_msg) {
        _remote_wakeup_response_t* msg = (_remote_wakeup_response_t*) inc_msg;
-       //preempt_disable();
+       preempt_disable();
+       
        FRPRINTK(KERN_ALERT"%s: response {%d} \n",
                        __func__, msg->errno);
        struct task_struct *p =  pid_task(find_vpid(msg->rem_pid), PIDTYPE_PID);
@@ -624,12 +625,13 @@ static int handle_remote_futex_wake_response(struct pcn_kmsg_message* inc_msg) {
        _local_rq_t *ptr = set_err_request(msg->request_id,msg->errno, &value->_lrq_head);
        // smp_wmb();
        FRPRINTK(KERN_ALERT"%s: errno{%d} p->tgp(%d} \n",__func__,msg->errno,p->tgroup_home_id);
-       wake_up_interruptible(&ptr->_wq);
+//     wake_up_interruptible(&ptr->_wq);
 
        put_task_struct(p);
 
        pcn_kmsg_free_msg(inc_msg);
-       //preempt_enable();
+       
+       preempt_enable();
 
        return 0;
 }
@@ -648,8 +650,8 @@ static int handle_remote_futex_wake_request(struct pcn_kmsg_message* inc_msg) {
        atomic_inc(&progress);
 
        FRPRINTK(KERN_ALERT"%s: request -- entered task comm{%s} pid{%d} msg->fn_flag{%lx} msg-flags{%lx}\n", __func__,tsk->comm,tsk->pid,msg->fn_flag,msg->flags);
-       printk(KERN_ALERT"%s: msg: uaddr {%lx} ticket {%d} tghid{%d} bitset {%u} rflag{%d} pid{%d} ifn_flags{%lx}\n",
-                       __func__,msg->uaddr,msg->ticket,msg->tghid,msg->bitset,msg->rflag,msg->pid,msg->fn_flag);
+       FRPRINTK(KERN_ALERT"%s: msg: uaddr {%lx}  uaddr2{%lx} ticket {%d} tghid{%d} bitset {%u} rflag{%d} pid{%d} ifn_flags{%lx}\n",
+                       __func__,msg->uaddr,(msg->uaddr2 & (PAGE_SIZE-1)),msg->ticket,msg->tghid,msg->bitset,msg->rflag,msg->pid,msg->fn_flag);
 
        // Finish constructing response
        response.header.type = PCN_KMSG_TYPE_REMOTE_IPC_FUTEX_WAKE_RESPONSE;
@@ -676,7 +678,7 @@ static int handle_remote_futex_wake_request(struct pcn_kmsg_message* inc_msg) {
 
                        FRPRINTK(KERN_ALERT"%s: set up head\n", __func__);
                        
-                       back_work->lock = &gvp->lock; // , sizeof(spinlock_t));
+                       back_work->lock = &gvp->lock; 
                        
                        _global_rq *trq = (_global_rq *) kmalloc(sizeof(_global_rq), GFP_ATOMIC);                       
                        memcpy(&trq->wakeup, msg, sizeof(_remote_wakeup_request_t));
@@ -687,7 +689,7 @@ static int handle_remote_futex_wake_request(struct pcn_kmsg_message* inc_msg) {
                        back_work->gq = trq;
                        queue_work(gvp->global_wq, (struct work_struct*) back_work);
                }
-       gvp->worker_task = back_work;// pid_task(find_vpid(worker_pid), PIDTYPE_PID);
+       gvp->worker_task = back_work;
        GENERAL_SPIN_UNLOCK(&access_global_value_table);
 
 
@@ -698,9 +700,9 @@ static int handle_remote_futex_wake_request(struct pcn_kmsg_message* inc_msg) {
                //if not holding the ticket add to the tail of Global request queue.
        }
        else {
-                FRPRINTK(KERN_ALERT"need to wake_st\n");
+                FRPRINTK(KERN_ALERT"need to wake_st uaddr2{%lx} \n",(msg->uaddr2 & ((1600*PAGE_SIZE)-1)));
                global_futex_wake(msg->uaddr, msg->flags, msg->nr_wake, msg->bitset,
-                                                               msg->rflag);
+                                                               msg->rflag,(unsigned long) (msg->uaddr2 & ((1600*PAGE_SIZE)-1)));
        }
        
        pcn_kmsg_free_msg(inc_msg);
@@ -710,7 +712,7 @@ static int handle_remote_futex_wake_request(struct pcn_kmsg_message* inc_msg) {
 
 int remote_futex_wakeup(u32 __user *uaddr, unsigned int flags, int nr_wake,
                u32 bitset, union futex_key *key, int rflag, unsigned int fn_flags,
-               u32 __user *uaddr2, int nr_requeue, int cmpval) {
+               unsigned long uaddr2, int nr_requeue, int cmpval) {
 
        int res = 0;
        int cpu = 0;
@@ -727,7 +729,7 @@ int remote_futex_wakeup(u32 __user *uaddr, unsigned int flags, int nr_wake,
        request->nr_wake = nr_wake;
        request->flags = flags;
        request->uaddr = uaddr;
-       request->uaddr2 = uaddr2;
+       request->uaddr2 = (unsigned long) uaddr2;
        request->nr_wake2 = nr_requeue;
        request->cmpval = cmpval;
        request->fn_flag = fn_flags;
@@ -760,7 +762,8 @@ out:
 }
 static int handle_remote_futex_key_response(struct pcn_kmsg_message* inc_msg) {
        _remote_key_response_t* msg = (_remote_key_response_t*) inc_msg;
-       //preempt_disable();
+       preempt_disable();
+       
        FRPRINTK(KERN_ALERT"%s: response to revoke wait request as origin is dead {%d} \n",
                        __func__,msg->errno);
 
@@ -781,12 +784,14 @@ static int handle_remote_futex_key_response(struct pcn_kmsg_message* inc_msg) {
 
        _local_rq_t *ptr = set_err_request(msg->request_id,msg->errno, &value->_lrq_head);
        
-       wake_up_interruptible(&ptr->_wq);
+//     wake_up_interruptible(&ptr->_wq);
 
        put_task_struct(p);
 
        pcn_kmsg_free_msg(inc_msg);
-       //preempt_enable();
+       
+       preempt_enable();
+       
        return 0;
 }
 
@@ -801,7 +806,7 @@ static int handle_remote_futex_key_request(struct pcn_kmsg_message* inc_msg) {
         atomic_inc(&progress);
 
        FRPRINTK(KERN_ALERT"%s: request -- entered whos calling{%s} \n", __func__,current->comm);
-       printk(KERN_ALERT"%s: msg: uaddr {%lx} flags {%lx} val{%d}  pid{%d}  fn_flags{%lx} ticket{%d}\n",
+       FRPRINTK(KERN_ALERT"%s: msg: uaddr {%lx} flags {%lx} val{%d}  pid{%d}  fn_flags{%lx} ticket{%d}\n",
                        __func__,msg->uaddr,msg->flags,msg->val,msg->pid,msg->fn_flags,msg->ticket);
 
        // Finish constructing response
@@ -817,7 +822,7 @@ static int handle_remote_futex_key_request(struct pcn_kmsg_message* inc_msg) {
        }
                //futex wait is the first global request
        FRPRINTK(KERN_ALERT"%s: wait gvp free \n", __func__);
-       scnprintf(gvp->name, sizeof(gvp->name), MODULE);
+//     scnprintf(gvp->name, sizeof(gvp->name), MODULE);
 
        gvp->global_wq = grq;//create_singlethread_workqueue(gvp->name);
        gvp->thread_group_leader = tsk;
@@ -849,6 +854,26 @@ static int handle_remote_futex_key_request(struct pcn_kmsg_message* inc_msg) {
        return 0;
 }
 
+int futex_global_worker_cleanup(struct task_struct *tsk){
+
+
+   if(tsk->tgroup_distributed && tsk->pid == tsk->tgroup_home_id){
+   _global_value * gvp = hashgroup(tsk);
+    FRPRINTK(KERN_INFO "GVP EXISTS{%s} tgid{%d} pid{%d} \n",tsk->comm,tsk->tgroup_home_id,tsk->pid);
+
+       if(gvp != NULL){
+
+               FRPRINTK(KERN_INFO"Inside GVP");
+               gvp->thread_group_leader = NULL;
+               gvp->free = 0;
+               gvp->global_wq = NULL;
+               gvp->worker_task =NULL;
+               FRPRINTK(KERN_INFO "cleaned up \n");
+       }
+    }
+
+       return 0;
+}
 
 static int __init futex_remote_init(void)
 {
index 953fbcc..32c0e8d 100644 (file)
@@ -72,6 +72,8 @@ struct futex_q {
 
        /*mklinux_akshay*/
        pid_t rem_pid;
+       union futex_key rem_requeue_key;
+       unsigned long req_addr;
 };
 
 
@@ -94,7 +96,7 @@ struct futex_q * query_q(struct task_struct *t);
 
 
 int remote_futex_wakeup(u32 __user  *uaddr,unsigned int flags, int nr_wake, u32 bitset,union futex_key *key, int rflag,
-               unsigned int fn_flags, u32 __user *uaddr2,  int nr_requeue, int cmpval);
+               unsigned int fn_flags, unsigned long uaddr2,  int nr_requeue, int cmpval);
 extern struct futex_hash_bucket futex_queues[1<<_FUTEX_HASHBITS];
 extern void get_futex_key_refs(union futex_key *key);
 extern int
@@ -122,7 +124,7 @@ int find_kernel_for_pfn(unsigned long addr, struct list_head *head);
 
 
 int get_futex_value_locked(u32 *dest, u32 __user *from);
-
+extern int futex_global_worker_cleanup(struct task_struct *tsk);
 extern struct list_head fq_head;
 
 struct kernel_robust_list {
index dc51291..dc77292 100644 (file)
@@ -20,8 +20,8 @@ union futex_key; //forward decl for futex_remote.h
 #define FLAGS_REMOTECALL       16
 #define FLAGS_ORIGINCALL       32
 
-#define GET_TOKEN 0
-#define WAIT_RELEASE_TOKEN 2
+#define WAKE_OPS 1
+#define WAIT_OPS 0
 
 DEFINE_SPINLOCK(request_queue_lock);
 
@@ -105,10 +105,9 @@ unsigned long f;
        {
                objPtr = list_entry(iter, _local_rq_t, lrq_member);
                if (objPtr->_request_id == request_id) {
-                       pagefault_disable();
                        objPtr->status =DONE;
                        objPtr->errno = err;
-                       pagefault_enable();
+                       wake_up_interruptible(&objPtr->_wq);
                        GENERAL_SPIN_UNLOCK(&request_queue_lock,f);
                        return objPtr;
                }
@@ -161,11 +160,9 @@ int getKey(unsigned long uaddr, _spin_key *sk, pid_t tgid)
 // hash spin key to find the spin bucket
 _spin_value *hashspinkey(_spin_key *sk)
 {
-       //u32 hash = jhash2((u32*)&sk->_uaddr,(sizeof(sk->_uaddr)+sizeof(sk->_uaddr))/4,100);
        pagefault_disable();
        u32 hash = sp_hashfn(sk->_uaddr,sk->_tgid);
        pagefault_enable();
-       //printk(KERN_ALERT"%s: hashspin{%u} -{%u} _uaddr{%lx) len{%d} \n", __func__,hash,hash & ((1 << _SPIN_HASHBITS)-1),sk->_uaddr,(sizeof(sk->_uaddr)+sizeof(sk->_uaddr))/4);
        return &spin_bucket[hash];
 }
 
@@ -174,34 +171,28 @@ _global_value *hashgroup(struct task_struct *group_pid)
 {
        struct task_struct *tsk =NULL;
        tsk= group_pid;
-       //u32 hash = jhash2((u32*)&tsk->pid,(sizeof(tsk->pid))/4,JHASH_INITVAL);
        pagefault_disable();
        u32 hash = sp_hashfn(tsk->pid,0);
        pagefault_enable();
-       //printk(KERN_ALERT"%s: globalhash{%u} \n", __func__,hash & ((1 << _SPIN_HASHBITS)-1));
        return &global_bucket[hash];
 }
 // Perform global spin lock
-int global_spinlock(unsigned long uaddr,futex_common_data_t *_data,_spin_value * value,_local_rq_t *rq_ptr,int localticket_value){
-
-
+int global_spinlock(unsigned long uaddr,futex_common_data_t *_data,_spin_value * value,_local_rq_t *rq_ptr,int localticket_value)
+__releases(&value->_sp)
+{
        //preempt_disable();
 
        int res = 0;
        int cpu=0;
        unsigned int flgs;
 
-
-       //TODO: check if interleaving is possible inside spin lock even though it is not pre emptible
-       //GENERAL_SPIN_LOCK(&value->_sp);
-
         _remote_key_request_t* wait_req= (_remote_key_request_t*) kmalloc(sizeof(_remote_key_request_t),
                                GFP_ATOMIC);
         _remote_wakeup_request_t *wake_req = (_remote_wakeup_request_t*) kmalloc(sizeof(_remote_wakeup_request_t),
                                GFP_ATOMIC);
 
        //Prepare request
-       if(_data->ops==0){
+       if(_data->ops==WAIT_OPS){
 
 //     printk(KERN_ALERT"%s: request -- entered whos calling{%s} \n", __func__,current->comm);
 //     printk(KERN_ALERT"%s:  uaddr {%lx}  pid{%d} current->tgroup_home_id{%d}\n",                             __func__,uaddr,current->pid,current->tgroup_home_id);
@@ -210,7 +201,7 @@ int global_spinlock(unsigned long uaddr,futex_common_data_t *_data,_spin_value *
        wait_req->header.type = PCN_KMSG_TYPE_REMOTE_IPC_FUTEX_KEY_REQUEST;
        wait_req->header.prio = PCN_KMSG_PRIO_NORMAL;
 
-       wait_req->ops = 0;
+       wait_req->ops = WAIT_OPS;
        wait_req->rw = _data->rw;
        wait_req->val = _data->val;
 
@@ -227,8 +218,8 @@ int global_spinlock(unsigned long uaddr,futex_common_data_t *_data,_spin_value *
                wake_req->header.type = PCN_KMSG_TYPE_REMOTE_IPC_FUTEX_WAKE_REQUEST;
                wake_req->header.prio = PCN_KMSG_PRIO_NORMAL;
 
-               wake_req->ops = 1;
-               wake_req->uaddr2 = _data->uaddr2;
+               wake_req->ops = WAKE_OPS;
+               wake_req->uaddr2 = (unsigned long) _data->uaddr2;
                wake_req->nr_wake2 = _data->nr_requeue;
                wake_req->cmpval = _data->cmpval;
                wake_req->rflag = _data->rflag;
@@ -242,6 +233,7 @@ int global_spinlock(unsigned long uaddr,futex_common_data_t *_data,_spin_value *
                wake_req->flags = _data->flags;
 
                wake_req->ticket = localticket_value;//GET_TOKEN; //set the request has no ticket
+               printk(KERN_ALERT"%s: wake uaddr2{%lx} data{%lx} \n",__func__,wake_req->uaddr2,_data->uaddr2);
        }
 
 
@@ -250,41 +242,38 @@ int global_spinlock(unsigned long uaddr,futex_common_data_t *_data,_spin_value *
        unsigned long pfn;
        pte_t pte;
        pte = *((pte_t *) do_page_walk((unsigned long)uaddr));
-       //printk(KERN_ALERT"%s pte ptr : ox{%lx} cpu{%d} \n",__func__,pte,smp_processor_id());
        pfn = pte_pfn(pte);
-       //printk(KERN_ALERT"%s pte pfn : 0x{%lx}\n",__func__,pfn);
-
-
-       //GENERAL_SPIN_UNLOCK(&value->_sp);
-       //preempt_enable();
 
        struct vm_area_struct *vma;
        vma = getVMAfromUaddr(uaddr);
        if (vma != NULL && current->executing_for_remote && (vma->vm_flags & VM_PFNMAP)) {
-                               if(_data->ops==0){
+                               if(_data->ops==WAIT_OPS){
                                        wait_req->fn_flags |= FLAGS_REMOTECALL;
                                }
                                else
                                        wake_req->fn_flag |= FLAGS_REMOTECALL;
-       //              printk(KERN_ALERT"%s: sending to origin remote callpfn cpu: 0x{%d} request->ticket{%d} \n",__func__,cpu,localticket_value);
+  //                   printk(KERN_ALERT"%s: sending to origin remote callpfn cpu: 0x{%d} request->ticket{%d} \n",__func__,cpu,localticket_value);
                        if ((cpu = find_kernel_for_pfn(pfn, &pfn_list_head)) != -1){
-                               res = pcn_kmsg_send(cpu, (struct pcn_kmsg_message*)  ((_data->ops==1)? (wake_req):(wait_req)));
+                               spin_unlock(&value->_sp);
+                               
+                               res = pcn_kmsg_send(cpu, (struct pcn_kmsg_message*)  ((_data->ops==WAKE_OPS)? (wake_req):(wait_req)));
                        }
                } else if (vma != NULL && !(vma->vm_flags & VM_PFNMAP) ) {
-                       if(_data->ops==0){
+                       if(_data->ops==WAIT_OPS){
                                        wait_req->fn_flags |= FLAGS_ORIGINCALL;
                                }
                                else{
                                        wake_req->fn_flag |= FLAGS_ORIGINCALL;
                                        wake_req->rflag = current->pid;
                                }
-       //              printk(KERN_ALERT"%s: sending to origin origin call cpu: 0x{%d} request->ticket{%d} \n",__func__,cpu,localticket_value);
+//                     printk(KERN_ALERT"%s: sending to origin origin call cpu: 0x{%d} request->ticket{%d} \n",__func__,cpu,localticket_value);
                        if ((cpu = find_kernel_for_pfn(pfn, &pfn_list_head)) != -1){
-                               res = pcn_kmsg_send(cpu, (struct pcn_kmsg_message*) ((_data->ops==1)? (wake_req):(wait_req)));
+                               spin_unlock(&value->_sp);
+                               
+                               res = pcn_kmsg_send(cpu, (struct pcn_kmsg_message*) ((_data->ops==WAKE_OPS)? (wake_req):(wait_req)));
                        }
                }
 
-       //check if it has acquired valid ticket
        //      printk(KERN_ALERT"%s:goto sleep after ticket request: 0x{%d} {%d}\n",__func__,cpu,current->pid);
                wait_event_interruptible(rq_ptr->_wq, (rq_ptr->status == DONE));
        //      printk(KERN_ALERT"%s:after wake up process: task woken{%d}\n",__func__,current->pid);
@@ -331,7 +320,7 @@ int global_spinunlock(unsigned long uaddr, unsigned int fn_flag){
                request->tghid = current->tgroup_home_id;
                request->fn_flags = fn_flag;
 
-               request->ticket = WAIT_RELEASE_TOKEN; //set the request to release lock
+               request->ticket = 2;// WAIT_RELEASE_TOKEN; //set the request to release lock
 
                unsigned long pfn;
                pte_t pte;
index 8c308db..bc8b7c6 100644 (file)
@@ -5611,15 +5611,15 @@ if ( !cpumask_intersects(in_mask, cpu_present_mask) ) {
     struct list_head *iter;
     _remote_cpu_info_list_t *objPtr;
     struct cpumask *pcpum;
-    extern struct list_head rlist_head;
+extern struct list_head rlist_head;
     list_for_each(iter, &rlist_head) {
         objPtr = list_entry(iter, _remote_cpu_info_list_t, cpu_list_member);
         i = objPtr->_data._processor;
         pcpum = &(objPtr->_data._cpumask);
         if ( cpumask_intersects(in_mask, pcpum) ) {
 #endif
-            // TODO ask the global scheduler if there are multiple affinities    
-               // do the migration
+        // TODO ask the global scheduler if there are multiple affinities    
+       // do the migration
             get_task_struct(p);
             rcu_read_unlock();
             ret =process_server_do_migration(p,i);
index e262088..3afc377 100644 (file)
@@ -165,13 +165,14 @@ _incomming_remote_signal_pool_t * add_incomming(int pid,int cpu_id, int request_
        _incomming_remote_signal_pool_t *Ptr = (_incomming_remote_signal_pool_t *) kmalloc(
                        sizeof(_incomming_remote_signal_pool_t), GFP_ATOMIC);
 
+       spin_lock(&in_list_lock);
        Ptr->req_id = request_id;
        Ptr->cpu_id = cpu_id;
        Ptr->pid = pid;
        Ptr->assign_for_kthread=0;
        INIT_LIST_HEAD(&Ptr->list_member);
        list_add(&Ptr->list_member, head);
-
+       spin_unlock(&in_list_lock);
        return Ptr;
 }
 
@@ -179,28 +180,35 @@ int find_and_delete_incomming(int pid, struct list_head *head) {
        struct list_head *iter;
        _incomming_remote_signal_pool_t *objPtr;
 
+       spin_lock(&in_list_lock);
        list_for_each(iter, head)
        {
                objPtr = list_entry(iter, _incomming_remote_signal_pool_t, list_member);
                if (objPtr->pid == pid) {
                        list_del(&objPtr->list_member);
                        kfree(objPtr);
+                       spin_unlock(&in_list_lock);
                        return 1;
                }
        }
+       spin_unlock(&in_list_lock);
+       return 0;
 }
 
 _incomming_remote_signal_pool_t * find_incomming(int pid, struct list_head *head) {
        struct list_head *iter;
        _incomming_remote_signal_pool_t *objPtr;
-
+       
+       spin_lock(&in_list_lock);
        list_for_each(iter, head)
        {
                objPtr = list_entry(iter, _incomming_remote_signal_pool_t, list_member);
                if (objPtr->pid == pid) {
+                       spin_unlock(&in_list_lock);
                        return objPtr;
                }
        }
+       spin_unlock(&in_list_lock);
        return NULL;
 }
 
@@ -208,55 +216,63 @@ _outgoing_remote_signal_pool_t * add_outgoing(int request_id, struct list_head *
        _outgoing_remote_signal_pool_t *Ptr = (_outgoing_remote_signal_pool_t *) kmalloc(
                        sizeof(_outgoing_remote_signal_pool_t), GFP_ATOMIC);
 
+       spin_lock(&out_list_lock);
        memset(Ptr, 0, sizeof(_outgoing_remote_signal_pool_t));
        Ptr->request_id = request_id;
        Ptr->status = IDLE;
        init_waitqueue_head(&Ptr->wq);
        INIT_LIST_HEAD(&Ptr->list_member);
        list_add(&Ptr->list_member, head);
-
+       spin_unlock(&out_list_lock);
        return Ptr;
 }
 
 int find_and_delete_outgoing(int request_id, struct list_head *head) {
        struct list_head *iter;
        _outgoing_remote_signal_pool_t *objPtr;
-
+       
+       spin_lock(&out_list_lock);
        list_for_each(iter, head)
        {
                objPtr = list_entry(iter, _outgoing_remote_signal_pool_t, list_member);
                if (objPtr->request_id == request_id) {
                        list_del(&objPtr->list_member);
                        kfree(objPtr);
+                       spin_unlock(&out_list_lock);
                        return 1;
                }
        }
+       spin_unlock(&out_list_lock);
 }
 
 _outgoing_remote_signal_pool_t * find_outgoing(int request_id, struct list_head *head) {
        struct list_head *iter;
        _outgoing_remote_signal_pool_t *objPtr;
 
+       spin_lock(&out_list_lock);
        list_for_each(iter, head)
        {
                objPtr = list_entry(iter, _outgoing_remote_signal_pool_t, list_member);
                if (objPtr->request_id == request_id) {
+                       spin_unlock(&out_list_lock);
                        return objPtr;
                }
        }
+       spin_unlock(&out_list_lock);
        return NULL;
 }
 
 void display_request(struct list_head *head) {
        struct list_head *iter;
        _outgoing_remote_signal_pool_t *objPtr;
-
+       spin_lock(&out_list_lock);
        list_for_each(iter, head)
        {
                objPtr = list_entry(iter, _outgoing_remote_signal_pool_t, list_member);
                printk("%d \t", objPtr->request_id);
                printk("%d \t", objPtr->status);
        }
+       spin_lock(&out_list_lock);
        printk("\n");
 }
 
@@ -267,12 +283,12 @@ static int handle_remote_kill_response(struct pcn_kmsg_message* inc_msg) {
                        "handle_remote_kill_response", msg->errno);
 
        _outgoing_remote_signal_pool_t *ptr = find_outgoing(msg->request_id, &out_head);
+       if(!ptr) goto free;
        ptr->status = DONE;
        ptr->errno = msg->errno;
        wake_up_interruptible(&ptr->wq);
-
+free:
        pcn_kmsg_free_msg(inc_msg);
-
        return 0;
 }
 
@@ -302,9 +318,9 @@ static int handle_remote_kill_request(struct pcn_kmsg_message* inc_msg) {
        info.si_uid = current_uid();
        info.si_remote = true;
 
-       spin_lock(&in_list_lock);
+       //spin_lock(&in_list_lock);
        ptr = add_incomming( msg->pid,msg->header.from_cpu,msg->request_id, &inc_head);
-       spin_unlock(&in_list_lock);
+       //spin_unlock(&in_list_lock);
 
        //perform action
 
@@ -328,9 +344,9 @@ static int handle_remote_kill_request(struct pcn_kmsg_message* inc_msg) {
        // Send response
        pcn_kmsg_send(msg->header.from_cpu, (struct pcn_kmsg_message*) (&response));
 
-       spin_lock(&in_list_lock);
+       //spin_lock(&in_list_lock);
                find_and_delete_incomming(msg->pid,&inc_head);
-       spin_unlock(&in_list_lock);
+       //spin_unlock(&in_list_lock);
        }
        else
        {
@@ -360,11 +376,11 @@ static int remote_kill_pid_info(int kernel, int sig, pid_t pid,
        request->header.type = PCN_KMSG_TYPE_REMOTE_SENDSIG_REQUEST;
        request->header.prio = PCN_KMSG_PRIO_NORMAL;
 
-       spin_lock(&out_list_lock);
+       //spin_lock(&out_list_lock);
        int req_id = get_counter_id();
        ptr = add_outgoing(req_id, &out_head);
        request->request_id = req_id;
-       spin_unlock(&out_list_lock);
+       //spin_unlock(&out_list_lock);
 
        // Send response
        res = pcn_kmsg_send(kernel, (struct pcn_kmsg_message*) (request));
@@ -373,9 +389,9 @@ static int remote_kill_pid_info(int kernel, int sig, pid_t pid,
 
        res = ptr->errno;
 
-       spin_lock(&out_list_lock);
+       //spin_lock(&out_list_lock);
        find_and_delete_outgoing(req_id, &out_head);
-       spin_unlock(&out_list_lock);
+       //spin_unlock(&out_list_lock);
 
        return res;
 
@@ -418,11 +434,11 @@ int remote_kill_pid_info_thread(void *data) {
                                request->header.type = PCN_KMSG_TYPE_REMOTE_SENDSIG_REQUEST;
                                request->header.prio = PCN_KMSG_PRIO_NORMAL;
 
-                               spin_lock(&out_list_lock);
+                               //spin_lock(&out_list_lock);
                                int req_id = get_counter_id();
                                ptr = add_outgoing(req_id, &out_head);
                                request->request_id = req_id;
-                               spin_unlock(&out_list_lock);
+                               //spin_unlock(&out_list_lock);
 
                                // Send response to kill migrated pid
                                res = pcn_kmsg_send(killinfo->kernel,
@@ -432,24 +448,9 @@ int remote_kill_pid_info_thread(void *data) {
 
                                killinfo->respon=ptr->errno;
 
-                               spin_lock(&out_list_lock);
+                               //spin_lock(&out_list_lock);
                                find_and_delete_outgoing(req_id, &out_head);
-                               spin_unlock(&out_list_lock);
-
-                               //send the expecting process to continue
-                               //kill_pid(find_vpid(killinfo->ret_pid), SIGCONT,1);
-
-                               /*struct task_struct *task = pid_task(find_vpid(killinfo->calling_pid), PIDTYPE_PID);
-
-                               if(task){
-                                       __set_task_state(task,TASK_INTERRUPTIBLE);
-                               }
-
-                               //send signal to current pid
-                               rcu_read_lock();
-                                       ret = kill_pid_info(killinfo->signal, killinfo->info, find_vpid(killinfo->calling_pid));
-                               rcu_read_unlock();*/
-
+                               //spin_unlock(&out_list_lock);
 
 
                                _remote_kill_response_t response;
@@ -465,9 +466,9 @@ int remote_kill_pid_info_thread(void *data) {
                                // Send response to the calling kernel
                                pcn_kmsg_send(killinfo->ret_cpu, (struct pcn_kmsg_message*) (&response));
 
-                               spin_lock(&in_list_lock);
+                               //spin_lock(&in_list_lock);
                                        find_and_delete_incomming(killinfo->pid,&inc_head);
-                               spin_unlock(&in_list_lock);
+                               //spin_unlock(&in_list_lock);
 
                                recv_signal = SIGSTOP;
                                sigaddset(&current->pending.signal,SIGSTOP);
@@ -502,11 +503,11 @@ static int remote_do_send_specific(int kernel, pid_t tgid, pid_t pid, int sig,
        request->header.type = PCN_KMSG_TYPE_REMOTE_SENDSIG_REQUEST;
        request->header.prio = PCN_KMSG_PRIO_NORMAL;
 
-       spin_lock(&out_list_lock);
+       //spin_lock(&out_list_lock);
        int req_id = get_counter_id();
        ptr = add_outgoing(req_id, &out_head);
        request->request_id = req_id;
-       spin_unlock(&out_list_lock);
+       //spin_unlock(&out_list_lock);
 
        // Send response
        res = pcn_kmsg_send(kernel, (struct pcn_kmsg_message*) (request));
@@ -515,9 +516,9 @@ static int remote_do_send_specific(int kernel, pid_t tgid, pid_t pid, int sig,
 
        res = ptr->errno;
 
-       spin_lock(&out_list_lock);
+       //spin_lock(&out_list_lock);
        find_and_delete_outgoing(req_id, &out_head);
-       spin_unlock(&out_list_lock);
+       //spin_unlock(&out_list_lock);
 
        return res;
 }
@@ -2028,8 +2029,10 @@ rcu_read_unlock();
 if (error == -ESRCH) {
        if (ORIG_NODE(pid) != _cpu) {
                _incomming_remote_signal_pool_t *ptr = find_incomming(pid, &inc_head);
-               if (ptr == NULL)
+               if (ptr == NULL){
+                       printk(KERN_ALERT"%s:remote_kill pid{%d} c(%d} cpu{%d}\n",__func__,pid,ORIG_NODE(pid),_cpu);
                        return remote_kill_pid_info( ORIG_NODE(pid),sig,pid,info);
+               }
                else {
                        spin_lock(&kthread_lock);
                        kthread_param.kernel = ORIG_NODE(pid);
@@ -2142,8 +2145,10 @@ if (pid > 0) {
 
                if (ORIG_NODE(pid) != _cpu) {
                        _incomming_remote_signal_pool_t *ptr = find_incomming(pid, &inc_head);
-                       if (ptr == NULL)
+                       if (ptr == NULL){
+                                       printk(KERN_ALERT"%s:remote_kill pid{%d} c(%d} cpu{%d}\n",__func__,pid,ORIG_NODE(pid),_cpu);
                                return remote_kill_pid_info( ORIG_NODE(pid),sig,pid,info);
+                       }
                        else {
                                spin_lock(&kthread_lock);
                                kthread_param.kernel = ORIG_NODE(pid);
@@ -2167,8 +2172,10 @@ if (pid > 0) {
        }
        else if (origin_pid != -1 && next_pid != -1) {
                                _incomming_remote_signal_pool_t *ptr = find_incomming(pid, &inc_head);
-                               if (ptr == NULL)
+                               if (ptr == NULL){
+                                               printk(KERN_ALERT"%s:remote_kill pid{%d} c(%d} cpu{%d}\n",__func__,pid,ORIG_NODE(pid),_cpu);
                                        return remote_kill_pid_info( ORIG_NODE(next_pid),sig,next_pid,info);
+                               }
                                else {
                                        spin_lock(&kthread_lock);
                                        ptr->assign_for_kthread=1;
@@ -4026,8 +4033,10 @@ sigqueue_cachep = KMEM_CACHE(sigqueue, SLAB_PANIC);
 }
 static int __init kill_handler_init(void) {
 /*mklinux_akshay*/
-_cpu = smp_processor_id();
 
+ _cpu= cpumask_first(cpu_present_mask);
+
+printk(KERN_ALERT"%s: cpu{%d}\n",__func__,_cpu);
 INIT_LIST_HEAD(&out_head);
 INIT_LIST_HEAD(&inc_head);