PERFORCE change 80051 for review
Peter Wemm
peter at FreeBSD.org
Tue Jul 12 20:30:59 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=80051
Change 80051 by peter at peter_overcee on 2005/07/12 20:30:33
Check in some WIP code that we're experimenting with (default off) at
work to see if we're seeing a 4K/2M page alias problem when atomic
ops are mixed in. This allows an expensive 4.x style temporary
ephemeral mapping for each operation.
Affected files ...
.. //depot/projects/hammer/sys/amd64/amd64/uio_machdep.c#5 edit
Differences ...
==== //depot/projects/hammer/sys/amd64/amd64/uio_machdep.c#5 (text+ko) ====
@@ -48,6 +48,10 @@
#include <vm/vm.h>
#include <vm/vm_page.h>
+#ifdef NODMAP
+#include <vm/vm_extern.h>
+#include <vm/vm_kern.h>
+#endif
#include <machine/vmparam.h>
@@ -65,11 +69,17 @@
size_t cnt;
int error = 0;
int save = 0;
+#ifdef NODMAP
+ vm_offset_t kva;
+#endif
KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE,
("uiomove_fromphys: mode"));
KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_td == curthread,
("uiomove_fromphys proc"));
+#ifdef NODMAP
+ kva = kmem_alloc_nofault(kernel_map, PAGE_SIZE);
+#endif
save = td->td_pflags & TDP_DEADLKTREAT;
td->td_pflags |= TDP_DEADLKTREAT;
while (n > 0 && uio->uio_resid) {
@@ -84,8 +94,13 @@
cnt = n;
page_offset = offset & PAGE_MASK;
cnt = min(cnt, PAGE_SIZE - page_offset);
+#ifdef NODMAP
+ pmap_kenter(kva, VM_PAGE_TO_PHYS(ma[offset >> PAGE_SHIFT]));
+ cp = (char *)kva + page_offset;
+#else
cp = (char *)PHYS_TO_DMAP(ma[offset >> PAGE_SHIFT]->phys_addr) +
page_offset;
+#endif
switch (uio->uio_segflg) {
case UIO_USERSPACE:
if (ticks - PCPU_GET(switchticks) >= hogticks)
@@ -106,6 +121,9 @@
case UIO_NOCOPY:
break;
}
+#ifdef NODMAP
+ pmap_kremove(kva);
+#endif
iov->iov_base = (char *)iov->iov_base + cnt;
iov->iov_len -= cnt;
uio->uio_resid -= cnt;
@@ -116,5 +134,8 @@
out:
if (save == 0)
td->td_pflags &= ~TDP_DEADLKTREAT;
+#ifdef NODMAP
+ kmem_free(kernel_map, kva, PAGE_SIZE);
+#endif
return (error);
}
More information about the p4-projects
mailing list