PERFORCE change 118894 for review
Rui Paulo
rpaulo at FreeBSD.org
Fri Apr 27 20:31:45 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=118894
Change 118894 by rpaulo at rpaulo_epsilon on 2007/04/27 20:30:43
IFC
Affected files ...
.. //depot/projects/soc2007/rpaulo-macbook/amd64/amd64/local_apic.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/amd64/amd64/pmap.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/amd64/amd64/vm_machdep.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/amd64/include/vmparam.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/bsm/audit.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/bsm/audit_internal.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/bsm/audit_kevents.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/bsm/audit_record.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/cam/cam_periph.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/cam/cam_periph.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/cam/cam_xpt.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/cam/scsi/scsi_da.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/cam/scsi/scsi_pt.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/cam/scsi/scsi_sa.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/compat/linprocfs/linprocfs.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/compat/opensolaris/kern/opensolaris_misc.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/compat/opensolaris/kern/opensolaris_vfs.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/compat/opensolaris/sys/misc.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/compat/opensolaris/sys/sunddi.h#1 branch
.. //depot/projects/soc2007/rpaulo-macbook/compat/opensolaris/sys/types.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/compat/opensolaris/sys/vnode.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/conf/files#3 integrate
.. //depot/projects/soc2007/rpaulo-macbook/contrib/opensolaris/uts/common/fs/dnlc.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/contrib/opensolaris/uts/common/fs/zfs/arc.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/contrib/opensolaris/uts/common/fs/zfs/spa.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/contrib/opensolaris/uts/common/fs/zfs/spa_config.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/contrib/opensolaris/uts/common/fs/zfs/vdev.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/contrib/opensolaris/uts/common/fs/zfs/zap.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/contrib/opensolaris/uts/common/fs/zfs/zil.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/contrib/opensolaris/uts/common/fs/zfs/zio.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/contrib/opensolaris/uts/common/fs/zfs/zvol.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/acpi_support/acpi_ibm.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/acpica/acpi.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/aic7xxx/aic79xx.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/aic7xxx/aic79xx.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/aic7xxx/aic7xxx.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/aic7xxx/aic7xxx.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/aic7xxx/aic7xxx_inline.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/ata/ata-disk.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/ath/if_ath.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/cxgb/cxgb_main.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/cxgb/cxgb_sge.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/cxgb/sys/uipc_mvec.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/firewire/firewire.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/firewire/fwdev.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/led/led.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/led/led.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/msk/if_msk.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/msk/if_mskreg.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/mxge/if_mxge.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/pci/pci.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/pci/pcireg.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/sound/pci/envy24.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/sound/pci/envy24ht.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/dev/sound/pci/hda/hdac.c#2 edit
.. //depot/projects/soc2007/rpaulo-macbook/dev/usb/if_ural.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/fs/devfs/devfs_devs.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/fs/devfs/devfs_vnops.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/fs/procfs/procfs_map.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/fs/pseudofs/pseudofs_vncache.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/geom/part/g_part.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/geom/uzip/g_uzip.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/i386/i386/local_apic.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/i386/i386/pmap.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/i386/i386/sys_machdep.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/i386/i386/vm_machdep.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/i386/include/vmparam.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/ia64/include/vmparam.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/kern/kern_descrip.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/kern/kern_linker.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/kern/kern_malloc.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/kern/kern_time.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/kern/kern_uuid.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/kern/sched_ule.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/kern/uipc_syscalls.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/kern/vfs_bio.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/kern/vfs_mount.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/modules/zfs/Makefile#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netgraph/ng_l2tp.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netgraph/ng_ppp.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_indata.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_indata.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_input.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_output.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_pcb.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_pcb.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_structs.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_uio.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet/sctp_usrreq.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet/sctputil.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet/sctputil.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet/tcp.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet/tcp_input.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet/tcp_output.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet/tcp_syncache.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet/tcp_var.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet6/in6_pcb.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/netinet6/route6.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/nfsclient/nfs_bio.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/nfsclient/nfs_lock.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/nfsclient/nfs_vnops.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/nfsserver/nfs_syscalls.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/pci/if_vr.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/pci/if_vrreg.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/pci/intpm.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/powerpc/powerpc/nexus.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/audit/audit_syscalls.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac/mac_audit.c#1 branch
.. //depot/projects/soc2007/rpaulo-macbook/security/mac/mac_framework.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac/mac_inet.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac/mac_net.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac/mac_pipe.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac/mac_policy.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac/mac_process.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac/mac_socket.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac/mac_system.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac/mac_vfs.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac_biba/mac_biba.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac_bsdextended/mac_bsdextended.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac_ifoff/mac_ifoff.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac_lomac/mac_lomac.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac_mls/mac_mls.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac_partition/mac_partition.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac_portacl/mac_portacl.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac_seeotheruids/mac_seeotheruids.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac_stub/mac_stub.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/security/mac_test/mac_test.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/sparc64/include/vmparam.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/sun4v/include/vmparam.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/sys/ioctl_compat.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/sys/mount.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/sys/priv.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/sys/proc.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/sys/socket.h#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/vm/swap_pager.c#2 integrate
.. //depot/projects/soc2007/rpaulo-macbook/vm/vm_map.c#2 integrate
Differences ...
==== //depot/projects/soc2007/rpaulo-macbook/amd64/amd64/local_apic.c#2 (text+ko) ====
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/local_apic.c,v 1.37 2007/03/20 21:53:30 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/local_apic.c,v 1.38 2007/04/25 19:58:41 ariff Exp $");
#include "opt_hwpmc_hooks.h"
@@ -326,6 +326,29 @@
/* XXX: Error and thermal LVTs */
+ if (strcmp(cpu_vendor, "AuthenticAMD") == 0) {
+ /*
+ * Detect the presence of C1E capability mostly on latest
+ * dual-cores (or future) k8 family. This feature renders
+ * the local APIC timer dead, so we disable it by reading
+ * the Interrupt Pending Message register and clearing both
+ * C1eOnCmpHalt (bit 28) and SmiOnCmpHalt (bit 27).
+ *
+ * Reference:
+ * "BIOS and Kernel Developer's Guide for AMD NPT
+ * Family 0Fh Processors"
+ * #32559 revision 3.00
+ */
+ if ((cpu_id & 0x00000f00) == 0x00000f00 &&
+ (cpu_id & 0x0fff0000) >= 0x00040000) {
+ uint64_t msr;
+
+ msr = rdmsr(0xc0010055);
+ if (msr & 0x18000000)
+ wrmsr(0xc0010055, msr & ~0x18000000ULL);
+ }
+ }
+
intr_restore(eflags);
}
==== //depot/projects/soc2007/rpaulo-macbook/amd64/amd64/pmap.c#2 (text+ko) ====
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.582 2007/04/13 16:07:29 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.584 2007/04/25 18:10:43 ups Exp $");
/*
* Manages physical address maps.
@@ -209,7 +209,7 @@
static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va,
vm_page_t m, vm_prot_t prot, vm_page_t mpte);
static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq,
- vm_offset_t sva, pd_entry_t ptepde);
+ vm_offset_t sva, pd_entry_t ptepde, vm_page_t *free);
static void pmap_remove_page(pmap_t pmap, vm_offset_t va, pd_entry_t *pde);
static void pmap_remove_entry(struct pmap *pmap, vm_page_t m,
vm_offset_t va);
@@ -221,8 +221,9 @@
static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va, int flags);
static vm_page_t _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, int flags);
-static int _pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m);
-static int pmap_unuse_pt(pmap_t, vm_offset_t, pd_entry_t);
+static int _pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m,
+ vm_page_t* free);
+static int pmap_unuse_pt(pmap_t, vm_offset_t, pd_entry_t, vm_page_t *);
static vm_offset_t pmap_kmem_choose(vm_offset_t addr);
CTASSERT(1 << PDESHIFT == sizeof(pd_entry_t));
@@ -1065,24 +1066,36 @@
/***************************************************
* Page table page management routines.....
***************************************************/
+static PMAP_INLINE void
+pmap_free_zero_pages(vm_page_t free)
+{
+ vm_page_t m;
+ while (free != NULL) {
+ m = free;
+ free = m->right;
+ vm_page_free_zero(m);
+ }
+}
+
/*
* This routine unholds page table pages, and if the hold count
* drops to zero, then it decrements the wire count.
*/
static PMAP_INLINE int
-pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m)
+pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_page_t *free)
{
--m->wire_count;
if (m->wire_count == 0)
- return _pmap_unwire_pte_hold(pmap, va, m);
+ return _pmap_unwire_pte_hold(pmap, va, m, free);
else
return 0;
}
static int
-_pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m)
+_pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m,
+ vm_page_t *free)
{
vm_offset_t pteva;
@@ -1114,14 +1127,14 @@
vm_page_t pdpg;
pdpg = PHYS_TO_VM_PAGE(*pmap_pdpe(pmap, va) & PG_FRAME);
- pmap_unwire_pte_hold(pmap, va, pdpg);
+ pmap_unwire_pte_hold(pmap, va, pdpg, free);
}
if (m->pindex >= NUPDE && m->pindex < (NUPDE + NUPDPE)) {
/* We just released a PD, unhold the matching PDP */
vm_page_t pdppg;
pdppg = PHYS_TO_VM_PAGE(*pmap_pml4e(pmap, va) & PG_FRAME);
- pmap_unwire_pte_hold(pmap, va, pdppg);
+ pmap_unwire_pte_hold(pmap, va, pdppg, free);
}
/*
@@ -1130,7 +1143,13 @@
*/
pmap_invalidate_page(pmap, pteva);
- vm_page_free_zero(m);
+ /*
+ * Put page on a list so that it is released after
+ * *ALL* TLB shootdown is done
+ */
+ m->right = *free;
+ *free = m;
+
atomic_subtract_int(&cnt.v_wire_count, 1);
return 1;
}
@@ -1140,7 +1159,7 @@
* conditionally free the page, and manage the hold/wire counts.
*/
static int
-pmap_unuse_pt(pmap_t pmap, vm_offset_t va, pd_entry_t ptepde)
+pmap_unuse_pt(pmap_t pmap, vm_offset_t va, pd_entry_t ptepde, vm_page_t *free)
{
vm_page_t mpte;
@@ -1148,7 +1167,7 @@
return 0;
KASSERT(ptepde != 0, ("pmap_unuse_pt: ptepde != 0"));
mpte = PHYS_TO_VM_PAGE(ptepde & PG_FRAME);
- return pmap_unwire_pte_hold(pmap, va, mpte);
+ return pmap_unwire_pte_hold(pmap, va, mpte, free);
}
void
@@ -1366,7 +1385,7 @@
{
vm_pindex_t ptepindex;
pd_entry_t *pd;
- vm_page_t m;
+ vm_page_t m, free;
KASSERT((flags & (M_NOWAIT | M_WAITOK)) == M_NOWAIT ||
(flags & (M_NOWAIT | M_WAITOK)) == M_WAITOK,
@@ -1390,8 +1409,10 @@
*pd = 0;
pd = 0;
pmap->pm_stats.resident_count -= NBPDR / PAGE_SIZE;
- pmap_unuse_pt(pmap, va, *pmap_pdpe(pmap, va));
+ free = NULL;
+ pmap_unuse_pt(pmap, va, *pmap_pdpe(pmap, va), &free);
pmap_invalidate_all(kernel_pmap);
+ pmap_free_zero_pages(free);
}
/*
@@ -1609,7 +1630,7 @@
pt_entry_t *pte, tpte;
pv_entry_t next_pv, pv;
vm_offset_t va;
- vm_page_t m;
+ vm_page_t m, free;
TAILQ_FOREACH(m, &vpq->pl, pageq) {
if (m->hold_count || m->busy)
@@ -1635,12 +1656,14 @@
va, tpte));
vm_page_dirty(m);
}
+ free = NULL;
+ pmap_unuse_pt(pmap, va, ptepde, &free);
pmap_invalidate_page(pmap, va);
+ pmap_free_zero_pages(free);
TAILQ_REMOVE(&m->md.pv_list, pv, pv_list);
if (TAILQ_EMPTY(&m->md.pv_list))
vm_page_flag_clear(m, PG_WRITEABLE);
m->md.pv_list_count--;
- pmap_unuse_pt(pmap, va, ptepde);
free_pv_entry(pmap, pv);
if (pmap != locked_pmap)
PMAP_UNLOCK(pmap);
@@ -1833,7 +1856,8 @@
* pmap_remove_pte: do the things to unmap a page in a process
*/
static int
-pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t va, pd_entry_t ptepde)
+pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t va,
+ pd_entry_t ptepde, vm_page_t *free)
{
pt_entry_t oldpte;
vm_page_t m;
@@ -1861,7 +1885,7 @@
vm_page_flag_set(m, PG_REFERENCED);
pmap_remove_entry(pmap, m, va);
}
- return (pmap_unuse_pt(pmap, va, ptepde));
+ return (pmap_unuse_pt(pmap, va, ptepde, free));
}
/*
@@ -1871,6 +1895,7 @@
pmap_remove_page(pmap_t pmap, vm_offset_t va, pd_entry_t *pde)
{
pt_entry_t *pte;
+ vm_page_t free = NULL;
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
if ((*pde & PG_V) == 0)
@@ -1878,8 +1903,9 @@
pte = pmap_pde_to_pte(pde, va);
if ((*pte & PG_V) == 0)
return;
- pmap_remove_pte(pmap, pte, va, *pde);
+ pmap_remove_pte(pmap, pte, va, *pde, &free);
pmap_invalidate_page(pmap, va);
+ pmap_free_zero_pages(free);
}
/*
@@ -1896,6 +1922,7 @@
pdp_entry_t *pdpe;
pd_entry_t ptpaddr, *pde;
pt_entry_t *pte;
+ vm_page_t free = NULL;
int anyvalid;
/*
@@ -1959,7 +1986,7 @@
if ((ptpaddr & PG_PS) != 0) {
*pde = 0;
pmap->pm_stats.resident_count -= NBPDR / PAGE_SIZE;
- pmap_unuse_pt(pmap, sva, *pdpe);
+ pmap_unuse_pt(pmap, sva, *pdpe, &free);
anyvalid = 1;
continue;
}
@@ -1983,14 +2010,16 @@
*/
if ((*pte & PG_G) == 0)
anyvalid = 1;
- if (pmap_remove_pte(pmap, pte, sva, ptpaddr))
+ if (pmap_remove_pte(pmap, pte, sva, ptpaddr, &free))
break;
}
}
out:
- vm_page_unlock_queues();
- if (anyvalid)
+ if (anyvalid) {
pmap_invalidate_all(pmap);
+ pmap_free_zero_pages(free);
+ }
+ vm_page_unlock_queues();
PMAP_UNLOCK(pmap);
}
@@ -2014,6 +2043,7 @@
pmap_t pmap;
pt_entry_t *pte, tpte;
pd_entry_t ptepde;
+ vm_page_t free;
#if defined(PMAP_DIAGNOSTIC)
/*
@@ -2045,10 +2075,12 @@
pv->pv_va, tpte));
vm_page_dirty(m);
}
+ free = NULL;
+ pmap_unuse_pt(pmap, pv->pv_va, ptepde, &free);
pmap_invalidate_page(pmap, pv->pv_va);
+ pmap_free_zero_pages(free);
TAILQ_REMOVE(&m->md.pv_list, pv, pv_list);
m->md.pv_list_count--;
- pmap_unuse_pt(pmap, pv->pv_va, ptepde);
free_pv_entry(pmap, pv);
PMAP_UNLOCK(pmap);
}
@@ -2161,9 +2193,9 @@
}
}
}
- vm_page_unlock_queues();
if (anychanged)
pmap_invalidate_all(pmap);
+ vm_page_unlock_queues();
PMAP_UNLOCK(pmap);
}
@@ -2413,6 +2445,7 @@
pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m,
vm_prot_t prot, vm_page_t mpte)
{
+ vm_page_t free;
pt_entry_t *pte;
vm_paddr_t pa;
@@ -2471,7 +2504,7 @@
pte = vtopte(va);
if (*pte) {
if (mpte != NULL) {
- pmap_unwire_pte_hold(pmap, va, mpte);
+ mpte->wire_count--;
mpte = NULL;
}
return (mpte);
@@ -2483,7 +2516,11 @@
if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0 &&
!pmap_try_insert_pv_entry(pmap, va, m)) {
if (mpte != NULL) {
- pmap_unwire_pte_hold(pmap, va, mpte);
+ free = NULL;
+ if (pmap_unwire_pte_hold(pmap, va, mpte, &free)) {
+ pmap_invalidate_page(pmap, va);
+ pmap_free_zero_pages(free);
+ }
mpte = NULL;
}
return (mpte);
@@ -2657,6 +2694,7 @@
pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len,
vm_offset_t src_addr)
{
+ vm_page_t free;
vm_offset_t addr;
vm_offset_t end_addr = src_addr + len;
vm_offset_t va_next;
@@ -2716,7 +2754,7 @@
dst_pmap->pm_stats.resident_count +=
NBPDR / PAGE_SIZE;
} else
- pmap_unwire_pte_hold(dst_pmap, addr, dstmpde);
+ dstmpde->wire_count--;
continue;
}
@@ -2753,9 +2791,15 @@
*dst_pte = ptetemp & ~(PG_W | PG_M |
PG_A);
dst_pmap->pm_stats.resident_count++;
- } else
- pmap_unwire_pte_hold(dst_pmap, addr,
- dstmpte);
+ } else {
+ free = NULL;
+ if (pmap_unwire_pte_hold(dst_pmap,
+ addr, dstmpte, &free)) {
+ pmap_invalidate_page(dst_pmap,
+ addr);
+ pmap_free_zero_pages(free);
+ }
+ }
if (dstmpte->wire_count >= srcmpte->wire_count)
break;
}
@@ -2866,7 +2910,7 @@
pmap_remove_pages(pmap_t pmap)
{
pt_entry_t *pte, tpte;
- vm_page_t m;
+ vm_page_t m, free = NULL;
pv_entry_t pv;
struct pv_chunk *pc, *npc;
int field, idx;
@@ -2939,7 +2983,7 @@
if (TAILQ_EMPTY(&m->md.pv_list))
vm_page_flag_clear(m, PG_WRITEABLE);
pmap_unuse_pt(pmap, pv->pv_va,
- *vtopde(pv->pv_va));
+ *vtopde(pv->pv_va), &free);
}
}
if (allfree) {
@@ -2952,8 +2996,9 @@
vm_page_free(m);
}
}
+ pmap_invalidate_all(pmap);
+ pmap_free_zero_pages(free);
vm_page_unlock_queues();
- pmap_invalidate_all(pmap);
PMAP_UNLOCK(pmap);
}
==== //depot/projects/soc2007/rpaulo-macbook/amd64/amd64/vm_machdep.c#2 (text+ko) ====
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/vm_machdep.c,v 1.252 2006/09/17 14:54:14 davidxu Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/vm_machdep.c,v 1.254 2007/04/24 21:17:45 jhb Exp $");
#include "opt_isa.h"
#include "opt_cpu.h"
@@ -457,6 +457,10 @@
static void
cpu_reset_real()
{
+ struct region_descriptor null_idt;
+ int b;
+
+ disable_intr();
/*
* Attempt to do a CPU reset via the keyboard controller,
@@ -465,14 +469,44 @@
*/
outb(IO_KBD + 4, 0xFE);
DELAY(500000); /* wait 0.5 sec to see if that did it */
- printf("Keyboard reset did not work, attempting CPU shutdown\n");
+
+ /*
+ * Attempt to force a reset via the Reset Control register at
+ * I/O port 0xcf9. Bit 2 forces a system reset when it is
+ * written as 1. Bit 1 selects the type of reset to attempt:
+ * 0 selects a "soft" reset, and 1 selects a "hard" reset. We
+ * try to do a "soft" reset first, and then a "hard" reset.
+ */
+ outb(0xcf9, 0x2);
+ outb(0xcf9, 0x6);
+ DELAY(500000); /* wait 0.5 sec to see if that did it */
+
+ /*
+ * Attempt to force a reset via the Fast A20 and Init register
+ * at I/O port 0x92. Bit 1 serves as an alternate A20 gate.
+ * Bit 0 asserts INIT# when set to 1. We are careful to only
+ * preserve bit 1 while setting bit 0. We also must clear bit
+ * 0 before setting it if it isn't already clear.
+ */
+ b = inb(0x92);
+ if (b != 0xff) {
+ if ((b & 0x1) != 0)
+ outb(0x92, b & 0xfe);
+ outb(0x92, b | 0x1);
+ DELAY(500000); /* wait 0.5 sec to see if that did it */
+ }
+
+ printf("No known reset method worked, attempting CPU shutdown\n");
DELAY(1000000); /* wait 1 sec for printf to complete */
- /* Force a shutdown by unmapping entire address space. */
- bzero((caddr_t)PML4map, PAGE_SIZE);
+ /* Wipe the IDT. */
+ null_idt.rd_limit = 0;
+ null_idt.rd_base = 0;
+ lidt(&null_idt);
/* "good night, sweet prince .... <THUNK!>" */
- invltlb();
+ breakpoint();
+
/* NOTREACHED */
while(1);
}
==== //depot/projects/soc2007/rpaulo-macbook/amd64/include/vmparam.h#2 (text+ko) ====
@@ -38,7 +38,7 @@
* SUCH DAMAGE.
*
* from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91
- * $FreeBSD: src/sys/amd64/include/vmparam.h,v 1.45 2004/10/27 17:21:15 peter Exp $
+ * $FreeBSD: src/sys/amd64/include/vmparam.h,v 1.46 2007/04/21 01:14:47 sepotvin Exp $
*/
@@ -122,7 +122,8 @@
/*
* How many physical pages per KVA page allocated.
- * min(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE), VM_KMEM_SIZE_MAX)
+ * min(max(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE),
+ * VM_KMEM_SIZE_MIN), VM_KMEM_SIZE_MAX)
* is the total KVA space allocated for kmem_map.
*/
#ifndef VM_KMEM_SIZE_SCALE
==== //depot/projects/soc2007/rpaulo-macbook/bsm/audit.h#2 (text) ====
@@ -30,8 +30,8 @@
*
* @APPLE_BSD_LICENSE_HEADER_END@
*
- * $P4: //depot/projects/trustedbsd/audit3/sys/bsm/audit.h#34 $
- * $FreeBSD: src/sys/bsm/audit.h,v 1.6 2006/09/21 07:27:02 rwatson Exp $
+ * P4: //depot/projects/trustedbsd/audit3/sys/bsm/audit.h#36
+ * $FreeBSD: src/sys/bsm/audit.h,v 1.8 2007/04/17 12:27:08 rwatson Exp $
*/
#ifndef _BSM_AUDIT_H
==== //depot/projects/soc2007/rpaulo-macbook/bsm/audit_internal.h#2 (text) ====
@@ -34,8 +34,8 @@
*
* @APPLE_BSD_LICENSE_HEADER_END@
*
- * $P4: //depot/projects/trustedbsd/audit3/sys/bsm/audit_internal.h#14 $
- * $FreeBSD: src/sys/bsm/audit_internal.h,v 1.5 2006/09/21 07:27:02 rwatson Exp $
+ * P4: //depot/projects/trustedbsd/audit3/sys/bsm/audit_internal.h#16
+ * $FreeBSD: src/sys/bsm/audit_internal.h,v 1.7 2007/04/17 12:27:08 rwatson Exp $
*/
#ifndef _AUDIT_INTERNAL_H
==== //depot/projects/soc2007/rpaulo-macbook/bsm/audit_kevents.h#2 (text) ====
@@ -30,8 +30,8 @@
*
* @APPLE_BSD_LICENSE_HEADER_END@
*
- * $P4: //depot/projects/trustedbsd/audit3/sys/bsm/audit_kevents.h#29 $
- * $FreeBSD: src/sys/bsm/audit_kevents.h,v 1.9 2006/09/25 12:22:07 rwatson Exp $
+ * P4: //depot/projects/trustedbsd/audit3/sys/bsm/audit_kevents.h#32
+ * $FreeBSD: src/sys/bsm/audit_kevents.h,v 1.11 2007/04/17 12:27:08 rwatson Exp $
*/
#ifndef _BSM_AUDIT_KEVENTS_H_
@@ -475,6 +475,28 @@
#define AUE_READDIR 43118 /* Linux. */
#define AUE_IOPL 43119 /* Linux. */
#define AUE_VM86 43120 /* Linux. */
+#define AUE_MAC_GET_PROC 43121 /* FreeBSD. */
+#define AUE_MAC_SET_PROC 43122 /* FreeBSD. */
+#define AUE_MAC_GET_FD 43123 /* FreeBSD. */
+#define AUE_MAC_GET_FILE 43124 /* FreeBSD. */
+#define AUE_MAC_SET_FD 43125 /* FreeBSD. */
+#define AUE_MAC_SET_FILE 43126 /* FreeBSD. */
+#define AUE_MAC_SYSCALL 43127 /* FreeBSD. */
+#define AUE_MAC_GET_PID 43128 /* FreeBSD. */
+#define AUE_MAC_GET_LINK 43129 /* FreeBSD. */
+#define AUE_MAC_SET_LINK 43130 /* FreeBSD. */
+#define AUE_MAC_EXECVE 43131 /* FreeBSD. */
+#define AUE_GETPATH_FROMFD 43132 /* FreeBSD. */
+#define AUE_GETPATH_FROMADDR 43133 /* FreeBSD. */
+#define AUE_MQ_OPEN 43134 /* FreeBSD. */
+#define AUE_MQ_SETATTR 43135 /* FreeBSD. */
+#define AUE_MQ_TIMEDRECEIVE 43136 /* FreeBSD. */
+#define AUE_MQ_TIMEDSEND 43137 /* FreeBSD. */
+#define AUE_MQ_NOTIFY 43138 /* FreeBSD. */
+#define AUE_MQ_UNLINK 43139 /* FreeBSD. */
+#define AUE_LISTEN 43140 /* FreeBSD/Darwin/Linux. */
+#define AUE_MLOCKALL 43141 /* FreeBSD. */
+#define AUE_MUNLOCKALL 43142 /* FreeBSD. */
/*
* Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the
@@ -572,16 +594,13 @@
#define AUE_GETSOCKOPT AUE_NULL
#define AUE_GTSOCKOPT AUE_GETSOCKOPT /* XXX: Typo in Darwin. */
#define AUE_ISSETUGID AUE_NULL
-#define AUE_LISTEN AUE_NULL
#define AUE_LSTATV AUE_NULL
#define AUE_MADVISE AUE_NULL
#define AUE_MINCORE AUE_NULL
#define AUE_MKCOMPLEX AUE_NULL
-#define AUE_MLOCKALL AUE_NULL
#define AUE_MODWATCH AUE_NULL
#define AUE_MSGCL AUE_NULL
#define AUE_MSYNC AUE_NULL
-#define AUE_MUNLOCKALL AUE_NULL
#define AUE_PREAD AUE_NULL
#define AUE_PWRITE AUE_NULL
#define AUE_PREADV AUE_NULL
==== //depot/projects/soc2007/rpaulo-macbook/bsm/audit_record.h#2 (text) ====
@@ -30,8 +30,8 @@
*
* @APPLE_BSD_LICENSE_HEADER_END@
*
- * $P4: //depot/projects/trustedbsd/audit3/sys/bsm/audit_record.h#21 $
- * $FreeBSD: src/sys/bsm/audit_record.h,v 1.6 2006/09/21 07:27:02 rwatson Exp $
+ * P4: //depot/projects/trustedbsd/audit3/sys/bsm/audit_record.h#24
+ * $FreeBSD: src/sys/bsm/audit_record.h,v 1.9 2007/04/17 12:27:08 rwatson Exp $
*/
#ifndef _BSM_AUDIT_RECORD_H_
@@ -86,6 +86,7 @@
/* XXXRW: Additional X11 tokens not defined? */
#define AUT_CMD 0x51
#define AUT_EXIT 0x52
+#define AUT_ZONENAME 0x60
/* XXXRW: OpenBSM AUT_HOST 0x70? */
#define AUT_ARG64 0x71
#define AUT_RETURN64 0x72
@@ -247,6 +248,8 @@
token_t *au_to_header32_tm(int rec_size, au_event_t e_type, au_emod_t e_mod,
struct timeval tm);
+token_t *au_to_header64_tm(int rec_size, au_event_t e_type, au_emod_t e_mod,
+ struct timeval tm);
#if !defined(KERNEL) && !defined(_KERNEL)
token_t *au_to_header(int rec_size, au_event_t e_type, au_emod_t e_mod);
token_t *au_to_header32(int rec_size, au_event_t e_type, au_emod_t e_mod);
@@ -329,6 +332,7 @@
token_t *au_to_text(char *text);
token_t *au_to_kevent(struct kevent *kev);
token_t *au_to_trailer(int rec_size);
+token_t *au_to_zonename(char *zonename);
__END_DECLS
==== //depot/projects/soc2007/rpaulo-macbook/cam/cam_periph.c#2 (text+ko) ====
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/cam_periph.c,v 1.66 2007/04/16 19:42:23 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/cam_periph.c,v 1.68 2007/04/19 23:34:51 scottl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -131,7 +131,6 @@
lun_id_t lun_id;
cam_status status;
u_int init_level;
- int s;
init_level = 0;
/*
@@ -200,7 +199,6 @@
if (status != CAM_REQ_CMP)
goto failure;
- s = splsoftcam();
cur_periph = TAILQ_FIRST(&(*p_drv)->units);
while (cur_periph != NULL
&& cur_periph->unit_number < periph->unit_number)
@@ -213,8 +211,6 @@
(*p_drv)->generation++;
}
- splx(s);
-
init_level++;
status = periph_ctor(periph, arg);
@@ -228,9 +224,7 @@
/* Initialized successfully */
break;
case 3:
- s = splsoftcam();
TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links);
- splx(s);
xpt_remove_periph(periph);
/* FALLTHROUGH */
case 2:
@@ -258,24 +252,25 @@
{
struct periph_driver **p_drv;
struct cam_periph *periph;
- int s;
+ xpt_lock_buses();
for (p_drv = periph_drivers; *p_drv != NULL; p_drv++) {
if (name != NULL && (strcmp((*p_drv)->driver_name, name) != 0))
continue;
- s = splsoftcam();
TAILQ_FOREACH(periph, &(*p_drv)->units, unit_links) {
if (xpt_path_comp(periph->path, path) == 0) {
- splx(s);
+ xpt_unlock_buses();
return(periph);
}
}
- splx(s);
- if (name != NULL)
+ if (name != NULL) {
+ xpt_unlock_buses();
return(NULL);
+ }
}
+ xpt_unlock_buses();
return(NULL);
}
@@ -372,11 +367,9 @@
{
struct cam_periph *periph;
char *periph_name;
- int s;
int i, val, dunit, r;
const char *dname, *strval;
- s = splsoftcam();
periph_name = p_drv->driver_name;
for (;;newunit++) {
@@ -422,7 +415,6 @@
if (r != 0)
break;
}
- splx(s);
return (newunit);
}
@@ -480,8 +472,7 @@
/*
* We only call this routine the first time a peripheral is
- * invalidated. The oninvalidate() routine is always called at
- * splsoftcam().
+ * invalidated.
*/
if (((periph->flags & CAM_PERIPH_INVALID) == 0)
&& (periph->periph_oninval != NULL))
@@ -550,26 +541,6 @@
}
/*
- * Wait interruptibly for an exclusive lock.
- */
-void
-cam_periph_lock(struct cam_periph *periph)
-{
-
- mtx_lock(periph->sim->mtx);
-}
-
-/*
- * Unlock and wake up any waiters.
- */
-void
-cam_periph_unlock(struct cam_periph *periph)
-{
-
- mtx_unlock(periph->sim->mtx);
-}
-
-/*
* Map user virtual pointers into kernel virtual address space, so we can
* access the memory. This won't work on physical pointers, for now it's
* up to the caller to check for that. (XXX KDM -- should we do that here
@@ -808,9 +779,7 @@
{
struct mtx *mtx;
struct cam_sim *sim;
- int s;
- s = splsoftcam();
sim = xpt_path_sim(ccb->ccb_h.path);
if (sim->mtx == &Giant)
mtx = NULL;
@@ -819,8 +788,6 @@
if ((ccb->ccb_h.pinfo.index != CAM_UNQUEUED_INDEX)
|| ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INPROG))
msleep(&ccb->ccb_h.cbfcnp, mtx, PRIBIO, "cbwait", 0);
-
- splx(s);
}
int
@@ -1225,11 +1192,8 @@
{
struct timeval delta;
struct timeval duration_tv;
- int s;
- s = splclock();
microtime(&delta);
- splx(s);
timevalsub(&delta, event_time);
duration_tv.tv_sec = duration_ms / 1000;
duration_tv.tv_usec = (duration_ms % 1000) * 1000;
==== //depot/projects/soc2007/rpaulo-macbook/cam/cam_periph.h#2 (text+ko) ====
@@ -25,13 +25,14 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/cam/cam_periph.h,v 1.17 2007/04/15 08:49:09 scottl Exp $
+ * $FreeBSD: src/sys/cam/cam_periph.h,v 1.18 2007/04/19 22:46:26 scottl Exp $
*/
#ifndef _CAM_CAM_PERIPH_H
#define _CAM_CAM_PERIPH_H 1
#include <sys/queue.h>
+#include <cam/cam_sim.h>
#ifdef _KERNEL
@@ -138,8 +139,6 @@
char *name, cam_periph_type type, struct cam_path *,
ac_callback_t *, ac_code, void *arg);
struct cam_periph *cam_periph_find(struct cam_path *path, char *name);
-void cam_periph_lock(struct cam_periph *periph);
-void cam_periph_unlock(struct cam_periph *periph);
cam_status cam_periph_acquire(struct cam_periph *periph);
void cam_periph_release(struct cam_periph *periph);
int cam_periph_hold(struct cam_periph *periph, int priority);
@@ -177,5 +176,17 @@
int cam_periph_error(union ccb *ccb, cam_flags camflags,
u_int32_t sense_flags, union ccb *save_ccb);
+static __inline void
+cam_periph_lock(struct cam_periph *periph)
+{
+ mtx_lock(periph->sim->mtx);
+}
+
+static __inline void
+cam_periph_unlock(struct cam_periph *periph)
+{
+ mtx_unlock(periph->sim->mtx);
+}
+
#endif /* _KERNEL */
#endif /* _CAM_CAM_PERIPH_H */
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list