Print this page
patch fixes
6345 remove xhat support

@@ -22,12 +22,10 @@
 /*
  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
-
 #include <sys/types.h>
 #include <sys/t_lock.h>
 #include <sys/param.h>
 #include <sys/cred.h>
 #include <sys/debug.h>

@@ -180,25 +178,20 @@
                 return (0);
 
         /*
          * as->a_wpage can only be changed while the process is totally stopped.
          * Don't grab p_lock here.  Holding p_lock while grabbing the address
-         * space lock leads to deadlocks with the clock thread.  Note that if an
-         * as_fault() is servicing a fault to a watched page on behalf of an
-         * XHAT provider, watchpoint will be temporarily cleared (and wp_prot
-         * will be set to wp_oprot).  Since this is done while holding as writer
-         * lock, we need to grab as lock (reader lock is good enough).
+         * space lock leads to deadlocks with the clock thread.
          *
          * p_maplock prevents simultaneous execution of this function.  Under
          * normal circumstances, holdwatch() will stop all other threads, so the
          * lock isn't really needed.  But there may be multiple threads within
          * stop() when SWATCHOK is set, so we need to handle multiple threads
          * at once.  See holdwatch() for the details of this dance.
          */
 
         mutex_enter(&p->p_maplock);
-        AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
 
         tpw.wp_vaddr = (caddr_t)((uintptr_t)addr & (uintptr_t)PAGEMASK);
         if ((pwp = avl_find(&as->a_wpage, &tpw, &where)) == NULL)
                 pwp = avl_nearest(&as->a_wpage, where, AVL_AFTER);
 

@@ -229,26 +222,20 @@
                         /*
                          * Before mapping the page in, ensure that
                          * all other lwps are held in the kernel.
                          */
                         if (p->p_mapcnt == 0) {
-                                /*
-                                 * Release as lock while in holdwatch()
-                                 * in case other threads need to grab it.
-                                 */
-                                AS_LOCK_EXIT(as, &as->a_lock);
                                 mutex_exit(&p->p_maplock);
                                 if (holdwatch() != 0) {
                                         /*
                                          * We stopped in holdwatch().
                                          * Start all over again because the
                                          * watched page list may have changed.
                                          */
                                         goto startover;
                                 }
                                 mutex_enter(&p->p_maplock);
-                                AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
                         }
                         p->p_mapcnt++;
                 }
 
                 addr = pwp->wp_vaddr;

@@ -304,11 +291,10 @@
                 if (pwp->wp_oprot != 0) {       /* if page exists */
                         struct seg *seg;
                         uint_t oprot;
                         int err, retrycnt = 0;
 
-                        AS_LOCK_EXIT(as, &as->a_lock);
                         AS_LOCK_ENTER(as, &as->a_lock, RW_WRITER);
                 retry:
                         seg = as_segat(as, addr);
                         ASSERT(seg != NULL);
                         SEGOP_GETPROT(seg, addr, 0, &oprot);

@@ -319,12 +305,11 @@
                                         retrycnt++;
                                         goto retry;
                                 }
                         }
                         AS_LOCK_EXIT(as, &as->a_lock);
-                } else
-                        AS_LOCK_EXIT(as, &as->a_lock);
+                }
 
                 /*
                  * When all pages are mapped back to their normal state,
                  * continue the other lwps.
                  */

@@ -337,15 +322,12 @@
                                 continuelwps(p);
                                 mutex_exit(&p->p_lock);
                                 mutex_enter(&p->p_maplock);
                         }
                 }
-
-                AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
         }
 
-        AS_LOCK_EXIT(as, &as->a_lock);
         mutex_exit(&p->p_maplock);
 
         return (rv);
 }
 

@@ -434,11 +416,10 @@
         AS_LOCK_EXIT(as, &as->a_lock);
 }
 
 
 
-/* Must be called with as lock held */
 int
 pr_is_watchpage_as(caddr_t addr, enum seg_rw rw, struct as *as)
 {
         register struct watched_page *pwp;
         struct watched_page tpw;

@@ -497,21 +478,15 @@
  */
 int
 pr_is_watchpage(caddr_t addr, enum seg_rw rw)
 {
         struct as *as = curproc->p_as;
-        int rv;
 
         if ((as == &kas) || avl_numnodes(&as->a_wpage) == 0)
                 return (0);
 
-        /* Grab the lock because of XHAT (see comment in pr_mappage()) */
-        AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
-        rv = pr_is_watchpage_as(addr, rw, as);
-        AS_LOCK_EXIT(as, &as->a_lock);
-
-        return (rv);
+        return (pr_is_watchpage_as(addr, rw, as));
 }
 
 
 
 /*