Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jan 2002 06:30:09 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        alpha@FreeBSD.org, dfr@FreeBSD.org
Subject:   pmap fixes for SMP
Message-ID:  <XFMail.020115063009.jhb@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
Hey gang,

I've got some fixes for pmap on SMP machines.  With these fixes the DS20 I have
here succesfully completed several buildworlds in a row with preemption turned
on whereas before it couldn't make it through a single buildworld w/ preemption
on without dying.  The main points of this patch are as follows:

- Create a private list of active pmaps rather than abusing the list of all
  processes when we need to look up pmaps.  The process list needs a sx lock
  and we can't be getting sx locks in the middle of cpu_switch()
  (pmap_activate() can call pmap_get_asn() from cpu_switch()).  Instead, we
  protect the list with a spinlock.  This also means the list is shorter
  since a pmap can be used by more than one process and we could (at least
  in thoery) dink with pmap's more than once, but now we only touch each
  pmap once when we have to update all of them.
- Wrap pmap_activate()'s code to get a new ASN in an explicit critical section
  so that when it is called while doing an exec() we can't get preempted.
- Replace splhigh() in pmap_growkernel() with a critical section to prevent
  preemption while we are adjusting the kernel page tables.
- Fixes abuse of PCPU_GET(), which doesn't return an L-value.
- Also adds some slight cleanups to the ASN handling by adding some macros
  instead of magic numbers in relation to the ASN and ASN generations.

Note that we have a bug if we ever run on an Alpha processor that supports more
than 256 ASN's we will corrupt our ASN generation.  We could make the
generation field smaller or truncate maxasn in that case to 255.  We could also
make the ASN and ASN generatino var a long with a 16-bit ASN (max ASN on alpha
is 65535) and a 48-bit generation count if we wanted I suppose.

I'd like to commit this unless there are objections.  The patch is at
http://www.freebsd.org/~jhb/patches/alpha.pmap.patch

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




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