Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Nov 2010 17:50:54 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r214931 - stable/8/sys/sparc64/sparc64
Message-ID:  <201011071750.oA7Hoss4066919@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Sun Nov  7 17:50:54 2010
New Revision: 214931
URL: http://svn.freebsd.org/changeset/base/214931

Log:
  MFC: r214528
  
  - When resetting pm_active and pm_context of a pmap in pmap_pinit() we
    need locking as otherwise we may race against the other parts of the
    MD code which expects a consistent state of these. While at it move
    the resetting of the pmap before entering it in the TSB.
  - Spell a 0 as TLB_CTX_KERNEL.

Modified:
  stable/8/sys/sparc64/sparc64/pmap.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/sparc64/sparc64/pmap.c
==============================================================================
--- stable/8/sys/sparc64/sparc64/pmap.c	Sun Nov  7 17:48:11 2010	(r214930)
+++ stable/8/sys/sparc64/sparc64/pmap.c	Sun Nov  7 17:50:54 2010	(r214931)
@@ -1061,7 +1061,7 @@ pmap_pinit0(pmap_t pm)
 
 	PMAP_LOCK_INIT(pm);
 	for (i = 0; i < MAXCPU; i++)
-		pm->pm_context[i] = 0;
+		pm->pm_context[i] = TLB_CTX_KERNEL;
 	pm->pm_active = 0;
 	pm->pm_tsb = NULL;
 	pm->pm_tsb_obj = NULL;
@@ -1099,6 +1099,12 @@ pmap_pinit(pmap_t pm)
 	if (pm->pm_tsb_obj == NULL)
 		pm->pm_tsb_obj = vm_object_allocate(OBJT_DEFAULT, TSB_PAGES);
 
+	mtx_lock_spin(&sched_lock);
+	for (i = 0; i < MAXCPU; i++)
+		pm->pm_context[i] = -1;
+	pm->pm_active = 0;
+	mtx_unlock_spin(&sched_lock);
+
 	VM_OBJECT_LOCK(pm->pm_tsb_obj);
 	for (i = 0; i < TSB_PAGES; i++) {
 		m = vm_page_grab(pm->pm_tsb_obj, i, VM_ALLOC_NOBUSY |
@@ -1110,9 +1116,6 @@ pmap_pinit(pmap_t pm)
 	VM_OBJECT_UNLOCK(pm->pm_tsb_obj);
 	pmap_qenter((vm_offset_t)pm->pm_tsb, ma, TSB_PAGES);
 
-	for (i = 0; i < MAXCPU; i++)
-		pm->pm_context[i] = -1;
-	pm->pm_active = 0;
 	bzero(&pm->pm_stats, sizeof(pm->pm_stats));
 	return (1);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011071750.oA7Hoss4066919>