From owner-svn-src-user@FreeBSD.ORG Sun Apr 25 01:36:47 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30B35106564A; Sun, 25 Apr 2010 01:36:47 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C9D88FC15; Sun, 25 Apr 2010 01:36:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3P1alFg006841; Sun, 25 Apr 2010 01:36:47 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3P1akd1006823; Sun, 25 Apr 2010 01:36:46 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201004250136.o3P1akd1006823@svn.freebsd.org> From: Kip Macy Date: Sun, 25 Apr 2010 01:36:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207179 - in user/kmacy/head_page_lock_2: . bin/ln contrib/top contrib/tzdata etc etc/devd etc/mtree include lib lib/libc/stdlib lib/libpkg lib/libufs lib/libz release/powerpc sbin/devd... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Apr 2010 01:36:47 -0000 Author: kmacy Date: Sun Apr 25 01:36:46 2010 New Revision: 207179 URL: http://svn.freebsd.org/changeset/base/207179 Log: IFC 206825:207178 Added: user/kmacy/head_page_lock_2/lib/libpkg/ - copied from r207178, head/lib/libpkg/ user/kmacy/head_page_lock_2/sbin/fsck_ffs/suj.c - copied unchanged from r207178, head/sbin/fsck_ffs/suj.c user/kmacy/head_page_lock_2/tools/regression/bin/sh/expansion/trim3.0 - copied unchanged from r207178, head/tools/regression/bin/sh/expansion/trim3.0 user/kmacy/head_page_lock_2/tools/test/testfloat/ - copied from r207178, head/tools/test/testfloat/ Deleted: user/kmacy/head_page_lock_2/sys/cddl/dev/cyclic/amd64/ user/kmacy/head_page_lock_2/sys/mips/mips/copystr.S user/kmacy/head_page_lock_2/usr.sbin/pkg_install/lib/ Modified: user/kmacy/head_page_lock_2/Makefile.inc1 user/kmacy/head_page_lock_2/bin/ln/ln.c user/kmacy/head_page_lock_2/contrib/top/utils.c user/kmacy/head_page_lock_2/contrib/tzdata/africa user/kmacy/head_page_lock_2/contrib/tzdata/asia user/kmacy/head_page_lock_2/contrib/tzdata/southamerica user/kmacy/head_page_lock_2/etc/devd.conf user/kmacy/head_page_lock_2/etc/devd/uath.conf user/kmacy/head_page_lock_2/etc/mtree/BSD.usr.dist user/kmacy/head_page_lock_2/include/stdlib.h user/kmacy/head_page_lock_2/lib/Makefile user/kmacy/head_page_lock_2/lib/libc/stdlib/realpath.3 user/kmacy/head_page_lock_2/lib/libc/stdlib/realpath.c user/kmacy/head_page_lock_2/lib/libufs/Makefile user/kmacy/head_page_lock_2/lib/libufs/cgroup.c user/kmacy/head_page_lock_2/lib/libufs/inode.c user/kmacy/head_page_lock_2/lib/libufs/libufs.h user/kmacy/head_page_lock_2/lib/libufs/sblock.c user/kmacy/head_page_lock_2/lib/libufs/type.c user/kmacy/head_page_lock_2/lib/libz/ChangeLog user/kmacy/head_page_lock_2/lib/libz/README user/kmacy/head_page_lock_2/lib/libz/crc32.c user/kmacy/head_page_lock_2/lib/libz/deflate.c user/kmacy/head_page_lock_2/lib/libz/deflate.h user/kmacy/head_page_lock_2/lib/libz/gzguts.h user/kmacy/head_page_lock_2/lib/libz/gzlib.c user/kmacy/head_page_lock_2/lib/libz/inffast.c user/kmacy/head_page_lock_2/lib/libz/inffast.h user/kmacy/head_page_lock_2/lib/libz/inftrees.c user/kmacy/head_page_lock_2/lib/libz/inftrees.h user/kmacy/head_page_lock_2/lib/libz/trees.c user/kmacy/head_page_lock_2/lib/libz/trees.h user/kmacy/head_page_lock_2/lib/libz/zconf.h user/kmacy/head_page_lock_2/lib/libz/zlib.3 user/kmacy/head_page_lock_2/lib/libz/zlib.h user/kmacy/head_page_lock_2/lib/libz/zutil.c user/kmacy/head_page_lock_2/lib/libz/zutil.h user/kmacy/head_page_lock_2/release/powerpc/boot_crunch.conf user/kmacy/head_page_lock_2/sbin/devd/devd.conf.5 user/kmacy/head_page_lock_2/sbin/dumpfs/dumpfs.c user/kmacy/head_page_lock_2/sbin/fsck_ffs/Makefile user/kmacy/head_page_lock_2/sbin/fsck_ffs/fsck.h user/kmacy/head_page_lock_2/sbin/fsck_ffs/gjournal.c user/kmacy/head_page_lock_2/sbin/fsck_ffs/main.c user/kmacy/head_page_lock_2/sbin/fsck_ffs/pass5.c user/kmacy/head_page_lock_2/sbin/fsdb/fsdb.c user/kmacy/head_page_lock_2/sbin/fsdb/fsdbutil.c user/kmacy/head_page_lock_2/sbin/geom/class/part/geom_part.c user/kmacy/head_page_lock_2/sbin/geom/class/part/gpart.8 user/kmacy/head_page_lock_2/sbin/hastctl/Makefile user/kmacy/head_page_lock_2/sbin/hastd/Makefile user/kmacy/head_page_lock_2/sbin/hastd/hast_proto.c user/kmacy/head_page_lock_2/sbin/ipfw/dummynet.c user/kmacy/head_page_lock_2/sbin/ipfw/ipfw2.c user/kmacy/head_page_lock_2/sbin/ipfw/ipfw2.h user/kmacy/head_page_lock_2/sbin/ping6/ping6.8 user/kmacy/head_page_lock_2/sbin/ping6/ping6.c user/kmacy/head_page_lock_2/sbin/tunefs/Makefile user/kmacy/head_page_lock_2/sbin/tunefs/tunefs.8 user/kmacy/head_page_lock_2/sbin/tunefs/tunefs.c user/kmacy/head_page_lock_2/share/examples/Makefile user/kmacy/head_page_lock_2/share/man/man1/builtin.1 user/kmacy/head_page_lock_2/share/misc/committers-src.dot user/kmacy/head_page_lock_2/share/mk/bsd.cpu.mk user/kmacy/head_page_lock_2/share/mk/bsd.libnames.mk user/kmacy/head_page_lock_2/sys/amd64/amd64/bpf_jit_machdep.c user/kmacy/head_page_lock_2/sys/amd64/amd64/bpf_jit_machdep.h user/kmacy/head_page_lock_2/sys/amd64/amd64/local_apic.c user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c user/kmacy/head_page_lock_2/sys/amd64/conf/GENERIC user/kmacy/head_page_lock_2/sys/amd64/ia32/ia32_signal.c user/kmacy/head_page_lock_2/sys/amd64/include/proc.h user/kmacy/head_page_lock_2/sys/arm/arm/pmap.c user/kmacy/head_page_lock_2/sys/arm/conf/DB-78XXX user/kmacy/head_page_lock_2/sys/arm/conf/DB-88F5XXX user/kmacy/head_page_lock_2/sys/arm/conf/DB-88F6XXX user/kmacy/head_page_lock_2/sys/arm/conf/HL200 user/kmacy/head_page_lock_2/sys/arm/conf/KB920X user/kmacy/head_page_lock_2/sys/arm/conf/LN2410SBC user/kmacy/head_page_lock_2/sys/arm/conf/SHEEVAPLUG user/kmacy/head_page_lock_2/sys/arm/include/proc.h user/kmacy/head_page_lock_2/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c user/kmacy/head_page_lock_2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c user/kmacy/head_page_lock_2/sys/cddl/dev/cyclic/i386/cyclic_machdep.c user/kmacy/head_page_lock_2/sys/compat/freebsd32/freebsd32.h user/kmacy/head_page_lock_2/sys/compat/freebsd32/freebsd32_misc.c user/kmacy/head_page_lock_2/sys/compat/freebsd32/freebsd32_util.h user/kmacy/head_page_lock_2/sys/conf/files.mips user/kmacy/head_page_lock_2/sys/conf/files.sparc64 user/kmacy/head_page_lock_2/sys/conf/files.sun4v user/kmacy/head_page_lock_2/sys/conf/kern.pre.mk user/kmacy/head_page_lock_2/sys/conf/kmod.mk user/kmacy/head_page_lock_2/sys/dev/age/if_age.c user/kmacy/head_page_lock_2/sys/dev/ahci/ahci.c user/kmacy/head_page_lock_2/sys/dev/alc/if_alc.c user/kmacy/head_page_lock_2/sys/dev/ale/if_ale.c user/kmacy/head_page_lock_2/sys/dev/bwn/if_bwn.c user/kmacy/head_page_lock_2/sys/dev/drm/ati_pcigart.c user/kmacy/head_page_lock_2/sys/dev/drm/drmP.h user/kmacy/head_page_lock_2/sys/dev/drm/drm_bufs.c user/kmacy/head_page_lock_2/sys/dev/drm/drm_context.c user/kmacy/head_page_lock_2/sys/dev/drm/drm_drv.c user/kmacy/head_page_lock_2/sys/dev/drm/drm_hashtab.c user/kmacy/head_page_lock_2/sys/dev/drm/drm_memory.c user/kmacy/head_page_lock_2/sys/dev/drm/drm_mm.c user/kmacy/head_page_lock_2/sys/dev/drm/drm_scatter.c user/kmacy/head_page_lock_2/sys/dev/drm/drm_sman.c user/kmacy/head_page_lock_2/sys/dev/drm/drm_sysctl.c user/kmacy/head_page_lock_2/sys/dev/drm/drm_vm.c user/kmacy/head_page_lock_2/sys/dev/drm/i915_dma.c user/kmacy/head_page_lock_2/sys/dev/drm/mach64_dma.c user/kmacy/head_page_lock_2/sys/dev/drm/mga_dma.c user/kmacy/head_page_lock_2/sys/dev/drm/mga_warp.c user/kmacy/head_page_lock_2/sys/dev/drm/r128_cce.c user/kmacy/head_page_lock_2/sys/dev/drm/r128_state.c user/kmacy/head_page_lock_2/sys/dev/drm/r600_blit.c user/kmacy/head_page_lock_2/sys/dev/drm/r600_cp.c user/kmacy/head_page_lock_2/sys/dev/drm/radeon_cp.c user/kmacy/head_page_lock_2/sys/dev/drm/radeon_cs.c user/kmacy/head_page_lock_2/sys/dev/drm/radeon_state.c user/kmacy/head_page_lock_2/sys/dev/drm/savage_bci.c user/kmacy/head_page_lock_2/sys/dev/drm/via_dma.c user/kmacy/head_page_lock_2/sys/dev/drm/via_map.c user/kmacy/head_page_lock_2/sys/dev/drm/via_mm.c user/kmacy/head_page_lock_2/sys/dev/fxp/if_fxp.c user/kmacy/head_page_lock_2/sys/dev/iwn/if_iwn.c user/kmacy/head_page_lock_2/sys/dev/msk/if_msk.c user/kmacy/head_page_lock_2/sys/dev/nfe/if_nfe.c user/kmacy/head_page_lock_2/sys/dev/sge/if_sge.c user/kmacy/head_page_lock_2/sys/dev/sis/if_sis.c user/kmacy/head_page_lock_2/sys/dev/sound/usb/uaudio.c user/kmacy/head_page_lock_2/sys/dev/usb/controller/ehci.c user/kmacy/head_page_lock_2/sys/dev/usb/controller/uhci.c user/kmacy/head_page_lock_2/sys/dev/usb/controller/uss820dci.c user/kmacy/head_page_lock_2/sys/dev/usb/input/atp.c user/kmacy/head_page_lock_2/sys/dev/usb/input/uhid.c user/kmacy/head_page_lock_2/sys/dev/usb/input/ukbd.c user/kmacy/head_page_lock_2/sys/dev/usb/input/ums.c user/kmacy/head_page_lock_2/sys/dev/usb/misc/udbp.c user/kmacy/head_page_lock_2/sys/dev/usb/net/if_aue.c user/kmacy/head_page_lock_2/sys/dev/usb/net/if_axe.c user/kmacy/head_page_lock_2/sys/dev/usb/net/if_cdce.c user/kmacy/head_page_lock_2/sys/dev/usb/net/if_cue.c user/kmacy/head_page_lock_2/sys/dev/usb/net/if_kue.c user/kmacy/head_page_lock_2/sys/dev/usb/net/if_rue.c user/kmacy/head_page_lock_2/sys/dev/usb/net/if_udav.c user/kmacy/head_page_lock_2/sys/dev/usb/serial/u3g.c user/kmacy/head_page_lock_2/sys/dev/usb/serial/ubsa.c user/kmacy/head_page_lock_2/sys/dev/usb/serial/ubser.c user/kmacy/head_page_lock_2/sys/dev/usb/serial/uchcom.c user/kmacy/head_page_lock_2/sys/dev/usb/serial/uftdi.c user/kmacy/head_page_lock_2/sys/dev/usb/serial/ulpt.c user/kmacy/head_page_lock_2/sys/dev/usb/serial/umodem.c user/kmacy/head_page_lock_2/sys/dev/usb/serial/umoscom.c user/kmacy/head_page_lock_2/sys/dev/usb/serial/uplcom.c user/kmacy/head_page_lock_2/sys/dev/usb/serial/usb_serial.c user/kmacy/head_page_lock_2/sys/dev/usb/serial/uslcom.c user/kmacy/head_page_lock_2/sys/dev/usb/serial/uvisor.c user/kmacy/head_page_lock_2/sys/dev/usb/serial/uvscom.c user/kmacy/head_page_lock_2/sys/dev/usb/storage/umass.c user/kmacy/head_page_lock_2/sys/dev/usb/storage/urio.c user/kmacy/head_page_lock_2/sys/dev/usb/storage/ustorage_fs.c user/kmacy/head_page_lock_2/sys/dev/usb/usb_compat_linux.c user/kmacy/head_page_lock_2/sys/dev/usb/usb_debug.h user/kmacy/head_page_lock_2/sys/dev/usb/usb_dev.c user/kmacy/head_page_lock_2/sys/dev/usb/usb_device.c user/kmacy/head_page_lock_2/sys/dev/usb/usb_device.h user/kmacy/head_page_lock_2/sys/dev/usb/usb_freebsd.h user/kmacy/head_page_lock_2/sys/dev/usb/usb_generic.c user/kmacy/head_page_lock_2/sys/dev/usb/usb_hub.c user/kmacy/head_page_lock_2/sys/dev/usb/usb_request.c user/kmacy/head_page_lock_2/sys/dev/usb/usb_transfer.c user/kmacy/head_page_lock_2/sys/dev/usb/usb_transfer.h user/kmacy/head_page_lock_2/sys/dev/usb/wlan/if_rum.c user/kmacy/head_page_lock_2/sys/dev/usb/wlan/if_run.c user/kmacy/head_page_lock_2/sys/dev/usb/wlan/if_ural.c user/kmacy/head_page_lock_2/sys/dev/usb/wlan/if_zyd.c user/kmacy/head_page_lock_2/sys/fs/nfs/nfs_commonkrpc.c user/kmacy/head_page_lock_2/sys/fs/nfs/nfs_commonport.c user/kmacy/head_page_lock_2/sys/fs/nfs/nfs_var.h user/kmacy/head_page_lock_2/sys/fs/nfs/nfsport.h user/kmacy/head_page_lock_2/sys/fs/nfsclient/nfs.h user/kmacy/head_page_lock_2/sys/fs/nfsclient/nfs_clbio.c user/kmacy/head_page_lock_2/sys/fs/nfsclient/nfs_clnfsiod.c user/kmacy/head_page_lock_2/sys/fs/nfsclient/nfs_clnode.c user/kmacy/head_page_lock_2/sys/fs/nfsclient/nfs_clrpcops.c user/kmacy/head_page_lock_2/sys/fs/nfsclient/nfs_clstate.c user/kmacy/head_page_lock_2/sys/fs/nfsclient/nfs_clvfsops.c user/kmacy/head_page_lock_2/sys/fs/nfsclient/nfs_clvnops.c user/kmacy/head_page_lock_2/sys/fs/nfsserver/nfs_nfsdstate.c user/kmacy/head_page_lock_2/sys/fs/pseudofs/pseudofs_vnops.c user/kmacy/head_page_lock_2/sys/geom/geom_subr.c user/kmacy/head_page_lock_2/sys/geom/part/g_part.c user/kmacy/head_page_lock_2/sys/geom/part/g_part_apm.c user/kmacy/head_page_lock_2/sys/geom/part/g_part_bsd.c user/kmacy/head_page_lock_2/sys/geom/part/g_part_gpt.c user/kmacy/head_page_lock_2/sys/geom/part/g_part_if.m user/kmacy/head_page_lock_2/sys/geom/part/g_part_mbr.c user/kmacy/head_page_lock_2/sys/geom/part/g_part_pc98.c user/kmacy/head_page_lock_2/sys/geom/part/g_part_vtoc8.c user/kmacy/head_page_lock_2/sys/i386/conf/GENERIC user/kmacy/head_page_lock_2/sys/i386/conf/XBOX user/kmacy/head_page_lock_2/sys/i386/i386/bpf_jit_machdep.c user/kmacy/head_page_lock_2/sys/i386/i386/bpf_jit_machdep.h user/kmacy/head_page_lock_2/sys/i386/i386/local_apic.c user/kmacy/head_page_lock_2/sys/i386/i386/pmap.c user/kmacy/head_page_lock_2/sys/i386/include/proc.h user/kmacy/head_page_lock_2/sys/i386/xen/pmap.c user/kmacy/head_page_lock_2/sys/ia64/conf/GENERIC user/kmacy/head_page_lock_2/sys/ia64/ia64/pmap.c user/kmacy/head_page_lock_2/sys/ia64/include/proc.h user/kmacy/head_page_lock_2/sys/kern/kern_clock.c user/kmacy/head_page_lock_2/sys/kern/kern_descrip.c user/kmacy/head_page_lock_2/sys/kern/kern_proc.c user/kmacy/head_page_lock_2/sys/kern/kern_shutdown.c user/kmacy/head_page_lock_2/sys/kern/subr_bus.c user/kmacy/head_page_lock_2/sys/kern/vfs_bio.c user/kmacy/head_page_lock_2/sys/kern/vfs_cache.c user/kmacy/head_page_lock_2/sys/kern/vfs_subr.c user/kmacy/head_page_lock_2/sys/mips/cavium/octeon_machdep.c user/kmacy/head_page_lock_2/sys/mips/cavium/octeon_mp.c user/kmacy/head_page_lock_2/sys/mips/conf/SENTRY5 user/kmacy/head_page_lock_2/sys/mips/conf/SWARM user/kmacy/head_page_lock_2/sys/mips/conf/XLR user/kmacy/head_page_lock_2/sys/mips/include/cpufunc.h user/kmacy/head_page_lock_2/sys/mips/include/cpuregs.h user/kmacy/head_page_lock_2/sys/mips/include/proc.h user/kmacy/head_page_lock_2/sys/mips/include/regnum.h user/kmacy/head_page_lock_2/sys/mips/include/vmparam.h user/kmacy/head_page_lock_2/sys/mips/malta/gt_pci.c user/kmacy/head_page_lock_2/sys/mips/mips/autoconf.c user/kmacy/head_page_lock_2/sys/mips/mips/exception.S user/kmacy/head_page_lock_2/sys/mips/mips/fp.S user/kmacy/head_page_lock_2/sys/mips/mips/genassym.c user/kmacy/head_page_lock_2/sys/mips/mips/machdep.c user/kmacy/head_page_lock_2/sys/mips/mips/pmap.c user/kmacy/head_page_lock_2/sys/mips/mips/swtch.S user/kmacy/head_page_lock_2/sys/mips/mips/tick.c user/kmacy/head_page_lock_2/sys/mips/mips/vm_machdep.c user/kmacy/head_page_lock_2/sys/mips/sibyte/sb_machdep.c user/kmacy/head_page_lock_2/sys/modules/cyclic/Makefile user/kmacy/head_page_lock_2/sys/netinet/ip_dummynet.h user/kmacy/head_page_lock_2/sys/netinet/ip_input.c user/kmacy/head_page_lock_2/sys/netinet/ipfw/dn_sched.h user/kmacy/head_page_lock_2/sys/netinet/ipfw/dn_sched_rr.c user/kmacy/head_page_lock_2/sys/netinet/ipfw/dn_sched_wf2q.c user/kmacy/head_page_lock_2/sys/netinet/ipfw/ip_dn_private.h user/kmacy/head_page_lock_2/sys/netinet/ipfw/ip_dummynet.c user/kmacy/head_page_lock_2/sys/netinet/ipfw/ip_fw_pfil.c user/kmacy/head_page_lock_2/sys/netinet/ipfw/ip_fw_private.h user/kmacy/head_page_lock_2/sys/netinet/sctp_asconf.c user/kmacy/head_page_lock_2/sys/netinet/sctp_indata.c user/kmacy/head_page_lock_2/sys/netinet/sctputil.c user/kmacy/head_page_lock_2/sys/netinet/tcp_output.c user/kmacy/head_page_lock_2/sys/pc98/cbus/clock.c user/kmacy/head_page_lock_2/sys/pc98/conf/GENERIC user/kmacy/head_page_lock_2/sys/powerpc/aim/mmu_oea.c user/kmacy/head_page_lock_2/sys/powerpc/aim/mmu_oea64.c user/kmacy/head_page_lock_2/sys/powerpc/booke/pmap.c user/kmacy/head_page_lock_2/sys/powerpc/conf/GENERIC user/kmacy/head_page_lock_2/sys/powerpc/conf/MPC85XX user/kmacy/head_page_lock_2/sys/powerpc/include/proc.h user/kmacy/head_page_lock_2/sys/powerpc/powerpc/mmu_if.m user/kmacy/head_page_lock_2/sys/powerpc/powerpc/pmap_dispatch.c user/kmacy/head_page_lock_2/sys/sparc64/conf/GENERIC user/kmacy/head_page_lock_2/sys/sparc64/include/proc.h user/kmacy/head_page_lock_2/sys/sparc64/sparc64/pmap.c user/kmacy/head_page_lock_2/sys/sun4v/conf/GENERIC user/kmacy/head_page_lock_2/sys/sun4v/include/proc.h user/kmacy/head_page_lock_2/sys/sun4v/sun4v/pmap.c user/kmacy/head_page_lock_2/sys/sys/buf.h user/kmacy/head_page_lock_2/sys/sys/dtrace_bsd.h user/kmacy/head_page_lock_2/sys/sys/mount.h user/kmacy/head_page_lock_2/sys/sys/thr.h user/kmacy/head_page_lock_2/sys/sys/user.h user/kmacy/head_page_lock_2/sys/ufs/ffs/ffs_alloc.c user/kmacy/head_page_lock_2/sys/ufs/ffs/ffs_balloc.c user/kmacy/head_page_lock_2/sys/ufs/ffs/ffs_extern.h user/kmacy/head_page_lock_2/sys/ufs/ffs/ffs_inode.c user/kmacy/head_page_lock_2/sys/ufs/ffs/ffs_snapshot.c user/kmacy/head_page_lock_2/sys/ufs/ffs/ffs_softdep.c user/kmacy/head_page_lock_2/sys/ufs/ffs/ffs_subr.c user/kmacy/head_page_lock_2/sys/ufs/ffs/ffs_vfsops.c user/kmacy/head_page_lock_2/sys/ufs/ffs/ffs_vnops.c user/kmacy/head_page_lock_2/sys/ufs/ffs/fs.h user/kmacy/head_page_lock_2/sys/ufs/ffs/softdep.h user/kmacy/head_page_lock_2/sys/ufs/ufs/dinode.h user/kmacy/head_page_lock_2/sys/ufs/ufs/inode.h user/kmacy/head_page_lock_2/sys/ufs/ufs/ufs_dirhash.c user/kmacy/head_page_lock_2/sys/ufs/ufs/ufs_extern.h user/kmacy/head_page_lock_2/sys/ufs/ufs/ufs_lookup.c user/kmacy/head_page_lock_2/sys/ufs/ufs/ufs_vnops.c user/kmacy/head_page_lock_2/sys/ufs/ufs/ufsmount.h user/kmacy/head_page_lock_2/sys/vm/pmap.h user/kmacy/head_page_lock_2/sys/vm/vm_mmap.c user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c user/kmacy/head_page_lock_2/sys/x86/isa/clock.c user/kmacy/head_page_lock_2/tools/regression/bpf/bpf_filter/tests/test0083.h user/kmacy/head_page_lock_2/tools/test/README user/kmacy/head_page_lock_2/tools/tools/ath/common/dumpregs_5416.c user/kmacy/head_page_lock_2/tools/tools/netrate/tcpp/tcpp_client.c user/kmacy/head_page_lock_2/tools/tools/netrate/tcpp/tcpp_server.c user/kmacy/head_page_lock_2/usr.bin/stat/stat.1 user/kmacy/head_page_lock_2/usr.bin/stat/stat.c user/kmacy/head_page_lock_2/usr.sbin/config/configvers.h user/kmacy/head_page_lock_2/usr.sbin/config/mkmakefile.c user/kmacy/head_page_lock_2/usr.sbin/makefs/ffs/ffs_bswap.c user/kmacy/head_page_lock_2/usr.sbin/pkg_install/Makefile user/kmacy/head_page_lock_2/usr.sbin/pkg_install/Makefile.inc user/kmacy/head_page_lock_2/usr.sbin/pkg_install/add/Makefile user/kmacy/head_page_lock_2/usr.sbin/pkg_install/add/extract.c user/kmacy/head_page_lock_2/usr.sbin/pkg_install/add/futil.c user/kmacy/head_page_lock_2/usr.sbin/pkg_install/add/main.c user/kmacy/head_page_lock_2/usr.sbin/pkg_install/add/perform.c user/kmacy/head_page_lock_2/usr.sbin/pkg_install/create/Makefile user/kmacy/head_page_lock_2/usr.sbin/pkg_install/create/main.c user/kmacy/head_page_lock_2/usr.sbin/pkg_install/create/perform.c user/kmacy/head_page_lock_2/usr.sbin/pkg_install/create/pl.c user/kmacy/head_page_lock_2/usr.sbin/pkg_install/delete/Makefile user/kmacy/head_page_lock_2/usr.sbin/pkg_install/delete/main.c user/kmacy/head_page_lock_2/usr.sbin/pkg_install/delete/perform.c user/kmacy/head_page_lock_2/usr.sbin/pkg_install/info/Makefile user/kmacy/head_page_lock_2/usr.sbin/pkg_install/info/info.h user/kmacy/head_page_lock_2/usr.sbin/pkg_install/info/main.c user/kmacy/head_page_lock_2/usr.sbin/pkg_install/info/perform.c user/kmacy/head_page_lock_2/usr.sbin/pkg_install/info/show.c user/kmacy/head_page_lock_2/usr.sbin/pkg_install/updating/Makefile user/kmacy/head_page_lock_2/usr.sbin/pkg_install/updating/main.c user/kmacy/head_page_lock_2/usr.sbin/pkg_install/version/Makefile user/kmacy/head_page_lock_2/usr.sbin/pkg_install/version/main.c user/kmacy/head_page_lock_2/usr.sbin/pkg_install/version/perform.c user/kmacy/head_page_lock_2/usr.sbin/pmcstat/pmcpl_calltree.c user/kmacy/head_page_lock_2/usr.sbin/sade/disks.c user/kmacy/head_page_lock_2/usr.sbin/sade/menus.c user/kmacy/head_page_lock_2/usr.sbin/sysinstall/disks.c user/kmacy/head_page_lock_2/usr.sbin/sysinstall/menus.c user/kmacy/head_page_lock_2/usr.sbin/sysinstall/tcpip.c Directory Properties: user/kmacy/head_page_lock_2/ (props changed) user/kmacy/head_page_lock_2/cddl/contrib/opensolaris/ (props changed) user/kmacy/head_page_lock_2/contrib/bind9/ (props changed) user/kmacy/head_page_lock_2/contrib/ee/ (props changed) user/kmacy/head_page_lock_2/contrib/expat/ (props changed) user/kmacy/head_page_lock_2/contrib/file/ (props changed) user/kmacy/head_page_lock_2/contrib/gdb/ (props changed) user/kmacy/head_page_lock_2/contrib/gdtoa/ (props changed) user/kmacy/head_page_lock_2/contrib/gnu-sort/ (props changed) user/kmacy/head_page_lock_2/contrib/groff/ (props changed) user/kmacy/head_page_lock_2/contrib/less/ (props changed) user/kmacy/head_page_lock_2/contrib/libpcap/ (props changed) user/kmacy/head_page_lock_2/contrib/ncurses/ (props changed) user/kmacy/head_page_lock_2/contrib/netcat/ (props changed) user/kmacy/head_page_lock_2/contrib/ntp/ (props changed) user/kmacy/head_page_lock_2/contrib/one-true-awk/ (props changed) user/kmacy/head_page_lock_2/contrib/openbsm/ (props changed) user/kmacy/head_page_lock_2/contrib/openpam/ (props changed) user/kmacy/head_page_lock_2/contrib/pf/ (props changed) user/kmacy/head_page_lock_2/contrib/sendmail/ (props changed) user/kmacy/head_page_lock_2/contrib/tcpdump/ (props changed) user/kmacy/head_page_lock_2/contrib/tcsh/ (props changed) user/kmacy/head_page_lock_2/contrib/top/ (props changed) user/kmacy/head_page_lock_2/contrib/top/install-sh (props changed) user/kmacy/head_page_lock_2/contrib/tzcode/stdtime/ (props changed) user/kmacy/head_page_lock_2/contrib/tzcode/zic/ (props changed) user/kmacy/head_page_lock_2/contrib/tzdata/ (props changed) user/kmacy/head_page_lock_2/contrib/wpa/ (props changed) user/kmacy/head_page_lock_2/crypto/openssh/ (props changed) user/kmacy/head_page_lock_2/crypto/openssl/ (props changed) user/kmacy/head_page_lock_2/lib/libc/ (props changed) user/kmacy/head_page_lock_2/lib/libc/stdtime/ (props changed) user/kmacy/head_page_lock_2/lib/libutil/ (props changed) user/kmacy/head_page_lock_2/lib/libz/ (props changed) user/kmacy/head_page_lock_2/sbin/ (props changed) user/kmacy/head_page_lock_2/sbin/ipfw/ (props changed) user/kmacy/head_page_lock_2/share/zoneinfo/ (props changed) user/kmacy/head_page_lock_2/sys/ (props changed) user/kmacy/head_page_lock_2/sys/amd64/include/xen/ (props changed) user/kmacy/head_page_lock_2/sys/cddl/contrib/opensolaris/ (props changed) user/kmacy/head_page_lock_2/sys/contrib/dev/acpica/ (props changed) user/kmacy/head_page_lock_2/sys/contrib/pf/ (props changed) user/kmacy/head_page_lock_2/sys/contrib/x86emu/ (props changed) user/kmacy/head_page_lock_2/sys/dev/xen/xenpci/ (props changed) user/kmacy/head_page_lock_2/sys/mips/rmi/debug.h (props changed) user/kmacy/head_page_lock_2/sys/mips/rmi/msgring.h (props changed) user/kmacy/head_page_lock_2/sys/mips/rmi/shared_structs.h (props changed) user/kmacy/head_page_lock_2/sys/mips/rmi/shared_structs_func.h (props changed) user/kmacy/head_page_lock_2/sys/mips/rmi/shared_structs_offsets.h (props changed) user/kmacy/head_page_lock_2/usr.bin/csup/ (props changed) user/kmacy/head_page_lock_2/usr.bin/procstat/ (props changed) user/kmacy/head_page_lock_2/usr.sbin/zic/ (props changed) Modified: user/kmacy/head_page_lock_2/Makefile.inc1 ============================================================================== --- user/kmacy/head_page_lock_2/Makefile.inc1 Sun Apr 25 00:54:11 2010 (r207178) +++ user/kmacy/head_page_lock_2/Makefile.inc1 Sun Apr 25 01:36:46 2010 (r207179) @@ -259,7 +259,7 @@ WMAKEENV= ${CROSSENV} \ VERSION="${VERSION}" \ INSTALL="sh ${.CURDIR}/tools/install.sh" \ PATH=${TMPPATH} -.if ${MK_CDDL} == "no" || defined(NO_CTF) +.if ${MK_CDDL} == "no" WMAKEENV+= NO_CTF=1 .endif WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP} @@ -780,7 +780,7 @@ buildkernel: @echo "--------------------------------------------------------------" cd ${KRNLOBJDIR}/${_kernel}; \ MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ - ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF \ + ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS \ -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) @@ -1111,7 +1111,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ ${_kerberos5_lib_libroken} \ lib/libbz2 lib/libcom_err lib/libcrypt \ - lib/libexpat \ + lib/libexpat lib/libfetch \ ${_lib_libgssapi} ${_lib_libipx} \ lib/libkiconv lib/libkvm lib/libmd \ lib/ncurses/ncurses lib/ncurses/ncursesw \ @@ -1138,6 +1138,7 @@ _cddl_lib= cddl/lib _secure_lib_libcrypto= secure/lib/libcrypto _secure_lib_libssl= secure/lib/libssl lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L +lib/libfetch__L: secure/lib/libcrypto__L secure/lib/libssl__L lib/libmd__L .if ${MK_OPENSSH} != "no" _secure_lib_libssh= secure/lib/libssh secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L @@ -1173,7 +1174,7 @@ _lib_libypclnt= lib/libypclnt .endif .if ${MK_OPENSSL} == "no" -lib/libradius__L: lib/libmd__L +lib/libfetch__L lib/libradius__L: lib/libmd__L .endif .for _lib in ${_prereq_libs} Modified: user/kmacy/head_page_lock_2/bin/ln/ln.c ============================================================================== --- user/kmacy/head_page_lock_2/bin/ln/ln.c Sun Apr 25 00:54:11 2010 (r207178) +++ user/kmacy/head_page_lock_2/bin/ln/ln.c Sun Apr 25 01:36:46 2010 (r207179) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -226,6 +227,7 @@ linkit(const char *source, const char *t int ch, exists, first; char path[PATH_MAX]; char wbuf[PATH_MAX]; + char bbuf[PATH_MAX]; if (!sflag) { /* If source doesn't exist, quit now. */ @@ -248,11 +250,9 @@ linkit(const char *source, const char *t if (isdir || (lstat(target, &sb) == 0 && S_ISDIR(sb.st_mode)) || (!hflag && stat(target, &sb) == 0 && S_ISDIR(sb.st_mode))) { - if ((p = strrchr(source, '/')) == NULL) - p = source; - else - ++p; - if (snprintf(path, sizeof(path), "%s/%s", target, p) >= + if (strlcpy(bbuf, source, sizeof(bbuf)) >= sizeof(bbuf) || + (p = basename(bbuf)) == NULL || + snprintf(path, sizeof(path), "%s/%s", target, p) >= (ssize_t)sizeof(path)) { errno = ENAMETOOLONG; warn("%s", source); @@ -276,15 +276,14 @@ linkit(const char *source, const char *t * absolute path of the source, by appending `source' * to the parent directory of the target. */ - p = strrchr(target, '/'); - if (p != NULL) - p++; - else - p = target; - (void)snprintf(wbuf, sizeof(wbuf), "%.*s%s", - (int)(p - target), target, source); - if (stat(wbuf, &sb) != 0) - warn("warning: %s", source); + strlcpy(bbuf, target, sizeof(bbuf)); + p = dirname(bbuf); + if (p != NULL) { + (void)snprintf(wbuf, sizeof(wbuf), "%s/%s", + p, source); + if (stat(wbuf, &sb) != 0) + warn("warning: %s", source); + } } } Modified: user/kmacy/head_page_lock_2/contrib/top/utils.c ============================================================================== --- user/kmacy/head_page_lock_2/contrib/top/utils.c Sun Apr 25 00:54:11 2010 (r207178) +++ user/kmacy/head_page_lock_2/contrib/top/utils.c Sun Apr 25 01:36:46 2010 (r207179) @@ -499,7 +499,7 @@ unsigned long long amt; } } - p = strecpy(p, itoa(amt)); + p = strecpy(p, itoa((int)amt)); *p++ = tag; *p = '\0'; Modified: user/kmacy/head_page_lock_2/contrib/tzdata/africa ============================================================================== --- user/kmacy/head_page_lock_2/contrib/tzdata/africa Sun Apr 25 00:54:11 2010 (r207178) +++ user/kmacy/head_page_lock_2/contrib/tzdata/africa Sun Apr 25 01:36:46 2010 (r207179) @@ -1,5 +1,5 @@ #
-# @(#)africa	8.23
+# @(#)africa	8.26
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -680,6 +680,21 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 # http://www.worldtimezone.com/dst_news/dst_news_morocco03.html
 # 
 
+# From Steffen Thorsen (2010-04-13):
+# Several news media in Morocco report that the Ministry of Modernization
+# of Public Sectors has announced that Morocco will have DST from
+# 2010-05-02 to 2010-08-08.
+#
+# Example:
+# 
+# http://www.lavieeco.com/actualites/4099-le-maroc-passera-a-l-heure-d-ete-gmt1-le-2-mai.html
+# 
+# (French)
+# Our page:
+# 
+# http://www.timeanddate.com/news/time/morocco-starts-dst-2010.html
+# 
+
 # RULE	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 
 Rule	Morocco	1939	only	-	Sep	12	 0:00	1:00	S
@@ -701,6 +716,8 @@ Rule	Morocco	2008	only	-	Jun	 1	 0:00	1:
 Rule	Morocco	2008	only	-	Sep	 1	 0:00	0	-
 Rule	Morocco	2009	only	-	Jun	 1	 0:00	1:00	S
 Rule	Morocco	2009	only	-	Aug	 21	 0:00	0	-
+Rule	Morocco	2010	only	-	May	 2	 0:00	1:00	S
+Rule	Morocco	2010	only	-	Aug	 8	 0:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Africa/Casablanca	-0:30:20 -	LMT	1913 Oct 26
 			 0:00	Morocco	WE%sT	1984 Mar 16
@@ -942,6 +959,24 @@ Zone	Africa/Lome	0:04:52 -	LMT	1893
 # Therefore, the standard time will be kept unchanged the whole year long."
 # So foregoing DST seems to be an exception (albeit one that may be repeated in the  future).
 
+# From Alexander Krivenyshev (2010-03-27):
+# According to some news reports Tunis confirmed not to use DST in 2010
+#
+# (translation):
+# "The Tunisian government has decided to abandon DST, which was scheduled on
+# Sunday...
+# Tunisian authorities had suspended the DST for the first time last year also
+# coincided with the month of Ramadan..."
+#
+# (in Arabic)
+# 
+# http://www.moheet.com/show_news.aspx?nid=358861&pg=1
+# 
+# http://www.almadenahnews.com/newss/news.php?c=118&id=38036
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_tunis02.html
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Tunisia	1939	only	-	Apr	15	23:00s	1:00	S
 Rule	Tunisia	1939	only	-	Nov	18	23:00s	0	-
@@ -968,8 +1003,7 @@ Rule	Tunisia	2005	only	-	May	 1	 0:00s	1
 Rule	Tunisia	2005	only	-	Sep	30	 1:00s	0	-
 Rule	Tunisia	2006	2008	-	Mar	lastSun	 2:00s	1:00	S
 Rule	Tunisia	2006	2008	-	Oct	lastSun	 2:00s	0	-
-Rule	Tunisia	2010	max	-	Mar	lastSun	 2:00s	1:00	S
-Rule	Tunisia	2010	max	-	Oct	lastSun	 2:00s	0	-
+
 # Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's
 # more precise 0:09:21.
 # Shanks & Pottenger say the 1911 switch was on Mar 9; go with Howse's Mar 11.

Modified: user/kmacy/head_page_lock_2/contrib/tzdata/asia
==============================================================================
--- user/kmacy/head_page_lock_2/contrib/tzdata/asia	Sun Apr 25 00:54:11 2010	(r207178)
+++ user/kmacy/head_page_lock_2/contrib/tzdata/asia	Sun Apr 25 01:36:46 2010	(r207179)
@@ -1,4 +1,4 @@
-# @(#)asia	8.58
+# @(#)asia	8.60
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -566,6 +566,28 @@ Zone	Asia/Hong_Kong	7:36:36 -	LMT	1904 O
 # was still controlled by Japan.  This is hard to believe, but we don't
 # have any other information.
 
+# From smallufo (2010-04-03):
+# According to Taiwan's CWB,
+# 
+# http://www.cwb.gov.tw/V6/astronomy/cdata/summert.htm
+# 
+# Taipei has DST in 1979 between July 1st and Sep 30.
+
+# From Arthur David Olson (2010-04-07):
+# Here's Google's translation of the table at the bottom of the "summert.htm" page:
+# Decade 	                                                    Name                      Start and end date
+# Republic of China 34 years to 40 years (AD 1945-1951 years) Summer Time               May 1 to September 30 
+# 41 years of the Republic of China (AD 1952)                 Daylight Saving Time      March 1 to October 31 
+# Republic of China 42 years to 43 years (AD 1953-1954 years) Daylight Saving Time      April 1 to October 31 
+# In the 44 years to 45 years (AD 1955-1956 years)            Daylight Saving Time      April 1 to September 30 
+# Republic of China 46 years to 48 years (AD 1957-1959)       Summer Time               April 1 to September 30 
+# Republic of China 49 years to 50 years (AD 1960-1961)       Summer Time               June 1 to September 30 
+# Republic of China 51 years to 62 years (AD 1962-1973 years) Stop Summer Time 
+# Republic of China 63 years to 64 years (1974-1975 AD)       Daylight Saving Time      April 1 to September 30 
+# Republic of China 65 years to 67 years (1976-1978 AD)       Stop Daylight Saving Time 
+# Republic of China 68 years (AD 1979)                        Daylight Saving Time      July 1 to September 30 
+# Republic of China since 69 years (AD 1980)                  Stop Daylight Saving Time
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Taiwan	1945	1951	-	May	1	0:00	1:00	D
 Rule	Taiwan	1945	1951	-	Oct	1	0:00	0	S
@@ -576,8 +598,9 @@ Rule	Taiwan	1955	1961	-	Oct	1	0:00	0	S
 Rule	Taiwan	1960	1961	-	Jun	1	0:00	1:00	D
 Rule	Taiwan	1974	1975	-	Apr	1	0:00	1:00	D
 Rule	Taiwan	1974	1975	-	Oct	1	0:00	0	S
-Rule	Taiwan	1980	only	-	Jun	30	0:00	1:00	D
-Rule	Taiwan	1980	only	-	Sep	30	0:00	0	S
+Rule	Taiwan	1979	only	-	Jun	30	0:00	1:00	D
+Rule	Taiwan	1979	only	-	Sep	30	0:00	0	S
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Taipei	8:06:00 -	LMT	1896 # or Taibei or T'ai-pei
 			8:00	Taiwan	C%sT
@@ -1912,13 +1935,35 @@ Zone	Asia/Muscat	3:54:20 -	LMT	1920
 # [T]he German Consulate General in Karachi reported me today that Pakistan
 # will go back to standard time on 1st of November.
 
+# From Steffen Thorsen (2010-03-26):
+# Steffen Thorsen wrote:
+# > On Thursday (2010-03-25) it was announced that DST would start in
+# > Pakistan on 2010-04-01.
+# >
+# > Then today, the president said that they might have to revert the
+# > decision if it is not supported by the parliament. So at the time
+# > being, it seems unclear if DST will be actually observed or not - but
+# > April 1 could be a more likely date than April 15.
+# Now, it seems that the decision to not observe DST in final:
+#
+# "Govt Withdraws Plan To Advance Clocks"
+# 
+# http://www.apakistannews.com/govt-withdraws-plan-to-advance-clocks-172041
+# 
+#
+# "People laud PM's announcement to end DST"
+# 
+# http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=99374&Itemid=2
+# 
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule Pakistan	2002	only	-	Apr	Sun>=2	0:01	1:00	S
 Rule Pakistan	2002	only	-	Oct	Sun>=2	0:01	0	-
 Rule Pakistan	2008	only	-	Jun	1	0:00	1:00	S
 Rule Pakistan	2008	only	-	Nov	1	0:00	0	-
-Rule Pakistan	2009	max	-	Apr	15	0:00	1:00	S
-Rule Pakistan	2009	max	-	Nov	1	0:00	0	-
+Rule Pakistan	2009	only	-	Apr	15	0:00	1:00	S
+Rule Pakistan	2009	only	-	Nov	1	0:00	0	-
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Karachi	4:28:12 -	LMT	1907
 			5:30	-	IST	1942 Sep

Modified: user/kmacy/head_page_lock_2/contrib/tzdata/southamerica
==============================================================================
--- user/kmacy/head_page_lock_2/contrib/tzdata/southamerica	Sun Apr 25 00:54:11 2010	(r207178)
+++ user/kmacy/head_page_lock_2/contrib/tzdata/southamerica	Sun Apr 25 01:36:46 2010	(r207179)
@@ -1,5 +1,5 @@
 # 
-# @(#)southamerica	8.43
+# @(#)southamerica	8.44
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -437,6 +437,27 @@ Rule	Arg	2008	only	-	Oct	Sun>=15	0:00	1:
 # of the country calls it "ART".
 # ...
 
+# From Alexander Krivenyshev (2010-04-09):
+# According to news reports from El Diario de la Republica Province San
+# Luis, Argentina (standard time UTC-04) will keep Daylight Saving Time
+# after April 11, 2010--will continue to have same time as rest of
+# Argentina (UTC-3) (no DST).
+#
+# Confirmaron la prórroga del huso horario de verano (Spanish)
+# 
+# http://www.eldiariodelarepublica.com/index.php?option=com_content&task=view&id=29383&Itemid=9
+# 
+# or (some English translation):
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_argentina08.html
+# 
+
+# From Mariano Absatz (2010-04-12):
+# yes...I can confirm this...and given that San Luis keeps calling
+# UTC-03:00 "summer time", we should't just let San Luis go back to "Arg"
+# rules...San Luis is still using "Western ARgentina Time" and it got
+# stuck on Summer daylight savings time even though the summer is over.
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 #
 # Buenos Aires (BA), Capital Federal (CF),
@@ -570,8 +591,8 @@ Zone America/Argentina/Mendoza -4:35:16 
 #
 # San Luis (SL)
 
-Rule	SanLuis	2008	max	-	Mar	Sun>=8	0:00	0	-
-Rule	SanLuis	2007	max	-	Oct	Sun>=8	0:00	1:00	S
+Rule	SanLuis	2008	2009	-	Mar	Sun>=8	0:00	0	-
+Rule	SanLuis	2007	2009	-	Oct	Sun>=8	0:00	1:00	S
 
 Zone America/Argentina/San_Luis -4:25:24 - LMT	1894 Oct 31
 			-4:16:48 -	CMT	1920 May

Modified: user/kmacy/head_page_lock_2/etc/devd.conf
==============================================================================
--- user/kmacy/head_page_lock_2/etc/devd.conf	Sun Apr 25 00:54:11 2010	(r207178)
+++ user/kmacy/head_page_lock_2/etc/devd.conf	Sun Apr 25 01:36:46 2010	(r207179)
@@ -138,12 +138,14 @@ attach 100 {
 # This entry starts the ColdSync tool in daemon mode. Make sure you have an up
 # to date /usr/local/etc/palms. We override the 'listen' settings for port and
 # type in /usr/local/etc/coldsync.conf.
-attach 100 {
-	device-name "ugen[0-9]+";
-	match "vendor" "0x082d";
-	match "product" "0x0100";
-	match "release" "0x0100";
-	action "/usr/local/bin/coldsync -md -p /dev/$device-name -t usb";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x082d";
+	match "product"		"0x0100";
+	match "release"		"0x0100";
+	action "/usr/local/bin/coldsync -md -p /dev/$cdev -t usb";
 };
 
 #

Modified: user/kmacy/head_page_lock_2/etc/devd/uath.conf
==============================================================================
--- user/kmacy/head_page_lock_2/etc/devd/uath.conf	Sun Apr 25 00:54:11 2010	(r207178)
+++ user/kmacy/head_page_lock_2/etc/devd/uath.conf	Sun Apr 25 01:36:46 2010	(r207179)
@@ -4,117 +4,143 @@
 
 # Accton
 #   SMCWUSB-G and SMCWUSBT-G2
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x083a";
-	match "product" "(0x4505|0x4507)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x083a";
+	match "product"		"(0x4505|0x4507)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Atheros Communications
 #   AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x168c";
-	match "product" "0x0002";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x168c";
+	match "product"		"0x0002";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Atheros Communications
 #   AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x0cf3";
-	match "product" "(0x0002|0x0004|0x0006)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x0cf3";
+	match "product"		"(0x0002|0x0004|0x0006)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Conceptronic
 #   AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x0d8e";
-	match "product" "(0x7802|0x7812)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x0d8e";
+	match "product"		"(0x7802|0x7812)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # D-Link
 #   DWL-AG132, DWL-G132 and DWL-AG122
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x2001";
-	match "product" "(0x3a01|0x3a03|0x3a05)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x2001";
+	match "product"		"(0x3a01|0x3a03|0x3a05)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # D-Link
 #  DWA-120
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x07d1";
-	match "product" "0x3a0c";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x07d1";
+	match "product"		"0x3a0c";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Gigaset
 #   SMCWUSBT-G
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x1690";
-	match "product" "(0x0711|0x0713)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x1690";
+	match "product"		"(0x0711|0x0713)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Global Sun Technology
 #   AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x16ab";
-	match "product" "(0x7802|0x7812)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x16ab";
+	match "product"		"(0x7802|0x7812)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # BayNETGEAR
 #   WG111U
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x0846";
-	match "product" "0x4301";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x0846";
+	match "product"		"0x4301";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Netgear
 #   WG111T and WPN111
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x1385";
-	match "product" "(0x4251|0x5f01)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x1385";
+	match "product"		"(0x4251|0x5f01)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # U-MEDIA Communications
 #   TEW-444UB and AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x157e";
-	match "product" "(0x3007|0x3206)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x157e";
+	match "product"		"(0x3007|0x3206)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Wistron NeWeb
 #   AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x1435";
-	match "product" "(0x0827|0x0829)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x1435";
+	match "product"		"(0x0827|0x0829)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Z-Com
 #   AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x0cde";
-	match "product" "0x0013";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x0cde";
+	match "product"		"0x0013";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };

Modified: user/kmacy/head_page_lock_2/etc/mtree/BSD.usr.dist
==============================================================================
--- user/kmacy/head_page_lock_2/etc/mtree/BSD.usr.dist	Sun Apr 25 00:54:11 2010	(r207178)
+++ user/kmacy/head_page_lock_2/etc/mtree/BSD.usr.dist	Sun Apr 25 01:36:46 2010	(r207179)
@@ -219,6 +219,8 @@
             ..
             ibcs2
             ..
+            indent
+            ..
             ipfilter
             ..
             ipfw

Modified: user/kmacy/head_page_lock_2/include/stdlib.h
==============================================================================
--- user/kmacy/head_page_lock_2/include/stdlib.h	Sun Apr 25 00:54:11 2010	(r207178)
+++ user/kmacy/head_page_lock_2/include/stdlib.h	Sun Apr 25 01:36:46 2010	(r207179)
@@ -155,6 +155,7 @@ void	 _Exit(int) __dead2;
 #if __POSIX_VISIBLE /* >= ??? */
 int	 posix_memalign(void **, size_t, size_t); /* (ADV) */
 int	 rand_r(unsigned *);			/* (TSF) */
+char	*realpath(const char * __restrict, char * __restrict);
 int	 setenv(const char *, const char *, int);
 int	 unsetenv(const char *);
 #endif
@@ -201,7 +202,6 @@ int	 posix_openpt(int);
 char	*ptsname(int);
 int	 putenv(char *);
 long	 random(void);
-char	*realpath(const char *, char resolved_path[]);
 unsigned short
 	*seed48(unsigned short[3]);
 #ifndef _SETKEY_DECLARED

Modified: user/kmacy/head_page_lock_2/lib/Makefile
==============================================================================
--- user/kmacy/head_page_lock_2/lib/Makefile	Sun Apr 25 00:54:11 2010	(r207178)
+++ user/kmacy/head_page_lock_2/lib/Makefile	Sun Apr 25 01:36:46 2010	(r207179)
@@ -85,6 +85,7 @@ SUBDIR=	${SUBDIR_ORDERED} \
 	libopie \
 	libpam \
 	libpcap \
+	${_libpkg} \
 	${_libpmc} \
 	libproc \
 	librt \
@@ -197,6 +198,10 @@ _libmp=		libmp
 _libpmc=	libpmc
 .endif
 
+.if ${MK_PKGTOOLS} != "no"
+_libpkg=	libpkg
+.endif
+
 .if ${MK_SENDMAIL} != "no"
 _libmilter=	libmilter
 _libsm=		libsm

Modified: user/kmacy/head_page_lock_2/lib/libc/stdlib/realpath.3
==============================================================================
--- user/kmacy/head_page_lock_2/lib/libc/stdlib/realpath.3	Sun Apr 25 00:54:11 2010	(r207178)
+++ user/kmacy/head_page_lock_2/lib/libc/stdlib/realpath.3	Sun Apr 25 01:36:46 2010	(r207179)
@@ -31,7 +31,7 @@
 .\"     @(#)realpath.3	8.2 (Berkeley) 2/16/94
 .\" $FreeBSD$
 .\"
-.Dd February 16, 1994
+.Dd April 19, 2010
 .Dt REALPATH 3
 .Os
 .Sh NAME
@@ -43,7 +43,7 @@
 .In sys/param.h
 .In stdlib.h
 .Ft "char *"
-.Fn realpath "const char *pathname" "char resolved_path[PATH_MAX]"
+.Fn realpath "const char *pathname" "char *resolved_path"
 .Sh DESCRIPTION
 The
 .Fn realpath
@@ -56,15 +56,16 @@ and
 in
 .Fa pathname ,
 and copies the resulting absolute pathname into
-the memory referenced by
+the memory pointed to by
 .Fa resolved_path .
 The
 .Fa resolved_path
 argument
 .Em must
-refer to a buffer capable of storing at least
+point to a buffer capable of storing at least
 .Dv PATH_MAX
-characters.
+characters, or be
+.Dv NULL .
 .Pp
 The
 .Fn realpath
@@ -82,13 +83,22 @@ The
 function returns
 .Fa resolved_path
 on success.
+If the function was supplied
+.Dv NULL
+as
+.Fa resolved_path ,
+and operation did not cause errors, the returned value is
+a null-terminated string in a buffer allocated by a call to
+.Fn malloc 3 .
 If an error occurs,
 .Fn realpath
 returns
 .Dv NULL ,
-and
+and if
 .Fa resolved_path
-contains the pathname which caused the problem.
+is not
+.Dv NULL ,
+the array that it points to contains the pathname which caused the problem.
 .Sh ERRORS
 The function
 .Fn realpath
@@ -113,6 +123,11 @@ when given a relative
 .Fa pathname .
 .Sh "SEE ALSO"
 .Xr getcwd 3
+.Sh STANDARDS
+The
+.Fn realpath
+function conforms to
+.St -p1003.1-2001 .
 .Sh HISTORY
 The
 .Fn realpath

Modified: user/kmacy/head_page_lock_2/lib/libc/stdlib/realpath.c
==============================================================================
--- user/kmacy/head_page_lock_2/lib/libc/stdlib/realpath.c	Sun Apr 25 00:54:11 2010	(r207178)
+++ user/kmacy/head_page_lock_2/lib/libc/stdlib/realpath.c	Sun Apr 25 01:36:46 2010	(r207179)
@@ -43,23 +43,37 @@ __FBSDID("$FreeBSD$");
 #include "un-namespace.h"
 
 /*
- * char *realpath(const char *path, char resolved[PATH_MAX]);
- *
  * Find the real name of path, by removing all ".", ".." and symlink
  * components.  Returns (resolved) on success, or (NULL) on failure,
  * in which case the path which caused trouble is left in (resolved).
  */
 char *
-realpath(const char *path, char resolved[PATH_MAX])
+realpath(const char * __restrict path, char * __restrict resolved)
 {
 	struct stat sb;
 	char *p, *q, *s;
 	size_t left_len, resolved_len;
 	unsigned symlinks;
-	int serrno, slen;
+	int serrno, slen, m;
 	char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX];
 
+	if (path == NULL) {
+		errno = EINVAL;
+		return (NULL);
+	}
+	if (path[0] == '\0') {
+		errno = ENOENT;
+		return (NULL);
+	}
 	serrno = errno;
+	if (resolved == NULL) {
+		resolved = malloc(PATH_MAX);
+		if (resolved == NULL)
+			return (NULL);
+		m = 1;
+	} else
+		m = 0;
+
 	symlinks = 0;
 	if (path[0] == '/') {
 		resolved[0] = '/';
@@ -70,13 +84,18 @@ realpath(const char *path, char resolved
 		left_len = strlcpy(left, path + 1, sizeof(left));
 	} else {
 		if (getcwd(resolved, PATH_MAX) == NULL) {
-			strlcpy(resolved, ".", PATH_MAX);
+			if (m)
+				free(resolved);
+			else
+				strlcpy(resolved, ".", PATH_MAX);
 			return (NULL);
 		}
 		resolved_len = strlen(resolved);
 		left_len = strlcpy(left, path, sizeof(left));
 	}
 	if (left_len >= sizeof(left) || resolved_len >= PATH_MAX) {
+		if (m)
+			free(resolved);
 		errno = ENAMETOOLONG;
 		return (NULL);
 	}
@@ -92,6 +111,8 @@ realpath(const char *path, char resolved
 		p = strchr(left, '/');
 		s = p ? p : left + left_len;
 		if (s - left >= sizeof(next_token)) {
+			if (m)
+				free(resolved);
 			errno = ENAMETOOLONG;
 			return (NULL);
 		}
@@ -102,6 +123,8 @@ realpath(const char *path, char resolved
 			memmove(left, s + 1, left_len + 1);
 		if (resolved[resolved_len - 1] != '/') {
 			if (resolved_len + 1 >= PATH_MAX) {
+				if (m)
+					free(resolved);
 				errno = ENAMETOOLONG;
 				return (NULL);
 			}
@@ -133,6 +156,8 @@ realpath(const char *path, char resolved
 		 */
 		resolved_len = strlcat(resolved, next_token, PATH_MAX);
 		if (resolved_len >= PATH_MAX) {
+			if (m)
+				free(resolved);
 			errno = ENAMETOOLONG;
 			return (NULL);
 		}
@@ -141,16 +166,23 @@ realpath(const char *path, char resolved
 				errno = serrno;
 				return (resolved);
 			}
+			if (m)
+				free(resolved);
 			return (NULL);
 		}
 		if (S_ISLNK(sb.st_mode)) {
 			if (symlinks++ > MAXSYMLINKS) {
+				if (m)
+					free(resolved);
 				errno = ELOOP;
 				return (NULL);
 			}
 			slen = readlink(resolved, symlink, sizeof(symlink) - 1);
-			if (slen < 0)
+			if (slen < 0) {
+				if (m)
+					free(resolved);
 				return (NULL);
+			}
 			symlink[slen] = '\0';
 			if (symlink[0] == '/') {
 				resolved[1] = 0;
@@ -171,6 +203,8 @@ realpath(const char *path, char resolved
 			if (p != NULL) {
 				if (symlink[slen - 1] != '/') {
 					if (slen + 1 >= sizeof(symlink)) {
+						if (m)
+							free(resolved);
 						errno = ENAMETOOLONG;
 						return (NULL);
 					}
@@ -179,6 +213,8 @@ realpath(const char *path, char resolved
 				}
 				left_len = strlcat(symlink, left, sizeof(left));
 				if (left_len >= sizeof(left)) {
+					if (m)
+						free(resolved);
 					errno = ENAMETOOLONG;
 					return (NULL);
 				}

Modified: user/kmacy/head_page_lock_2/lib/libufs/Makefile
==============================================================================
--- user/kmacy/head_page_lock_2/lib/libufs/Makefile	Sun Apr 25 00:54:11 2010	(r207178)
+++ user/kmacy/head_page_lock_2/lib/libufs/Makefile	Sun Apr 25 01:36:46 2010	(r207179)
@@ -3,7 +3,7 @@
 LIB=	ufs
 SHLIBDIR?= /lib
 
-SRCS=	block.c cgroup.c inode.c sblock.c type.c
+SRCS=	block.c cgroup.c inode.c sblock.c type.c ffs_subr.c ffs_tables.c
 INCS=	libufs.h
 
 MAN=	bread.3 cgread.3 libufs.3 sbread.3 ufs_disk_close.3
@@ -16,8 +16,11 @@ MLINKS+= ufs_disk_close.3 ufs_disk_fillo
 MLINKS+= ufs_disk_close.3 ufs_disk_fillout_blank.3
 MLINKS+= ufs_disk_close.3 ufs_disk_write.3
 
-WARNS?=	3
+.PATH:  ${.CURDIR}/../../sys/ufs/ffs
 
+WARNS?=	2
+
+DEBUG_FLAGS = -g
 CFLAGS+= -D_LIBUFS
 .if defined(LIBUFS_DEBUG)
 CFLAGS+= -D_LIBUFS_DEBUGGING

Modified: user/kmacy/head_page_lock_2/lib/libufs/cgroup.c
==============================================================================
--- user/kmacy/head_page_lock_2/lib/libufs/cgroup.c	Sun Apr 25 00:54:11 2010	(r207178)
+++ user/kmacy/head_page_lock_2/lib/libufs/cgroup.c	Sun Apr 25 01:36:46 2010	(r207179)
@@ -40,11 +40,143 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
 #include 
 
+ufs2_daddr_t
+cgballoc(struct uufsd *disk)
+{
+	u_int8_t *blksfree;
+	struct cg *cgp;
+	struct fs *fs;
+	long bno;
+
+	fs = &disk->d_fs;
+	cgp = &disk->d_cg;
+	blksfree = cg_blksfree(cgp);
+	for (bno = 0; bno < fs->fs_fpg / fs->fs_frag; bno++)
+		if (ffs_isblock(fs, blksfree, bno))
+			goto gotit;
+	return (0);
+gotit:
+	fs->fs_cs(fs, cgp->cg_cgx).cs_nbfree--;
+	ffs_clrblock(fs, blksfree, (long)bno);
+	ffs_clusteracct(fs, cgp, bno, -1);
+	cgp->cg_cs.cs_nbfree--;
+	fs->fs_cstotal.cs_nbfree--;
+	fs->fs_fmod = 1;
+	return (cgbase(fs, cgp->cg_cgx) + blkstofrags(fs, bno));
+}
+
+int
+cgbfree(struct uufsd *disk, ufs2_daddr_t bno, long size)
+{
+	u_int8_t *blksfree;
+	struct fs *fs;
+	struct cg *cgp;
+	ufs1_daddr_t fragno, cgbno;
+	int i, cg, blk, frags, bbase;
+
+	fs = &disk->d_fs;
+	cg = dtog(fs, bno);
+	if (cgread1(disk, cg) != 1)
+		return (-1);
+	cgp = &disk->d_cg;
+	cgbno = dtogd(fs, bno);
+	blksfree = cg_blksfree(cgp);
+	if (size == fs->fs_bsize) {
+		fragno = fragstoblks(fs, cgbno);
+		ffs_setblock(fs, blksfree, fragno);
+		ffs_clusteracct(fs, cgp, fragno, 1);
+		cgp->cg_cs.cs_nbfree++;
+		fs->fs_cstotal.cs_nbfree++;
+		fs->fs_cs(fs, cg).cs_nbfree++;
+	} else {
+		bbase = cgbno - fragnum(fs, cgbno);
+		/*
+		 * decrement the counts associated with the old frags
+		 */
+		blk = blkmap(fs, blksfree, bbase);
+		ffs_fragacct(fs, blk, cgp->cg_frsum, -1);
+		/*
+		 * deallocate the fragment
+		 */
+		frags = numfrags(fs, size);
+		for (i = 0; i < frags; i++)
+			setbit(blksfree, cgbno + i);
+		cgp->cg_cs.cs_nffree += i;
+		fs->fs_cstotal.cs_nffree += i;
+		fs->fs_cs(fs, cg).cs_nffree += i;
+		/*
+		 * add back in counts associated with the new frags
+		 */
+		blk = blkmap(fs, blksfree, bbase);
+		ffs_fragacct(fs, blk, cgp->cg_frsum, 1);
+		/*
+		 * if a complete block has been reassembled, account for it
+		 */
+		fragno = fragstoblks(fs, bbase);
+		if (ffs_isblock(fs, blksfree, fragno)) {
+			cgp->cg_cs.cs_nffree -= fs->fs_frag;
+			fs->fs_cstotal.cs_nffree -= fs->fs_frag;
+			fs->fs_cs(fs, cg).cs_nffree -= fs->fs_frag;
+			ffs_clusteracct(fs, cgp, fragno, 1);
+			cgp->cg_cs.cs_nbfree++;
+			fs->fs_cstotal.cs_nbfree++;
+			fs->fs_cs(fs, cg).cs_nbfree++;
+		}
+	}
+	return cgwrite(disk);
+}
+
+ino_t
+cgialloc(struct uufsd *disk)
+{
+	struct ufs2_dinode *dp2;
+	u_int8_t *inosused;
+	struct cg *cgp;
+	struct fs *fs;
+	ino_t ino;
+	int i;
+
+	fs = &disk->d_fs;
+	cgp = &disk->d_cg;
+	inosused = cg_inosused(cgp);
+	for (ino = 0; ino < fs->fs_ipg / NBBY; ino++)
+		if (isclr(inosused, ino))
+			goto gotit;
+	return (0);
+gotit:
+	if (fs->fs_magic == FS_UFS2_MAGIC &&
+	    ino + INOPB(fs) > cgp->cg_initediblk &&
+	    cgp->cg_initediblk < cgp->cg_niblk) {
+		char block[MAXBSIZE];
+		bzero(block, (int)fs->fs_bsize);
+		dp2 = (struct ufs2_dinode *)█
+		for (i = 0; i < INOPB(fs); i++) {
+			dp2->di_gen = arc4random() / 2 + 1;
+			dp2++;
+		}
+		if (bwrite(disk, ino_to_fsba(fs,
+		    cgp->cg_cgx * fs->fs_ipg + cgp->cg_initediblk),
+		    block, fs->fs_bsize))
+			return (0);
+		cgp->cg_initediblk += INOPB(fs);
+	}
+
+	setbit(inosused, ino);
+	cgp->cg_irotor = ino;
+	cgp->cg_cs.cs_nifree--;
+	fs->fs_cstotal.cs_nifree--;
+	fs->fs_cs(fs, cgp->cg_cgx).cs_nifree--;
+	fs->fs_fmod = 1;
+
+	return (ino + (cgp->cg_cgx * fs->fs_ipg));
+}
+
 int
 cgread(struct uufsd *disk)
 {
@@ -55,14 +187,12 @@ int
 cgread1(struct uufsd *disk, int c)
 {
 	struct fs *fs;
-	off_t ccg;
 
 	fs = &disk->d_fs;
 
 	if ((unsigned)c >= fs->fs_ncg) {
 		return (0);
 	}

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-user@FreeBSD.ORG  Sun Apr 25 03:49:44 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5BAC81065672;
	Sun, 25 Apr 2010 03:49:44 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 31E558FC12;
	Sun, 25 Apr 2010 03:49:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3P3niFP036351;
	Sun, 25 Apr 2010 03:49:44 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3P3niET036349;
	Sun, 25 Apr 2010 03:49:44 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004250349.o3P3niET036349@svn.freebsd.org>
From: Juli Mallett 
Date: Sun, 25 Apr 2010 03:49:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207182 - user/jmallett/octeon/sys/mips/cavium/octe
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Apr 2010 03:49:44 -0000

Author: jmallett
Date: Sun Apr 25 03:49:43 2010
New Revision: 207182
URL: http://svn.freebsd.org/changeset/base/207182

Log:
  Work around a couple of bugs.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/octe.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Sun Apr 25 01:56:39 2010	(r207181)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Sun Apr 25 03:49:43 2010	(r207182)
@@ -250,7 +250,7 @@ static void
 octe_start(struct ifnet *ifp)
 {
 	cvm_oct_private_t *priv;
-	struct mbuf *m;
+	struct mbuf *m, *n;
 	int error;
 
 	priv = ifp->if_softc;
@@ -261,6 +261,31 @@ octe_start(struct ifnet *ifp)
 	while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) {
 		IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
 
+		/*
+		 * XXX
+		 *
+		 * We may not be able to pass the mbuf up to BPF for one of
+		 * two very good reasons:
+		 * (1) immediately after our inserting it another CPU may be
+		 *     kind enough to free it for us.
+		 * (2) m_defrag gets called on m and we don't get back the
+		 *     modified pointer.
+		 *
+		 * We have some options other than this m_dup route:
+		 * (1) use a mutex or spinlock to prevent another CPU from
+		 *     freeing it.  We could lock the tx_free_list's lock,
+		 *     that would make sense.
+		 * (2) get back the new mbuf pointer.
+		 * (3) do the defrag here.
+		 *
+		 * #3 makes sense in the long run when we have code that can
+		 * load mbufs into any number of segments, but for now the
+		 * transmit code is called with the assumption that it knows
+		 * how to defrag mbufs for itself and that it will handle the
+		 * failure cases internally.
+		 */
+		n = m_dup(m, M_DONTWAIT);
+
 		if (priv->queue != -1) {
 			error = cvm_oct_xmit(m, ifp);
 		} else {
@@ -272,16 +297,17 @@ octe_start(struct ifnet *ifp)
 			 * XXX
 			 * Need to implement freeing and clearing of
 			 * OACTIVE at some point.
-			 *
-			 * XXX
-			 * Incremenet errors?  Maybe make xmit functions
-			 * not free the packets?
 			 */
+			if (n != NULL)
+				IFQ_DRV_PREPEND(&ifp->if_snd, n);
 			ifp->if_drv_flags |= IFF_DRV_OACTIVE;
 			return;
 		}
 
-		BPF_MTAP(ifp, m);
+		if (n != NULL) {
+			BPF_MTAP(ifp, n);
+			m_freem(n);
+		}
 	}
 }
 

From owner-svn-src-user@FreeBSD.ORG  Sun Apr 25 04:03:45 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6B294106566B;
	Sun, 25 Apr 2010 04:03:45 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5B6728FC08;
	Sun, 25 Apr 2010 04:03:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3P43ja9039517;
	Sun, 25 Apr 2010 04:03:45 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3P43j4r039515;
	Sun, 25 Apr 2010 04:03:45 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201004250403.o3P43j4r039515@svn.freebsd.org>
From: Doug Barton 
Date: Sun, 25 Apr 2010 04:03:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207183 - user/dougb/portmaster
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Apr 2010 04:03:45 -0000

Author: dougb
Date: Sun Apr 25 04:03:45 2010
New Revision: 207183
URL: http://svn.freebsd.org/changeset/base/207183

Log:
  In check_for move some local variables down into the block where they
  are used.

Modified:
  user/dougb/portmaster/portmaster

Modified: user/dougb/portmaster/portmaster
==============================================================================
--- user/dougb/portmaster/portmaster	Sun Apr 25 03:49:43 2010	(r207182)
+++ user/dougb/portmaster/portmaster	Sun Apr 25 04:03:45 2010	(r207183)
@@ -2067,7 +2067,7 @@ dependency_check () {
 		clean_build_only_list
 	fi
 
-	local d_port origin iport conflicts glob confl_p udf
+	local d_port origin iport udf
 
 	# Do not export, for THIS parent process only
 	[ -n "$CONFIG_ONLY" ] && doing_dep_check=doing_dep_check
@@ -2094,6 +2094,8 @@ dependency_check () {
 			case "$CUR_DEPS" in *:${origin}:*) continue ;; esac
 
 		if [ -z "$PM_INDEX_ONLY" ]; then
+			local conflicts glob confl_p
+
 			conflicts=''
 			if pm_cd $d_port; then
 				grep -ql ^CONFLICTS Makefile &&

From owner-svn-src-user@FreeBSD.ORG  Sun Apr 25 04:04:23 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1BBB9106564A;
	Sun, 25 Apr 2010 04:04:23 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0BC208FC19;
	Sun, 25 Apr 2010 04:04:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3P44M6U039688;
	Sun, 25 Apr 2010 04:04:22 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3P44MOD039686;
	Sun, 25 Apr 2010 04:04:22 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004250404.o3P44MOD039686@svn.freebsd.org>
From: Juli Mallett 
Date: Sun, 25 Apr 2010 04:04:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207184 - user/jmallett/octeon/sys/mips/cavium/octe
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Apr 2010 04:04:23 -0000

Author: jmallett
Date: Sun Apr 25 04:04:22 2010
New Revision: 207184
URL: http://svn.freebsd.org/changeset/base/207184

Log:
  Add a note to my future self.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/octe.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Sun Apr 25 04:03:45 2010	(r207183)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Sun Apr 25 04:04:22 2010	(r207184)
@@ -32,6 +32,10 @@
  * XXX This file should be moved to if_octe.c
  * XXX The driver may have sufficient locking but we need locking to protect
  *     the interfaces presented here, right?
+ * XXX There is a common MII bus on Octeon, we get the identifier of our PHY
+ *     in priv->phy_id; right now we attach all the PHYs to each interface,
+ *     which is clearly wrong.  Need to either modify miibus or probe and
+ *     attach the specific PHY for each interface without an miibus in between.
  */
 
 #include 

From owner-svn-src-user@FreeBSD.ORG  Sun Apr 25 05:09:09 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4A6B2106564A;
	Sun, 25 Apr 2010 05:09:09 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 20E498FC12;
	Sun, 25 Apr 2010 05:09:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3P599mJ053928;
	Sun, 25 Apr 2010 05:09:09 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3P598GX053927;
	Sun, 25 Apr 2010 05:09:08 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004250509.o3P598GX053927@svn.freebsd.org>
From: Juli Mallett 
Date: Sun, 25 Apr 2010 05:09:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207185 - user/jmallett/octeon/sys/mips/cavium/octe
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Apr 2010 05:09:09 -0000

Author: jmallett
Date: Sun Apr 25 05:09:08 2010
New Revision: 207185
URL: http://svn.freebsd.org/changeset/base/207185

Log:
  o) Allow miibus attachment to fail, falling back to non-MII media handling.
  o) Only allow miibus access to *our* PHY on the shared MII bus.
  
  XXX The PHY numbering that we get from the Simple Executive seems to be off or
      we're not configuring something right at the MII layer or something; the
      miibus correctly finds the RTL8212 chips on the CAM-0100 and says they are
      at PHY 2 and PHY 3.  Except octe0 and octe1 think their PHYs are #4 and #9
      respectively.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/octe.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Sun Apr 25 04:04:22 2010	(r207184)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Sun Apr 25 05:09:08 2010	(r207185)
@@ -145,20 +145,21 @@ octe_attach(device_t dev)
 
 	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
 
-	ifmedia_init(&priv->media, 0, octe_medchange, octe_medstat);
-	if (priv->phy_id == -1) {
-		ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL);
-		ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO);
-	} else {
+	if (priv->phy_id != -1) {
 		error = mii_phy_probe(dev, &priv->miibus, octe_mii_medchange,
 				      octe_mii_medstat);
 		if (error != 0) {
-			device_printf(dev, "could not find PHY!\n");
-			/* XXX Cleanup.  */
-			return (error);
+			device_printf(dev, "missing phy %u\n", priv->phy_id);
 		}
 	}
 
+	if (priv->miibus == NULL) {
+		ifmedia_init(&priv->media, 0, octe_medchange, octe_medstat);
+
+		ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL);
+		ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO);
+	}
+
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_init = octe_init;
 	ifp->if_ioctl = octe_ioctl;
@@ -199,6 +200,9 @@ octe_miibus_readreg(device_t dev, int ph
 
 	priv = device_get_softc(dev);
 
+	if (phy != priv->phy_id)
+		return (0);
+
 	return (cvm_oct_mdio_read(priv->ifp, phy, reg));
 }
 
@@ -209,6 +213,9 @@ octe_miibus_writereg(device_t dev, int p
 
 	priv = device_get_softc(dev);
 
+	KASSERT(phy == priv->phy_id,
+	    ("write to phy %u but our phy is %u", phy, priv->phy_id));
+
 	cvm_oct_mdio_write(priv->ifp, phy, reg, val);
 
 	return (0);

From owner-svn-src-user@FreeBSD.ORG  Sun Apr 25 22:39:26 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 12E70106566B;
	Sun, 25 Apr 2010 22:39:26 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 01CCF8FC13;
	Sun, 25 Apr 2010 22:39:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3PMdPKE091973;
	Sun, 25 Apr 2010 22:39:25 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3PMdP8Y091971;
	Sun, 25 Apr 2010 22:39:25 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201004252239.o3PMdP8Y091971@svn.freebsd.org>
From: Doug Barton 
Date: Sun, 25 Apr 2010 22:39:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207208 - user/dougb/portmaster
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Apr 2010 22:39:26 -0000

Author: dougb
Date: Sun Apr 25 22:39:25 2010
New Revision: 207208
URL: http://svn.freebsd.org/changeset/base/207208

Log:
  Improve the handling of various situations where there is no ORIGIN
  recorded in the +CONTENTS file. This is almost always an error in the
  package building process, and therefore usually needs to be flagged and
  handled as an error. There are (at least) 2 situations where it may not
  be an error; bsdpan ports, and when the user has added an +IGNOREME file
  (usually for 3rd party packages).
  
  1. Add code to origin_from_pdb() that tests to see that grep returned
     something, echos the result as before, then also returns successfully.
     a. If the port is a bsdpan port, return with an error code but let the
        caller handle the reporting as appropriate.
     b. If there is no ORIGIN but there is an +IGNOREME file don't report
        the error unless we're using -v, then also report that the +IGNOREME
        file is there. Either way, return with an error code.
     c. If there is no ORIGIN, and no +IGNOREME file, report the error and
        return with an error code.
  
  2. In several places this allows several lines of code where the function
     is called to be collapsed into:
     origin=`origin_from_pdb $iport` || continue
  
  3. In the main body where we parse the command line for what to work on
     convert the code that was individually testing the various conditions
     that are now handled in origin_from_pdb() to simply parse the return
     codes with a case statement.
  
  In the common case (there is an ORIGIN in +CONTENTS) this is almost
  certainly a minor optimization since the error handling code in
  origin_from_pdb() is never reached, and several places where things like
  "is it a bsdpan port?" and other error handling have been removed.

Modified:
  user/dougb/portmaster/portmaster

Modified: user/dougb/portmaster/portmaster
==============================================================================
--- user/dougb/portmaster/portmaster	Sun Apr 25 22:01:32 2010	(r207207)
+++ user/dougb/portmaster/portmaster	Sun Apr 25 22:39:25 2010	(r207208)
@@ -567,8 +567,23 @@ iport_from_origin () {
 
 origin_from_pdb () {
 	local o
-	o=`grep -m1 '@comment ORIGIN:' $pdb/$1/+CONTENTS 2>/dev/null`
-	echo ${o#@comment ORIGIN:}
+	o=`grep -m1 '@comment ORIGIN:' $pdb/$1/+CONTENTS 2>/dev/null` && {
+		echo ${o#@comment ORIGIN:}; return 0; }
+
+	case "$1" in bsdpan-*) return 3 ;; esac
+
+	if [ -e "$pdb/$1/+IGNOREME" ]; then
+		if [ -n "$PM_VERBOSE" -o -n "$LIST_ORIGINS" ]; then
+			echo "	===>>> No ORIGIN in $pdb/$1/+CONTENTS" >&2
+			echo "	===>>> $pdb/$1/+IGNOREME exists" >&2
+			echo '' >&2
+		fi
+		return 2
+	else
+		echo "	===>>> No ORIGIN in $pdb/$1/+CONTENTS" >&2
+		echo '' >&2
+	fi
+	return 1
 }
 
 check_regular_file () {
@@ -780,9 +795,7 @@ read_distinfos () {
 		[ -d $pkg ] || continue
 		iport=${pkg#$pdb/}
 
-		case "$iport" in bsdpan-*) continue ;; esac
-
-		origin=`origin_from_pdb $iport`
+		origin=`origin_from_pdb $iport` || continue
 
 		if [ ! -d "$pd/$origin" ]; then
 			find_moved_port $origin $iport nonfatal >/dev/null
@@ -915,20 +928,13 @@ IFS='
 
 		iport=${pkg#$pdb/}
 
-		case "$iport" in bsdpan-*)
-		echo "===>>> BSDPAN ports do not record dependencies ($iport)"
-		continue ;; esac
-
 		echo "===>>> Checking $iport"
 
 		[ -r "$pkg/+CONTENTS" ] || {
 			echo "	===>>> Warning: No +CONTENTS file!";
 			continue; }
 
-		origin=`origin_from_pdb ${pkg#$pdb/}`
-		[ -n "$origin" ] || {
-			echo "	===>>> Warning: No ORIGIN in +CONTENTS file";
-			continue; }
+		origin=`origin_from_pdb $iport` || continue
 
 		if [ ! -d "$pd/$origin" ]; then
 			echo "	===>>> $pd/$origin does not exist"
@@ -972,7 +978,7 @@ if [ -n "$CHECK_PORT_DBDIR" ]; then
 		unset unique_name
 
 		iport=${pkg#$pdb/}
-		origin=`origin_from_pdb $iport`
+		origin=`origin_from_pdb $iport` || continue
 
 		if [ ! -d "$pd/$origin" ]; then
 			find_moved_port $origin $iport nonfatal >/dev/null
@@ -1018,7 +1024,7 @@ if [ -n "$LIST_ORIGINS" ]; then
 	ports_by_category
 
 	for iport in $roots $leaves; do
-		origin=`origin_from_pdb $iport`
+		origin=`origin_from_pdb $iport` || continue
 		echo $origin
 	done
 
@@ -1196,18 +1202,7 @@ check_for_updates () {
 
 	iport=$1
 
-	case "$iport" in bsdpan-*)	[ -n "$PM_VERBOSE" ] &&
-	echo "	===>>> BSDPAN ports cannot be upgraded with portmaster"
-	return 0 ;; esac
-
-	origin=${2:-`origin_from_pdb $iport`}
-	if [ -z "$origin" ]; then
-		if [ -n "$PM_VERBOSE" ]; then
-			echo "===>>> No ORIGIN in $pdb/$iport/+CONTENTS"
-			echo ''
-		fi
-		return 0
-	fi
+	origin=${2:-`origin_from_pdb $iport`} || return 0
 
 	if [ -n "$PM_INDEX" ]; then
 		port_ver=`parse_index $origin name`
@@ -2476,11 +2471,7 @@ all_config () {
 
 		case "$CUR_DEPS" in *:${iport}:*) continue ;; esac
 
-		case "$iport" in bsdpan-*)	[ -n "$PM_VERBOSE" ] &&
-		echo "	===>>> BSDPAN ports cannot be upgraded with portmaster"
-		continue ;; esac
-
-		origin=`origin_from_pdb $iport`
+		origin=`origin_from_pdb $iport` || continue
 		case "$CONFIG_SEEN_LIST" in *:${origin}:*) continue ;; esac
 
 		[ -n "$PM_BUILD_ONLY_LIST" ] &&
@@ -2634,15 +2625,16 @@ else
 fi
 
 if [ -n "$upg_port" -a -z "$REPLACE_ORIGIN" ]; then
-	portdir=`origin_from_pdb $upg_port`
-	if [ ! -n "$portdir" ]; then
-		case "$upg_port" in
-		bsdpan-*)	echo ''
+	portdir=`origin_from_pdb $upg_port` || {
+	case "$?" in
+	3)	echo ''
 		echo "===>>> BSDPAN ports cannot be upgraded with portmaster"
-			echo "       (${upg_port})"; echo ''; safe_exit ;;
-		*)	fail "No ORIGIN in $pdb/$upg_port/+CONTENTS" ;;
-		esac
-	fi
+		echo "       (${upg_port})"; echo ''; safe_exit ;;
+	2)	[ -z "$PM_VERBOSE" ] && {
+		echo "	===>>> No ORIGIN for $upg_port, and +IGNOREME is present";
+		echo ''; }; safe_exit ;;
+	*)	fail 'Cannot continue' ;;
+	esac ; }
 elif [ -z "$portdir" ]; then
 	no_valid_port
 fi

From owner-svn-src-user@FreeBSD.ORG  Sun Apr 25 23:08:38 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0C96B1065673;
	Sun, 25 Apr 2010 23:08:38 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EF85D8FC0C;
	Sun, 25 Apr 2010 23:08:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3PN8bl8098358;
	Sun, 25 Apr 2010 23:08:37 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3PN8bP2098356;
	Sun, 25 Apr 2010 23:08:37 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004252308.o3PN8bP2098356@svn.freebsd.org>
From: Kip Macy 
Date: Sun, 25 Apr 2010 23:08:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207209 - user/kmacy/head_page_lock_2/sys/amd64/amd64
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Apr 2010 23:08:38 -0000

Author: kmacy
Date: Sun Apr 25 23:08:37 2010
New Revision: 207209
URL: http://svn.freebsd.org/changeset/base/207209

Log:
  reduce delta with HEAD
  - white space cleanups
  - remove comment and braces no longer present in HEAD
  - remove INVARIANTS check

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Sun Apr 25 22:39:25 2010	(r207208)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Sun Apr 25 23:08:37 2010	(r207209)
@@ -2328,12 +2328,6 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse
 	pv = pmap_pvh_remove(pvh, pmap, va);
 	KASSERT(pv != NULL, ("pmap_pv_demote_pde: pv not found"));
 	m = PHYS_TO_VM_PAGE(pa);
-#ifdef INVARIANTS
-		if (va == 0) {
-			printf("inserting va==0\n");
-			kdb_backtrace();
-		}
-#endif
 	vm_page_lock(m);
 	TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
 	vm_page_unlock(m);
@@ -2352,12 +2346,6 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse
 		va += PAGE_SIZE;
 		pv = TAILQ_FIRST(pv_list);
 		TAILQ_REMOVE(pv_list, pv, pv_list);
-#ifdef INVARIANTS
-		if (va == 0) {
-			printf("inserting va==0\n");
-			kdb_backtrace();
-		}
-#endif		
 		pv->pv_va = va;
 		vm_page_lock(m);
 		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
@@ -2443,12 +2431,6 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm
 	vm_page_lock_assert(m, MA_OWNED);
 	if (pv_entry_count < pv_entry_high_water && 
 	    (pv = get_pv_entry(pmap)) != NULL) {
-#ifdef INVARIANTS
-		if (va == 0) {
-			printf("inserting va==0\n");
-			kdb_backtrace();
-		}
-#endif		
 		pv->pv_va = va;
 		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
 		return (TRUE);
@@ -2469,12 +2451,6 @@ pmap_pv_insert_pde(pmap_t pmap, vm_offse
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
 	if (pv_entry_count < pv_entry_high_water && 
 	    (pv = get_pv_entry(pmap)) != NULL) {
-#ifdef INVARIANTS
-		if (va == 0) {
-			printf("inserting va==0\n");
-			kdb_backtrace();
-		}
-#endif		
 		pv->pv_va = va;
 		pvh = pa_to_pvh(pa);
 		TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_list);
@@ -3089,18 +3065,9 @@ retry:
 	if (oldpde & PG_MANAGED) {
 		eva = sva + NBPDR;
 		for (va = sva, m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME);
-		    va < eva; va += PAGE_SIZE, m++) {
-			/*
-			 * In contrast to the analogous operation on a 4KB page
-			 * mapping, the mapping's PG_A flag is not cleared and
-			 * the page's PG_REFERENCED flag is not set.  The
-			 * reason is that pmap_demote_pde() expects that a 2MB
-			 * page mapping with a stored page table page has PG_A
-			 * set.
-			 */
+		    va < eva; va += PAGE_SIZE, m++)
 			if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW))
 				vm_page_dirty(m);
-		}
 	}
 	if ((prot & VM_PROT_WRITE) == 0)
 		newpde &= ~(PG_RW | PG_M);
@@ -3473,7 +3440,6 @@ restart:
 			goto restart;
 		}
 	}
-	    
 	/*
 	 * Mapping has not changed, must be protection or wiring change.
 	 */
@@ -3505,7 +3471,6 @@ restart:
 		}
 		goto validate;
 	} 
-	
 	/*
 	 * Mapping has changed, invalidate old range and fall through to
 	 * handle validating new mapping.
@@ -3533,12 +3498,6 @@ restart:
 	if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) {
 		KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva,
 		    ("pmap_enter: managed mapping within the clean submap"));
-#ifdef INVARIANTS
-		if (va == 0) {
-			printf("inserting va==0\n");
-			kdb_backtrace();
-		}
-#endif		
 		pv->pv_va = va;
 		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
 		pa |= PG_MANAGED;
@@ -4417,6 +4376,7 @@ restart:
 					} else
 						vm_page_dirty(m);
 				}
+
 				/* Mark free */
 				PV_STAT(pv_entry_frees++);
 				PV_STAT(pv_entry_spare++);
@@ -4434,7 +4394,7 @@ restart:
 					mpte = pmap_lookup_pt_page(pmap, pv->pv_va);
 					if (mpte != NULL) {
 						pmap_remove_pt_page(pmap, mpte);
-						pmap_resident_count_dec(pmap, 1);	
+						pmap_resident_count_dec(pmap, 1);
 						KASSERT(mpte->wire_count == NPTEPG,
 						    ("pmap_remove_pages: pte page wire count error"));
 						mpte->wire_count = 0;

From owner-svn-src-user@FreeBSD.ORG  Sun Apr 25 23:42:23 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D870E1065672;
	Sun, 25 Apr 2010 23:42:23 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C480B8FC1F;
	Sun, 25 Apr 2010 23:42:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3PNgNZD005905;
	Sun, 25 Apr 2010 23:42:23 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3PNgNo0005886;
	Sun, 25 Apr 2010 23:42:23 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004252342.o3PNgNo0005886@svn.freebsd.org>
From: Kip Macy 
Date: Sun, 25 Apr 2010 23:42:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207211 - in user/kmacy/head_page_lock_2: bin/ln bin/sh
	contrib/top lib/libc/gen lib/libc/sys lib/libkvm
	share/man/man1 sys/amd64/amd64 sys/amd64/conf sys/geom/part
	sys/i386/i386 sys/ne...
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Apr 2010 23:42:23 -0000

Author: kmacy
Date: Sun Apr 25 23:42:23 2010
New Revision: 207211
URL: http://svn.freebsd.org/changeset/base/207211

Log:
  IFC 207179:207210

Modified:
  user/kmacy/head_page_lock_2/bin/ln/symlink.7
  user/kmacy/head_page_lock_2/bin/sh/arith.y
  user/kmacy/head_page_lock_2/bin/sh/arith_lex.l
  user/kmacy/head_page_lock_2/bin/sh/expand.c
  user/kmacy/head_page_lock_2/lib/libc/gen/sysctl.3
  user/kmacy/head_page_lock_2/lib/libc/sys/unlink.2
  user/kmacy/head_page_lock_2/lib/libkvm/kvm.3
  user/kmacy/head_page_lock_2/share/man/man1/builtin.1
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
  user/kmacy/head_page_lock_2/sys/amd64/conf/GENERIC
  user/kmacy/head_page_lock_2/sys/geom/part/g_part.c
  user/kmacy/head_page_lock_2/sys/i386/i386/pmap.c
  user/kmacy/head_page_lock_2/sys/net/bpf.c
  user/kmacy/head_page_lock_2/sys/net/bpfdesc.h
  user/kmacy/head_page_lock_2/sys/net/rtsock.c
  user/kmacy/head_page_lock_2/sys/netinet/sctp_indata.c
  user/kmacy/head_page_lock_2/sys/netinet/sctp_output.c
  user/kmacy/head_page_lock_2/usr.bin/alias/Makefile
Directory Properties:
  user/kmacy/head_page_lock_2/   (props changed)
  user/kmacy/head_page_lock_2/cddl/contrib/opensolaris/   (props changed)
  user/kmacy/head_page_lock_2/contrib/bind9/   (props changed)
  user/kmacy/head_page_lock_2/contrib/ee/   (props changed)
  user/kmacy/head_page_lock_2/contrib/expat/   (props changed)
  user/kmacy/head_page_lock_2/contrib/file/   (props changed)
  user/kmacy/head_page_lock_2/contrib/gdb/   (props changed)
  user/kmacy/head_page_lock_2/contrib/gdtoa/   (props changed)
  user/kmacy/head_page_lock_2/contrib/gnu-sort/   (props changed)
  user/kmacy/head_page_lock_2/contrib/groff/   (props changed)
  user/kmacy/head_page_lock_2/contrib/less/   (props changed)
  user/kmacy/head_page_lock_2/contrib/libpcap/   (props changed)
  user/kmacy/head_page_lock_2/contrib/ncurses/   (props changed)
  user/kmacy/head_page_lock_2/contrib/netcat/   (props changed)
  user/kmacy/head_page_lock_2/contrib/ntp/   (props changed)
  user/kmacy/head_page_lock_2/contrib/one-true-awk/   (props changed)
  user/kmacy/head_page_lock_2/contrib/openbsm/   (props changed)
  user/kmacy/head_page_lock_2/contrib/openpam/   (props changed)
  user/kmacy/head_page_lock_2/contrib/pf/   (props changed)
  user/kmacy/head_page_lock_2/contrib/sendmail/   (props changed)
  user/kmacy/head_page_lock_2/contrib/tcpdump/   (props changed)
  user/kmacy/head_page_lock_2/contrib/tcsh/   (props changed)
  user/kmacy/head_page_lock_2/contrib/top/   (props changed)
  user/kmacy/head_page_lock_2/contrib/top/install-sh   (props changed)
  user/kmacy/head_page_lock_2/contrib/tzcode/stdtime/   (props changed)
  user/kmacy/head_page_lock_2/contrib/tzcode/zic/   (props changed)
  user/kmacy/head_page_lock_2/contrib/tzdata/   (props changed)
  user/kmacy/head_page_lock_2/contrib/wpa/   (props changed)
  user/kmacy/head_page_lock_2/crypto/openssh/   (props changed)
  user/kmacy/head_page_lock_2/crypto/openssl/   (props changed)
  user/kmacy/head_page_lock_2/lib/libc/   (props changed)
  user/kmacy/head_page_lock_2/lib/libc/stdtime/   (props changed)
  user/kmacy/head_page_lock_2/lib/libutil/   (props changed)
  user/kmacy/head_page_lock_2/lib/libz/   (props changed)
  user/kmacy/head_page_lock_2/sbin/   (props changed)
  user/kmacy/head_page_lock_2/sbin/ipfw/   (props changed)
  user/kmacy/head_page_lock_2/share/zoneinfo/   (props changed)
  user/kmacy/head_page_lock_2/sys/   (props changed)
  user/kmacy/head_page_lock_2/sys/amd64/include/xen/   (props changed)
  user/kmacy/head_page_lock_2/sys/cddl/contrib/opensolaris/   (props changed)
  user/kmacy/head_page_lock_2/sys/contrib/dev/acpica/   (props changed)
  user/kmacy/head_page_lock_2/sys/contrib/pf/   (props changed)
  user/kmacy/head_page_lock_2/sys/contrib/x86emu/   (props changed)
  user/kmacy/head_page_lock_2/sys/dev/xen/xenpci/   (props changed)
  user/kmacy/head_page_lock_2/usr.bin/csup/   (props changed)
  user/kmacy/head_page_lock_2/usr.bin/procstat/   (props changed)
  user/kmacy/head_page_lock_2/usr.sbin/zic/   (props changed)

Modified: user/kmacy/head_page_lock_2/bin/ln/symlink.7
==============================================================================
--- user/kmacy/head_page_lock_2/bin/ln/symlink.7	Sun Apr 25 23:18:02 2010	(r207210)
+++ user/kmacy/head_page_lock_2/bin/ln/symlink.7	Sun Apr 25 23:42:23 2010	(r207211)
@@ -29,7 +29,7 @@
 .\"	@(#)symlink.7	8.3 (Berkeley) 3/31/94
 .\" $FreeBSD$
 .\"
-.Dd March 31, 1994
+.Dd April 25, 2010
 .Dt SYMLINK 7
 .Os
 .Sh NAME
@@ -103,19 +103,23 @@ the system call
 would return a file descriptor to the file
 .Dq afile .
 .Pp
-There are nine system calls that do not follow links, and which operate
+There are thirteen system calls that do not follow links, and which operate
 on the symbolic link itself.
 They are:
 .Xr lchflags 2 ,
 .Xr lchmod 2 ,
 .Xr lchown 2 ,
+.Xr lpathconf 2 ,
 .Xr lstat 2 ,
 .Xr lutimes 2 ,
 .Xr readlink 2 ,
+.Xr readlinkat 2 ,
 .Xr rename 2 ,
+.Xr renameat 2 ,
 .Xr rmdir 2 ,
+.Xr unlink 2 ,
 and
-.Xr unlink 2 .
+.Xr unlinkat 2 .
 Because
 .Xr remove 3
 is an alias for
@@ -123,9 +127,30 @@ is an alias for
 it also does not follow symbolic links.
 When
 .Xr rmdir 2
+or
+.Xr unlinkat 2
+with the
+.Dv AT_REMOVEDIR
+flag
 is applied to a symbolic link, it fails with the error
 .Er ENOTDIR .
 .Pp
+The
+.Xr linkat 2
+system call does not follow symbolic links
+unless given the
+.Dv AT_SYMLINK_FOLLOW
+flag.
+.Pp
+The following system calls follow symbolic links
+unless given the
+.Dv AT_SYMLINK_NOFOLLOW
+flag:
+.Xr fchmodat 2 ,
+.Xr fchownat 2
+and
+.Xr fstatat 2 .
+.Pp
 The owner and group of an existing symbolic link can be changed by
 means of the
 .Xr lchown 2
@@ -138,8 +163,8 @@ an existing symbolic link can be changed
 and
 .Xr lutimes 2
 system calls, respectively.
-Of these, only the flags are used by the system;
-the access permissions and ownership are ignored.
+Of these, only the flags and ownership are used by the system;
+the access permissions are ignored.
 .Pp
 The
 .Bx 4.4

Modified: user/kmacy/head_page_lock_2/bin/sh/arith.y
==============================================================================
--- user/kmacy/head_page_lock_2/bin/sh/arith.y	Sun Apr 25 23:18:02 2010	(r207210)
+++ user/kmacy/head_page_lock_2/bin/sh/arith.y	Sun Apr 25 23:42:23 2010	(r207211)
@@ -287,7 +287,9 @@ arith_t
 arith(const char *s)
 {
 	arith_t result;
+	struct stackmark smark;
 
+	setstackmark(&smark);
 	arith_buf = arith_startbuf = s;
 
 	INTOFF;
@@ -295,6 +297,8 @@ arith(const char *s)
 	arith_lex_reset();	/* Reprime lex. */
 	INTON;
 
+	popstackmark(&smark);
+
 	return result;
 }
 

Modified: user/kmacy/head_page_lock_2/bin/sh/arith_lex.l
==============================================================================
--- user/kmacy/head_page_lock_2/bin/sh/arith_lex.l	Sun Apr 25 23:18:02 2010	(r207210)
+++ user/kmacy/head_page_lock_2/bin/sh/arith_lex.l	Sun Apr 25 23:42:23 2010	(r207211)
@@ -51,13 +51,6 @@ __FBSDID("$FreeBSD$");
 
 int yylex(void);
 
-struct varname
-{
-	struct varname *next;
-	char name[1];
-};
-static struct varname *varnames;
-
 #undef YY_INPUT
 #define YY_INPUT(buf,result,max) \
 	result = (*buf = *arith_buf++) ? 1 : YY_NULL;
@@ -87,14 +80,11 @@ static struct varname *varnames;
 			 * If variable doesn't exist, we should initialize
 			 * it to zero.
 			 */
-			struct varname *temp;
+			char *temp;
 			if (lookupvar(yytext) == NULL)
 				setvarsafe(yytext, "0", 0);
-			temp = ckmalloc(sizeof(struct varname) +
-			    strlen(yytext));
-			temp->next = varnames;
-			varnames = temp;
-			yylval.s_value = strcpy(temp->name, yytext);
+			temp = stalloc(strlen(yytext) + 1);
+			yylval.s_value = strcpy(temp, yytext);
 
 			return ARITH_VAR;
 		}
@@ -140,15 +130,5 @@ static struct varname *varnames;
 void
 arith_lex_reset(void)
 {
-	struct varname *name, *next;
-
 	YY_NEW_FILE;
-
-	name = varnames;
-	while (name != NULL) {
-		next = name->next;
-		ckfree(name);
-		name = next;
-	}
-	varnames = NULL;
 }

Modified: user/kmacy/head_page_lock_2/bin/sh/expand.c
==============================================================================
--- user/kmacy/head_page_lock_2/bin/sh/expand.c	Sun Apr 25 23:18:02 2010	(r207210)
+++ user/kmacy/head_page_lock_2/bin/sh/expand.c	Sun Apr 25 23:42:23 2010	(r207211)
@@ -360,7 +360,7 @@ removerecordregions(int endoff)
 void
 expari(int flag)
 {
-	char *p, *start;
+	char *p, *q, *start;
 	arith_t result;
 	int begoff;
 	int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR);
@@ -398,7 +398,9 @@ expari(int flag)
 	removerecordregions(begoff);
 	if (quotes)
 		rmescapes(p+2);
+	q = grabstackstr(expdest);
 	result = arith(p+2);
+	ungrabstackstr(q, expdest);
 	fmtstr(p, DIGITS(result), ARITH_FORMAT_STR, result);
 	while (*p++)
 		;

Modified: user/kmacy/head_page_lock_2/lib/libc/gen/sysctl.3
==============================================================================
--- user/kmacy/head_page_lock_2/lib/libc/gen/sysctl.3	Sun Apr 25 23:18:02 2010	(r207210)
+++ user/kmacy/head_page_lock_2/lib/libc/gen/sysctl.3	Sun Apr 25 23:42:23 2010	(r207211)
@@ -28,7 +28,7 @@
 .\"	@(#)sysctl.3	8.4 (Berkeley) 5/9/95
 .\" $FreeBSD$
 .\"
-.Dd February 21, 2010
+.Dd April 25, 2010
 .Dt SYSCTL 3
 .Os
 .Sh NAME
@@ -325,7 +325,7 @@ information.
 .It "KERN_BOOTFILE	string	yes"
 .It "KERN_BOOTTIME	struct timeval	no"
 .It "KERN_CLOCKRATE	struct clockinfo	no"
-.It "KERN_FILE	struct file	no"
+.It "KERN_FILE	struct xfile	no"
 .It "KERN_HOSTID	integer	yes"
 .It "KERN_HOSTUUID	string	yes"
 .It "KERN_HOSTNAME	string	yes"
@@ -342,14 +342,14 @@ information.
 .It "KERN_OSREV	integer	no"
 .It "KERN_OSTYPE	string	no"
 .It "KERN_POSIX1	integer	no"
-.It "KERN_PROC	struct proc	no"
+.It "KERN_PROC	node	not applicable"
 .It "KERN_PROF	node	not applicable"
 .It "KERN_QUANTUM	integer	yes"
 .It "KERN_SAVED_IDS	integer	no"
 .It "KERN_SECURELVL	integer	raise only"
 .It "KERN_UPDATEINTERVAL	integer	no"
 .It "KERN_VERSION	string	no"
-.It "KERN_VNODE	struct vnode	no"
+.It "KERN_VNODE	struct xvnode	no"
 .El
 .Bl -tag -width 6n
 .It Li KERN_ARGMAX
@@ -370,10 +370,8 @@ This structure contains the clock, stati
 frequencies, the number of micro-seconds per hz tick and the skew rate.
 .It Li KERN_FILE
 Return the entire file table.
-The returned data consists of a single
-.Va struct filehead
-followed by an array of
-.Va struct file ,
+The returned data consists of an array of
+.Va struct xfile ,
 whose size depends on the current number of such objects in the system.
 .It Li KERN_HOSTID
 Get or set the host ID.
@@ -525,10 +523,8 @@ Note, the vnode table is not necessarily
 the system.
 The returned data consists of an array whose size depends on the
 current number of such objects in the system.
-Each element of the array contains the kernel address of a vnode
-.Va struct vnode *
-followed by the vnode itself
-.Va struct vnode .
+Each element of the array consists of a
+.Va struct xvnode .
 .El
 .Ss CTL_NET
 The string and integer information available for the CTL_NET level
@@ -854,6 +850,8 @@ An attempt is made to set a read-only va
 A process without appropriate privilege attempts to set a value.
 .El
 .Sh SEE ALSO
+.Xr confstr 3 ,
+.Xr kvm 3 ,
 .Xr sysconf 3 ,
 .Xr sysctl 8
 .Sh HISTORY

Modified: user/kmacy/head_page_lock_2/lib/libc/sys/unlink.2
==============================================================================
--- user/kmacy/head_page_lock_2/lib/libc/sys/unlink.2	Sun Apr 25 23:18:02 2010	(r207210)
+++ user/kmacy/head_page_lock_2/lib/libc/sys/unlink.2	Sun Apr 25 23:42:23 2010	(r207211)
@@ -28,7 +28,7 @@
 .\"     @(#)unlink.2	8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd April 10, 2008
+.Dd April 25, 2010
 .Dt UNLINK 2
 .Os
 .Sh NAME
@@ -167,7 +167,7 @@ argument does not specify an absolute pa
 argument is neither
 .Dv AT_FDCWD
 nor a valid file descriptor open for searching.
-.It Bq Er EEXIST
+.It Bq Er ENOTEMPTY
 The
 .Fa flag
 parameter has the

Modified: user/kmacy/head_page_lock_2/lib/libkvm/kvm.3
==============================================================================
--- user/kmacy/head_page_lock_2/lib/libkvm/kvm.3	Sun Apr 25 23:18:02 2010	(r207210)
+++ user/kmacy/head_page_lock_2/lib/libkvm/kvm.3	Sun Apr 25 23:42:23 2010	(r207211)
@@ -32,7 +32,7 @@
 .\"     @(#)kvm.3	8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd January 29, 2004
+.Dd April 25, 2010
 .Dt KVM 3
 .Os
 .Sh NAME
@@ -46,12 +46,15 @@ The
 library provides a uniform interface for accessing kernel virtual memory
 images, including live systems and crash dumps.
 Access to live systems is via
+.Xr sysctl 3
+for some functions, and
 .Xr mem 4
 and
 .Xr kmem 4
+for other functions,
 while crash dumps can be examined via the core file generated by
 .Xr savecore 8 .
-The interface behaves identically in both cases.
+The interface behaves similarly in both cases.
 Memory can be read and written, kernel symbol addresses can be
 looked up efficiently, and information about user processes can
 be gathered.
@@ -112,5 +115,6 @@ given descriptor.
 .Xr kvm_openfiles 3 ,
 .Xr kvm_read 3 ,
 .Xr kvm_write 3 ,
+.Xr sysctl 3 ,
 .Xr kmem 4 ,
 .Xr mem 4

Modified: user/kmacy/head_page_lock_2/share/man/man1/builtin.1
==============================================================================
--- user/kmacy/head_page_lock_2/share/man/man1/builtin.1	Sun Apr 25 23:18:02 2010	(r207210)
+++ user/kmacy/head_page_lock_2/share/man/man1/builtin.1	Sun Apr 25 23:42:23 2010	(r207211)
@@ -245,7 +245,7 @@ but are implemented as scripts using a b
 .It Ic getopts Ta No** Ta \&No Ta Yes
 .It Ic glob Ta \&No Ta Yes Ta \&No
 .It Ic goto Ta \&No Ta Yes Ta \&No
-.It Ic hash Ta \&No Ta \&No Ta Yes
+.It Ic hash Ta No** Ta \&No Ta Yes
 .It Ic hashstat Ta \&No Ta Yes Ta \&No
 .It Ic history Ta \&No Ta Yes Ta \&No
 .It Ic hup Ta \&No Ta Yes Ta \&No
@@ -290,8 +290,8 @@ but are implemented as scripts using a b
 .It Ic times Ta \&No Ta \&No Ta Yes
 .It Ic trap Ta \&No Ta \&No Ta Yes
 .It Ic true Ta Yes Ta \&No Ta Yes
-.It Ic type Ta \&No Ta \&No Ta Yes
-.It Ic ulimit Ta \&No Ta \&No Ta Yes
+.It Ic type Ta No** Ta \&No Ta Yes
+.It Ic ulimit Ta No** Ta \&No Ta Yes
 .It Ic umask Ta No** Ta Yes Ta Yes
 .It Ic unalias Ta No** Ta Yes Ta Yes
 .It Ic uncomplete Ta \&No Ta Yes Ta \&No

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Sun Apr 25 23:18:02 2010	(r207210)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Sun Apr 25 23:42:23 2010	(r207211)
@@ -3035,7 +3035,6 @@ pmap_remove_all(vm_page_t m)
 		 *
 		 */
 		pmap_unuse_pt(pmap, pv->pv_va, *pde, &free);
-
 		pmap_invalidate_page(pmap, pv->pv_va);
 		pmap_free_zero_pages(free);
 		TAILQ_REMOVE(&m->md.pv_list, pv, pv_list);
@@ -3179,22 +3178,17 @@ retry:
 			obits = pbits = *pte;
 			if ((pbits & PG_V) == 0)
 				continue;
-			if ((pbits & PG_MANAGED) &&
-			    (pbits & (PG_M | PG_A))) {
-				if (pa_tryrelock(pmap, pbits & PG_FRAME, &pa))
-					goto restart;
 
-				m = PHYS_TO_VM_PAGE(pbits & PG_FRAME);
-				if (pbits & PG_A) {
-					vm_page_flag_set(m, PG_REFERENCED);
-					pbits &= ~PG_A;
-				}
-				if ((pbits & (PG_M | PG_RW)) == (PG_M | PG_RW))
+			if ((prot & VM_PROT_WRITE) == 0) {
+				if ((pbits & (PG_MANAGED | PG_M | PG_RW)) ==
+				    (PG_MANAGED | PG_M | PG_RW)) {
+					m = PHYS_TO_VM_PAGE(pbits & PG_FRAME);
+					if (pa_tryrelock(pmap, pbits & PG_FRAME, &pa))
+					    goto restart;
 					vm_page_dirty(m);
-			}
-
-			if ((prot & VM_PROT_WRITE) == 0)
+				}
 				pbits &= ~(PG_RW | PG_M);
+			}
 			if ((prot & VM_PROT_EXECUTE) == 0)
 				pbits |= pg_nx;
 

Modified: user/kmacy/head_page_lock_2/sys/amd64/conf/GENERIC
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/conf/GENERIC	Sun Apr 25 23:18:02 2010	(r207210)
+++ user/kmacy/head_page_lock_2/sys/amd64/conf/GENERIC	Sun Apr 25 23:42:23 2010	(r207211)
@@ -281,7 +281,7 @@ device		firmware	# firmware assist modul
 device		bpf		# Berkeley packet filter
 
 # USB support
-#options 	USB_DEBUG	# enable debug msgs
+options 	USB_DEBUG	# enable debug msgs
 device		uhci		# UHCI PCI->USB interface
 device		ohci		# OHCI PCI->USB interface
 device		ehci		# EHCI PCI->USB interface (USB 2.0)

Modified: user/kmacy/head_page_lock_2/sys/geom/part/g_part.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/geom/part/g_part.c	Sun Apr 25 23:18:02 2010	(r207210)
+++ user/kmacy/head_page_lock_2/sys/geom/part/g_part.c	Sun Apr 25 23:42:23 2010	(r207211)
@@ -1166,6 +1166,15 @@ g_part_ctl_undo(struct gctl_req *req, st
 			return (0);
 		}
 		table = gp->softc;
+
+		/*
+		 * Synthesize a disk geometry. Some partitioning schemes
+		 * depend on it and since some file systems need it even
+		 * when the partitition scheme doesn't, we do it here in
+		 * scheme-independent code.
+		 */
+		pp = cp->provider;
+		g_part_geometry(table, cp, pp->mediasize / pp->sectorsize);
 	}
 
 	error = G_PART_READ(table, cp);

Modified: user/kmacy/head_page_lock_2/sys/i386/i386/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/i386/i386/pmap.c	Sun Apr 25 23:18:02 2010	(r207210)
+++ user/kmacy/head_page_lock_2/sys/i386/i386/pmap.c	Sun Apr 25 23:42:23 2010	(r207211)
@@ -2955,18 +2955,9 @@ retry:
 	if (oldpde & PG_MANAGED) {
 		eva = sva + NBPDR;
 		for (va = sva, m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME);
-		    va < eva; va += PAGE_SIZE, m++) {
-			/*
-			 * In contrast to the analogous operation on a 4KB page
-			 * mapping, the mapping's PG_A flag is not cleared and
-			 * the page's PG_REFERENCED flag is not set.  The
-			 * reason is that pmap_demote_pde() expects that a 2/4MB
-			 * page mapping with a stored page table page has PG_A
-			 * set.
-			 */
+		    va < eva; va += PAGE_SIZE, m++)
 			if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW))
 				vm_page_dirty(m);
-		}
 	}
 	if ((prot & VM_PROT_WRITE) == 0)
 		newpde &= ~(PG_RW | PG_M);
@@ -3074,22 +3065,15 @@ retry:
 			obits = pbits = *pte;
 			if ((pbits & PG_V) == 0)
 				continue;
-			if (pbits & PG_MANAGED) {
-				m = NULL;
-				if (pbits & PG_A) {
+
+			if ((prot & VM_PROT_WRITE) == 0) {
+				if ((pbits & (PG_MANAGED | PG_M | PG_RW)) ==
+				    (PG_MANAGED | PG_M | PG_RW)) {
 					m = PHYS_TO_VM_PAGE(pbits & PG_FRAME);
-					vm_page_flag_set(m, PG_REFERENCED);
-					pbits &= ~PG_A;
-				}
-				if ((pbits & (PG_M | PG_RW)) == (PG_M | PG_RW)) {
-					if (m == NULL)
-						m = PHYS_TO_VM_PAGE(pbits & PG_FRAME);
 					vm_page_dirty(m);
 				}
-			}
-
-			if ((prot & VM_PROT_WRITE) == 0)
 				pbits &= ~(PG_RW | PG_M);
+			}
 #ifdef PAE
 			if ((prot & VM_PROT_EXECUTE) == 0)
 				pbits |= pg_nx;

Modified: user/kmacy/head_page_lock_2/sys/net/bpf.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/net/bpf.c	Sun Apr 25 23:18:02 2010	(r207210)
+++ user/kmacy/head_page_lock_2/sys/net/bpf.c	Sun Apr 25 23:42:23 2010	(r207211)
@@ -38,6 +38,7 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_bpf.h"
+#include "opt_compat.h"
 #include "opt_netgraph.h"
 
 #include 
@@ -89,6 +90,43 @@ MALLOC_DEFINE(M_BPF, "BPF", "BPF data");
 
 #define PRINET  26			/* interruptible */
 
+#ifdef COMPAT_FREEBSD32
+#include 
+#include 
+#define BPF_ALIGNMENT32 sizeof(int32_t)
+#define BPF_WORDALIGN32(x) (((x)+(BPF_ALIGNMENT32-1))&~(BPF_ALIGNMENT32-1))
+
+/*
+ * 32-bit version of structure prepended to each packet.  We use this header
+ * instead of the standard one for 32-bit streams.  We mark the a stream as
+ * 32-bit the first time we see a 32-bit compat ioctl request.
+ */
+struct bpf_hdr32 {
+	struct timeval32 bh_tstamp;	/* time stamp */
+	uint32_t	bh_caplen;	/* length of captured portion */
+	uint32_t	bh_datalen;	/* original length of packet */
+	uint16_t	bh_hdrlen;	/* length of bpf header (this struct
+					   plus alignment padding) */
+};
+
+struct bpf_program32 {
+	u_int bf_len;
+	uint32_t bf_insns;
+};
+
+struct bpf_dltlist32 {
+	u_int	bfl_len;
+	u_int	bfl_list;
+};
+
+#define	BIOCSETF32	_IOW('B', 103, struct bpf_program32)
+#define	BIOCSRTIMEOUT32	_IOW('B',109, struct timeval32)
+#define	BIOCGRTIMEOUT32	_IOR('B',110, struct timeval32)
+#define	BIOCGDLTLIST32	_IOWR('B',121, struct bpf_dltlist32)
+#define	BIOCSETWF32	_IOW('B',123, struct bpf_program32)
+#define	BIOCSETFNR32	_IOW('B',130, struct bpf_program32)
+#endif
+
 /*
  * bpf_iflist is a list of BPF interface structures, each corresponding to a
  * specific DLT.  The same network interface might have several BPF interface
@@ -1005,8 +1043,14 @@ bpfioctl(struct cdev *dev, u_long cmd, c
 		case BIOCFLUSH:
 		case BIOCGDLT:
 		case BIOCGDLTLIST:
+#ifdef COMPAT_FREEBSD32
+		case BIOCGDLTLIST32:
+#endif
 		case BIOCGETIF:
 		case BIOCGRTIMEOUT:
+#ifdef COMPAT_FREEBSD32
+		case BIOCGRTIMEOUT32:
+#endif
 		case BIOCGSTATS:
 		case BIOCVERSION:
 		case BIOCGRSIG:
@@ -1015,6 +1059,9 @@ bpfioctl(struct cdev *dev, u_long cmd, c
 		case FIONREAD:
 		case BIOCLOCK:
 		case BIOCSRTIMEOUT:
+#ifdef COMPAT_FREEBSD32
+		case BIOCSRTIMEOUT32:
+#endif
 		case BIOCIMMEDIATE:
 		case TIOCGPGRP:
 		case BIOCROTZBUF:
@@ -1023,6 +1070,22 @@ bpfioctl(struct cdev *dev, u_long cmd, c
 			return (EPERM);
 		}
 	}
+#ifdef COMPAT_FREEBSD32
+	/*
+	 * If we see a 32-bit compat ioctl, mark the stream as 32-bit so
+	 * that it will get 32-bit packet headers.
+	 */
+	switch (cmd) {
+	case BIOCSETF32:
+	case BIOCSETFNR32:
+	case BIOCSETWF32:
+	case BIOCGDLTLIST32:
+	case BIOCGRTIMEOUT32:
+	case BIOCSRTIMEOUT32:
+		d->bd_compat32 = 1;
+	}
+#endif
+
 	CURVNET_SET(TD_TO_VNET(td));
 	switch (cmd) {
 
@@ -1080,6 +1143,11 @@ bpfioctl(struct cdev *dev, u_long cmd, c
 	case BIOCSETF:
 	case BIOCSETFNR:
 	case BIOCSETWF:
+#ifdef COMPAT_FREEBSD32
+	case BIOCSETF32:
+	case BIOCSETFNR32:
+	case BIOCSETWF32:
+#endif
 		error = bpf_setf(d, (struct bpf_program *)addr, cmd);
 		break;
 
@@ -1123,6 +1191,26 @@ bpfioctl(struct cdev *dev, u_long cmd, c
 	/*
 	 * Get a list of supported data link types.
 	 */
+#ifdef COMPAT_FREEBSD32
+	case BIOCGDLTLIST32:
+		{
+			struct bpf_dltlist32 *list32;
+			struct bpf_dltlist dltlist;
+
+			list32 = (struct bpf_dltlist32 *)addr;
+			dltlist.bfl_len = list32->bfl_len;
+			dltlist.bfl_list = PTRIN(list32->bfl_list);
+			if (d->bd_bif == NULL)
+				error = EINVAL;
+			else {
+				error = bpf_getdltlist(d, &dltlist);
+				if (error == 0)
+					list32->bfl_len = dltlist.bfl_len;
+			}
+			break;
+		}
+#endif
+
 	case BIOCGDLTLIST:
 		if (d->bd_bif == NULL)
 			error = EINVAL;
@@ -1166,8 +1254,23 @@ bpfioctl(struct cdev *dev, u_long cmd, c
 	 * Set read timeout.
 	 */
 	case BIOCSRTIMEOUT:
+#ifdef COMPAT_FREEBSD32
+	case BIOCSRTIMEOUT32:
+#endif
 		{
 			struct timeval *tv = (struct timeval *)addr;
+#ifdef COMPAT_FREEBSD32
+			struct timeval32 *tv32;
+			struct timeval tv64;
+
+			if (cmd == BIOCSRTIMEOUT32) {
+				tv32 = (struct timeval32 *)addr;
+				tv = &tv64;
+				tv->tv_sec = tv32->tv_sec;
+				tv->tv_usec = tv32->tv_usec;
+			} else
+#endif
+				tv = (struct timeval *)addr;
 
 			/*
 			 * Subtract 1 tick from tvtohz() since this isn't
@@ -1182,11 +1285,31 @@ bpfioctl(struct cdev *dev, u_long cmd, c
 	 * Get read timeout.
 	 */
 	case BIOCGRTIMEOUT:
+#ifdef COMPAT_FREEBSD32
+	case BIOCGRTIMEOUT32:
+#endif
 		{
-			struct timeval *tv = (struct timeval *)addr;
+			struct timeval *tv;
+#ifdef COMPAT_FREEBSD32
+			struct timeval32 *tv32;
+			struct timeval tv64;
+
+			if (cmd == BIOCGRTIMEOUT32)
+				tv = &tv64;
+			else
+#endif
+				tv = (struct timeval *)addr;
 
 			tv->tv_sec = d->bd_rtout / hz;
 			tv->tv_usec = (d->bd_rtout % hz) * tick;
+#ifdef COMPAT_FREEBSD32
+			if (cmd == BIOCGRTIMEOUT32) {
+				tv32 = (struct timeval32 *)addr;
+				tv32->tv_sec = tv->tv_sec;
+				tv32->tv_usec = tv->tv_usec;
+			}
+#endif
+
 			break;
 		}
 
@@ -1369,7 +1492,19 @@ bpf_setf(struct bpf_d *d, struct bpf_pro
 #ifdef BPF_JITTER
 	bpf_jit_filter *ofunc;
 #endif
-
+#ifdef COMPAT_FREEBSD32
+	struct bpf_program32 *fp32;
+	struct bpf_program fp_swab;
+
+	if (cmd == BIOCSETWF32 || cmd == BIOCSETF32 || cmd == BIOCSETFNR32) {
+		fp32 = (struct bpf_program32 *)fp;
+		fp_swab.bf_len = fp32->bf_len;
+		fp_swab.bf_insns = (struct bpf_insn *)(uintptr_t)fp32->bf_insns;
+		fp = &fp_swab;
+		if (cmd == BIOCSETWF32)
+			cmd = BIOCSETWF;
+	}
+#endif
 	if (cmd == BIOCSETWF) {
 		old = d->bd_wfilter;
 		wfilter = 1;
@@ -1771,6 +1906,9 @@ catchpacket(struct bpf_d *d, u_char *pkt
     struct timeval *tv)
 {
 	struct bpf_hdr hdr;
+#ifdef COMPAT_FREEBSD32
+	struct bpf_hdr32 hdr32;
+#endif
 	int totlen, curlen;
 	int hdrlen = d->bd_bif->bif_hdrlen;
 	int do_wakeup = 0;
@@ -1809,7 +1947,12 @@ catchpacket(struct bpf_d *d, u_char *pkt
 	 * buffer is considered immutable by the buffer model, try to rotate
 	 * the buffer and wakeup pending processes.
 	 */
-	curlen = BPF_WORDALIGN(d->bd_slen);
+#ifdef COMPAT_FREEBSD32
+	if (d->bd_compat32)
+		curlen = BPF_WORDALIGN32(d->bd_slen);
+	else
+#endif
+		curlen = BPF_WORDALIGN(d->bd_slen);
 	if (curlen + totlen > d->bd_bufsize || !bpf_canwritebuf(d)) {
 		if (d->bd_fbuf == NULL) {
 			/*
@@ -1831,6 +1974,22 @@ catchpacket(struct bpf_d *d, u_char *pkt
 		 * reader should be woken up.
 		 */
 		do_wakeup = 1;
+#ifdef COMPAT_FREEBSD32
+	/*
+	 * If this is a 32-bit stream, then stick a 32-bit header at the
+	 * front and copy the data into the buffer.
+	 */
+	if (d->bd_compat32) {
+		bzero(&hdr32, sizeof(hdr32));
+		hdr32.bh_tstamp.tv_sec = tv->tv_sec;
+		hdr32.bh_tstamp.tv_usec = tv->tv_usec;
+		hdr32.bh_datalen = pktlen;
+		hdr32.bh_hdrlen = hdrlen;
+		hdr.bh_caplen = hdr32.bh_caplen = totlen - hdrlen;
+		bpf_append_bytes(d, d->bd_sbuf, curlen, &hdr32, sizeof(hdr32));
+		goto copy;
+	}
+#endif
 
 	/*
 	 * Append the bpf header.  Note we append the actual header size, but
@@ -1846,6 +2005,9 @@ catchpacket(struct bpf_d *d, u_char *pkt
 	/*
 	 * Copy the packet data into the store buffer and update its length.
 	 */
+#ifdef COMPAT_FREEBSD32
+ copy:
+#endif
 	(*cpfn)(d, d->bd_sbuf, curlen + hdrlen, pkt, hdr.bh_caplen);
 	d->bd_slen = curlen + totlen;
 

Modified: user/kmacy/head_page_lock_2/sys/net/bpfdesc.h
==============================================================================
--- user/kmacy/head_page_lock_2/sys/net/bpfdesc.h	Sun Apr 25 23:18:02 2010	(r207210)
+++ user/kmacy/head_page_lock_2/sys/net/bpfdesc.h	Sun Apr 25 23:42:23 2010	(r207211)
@@ -97,6 +97,7 @@ struct bpf_d {
 	u_int64_t	bd_wfcount;	/* number of packets that matched write filter */
 	u_int64_t	bd_wdcount;	/* number of packets dropped during a write */
 	u_int64_t	bd_zcopy;	/* number of zero copy operations */
+	u_char		bd_compat32;	/* 32-bit stream on LP64 system */
 };
 
 /* Values for bd_state */

Modified: user/kmacy/head_page_lock_2/sys/net/rtsock.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/net/rtsock.c	Sun Apr 25 23:18:02 2010	(r207210)
+++ user/kmacy/head_page_lock_2/sys/net/rtsock.c	Sun Apr 25 23:42:23 2010	(r207211)
@@ -29,6 +29,7 @@
  *	@(#)rtsock.c	8.7 (Berkeley) 10/12/95
  * $FreeBSD$
  */
+#include "opt_compat.h"
 #include "opt_sctp.h"
 #include "opt_mpath.h"
 #include "opt_inet.h"
@@ -71,6 +72,49 @@ extern void sctp_addr_change(struct ifad
 #endif /* SCTP */
 #endif
 
+#ifdef COMPAT_FREEBSD32
+#include 
+#include 
+
+struct if_data32 {
+	uint8_t	ifi_type;
+	uint8_t	ifi_physical;
+	uint8_t	ifi_addrlen;
+	uint8_t	ifi_hdrlen;
+	uint8_t	ifi_link_state;
+	uint8_t	ifi_spare_char1;
+	uint8_t	ifi_spare_char2;
+	uint8_t	ifi_datalen;
+	uint32_t ifi_mtu;
+	uint32_t ifi_metric;
+	uint32_t ifi_baudrate;
+	uint32_t ifi_ipackets;
+	uint32_t ifi_ierrors;
+	uint32_t ifi_opackets;
+	uint32_t ifi_oerrors;
+	uint32_t ifi_collisions;
+	uint32_t ifi_ibytes;
+	uint32_t ifi_obytes;
+	uint32_t ifi_imcasts;
+	uint32_t ifi_omcasts;
+	uint32_t ifi_iqdrops;
+	uint32_t ifi_noproto;
+	uint32_t ifi_hwassist;
+	int32_t	ifi_epoch;
+	struct	timeval32 ifi_lastchange;
+};
+
+struct if_msghdr32 {
+	uint16_t ifm_msglen;
+	uint8_t	ifm_version;
+	uint8_t	ifm_type;
+	int32_t	ifm_addrs;
+	int32_t	ifm_flags;
+	uint16_t ifm_index;
+	struct	if_data32 ifm_data;
+};
+#endif
+
 MALLOC_DEFINE(M_RTABLE, "routetbl", "routing tables");
 
 /* NB: these are not modified */
@@ -1001,6 +1045,12 @@ again:
 		break;
 
 	case RTM_IFINFO:
+#ifdef COMPAT_FREEBSD32
+		if (w != NULL && w->w_req->flags & SCTL_MASK32) {
+			len = sizeof(struct if_msghdr32);
+			break;
+		}
+#endif
 		len = sizeof(struct if_msghdr);
 		break;
 
@@ -1367,6 +1417,38 @@ sysctl_dumpentry(struct radix_node *rn, 
 	return (error);
 }
 
+#ifdef COMPAT_FREEBSD32
+static void
+copy_ifdata32(struct if_data *src, struct if_data32 *dst)
+{
+
+	bzero(dst, sizeof(*dst));
+	CP(*src, *dst, ifi_type);
+	CP(*src, *dst, ifi_physical);
+	CP(*src, *dst, ifi_addrlen);
+	CP(*src, *dst, ifi_hdrlen);
+	CP(*src, *dst, ifi_link_state);
+	CP(*src, *dst, ifi_datalen);
+	CP(*src, *dst, ifi_mtu);
+	CP(*src, *dst, ifi_metric);
+	CP(*src, *dst, ifi_baudrate);
+	CP(*src, *dst, ifi_ipackets);
+	CP(*src, *dst, ifi_ierrors);
+	CP(*src, *dst, ifi_opackets);
+	CP(*src, *dst, ifi_oerrors);
+	CP(*src, *dst, ifi_collisions);
+	CP(*src, *dst, ifi_ibytes);
+	CP(*src, *dst, ifi_obytes);
+	CP(*src, *dst, ifi_imcasts);
+	CP(*src, *dst, ifi_omcasts);
+	CP(*src, *dst, ifi_iqdrops);
+	CP(*src, *dst, ifi_noproto);
+	CP(*src, *dst, ifi_hwassist);
+	CP(*src, *dst, ifi_epoch);
+	TV_CP(*src, *dst, ifi_lastchange);
+}
+#endif
+
 static int
 sysctl_iflist(int af, struct walkarg *w)
 {
@@ -1387,12 +1469,30 @@ sysctl_iflist(int af, struct walkarg *w)
 		if (w->w_req && w->w_tmem) {
 			struct if_msghdr *ifm;
 
+#ifdef COMPAT_FREEBSD32
+			if (w->w_req->flags & SCTL_MASK32) {
+				struct if_msghdr32 *ifm32;
+
+				ifm32 = (struct if_msghdr32 *)w->w_tmem;
+				ifm32->ifm_index = ifp->if_index;
+				ifm32->ifm_flags = ifp->if_flags |
+				    ifp->if_drv_flags;
+				copy_ifdata32(&ifp->if_data, &ifm32->ifm_data);
+				ifm32->ifm_addrs = info.rti_addrs;
+				error = SYSCTL_OUT(w->w_req, (caddr_t)ifm32,
+				    len);
+				goto sysctl_out;
+			}
+#endif
 			ifm = (struct if_msghdr *)w->w_tmem;
 			ifm->ifm_index = ifp->if_index;
 			ifm->ifm_flags = ifp->if_flags | ifp->if_drv_flags;
 			ifm->ifm_data = ifp->if_data;
 			ifm->ifm_addrs = info.rti_addrs;
-			error = SYSCTL_OUT(w->w_req,(caddr_t)ifm, len);
+			error = SYSCTL_OUT(w->w_req, (caddr_t)ifm, len);
+#ifdef COMPAT_FREEBSD32
+		sysctl_out:
+#endif
 			if (error)
 				goto done;
 		}

Modified: user/kmacy/head_page_lock_2/sys/netinet/sctp_indata.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/netinet/sctp_indata.c	Sun Apr 25 23:18:02 2010	(r207210)
+++ user/kmacy/head_page_lock_2/sys/netinet/sctp_indata.c	Sun Apr 25 23:42:23 2010	(r207211)
@@ -3514,25 +3514,6 @@ sctp_strike_gap_ack_chunks(struct sctp_t
 		if (tp1->sent == SCTP_DATAGRAM_RESEND) {
 			struct sctp_nets *alt;
 
-			if ((stcb->asoc.peer_supports_prsctp) &&
-			    (PR_SCTP_RTX_ENABLED(tp1->flags))) {
-				/*
-				 * Has it been retransmitted tv_sec times? -
-				 * we store the retran count there.
-				 */
-				if (tp1->snd_count > tp1->rec.data.timetodrop.tv_sec) {
-					/* Yes, so drop it */
-					if (tp1->data != NULL) {
-						(void)sctp_release_pr_sctp_chunk(stcb, tp1,
-						    (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT),
-						    SCTP_SO_NOT_LOCKED);
-					}
-					/* Make sure to flag we had a FR */
-					tp1->whoTo->net_ack++;
-					tp1 = TAILQ_NEXT(tp1, sctp_next);
-					continue;
-				}
-			}
 			/* fix counts and things */
 			if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FLIGHT_LOGGING_ENABLE) {
 				sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_RSND,
@@ -3555,6 +3536,25 @@ sctp_strike_gap_ack_chunks(struct sctp_t
 			/* remove from the total flight */
 			sctp_total_flight_decrease(stcb, tp1);
 
+			if ((stcb->asoc.peer_supports_prsctp) &&
+			    (PR_SCTP_RTX_ENABLED(tp1->flags))) {
+				/*
+				 * Has it been retransmitted tv_sec times? -
+				 * we store the retran count there.
+				 */
+				if (tp1->snd_count > tp1->rec.data.timetodrop.tv_sec) {
+					/* Yes, so drop it */
+					if (tp1->data != NULL) {
+						(void)sctp_release_pr_sctp_chunk(stcb, tp1,
+						    (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT),
+						    SCTP_SO_NOT_LOCKED);
+					}
+					/* Make sure to flag we had a FR */
+					tp1->whoTo->net_ack++;
+					tp1 = TAILQ_NEXT(tp1, sctp_next);
+					continue;
+				}
+			}
 			/* printf("OK, we are now ready to FR this guy\n"); */
 			if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) {
 				sctp_log_fr(tp1->rec.data.TSN_seq, tp1->snd_count,

Modified: user/kmacy/head_page_lock_2/sys/netinet/sctp_output.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/netinet/sctp_output.c	Sun Apr 25 23:18:02 2010	(r207210)
+++ user/kmacy/head_page_lock_2/sys/netinet/sctp_output.c	Sun Apr 25 23:42:23 2010	(r207211)
@@ -8973,7 +8973,7 @@ sctp_chunk_retransmission(struct sctp_in
 		/* (void)SCTP_GETTIME_TIMEVAL(&chk->whoTo->last_sent_time); */
 		*cnt_out += 1;
 		chk->sent = SCTP_DATAGRAM_SENT;
-		sctp_ucount_decr(asoc->sent_queue_retran_cnt);
+		/* sctp_ucount_decr(asoc->sent_queue_retran_cnt); */
 		if (fwd_tsn == 0) {
 			return (0);
 		} else {

Modified: user/kmacy/head_page_lock_2/usr.bin/alias/Makefile
==============================================================================
--- user/kmacy/head_page_lock_2/usr.bin/alias/Makefile	Sun Apr 25 23:18:02 2010	(r207210)
+++ user/kmacy/head_page_lock_2/usr.bin/alias/Makefile	Sun Apr 25 23:42:23 2010	(r207211)
@@ -10,8 +10,11 @@ LINKS=	${BINDIR}/alias ${BINDIR}/bg \
 	${BINDIR}/alias ${BINDIR}/fc \
 	${BINDIR}/alias ${BINDIR}/fg \
 	${BINDIR}/alias ${BINDIR}/getopts \
+	${BINDIR}/alias ${BINDIR}/hash \
 	${BINDIR}/alias ${BINDIR}/jobs \
 	${BINDIR}/alias ${BINDIR}/read \
+	${BINDIR}/alias ${BINDIR}/type \
+	${BINDIR}/alias ${BINDIR}/ulimit \
 	${BINDIR}/alias ${BINDIR}/umask \
 	${BINDIR}/alias ${BINDIR}/unalias \
 	${BINDIR}/alias ${BINDIR}/wait

From owner-svn-src-user@FreeBSD.ORG  Sun Apr 25 23:49:32 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 60B321065676;
	Sun, 25 Apr 2010 23:49:32 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 505068FC08;
	Sun, 25 Apr 2010 23:49:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3PNnWmQ007519;
	Sun, 25 Apr 2010 23:49:32 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3PNnWEd007517;
	Sun, 25 Apr 2010 23:49:32 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004252349.o3PNnWEd007517@svn.freebsd.org>
From: Kip Macy 
Date: Sun, 25 Apr 2010 23:49:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207212 - user/kmacy/head_page_lock_2/sys/amd64/amd64
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sun, 25 Apr 2010 23:49:32 -0000

Author: kmacy
Date: Sun Apr 25 23:49:32 2010
New Revision: 207212
URL: http://svn.freebsd.org/changeset/base/207212

Log:
  white space normalization

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Sun Apr 25 23:42:23 2010	(r207211)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Sun Apr 25 23:49:32 2010	(r207212)
@@ -247,7 +247,7 @@ static caddr_t crashdumpmap;
 
 static void	free_pv_entry(pmap_t pmap, pv_entry_t pv);
 static pv_entry_t get_pv_entry(pmap_t locked_pmap);
-static void pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa,
+static void	pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa,
 	struct pv_list_head *pv_list);
 static boolean_t pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
 static void	pmap_pv_promote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
@@ -305,10 +305,6 @@ static vm_offset_t pmap_kmem_choose(vm_o
 CTASSERT(1 << PDESHIFT == sizeof(pd_entry_t));
 CTASSERT(1 << PTESHIFT == sizeof(pt_entry_t));
 
-
-#ifdef INVARIANTS
-extern void kdb_backtrace(void);
-#endif
 /*
  * Move the kernel virtual free pointer to the next
  * 2MB.  This is used to help improve performance
@@ -1845,6 +1841,7 @@ _pmap_allocpte(pmap_t pmap, vm_paddr_t p
 		pd = &pd[ptepindex & ((1ul << NPDEPGSHIFT) - 1)];
 		*pd = VM_PAGE_TO_PHYS(m) | PG_U | PG_RW | PG_V | PG_A | PG_M;
 	}
+
 	pmap_resident_count_inc(pmap, 1);
 
 	return (m);
@@ -2222,7 +2219,6 @@ get_pv_entry(pmap_t pmap)
 	pv = &pc->pc_pventry[0];
 	TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list);
 	PV_STAT(pv_entry_spare += _NPCPV - 1);
-
 	return (pv);
 }
 
@@ -2937,7 +2933,6 @@ restart:
 
 		for (pte = pmap_pde_to_pte(pde, sva); sva != va_next; pte++,
 		    sva += PAGE_SIZE) {
-
 			if (*pte == 0)
 				continue;
 

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 26 01:12:14 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 333201065673;
	Mon, 26 Apr 2010 01:12:14 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 23B448FC19;
	Mon, 26 Apr 2010 01:12:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3Q1CERZ025678;
	Mon, 26 Apr 2010 01:12:14 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3Q1CE6o025676;
	Mon, 26 Apr 2010 01:12:14 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004260112.o3Q1CE6o025676@svn.freebsd.org>
From: Kip Macy 
Date: Mon, 26 Apr 2010 01:12:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207214 - user/kmacy/head_page_lock_2/sys/vm
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Apr 2010 01:12:14 -0000

Author: kmacy
Date: Mon Apr 26 01:12:13 2010
New Revision: 207214
URL: http://svn.freebsd.org/changeset/base/207214

Log:
  My understanding (alc correct me if I'm wrong) is that we don't need protect wire_count if the page is unmanaged
  and the wire count is 1

Modified:
  user/kmacy/head_page_lock_2/sys/vm/vm_page.c

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_page.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_page.c	Sun Apr 25 23:51:05 2010	(r207213)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_page.c	Mon Apr 26 01:12:13 2010	(r207214)
@@ -1595,10 +1595,13 @@ void
 vm_page_unwire(vm_page_t m, int activate)
 {
 
-	vm_page_lock_assert(m, MA_OWNED);
 	if (m->flags & PG_FICTITIOUS)
 		return;
 	if (m->wire_count > 0) {
+#ifdef INVARIANTS
+		if ((m->wire_count > 1) || !(m->flags & PG_UNMANAGED))
+			vm_page_lock_assert(m, MA_OWNED);
+#endif		
 		m->wire_count--;
 		if (m->wire_count == 0) {
 			atomic_subtract_int(&cnt.v_wire_count, 1);

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 26 01:13:11 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1A169106566C;
	Mon, 26 Apr 2010 01:13:11 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0A57E8FC14;
	Mon, 26 Apr 2010 01:13:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3Q1DAaj025940;
	Mon, 26 Apr 2010 01:13:10 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3Q1DAUd025938;
	Mon, 26 Apr 2010 01:13:10 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004260113.o3Q1DAUd025938@svn.freebsd.org>
From: Kip Macy 
Date: Mon, 26 Apr 2010 01:13:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207215 - user/kmacy/head_page_lock_2/sys/amd64/amd64
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Apr 2010 01:13:11 -0000

Author: kmacy
Date: Mon Apr 26 01:13:10 2010
New Revision: 207215
URL: http://svn.freebsd.org/changeset/base/207215

Log:
  - white space cleanup
  - use vm_page_unwire in the same places that it is used on HEAD

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 26 01:12:13 2010	(r207214)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 26 01:13:10 2010	(r207215)
@@ -2146,9 +2146,7 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv
 	/* entire chunk is free, return it */
 	m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc));
 	dump_drop_page(m->phys_addr);
-	KASSERT(m->wire_count == 1, ("wire_count == %d", m->wire_count));
-	m->wire_count--;
-	atomic_subtract_int(&cnt.v_wire_count, 1);
+	vm_page_unwire(m, 0);
 	vm_page_free(m);
 }
 
@@ -3339,15 +3337,14 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
 	vm_paddr_t pa;
 	pd_entry_t *pde;
 	pt_entry_t *pte;
-	vm_paddr_t opa, lockedpa;
 	pt_entry_t origpte, newpte;
 	vm_page_t mpte, om;
 	boolean_t invlva, opalocked;
+	vm_paddr_t lockedpa, opa = 0;
 	pv_entry_t pv;
 	struct lock_stack ls;
 
 	va = trunc_page(va);
-
 	KASSERT(va <= VM_MAX_KERNEL_ADDRESS, ("pmap_enter: toobig"));
 	KASSERT(va < UPT_MIN_ADDRESS || va >= UPT_MAX_ADDRESS,
 	    ("pmap_enter: invalid to pmap_enter page table pages (va: 0x%lx)", va));
@@ -3355,7 +3352,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
 	mpte = NULL;
 	pv = NULL;
 	lockedpa = pa = VM_PAGE_TO_PHYS(m);
-	opa = 0;
 	opalocked = FALSE;
 	ls_init(&ls);
 	ls_push(&ls, &lock_class_mtx_sleep,
@@ -4413,10 +4409,7 @@ restart:
 			TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
 			m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc));
 			dump_drop_page(m->phys_addr);
-			KASSERT(m->wire_count == 1,
-			    ("wire_count == %d", m->wire_count));
-			m->wire_count = 0;
-			atomic_subtract_int(&cnt.v_wire_count, 1);
+			vm_page_unwire(m, 0);
 			vm_page_free(m);
 		}
 	}

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 26 01:40:52 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8FBB5106566B;
	Mon, 26 Apr 2010 01:40:52 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 66CA18FC08;
	Mon, 26 Apr 2010 01:40:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3Q1eq6k032021;
	Mon, 26 Apr 2010 01:40:52 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3Q1eqAU032019;
	Mon, 26 Apr 2010 01:40:52 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004260140.o3Q1eqAU032019@svn.freebsd.org>
From: Kip Macy 
Date: Mon, 26 Apr 2010 01:40:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207216 - user/kmacy/head_page_lock_2/sys/amd64/amd64
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Apr 2010 01:40:52 -0000

Author: kmacy
Date: Mon Apr 26 01:40:52 2010
New Revision: 207216
URL: http://svn.freebsd.org/changeset/base/207216

Log:
  - more white space harmonization
  - move pmap lock out of the loop in pmap_enter_object (as on HEAD)

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 26 01:13:10 2010	(r207215)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 26 01:40:52 2010	(r207216)
@@ -2124,10 +2124,9 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv
 	int idx, field, bit;
 
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
-
-	atomic_add_int(&pv_entry_count, -1);
 	PV_STAT(pv_entry_frees++);
 	PV_STAT(pv_entry_spare++);
+	atomic_add_int(&pv_entry_count, -1);
 	pc = pv_to_chunk(pv);
 	idx = pv - &pc->pc_pventry[0];
 	field = idx / 64;
@@ -2167,9 +2166,8 @@ get_pv_entry(pmap_t pmap)
 	vm_page_t m;
 
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
-
-	atomic_add_int(&pv_entry_count, 1);
 	PV_STAT(pv_entry_allocs++);
+	atomic_add_int(&pv_entry_count, 1);
 	if (pv_entry_count > pv_entry_high_water)
 		if (ratecheck(&lastprint, &printinterval))
 			printf("Approaching the limit on PV entries, consider "
@@ -3647,15 +3645,19 @@ pmap_enter_object(pmap_t pmap, vm_offset
 	vm_offset_t va;
 	vm_page_t m, mpte;
 	vm_pindex_t diff, psize;
+	vm_paddr_t pa;
 
 	VM_OBJECT_LOCK_ASSERT(m_start->object, MA_OWNED);
 	psize = atop(end - start);
 	mpte = NULL;
 	m = m_start;
+	pa = 0;
+	PMAP_LOCK(pmap);
+restart:	
 	while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) {
 		va = start + ptoa(diff);
-		vm_page_lock(m);
-		PMAP_LOCK(pmap);
+		if (pa_tryrelock(pmap, VM_PAGE_TO_PHYS(m), &pa))
+			goto restart;
 		if ((va & PDRMASK) == 0 && va + NBPDR <= end &&
 		    (VM_PAGE_TO_PHYS(m) & PDRMASK) == 0 &&
 		    pg_ps_enabled && vm_reserv_level_iffullpop(m) == 0 &&
@@ -3664,10 +3666,11 @@ pmap_enter_object(pmap_t pmap, vm_offset
 		else
 			mpte = pmap_enter_quick_locked(pmap, va, m, prot,
 			    mpte);
-		PMAP_UNLOCK(pmap);
-		vm_page_unlock(m);
 		m = TAILQ_NEXT(m, listq);
 	}
+	if (pa)
+		PA_UNLOCK(pa);
+	PMAP_UNLOCK(pmap);
 }
 
 /*

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 26 01:54:45 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D5DBE106566C;
	Mon, 26 Apr 2010 01:54:45 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C5F068FC1B;
	Mon, 26 Apr 2010 01:54:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3Q1sjwp035077;
	Mon, 26 Apr 2010 01:54:45 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3Q1sjKi035075;
	Mon, 26 Apr 2010 01:54:45 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004260154.o3Q1sjKi035075@svn.freebsd.org>
From: Kip Macy 
Date: Mon, 26 Apr 2010 01:54:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207217 - user/kmacy/head_page_lock_2/sys/amd64/amd64
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Apr 2010 01:54:45 -0000

Author: kmacy
Date: Mon Apr 26 01:54:45 2010
New Revision: 207217
URL: http://svn.freebsd.org/changeset/base/207217

Log:
  consolidate pv list functions

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 26 01:40:52 2010	(r207216)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 26 01:54:45 2010	(r207217)
@@ -2218,6 +2218,10 @@ get_pv_entry(pmap_t pmap)
 	return (pv);
 }
 
+/*
+ * Utility functions for managing pv lists
+ * essentially handling pre-allocation and failure of pre-allocation
+ */
 static void
 pmap_pv_list_free(pmap_t pmap, struct pv_list_head *pv_list)
 {
@@ -2271,6 +2275,80 @@ done:
 	return (success);
 }
 
+static void
+pmap_prealloc_pv_list(pmap_t pmap, vm_offset_t sva, vm_offset_t eva,
+	struct pv_list_head *pv_list)
+{
+	vm_offset_t va_next;
+	pml4_entry_t *pml4e;
+	pdp_entry_t *pdpe;
+	pd_entry_t ptpaddr, *pde;
+	pt_entry_t *pte;
+	int i, alloc_count;
+
+	alloc_count = 0;
+	PMAP_LOCK(pmap);
+	for (; sva < eva; sva = va_next) {
+
+		pml4e = pmap_pml4e(pmap, sva);
+		if ((*pml4e & PG_V) == 0) {
+			va_next = (sva + NBPML4) & ~PML4MASK;
+			if (va_next < sva)
+				va_next = eva;
+			continue;
+		}
+
+		pdpe = pmap_pml4e_to_pdpe(pml4e, sva);
+		if ((*pdpe & PG_V) == 0) {
+			va_next = (sva + NBPDP) & ~PDPMASK;
+			if (va_next < sva)
+				va_next = eva;
+			continue;
+		}
+
+		/*
+		 * Calculate index for next page table.
+		 */
+		va_next = (sva + NBPDR) & ~PDRMASK;
+		if (va_next < sva)
+			va_next = eva;
+
+		pde = pmap_pdpe_to_pde(pdpe, sva);
+		ptpaddr = *pde;
+
+		/*
+		 * Weed out invalid mappings.
+		 */
+		if (ptpaddr == 0)
+			continue;
+
+		/*
+		 * Check for large page.
+		 */
+		if ((ptpaddr & PG_PS) != 0) {
+			alloc_count++;
+			continue;
+		}
+		/*
+		 * Limit our scan to either the end of the va represented
+		 * by the current page table page, or to the end of the
+		 * range being removed.
+		 */
+		if (va_next > eva)
+			va_next = eva;
+
+		for (pte = pmap_pde_to_pte(pde, sva); sva != va_next; pte++,
+		    sva += PAGE_SIZE) {
+			if (*pte == 0)
+				continue;
+		}
+	}
+	for (i = 0; i < alloc_count; i++)
+		pmap_pv_list_alloc(pmap, NPTEPG-1, pv_list);
+
+	PMAP_UNLOCK(pmap);
+}
+
 /*
  * First find and then remove the pv entry for the specified pmap and virtual
  * address from the specified pv list.  Returns the pv entry if found and NULL
@@ -2716,80 +2794,6 @@ pmap_remove_page(pmap_t pmap, vm_offset_
 	pmap_invalidate_page(pmap, va);
 }
 
-static void
-pmap_prealloc_pv_list(pmap_t pmap, vm_offset_t sva, vm_offset_t eva,
-	struct pv_list_head *pv_list)
-{
-	vm_offset_t va_next;
-	pml4_entry_t *pml4e;
-	pdp_entry_t *pdpe;
-	pd_entry_t ptpaddr, *pde;
-	pt_entry_t *pte;
-	int i, alloc_count;
-
-	alloc_count = 0;
-	PMAP_LOCK(pmap);
-	for (; sva < eva; sva = va_next) {
-
-		pml4e = pmap_pml4e(pmap, sva);
-		if ((*pml4e & PG_V) == 0) {
-			va_next = (sva + NBPML4) & ~PML4MASK;
-			if (va_next < sva)
-				va_next = eva;
-			continue;
-		}
-
-		pdpe = pmap_pml4e_to_pdpe(pml4e, sva);
-		if ((*pdpe & PG_V) == 0) {
-			va_next = (sva + NBPDP) & ~PDPMASK;
-			if (va_next < sva)
-				va_next = eva;
-			continue;
-		}
-
-		/*
-		 * Calculate index for next page table.
-		 */
-		va_next = (sva + NBPDR) & ~PDRMASK;
-		if (va_next < sva)
-			va_next = eva;
-
-		pde = pmap_pdpe_to_pde(pdpe, sva);
-		ptpaddr = *pde;
-
-		/*
-		 * Weed out invalid mappings.
-		 */
-		if (ptpaddr == 0)
-			continue;
-
-		/*
-		 * Check for large page.
-		 */
-		if ((ptpaddr & PG_PS) != 0) {
-			alloc_count++;
-			continue;
-		}
-		/*
-		 * Limit our scan to either the end of the va represented
-		 * by the current page table page, or to the end of the
-		 * range being removed.
-		 */
-		if (va_next > eva)
-			va_next = eva;
-
-		for (pte = pmap_pde_to_pte(pde, sva); sva != va_next; pte++,
-		    sva += PAGE_SIZE) {
-			if (*pte == 0)
-				continue;
-		}
-	}
-	for (i = 0; i < alloc_count; i++)
-		pmap_pv_list_alloc(pmap, NPTEPG-1, pv_list);
-
-	PMAP_UNLOCK(pmap);
-}
-
 /*
  *	Remove the given range of addresses from the specified map.
  *

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 26 02:35:38 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DDDEA106564A;
	Mon, 26 Apr 2010 02:35:37 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CE5298FC1F;
	Mon, 26 Apr 2010 02:35:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3Q2ZbVF044041;
	Mon, 26 Apr 2010 02:35:37 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3Q2Zb8M044039;
	Mon, 26 Apr 2010 02:35:37 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004260235.o3Q2Zb8M044039@svn.freebsd.org>
From: Kip Macy 
Date: Mon, 26 Apr 2010 02:35:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207218 - user/kmacy/head_page_lock_2/sys/amd64/amd64
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Apr 2010 02:35:38 -0000

Author: kmacy
Date: Mon Apr 26 02:35:37 2010
New Revision: 207218
URL: http://svn.freebsd.org/changeset/base/207218

Log:
  - white space harmonize
  - collapse expressions and remove temporary in pmap_change_wiring
  - remove invalid XXX pmap lock drop
  - handle two cases of pmap lock drop with gen_count check

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 26 01:54:45 2010	(r207217)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 26 02:35:37 2010	(r207218)
@@ -2946,10 +2946,6 @@ restart:
 			 */
 			if ((*pte & PG_G) == 0)
 				anyvalid = 1;
-			/*
-			 * XXX check if the pmap lock was dropped - maybe we need 
-			 * to restart
-			 */
 			if (pmap_remove_pte(pmap, pte, sva, ptpaddr, &free))
 				break;
 		}
@@ -3024,11 +3020,6 @@ pmap_remove_all(vm_page_t m)
 		if ((tpte & (PG_M | PG_RW)) == (PG_M | PG_RW))
 			vm_page_dirty(m);
 		free = NULL;
-
-		/*
-		 * XXX pmap_unuse_pt can drop the pmap lock
-		 *
-		 */
 		pmap_unuse_pt(pmap, pv->pv_va, *pde, &free);
 		pmap_invalidate_page(pmap, pv->pv_va);
 		pmap_free_zero_pages(free);
@@ -3106,6 +3097,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sv
 	TAILQ_INIT(&pv_list);
 	pa = 0;
 	anychanged = 0;
+
 	PMAP_LOCK(pmap);
 restart:	
 	for (; sva < eva; sva = va_next) {
@@ -3690,7 +3682,6 @@ void
 pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot)
 {
 
-	vm_page_lock_assert(m, MA_OWNED);
 	PMAP_LOCK(pmap);
 	(void) pmap_enter_quick_locked(pmap, va, m, prot, NULL);
 	PMAP_UNLOCK(pmap);
@@ -3913,9 +3904,9 @@ pmap_change_wiring(pmap_t pmap, vm_offse
 {
 	pd_entry_t *pde;
 	pt_entry_t *pte;
-	vm_paddr_t pa;
-	boolean_t slept;
 	struct pv_list_head pv_list;
+	uint32_t gen_count;
+	vm_paddr_t pa = 0;
 
 	TAILQ_INIT(&pv_list);
 
@@ -3923,27 +3914,23 @@ pmap_change_wiring(pmap_t pmap, vm_offse
 	 * Wiring is not a hardware characteristic so there is no need to
 	 * invalidate TLB.
 	 */
-	pa = 0;
 	PMAP_LOCK(pmap);
 retry:
-	slept = FALSE;
 	pde = pmap_pde(pmap, va);
 	if ((*pde & PG_PS) && (!wired != ((*pde & PG_W) == 0))) {
-		if (TAILQ_EMPTY(&pv_list))
-			slept = pmap_pv_list_alloc(pmap, NPTEPG-1, &pv_list);
-		if (slept)
+		if (TAILQ_EMPTY(&pv_list) &&
+		    pmap_pv_list_alloc(pmap, NPTEPG-1, &pv_list))
 			goto retry;
-		
 		if (pa_tryrelock(pmap, *pde & PG_FRAME, &pa))
 			goto retry;
 	}
 	if ((*pde & PG_PS) != 0) {
 		if (!wired != ((*pde & PG_W) == 0)) {
-			/*
-			 * XXX do we need to check if the pmap lock was dropped
-			 */
+			gen_count = pmap->pm_gen_count;
 			if (!pmap_demote_pde(pmap, pde, va, &pv_list))
 				panic("pmap_change_wiring: demotion failed");
+			if (gen_count != pmap->pm_gen_count)
+				goto retry;
 		} else
 			goto out;
 	}
@@ -4298,6 +4285,7 @@ pmap_remove_pages(pmap_t pmap)
 	int field, idx, iter;
 	int64_t bit;
 	uint64_t inuse, bitmask;
+	uint32_t gen_count;
 	int allfree;
 
 	if (pmap != vmspace_pmap(curthread->td_proc->p_vmspace)) {
@@ -4402,11 +4390,11 @@ restart:
 							vm_page_flag_clear(m, PG_WRITEABLE);
 					}
 				}
-				/*
-				 *
-				 * XXX check if the pmap lock has been dropped
-				 */
+				gen_count = pmap->pm_gen_count;
 				pmap_unuse_pt(pmap, pv->pv_va, ptepde, &free);
+				if (pmap->pm_gen_count != gen_count &&
+				    pmap->pm_gen_count != gen_count + 1)
+					goto restart;
 			}
 		}
 		if (allfree) {

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 26 03:16:01 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 41A861065674;
	Mon, 26 Apr 2010 03:16:01 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3124E8FC1A;
	Mon, 26 Apr 2010 03:16:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3Q3G1cE053283;
	Mon, 26 Apr 2010 03:16:01 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3Q3G11J053280;
	Mon, 26 Apr 2010 03:16:01 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004260316.o3Q3G11J053280@svn.freebsd.org>
From: Kip Macy 
Date: Mon, 26 Apr 2010 03:16:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207219 - in user/kmacy/head_page_lock_2/sys/amd64:
	amd64 include
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Apr 2010 03:16:01 -0000

Author: kmacy
Date: Mon Apr 26 03:16:00 2010
New Revision: 207219
URL: http://svn.freebsd.org/changeset/base/207219

Log:
  - remove ugly lock_object casts by creating LOCKOBJPTR macros
  - replace if (pa) PA_UNLOCK(pa) with PA_UNLOCK_COND(pa)
  - avoid LOR in pmap_pv_demote_pde - the initial pa is already locked and subsequent pages need to
    be locked with pa_tryrelock

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
  user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 26 02:35:37 2010	(r207218)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 26 03:16:00 2010	(r207219)
@@ -177,10 +177,18 @@ struct vp_lock {
 #define	pa_to_pvh(pa)	(&pv_table[pa_index(pa)])
 
 #define	PA_LOCKPTR(pa)	&pa_lock[pa_index((pa)) % PA_LOCK_COUNT].vp_lock
+#define	PA_LOCKOBJPTR(pa)	((struct lock_object *)PA_LOCKPTR((pa)))
 #define	PA_LOCK(pa)	mtx_lock(PA_LOCKPTR(pa))
 #define	PA_TRYLOCK(pa)	mtx_trylock(PA_LOCKPTR(pa))
 #define	PA_UNLOCK(pa)	mtx_unlock(PA_LOCKPTR(pa))
+#define PA_UNLOCK_COND(pa) 			\
+	do {		   			\
+		if (pa) 			\
+			PA_UNLOCK(pa);		\
+	} while (0)
+
 #define	PA_LOCK_ASSERT(pa, a)	mtx_assert(PA_LOCKPTR(pa), (a))
+#define	PMAP_LOCKOBJPTR(pmap)	((struct lock_object *)(&(pmap)->pm_mtx))
 
 #define	PA_LOCK_COUNT	256
 
@@ -1300,7 +1308,6 @@ retry:
 				if (pa_tryrelock(pmap, (pde & PG_PS_FRAME) |
 				       (va & PDRMASK), &pa))
 					goto retry;
-
 				m = PHYS_TO_VM_PAGE((pde & PG_PS_FRAME) |
 				    (va & PDRMASK));
 				vm_page_hold(m);
@@ -1316,8 +1323,7 @@ retry:
 			}
 		}
 	}
-	if (pa)
-		PA_UNLOCK(pa);
+	PA_UNLOCK_COND(pa);
 	PMAP_UNLOCK(pmap);
 	return (m);
 }
@@ -2377,30 +2383,29 @@ pmap_pvh_remove(struct md_page *pvh, pma
  * entries for each of the 4KB page mappings.
  */
 static void
-pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa,
+pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t paddr,
 	struct pv_list_head *pv_list)
 {
 	struct md_page *pvh;
 	pv_entry_t pv;
 	vm_offset_t va_last;
 	vm_page_t m;
+	vm_paddr_t pa = 0;
 
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
-	PA_LOCK_ASSERT(pa, MA_OWNED);
+	PA_LOCK_ASSERT(paddr, MA_OWNED);
 	KASSERT((pa & PDRMASK) == 0,
 	    ("pmap_pv_demote_pde: pa is not 2mpage aligned"));
 
 	 /* Transfer the 2mpage's pv entry for this mapping to the first
 	  *  page's pv list.
 	  */
-	pvh = pa_to_pvh(pa);
+	pvh = pa_to_pvh(paddr);
 	va = trunc_2mpage(va);
 	pv = pmap_pvh_remove(pvh, pmap, va);
 	KASSERT(pv != NULL, ("pmap_pv_demote_pde: pv not found"));
-	m = PHYS_TO_VM_PAGE(pa);
-	vm_page_lock(m);
+	m = PHYS_TO_VM_PAGE(paddr);
 	TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
-	vm_page_unlock(m);
 	/* We open ourselves up to an LOR by doing the page lock acquisitions
 	 * with the pmap lock held - which raises the question as to whether
 	 * we should use pa_tryrelock (can the pmap be corrupted if we allow it
@@ -2417,10 +2422,10 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse
 		pv = TAILQ_FIRST(pv_list);
 		TAILQ_REMOVE(pv_list, pv, pv_list);
 		pv->pv_va = va;
-		vm_page_lock(m);
+		pa_tryrelock(pmap, VM_PAGE_TO_PHYS(m), &pa);
 		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
-		vm_page_unlock(m);
 	} while (va < va_last);
+	PA_UNLOCK_COND(pa);
 }
 
 /*
@@ -2711,8 +2716,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t 
 			    TAILQ_EMPTY(&pvh->pv_list))
 				vm_page_flag_clear(m, PG_WRITEABLE);
 		}
-		if (pa)
-			PA_UNLOCK(pa);
+		PA_UNLOCK_COND(pa);
 	}
 	if (pmap == kernel_pmap) {
 		/*
@@ -2789,8 +2793,7 @@ pmap_remove_page(pmap_t pmap, vm_offset_
 		(void)pa_tryrelock(pmap, *pte & PG_FRAME, &pa);
 
 	pmap_remove_pte(pmap, pte, va, *pde, free);
-	if (pa)
-		PA_UNLOCK(pa);
+	PA_UNLOCK_COND(pa);
 	pmap_invalidate_page(pmap, va);
 }
 
@@ -2939,7 +2942,6 @@ restart:
 			if  ((*pte & PG_MANAGED) &&
 			    pa_tryrelock(pmap, *pte & PG_FRAME, &pa))
 				goto restart;
-
 			/*
 			 * The TLB entry for a PG_G mapping is invalidated
 			 * by pmap_remove_pte().
@@ -2951,8 +2953,7 @@ restart:
 		}
 	}
 out:
-	if (pa)
-		PA_UNLOCK(pa);
+	PA_UNLOCK_COND(pa);
 	if (anyvalid)
 		pmap_invalidate_all(pmap);
 	if (!TAILQ_EMPTY(&pv_list))
@@ -3189,8 +3190,7 @@ retry:
 			}
 		}
 	}
-	if (pa)
-		PA_UNLOCK(pa);
+	PA_UNLOCK_COND(pa);
 	if (anychanged)
 		pmap_invalidate_all(pmap);
 	PMAP_UNLOCK(pmap);
@@ -3348,19 +3348,15 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
 	lockedpa = pa = VM_PAGE_TO_PHYS(m);
 	opalocked = FALSE;
 	ls_init(&ls);
-	ls_push(&ls, &lock_class_mtx_sleep,
-	    (struct lock_object *)PA_LOCKPTR(lockedpa));
-	ls_push(&ls, &lock_class_mtx_sleep,
-	    (struct lock_object *)PMAP_LOCKPTR(pmap));
+	ls_push(&ls, &lock_class_mtx_sleep, PA_LOCKOBJPTR(lockedpa));
+	ls_push(&ls, &lock_class_mtx_sleep, PMAP_LOCKOBJPTR(pmap));
 	PMAP_UPDATE_GEN_COUNT(pmap);
 	if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) {
 		while ((pv = get_pv_entry(pmap)) == NULL) {
 			ls_popa(&ls);
 			VM_WAIT;
-			ls_push(&ls, &lock_class_mtx_sleep,
-			    (struct lock_object *)PA_LOCKPTR(lockedpa));
-			ls_push(&ls, &lock_class_mtx_sleep,
-			    (struct lock_object *)PMAP_LOCKPTR(pmap));
+			ls_push(&ls, &lock_class_mtx_sleep, PA_LOCKOBJPTR(lockedpa));
+			ls_push(&ls, &lock_class_mtx_sleep, PMAP_LOCKOBJPTR(pmap));
 			PMAP_UPDATE_GEN_COUNT(pmap);
 		}
 	}
@@ -3385,10 +3381,8 @@ restart:
 	origpte = *pte;
 	if (opa && (opa != (origpte & PG_FRAME))) {
 		ls_popa(&ls);
-		ls_push(&ls, &lock_class_mtx_sleep,
-			    (struct lock_object *)PA_LOCKPTR(lockedpa));
-		ls_push(&ls, &lock_class_mtx_sleep,
-			    (struct lock_object *)PMAP_LOCKPTR(pmap));
+		ls_push(&ls, &lock_class_mtx_sleep, PA_LOCKOBJPTR(lockedpa));
+		ls_push(&ls, &lock_class_mtx_sleep, PMAP_LOCKOBJPTR(pmap));
 		PMAP_UPDATE_GEN_COUNT(pmap);
 		opalocked = FALSE;
 		opa = 0;
@@ -3398,23 +3392,17 @@ restart:
 	opa = origpte & PG_FRAME;
 	if (opa && (opa != lockedpa) && (opalocked == FALSE)) {
 		opalocked = TRUE;
-		if (ls_trypush(&ls, &lock_class_mtx_sleep,
-			(struct lock_object *)PA_LOCKPTR(opa)) == 0) {
+		if (ls_trypush(&ls, &lock_class_mtx_sleep, PA_LOCKOBJPTR(opa)) == 0) {
 			ls_popa(&ls);
 			if ((uintptr_t)PA_LOCKPTR(lockedpa) <
 			    (uintptr_t)PA_LOCKPTR(opa)) {
-				ls_push(&ls, &lock_class_mtx_sleep,
-				    (struct lock_object *)PA_LOCKPTR(lockedpa));
-				ls_push(&ls, &lock_class_mtx_sleep,
-				    (struct lock_object *)PA_LOCKPTR(opa));
+				ls_push(&ls, &lock_class_mtx_sleep, PA_LOCKOBJPTR(lockedpa));
+				ls_push(&ls, &lock_class_mtx_sleep, PA_LOCKOBJPTR(opa));
 			} else {
-				ls_push(&ls, &lock_class_mtx_sleep,
-				    (struct lock_object *)PA_LOCKPTR(opa));
-				ls_push(&ls, &lock_class_mtx_sleep,
-				    (struct lock_object *)PA_LOCKPTR(lockedpa));
+				ls_push(&ls, &lock_class_mtx_sleep, PA_LOCKOBJPTR(opa));
+				ls_push(&ls, &lock_class_mtx_sleep, PA_LOCKOBJPTR(lockedpa));
 			}
-			ls_push(&ls, &lock_class_mtx_sleep,
-			    (struct lock_object *)PMAP_LOCKPTR(pmap));
+			ls_push(&ls, &lock_class_mtx_sleep, PMAP_LOCKOBJPTR(pmap));
 			PMAP_UPDATE_GEN_COUNT(pmap);
 			goto restart;
 		}
@@ -3664,8 +3652,7 @@ restart:	
 			    mpte);
 		m = TAILQ_NEXT(m, listq);
 	}
-	if (pa)
-		PA_UNLOCK(pa);
+	PA_UNLOCK_COND(pa);
 	PMAP_UNLOCK(pmap);
 }
 
@@ -3943,8 +3930,7 @@ retry:
 		atomic_clear_long(pte, PG_W);
 	}
 out:
-	if (pa)
-		PA_UNLOCK(pa);
+	PA_UNLOCK_COND(pa);
 	if (!TAILQ_EMPTY(&pv_list))
 		pmap_pv_list_free(pmap, &pv_list);
 	PMAP_UNLOCK(pmap);
@@ -4408,8 +4394,7 @@ restart:
 			vm_page_free(m);
 		}
 	}
-	if (pa)
-		PA_UNLOCK(pa);
+	PA_UNLOCK_COND(pa);
 
 	pmap_invalidate_all(pmap);
 	PMAP_UNLOCK(pmap);

Modified: user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h	Mon Apr 26 02:35:37 2010	(r207218)
+++ user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h	Mon Apr 26 03:16:00 2010	(r207219)
@@ -267,8 +267,6 @@ extern struct pmap	kernel_pmap_store;
 		PMAP_UPDATE_GEN_COUNT((pmap));			\
 	} while (0)
 
-#define	PMAP_LOCKPTR(pmap)	(&(pmap)->pm_mtx)
-
 #define	PMAP_LOCK_ASSERT(pmap, type)					\
 				mtx_assert(&(pmap)->pm_mtx, (type))
 #define	PMAP_LOCK_DESTROY(pmap)	mtx_destroy(&(pmap)->pm_mtx)

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 26 04:32:29 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9AD17106564A;
	Mon, 26 Apr 2010 04:32:29 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8AF438FC30;
	Mon, 26 Apr 2010 04:32:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3Q4WTFU069970;
	Mon, 26 Apr 2010 04:32:29 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3Q4WTpe069968;
	Mon, 26 Apr 2010 04:32:29 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201004260432.o3Q4WTpe069968@svn.freebsd.org>
From: Doug Barton 
Date: Mon, 26 Apr 2010 04:32:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207220 - user/dougb/portmaster
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Apr 2010 04:32:29 -0000

Author: dougb
Date: Mon Apr 26 04:32:29 2010
New Revision: 207220
URL: http://svn.freebsd.org/changeset/base/207220

Log:
  For the handling of no ORIGIN all_config() needs the same logic
  as the main parser.
  
  For the case of bsdpan port, or +IGNOREME, add $iport to $CUR_DEPS
  so that the user is not reprompted at build time.

Modified:
  user/dougb/portmaster/portmaster

Modified: user/dougb/portmaster/portmaster
==============================================================================
--- user/dougb/portmaster/portmaster	Mon Apr 26 03:16:00 2010	(r207219)
+++ user/dougb/portmaster/portmaster	Mon Apr 26 04:32:29 2010	(r207220)
@@ -2471,7 +2471,20 @@ all_config () {
 
 		case "$CUR_DEPS" in *:${iport}:*) continue ;; esac
 
-		origin=`origin_from_pdb $iport` || continue
+		origin=`origin_from_pdb $iport` || {
+			case "$?" in
+			3) ;;
+			2) [ -z "$PM_VERBOSE" ] &&
+				echo "	===>>> No ORIGIN for $iport, and +IGNOREME is present"
+				echo "	===>>> Skipping"
+				echo '' ;;
+			*)	fail 'Cannot continue' ;;
+			esac;
+
+			# Prevent the user from getting reprompted during build
+			CUR_DEPS="${CUR_DEPS}${iport}:";
+			continue; }
+
 		case "$CONFIG_SEEN_LIST" in *:${origin}:*) continue ;; esac
 
 		[ -n "$PM_BUILD_ONLY_LIST" ] &&

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 26 14:33:33 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0E31F1065672;
	Mon, 26 Apr 2010 14:33:33 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id D45E58FC08;
	Mon, 26 Apr 2010 14:33:32 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 86C5646B53;
	Mon, 26 Apr 2010 10:33:32 -0400 (EDT)
Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id BB69A8A025;
	Mon, 26 Apr 2010 10:33:31 -0400 (EDT)
From: John Baldwin 
To: Kip Macy 
Date: Mon, 26 Apr 2010 10:08:18 -0400
User-Agent: KMail/1.12.1 (FreeBSD/7.3-CBSD-20100217; KDE/4.3.1; amd64; ; )
References: <201004260316.o3Q3G11J053280@svn.freebsd.org>
In-Reply-To: <201004260316.o3Q3G11J053280@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <201004261008.18820.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Mon, 26 Apr 2010 10:33:31 -0400 (EDT)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham
	version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: Re: svn commit: r207219 - in user/kmacy/head_page_lock_2/sys/amd64:
	amd64 include
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Apr 2010 14:33:33 -0000

On Sunday 25 April 2010 11:16:01 pm Kip Macy wrote:
> Author: kmacy
> Date: Mon Apr 26 03:16:00 2010
> New Revision: 207219
> URL: http://svn.freebsd.org/changeset/base/207219
> 
> Log:
>   - remove ugly lock_object casts by creating LOCKOBJPTR macros
>   - replace if (pa) PA_UNLOCK(pa) with PA_UNLOCK_COND(pa)
>   - avoid LOR in pmap_pv_demote_pde - the initial pa is already locked and 
subsequent pages need to
>     be locked with pa_tryrelock
> 
> Modified:
>   user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
>   user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h
> 
> Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
> 
==============================================================================
> --- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 26 02:35:37 
2010	(r207218)
> +++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 26 03:16:00 
2010	(r207219)
> @@ -177,10 +177,18 @@ struct vp_lock {
>  #define	pa_to_pvh(pa)	(&pv_table[pa_index(pa)])
>  
>  #define	PA_LOCKPTR(pa)	&pa_lock[pa_index((pa)) % PA_LOCK_COUNT].vp_lock
> +#define	PA_LOCKOBJPTR(pa)	((struct lock_object *)PA_LOCKPTR((pa)))
>  #define	PA_LOCK(pa)	mtx_lock(PA_LOCKPTR(pa))
>  #define	PA_TRYLOCK(pa)	mtx_trylock(PA_LOCKPTR(pa))
>  #define	PA_UNLOCK(pa)	mtx_unlock(PA_LOCKPTR(pa))
> +#define PA_UNLOCK_COND(pa) 			\
> +	do {		   			\
> +		if (pa) 			\
> +			PA_UNLOCK(pa);		\
> +	} while (0)
> +
>  #define	PA_LOCK_ASSERT(pa, a)	mtx_assert(PA_LOCKPTR(pa), (a))
> +#define	PMAP_LOCKOBJPTR(pmap)	((struct lock_object *)(&(pmap)->pm_mtx))

FWIW, I would actually prefer to use something like &PA_LOCKPTR(pa)->lo_object 
rather than casts.

-- 
John Baldwin

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 26 19:19:01 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9BFB81065673;
	Mon, 26 Apr 2010 19:19:01 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8A7AE8FC0C;
	Mon, 26 Apr 2010 19:19:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3QJJ1x1076022;
	Mon, 26 Apr 2010 19:19:01 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3QJJ1eK076018;
	Mon, 26 Apr 2010 19:19:01 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004261919.o3QJJ1eK076018@svn.freebsd.org>
From: Juli Mallett 
Date: Mon, 26 Apr 2010 19:19:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207244 - user/jmallett/octeon/sys/mips/cavium/octe
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Apr 2010 19:19:01 -0000

Author: jmallett
Date: Mon Apr 26 19:19:01 2010
New Revision: 207244
URL: http://svn.freebsd.org/changeset/base/207244

Log:
  Add support for the driver's polling timer.  This updates link status and
  drains the mbuf transmit free list (and clears OACTIVE if it was set.)

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c	Mon Apr 26 19:13:10 2010	(r207243)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c	Mon Apr 26 19:19:01 2010	(r207244)
@@ -43,11 +43,8 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #include "wrapper-cvmx-includes.h"
 #include "ethernet-headers.h"
 
-static struct mtx mdio_mtx;
-MTX_SYSINIT(cvm_oct_mdio, &mdio_mtx, "MDIO", MTX_DEF);
-
-#define	MDIO_LOCK()	mtx_lock(&mdio_mtx)
-#define	MDIO_UNLOCK()	mtx_unlock(&mdio_mtx)
+struct mtx cvm_oct_mdio_mtx;
+MTX_SYSINIT(cvm_oct_mdio, &cvm_oct_mdio_mtx, "MDIO", MTX_DEF);
 
 /**
  * Perform an MII read. Called by the generic MII routines

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h	Mon Apr 26 19:13:10 2010	(r207243)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h	Mon Apr 26 19:19:01 2010	(r207244)
@@ -27,6 +27,12 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 
 *************************************************************************/
 
+extern struct mtx cvm_oct_mdio_mtx;
+
+#define	MDIO_LOCK()	mtx_lock(&cvm_oct_mdio_mtx)
+#define	MDIO_UNLOCK()	mtx_unlock(&cvm_oct_mdio_mtx)
+#define	MDIO_TRYLOCK()	mtx_trylock(&cvm_oct_mdio_mtx)
+
 int cvm_oct_mdio_read(struct ifnet *ifp, int phy_id, int location);
 void cvm_oct_mdio_write(struct ifnet *ifp, int phy_id, int location, int val);
 int cvm_oct_mdio_setup_device(struct ifnet *ifp);

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Mon Apr 26 19:13:10 2010	(r207243)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Mon Apr 26 19:19:01 2010	(r207244)
@@ -115,16 +115,10 @@ extern int octeon_is_simulation(void);
  */
 extern cvmx_bootinfo_t *octeon_bootinfo;
 
-/*
- * XXX
- * This should be a per-if callout?
- */
-#if 0
 /**
  * Periodic timer to check auto negotiation
  */
-static struct timer_list cvm_oct_poll_timer;
-#endif
+static struct callout cvm_oct_poll_timer;
 
 /**
  * Array of every ethernet device owned by this driver indexed by
@@ -132,76 +126,63 @@ static struct timer_list cvm_oct_poll_ti
  */
 struct ifnet *cvm_oct_device[TOTAL_NUMBER_OF_PORTS];
 
-#if 0
-extern struct semaphore mdio_sem;
-#endif
-
 
 /**
  * Periodic timer tick for slow management operations
  *
  * @param arg    Device to check
  */
-#if 0
-static void cvm_do_timer(unsigned long arg)
+static void cvm_do_timer(void *arg)
 {
 	static int port;
 	if (port < CVMX_PIP_NUM_INPUT_PORTS) {
 		if (cvm_oct_device[port]) {
 			int queues_per_port;
-#if 0
 			int qos;
-#endif
 			cvm_oct_private_t *priv = (cvm_oct_private_t *)cvm_oct_device[port]->if_softc;
 			if (priv->poll) 
 			{
-#if 0
 				/* skip polling if we don't get the lock */
-				if(!down_trylock(&mdio_sem)) {
+				if (MDIO_TRYLOCK()) {
 					priv->poll(cvm_oct_device[port]);
-					up(&mdio_sem);
+					MDIO_UNLOCK();
 				}
-#else
-				panic("%s: wrap priv->poll with an mdio lock.", __func__);
-#endif
 			}
 
 			queues_per_port = cvmx_pko_get_num_queues(port);
 			/* Drain any pending packets in the free list */
-#if 0
 			for (qos = 0; qos < queues_per_port; qos++) {
-				if (m_queue_len(&priv->tx_free_list[qos])) {
-					spin_lock(&priv->tx_free_list[qos].lock);
-					while (m_queue_len(&priv->tx_free_list[qos]) > cvmx_fau_fetch_and_add32(priv->fau+qos*4, 0))
-						dev_kfree_m(__m_dequeue(&priv->tx_free_list[qos]));
-					spin_unlock(&priv->tx_free_list[qos].lock);
+				if (_IF_QLEN(&priv->tx_free_queue[qos]) > 0) {
+					IF_LOCK(&priv->tx_free_queue[qos]);
+					while (_IF_QLEN(&priv->tx_free_queue[qos]) > cvmx_fau_fetch_and_add32(priv->fau+qos*4, 0)) {
+						struct mbuf *m;
+
+						_IF_DEQUEUE(&priv->tx_free_queue[qos], m);
+						m_freem(m);
+					}
+					IF_UNLOCK(&priv->tx_free_queue[qos]);
+
+					/*
+					 * XXX locking!
+					 */
+					priv->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 				}
 			}
-#else
-			panic("%s: need to implement Tx queue draining.", __func__);
-#endif
 #if 0
 			cvm_oct_device[port]->get_stats(cvm_oct_device[port]);
-#else
-			panic("%s: need to implement stats getting.", __func__);
 #endif
 		}
 		port++;
-#if 0
 		/* Poll the next port in a 50th of a second.
 		   This spreads the polling of ports out a little bit */
-		mod_timer(&cvm_oct_poll_timer, jiffies + HZ/50);
-#endif
+		callout_reset(&cvm_oct_poll_timer, hz / 50, cvm_do_timer, NULL);
 	} else {
 		port = 0;
-#if 0
 		/* All ports have been polled. Start the next iteration through
 		   the ports in one second */
-		mod_timer(&cvm_oct_poll_timer, jiffies + HZ);
-#endif
+		callout_reset(&cvm_oct_poll_timer, hz, cvm_do_timer, NULL);
 	}
 }
-#endif
 
 
 /**
@@ -528,13 +509,8 @@ int cvm_oct_init_module(device_t bus)
 		cvmx_write_csr(CVMX_POW_WQ_INT_THRX(pow_receive_group), 0x1001);
 	}
 
-#if 0
-	/* Enable the poll timer for checking RGMII status */
-	init_timer(&cvm_oct_poll_timer);
-	cvm_oct_poll_timer.data = 0;
-	cvm_oct_poll_timer.function = cvm_do_timer;
-	mod_timer(&cvm_oct_poll_timer, jiffies + HZ);
-#endif
+	callout_init(&cvm_oct_poll_timer, CALLOUT_MPSAFE);
+	callout_reset(&cvm_oct_poll_timer, hz, cvm_do_timer, NULL);
 
 	return 0;
 }
@@ -559,9 +535,7 @@ void cvm_oct_cleanup_module(void)
 	free_irq(8 + pow_receive_group, cvm_oct_device);
 #endif
 
-#if 0
-	del_timer(&cvm_oct_poll_timer);
-#endif
+	callout_stop(&cvm_oct_poll_timer);
 	cvm_oct_rx_shutdown();
 	cvmx_pko_disable();
 

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 26 20:01:53 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 58A05106566B;
	Mon, 26 Apr 2010 20:01:53 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 47D018FC0C;
	Mon, 26 Apr 2010 20:01:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3QK1rGH085885;
	Mon, 26 Apr 2010 20:01:53 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3QK1rG4085883;
	Mon, 26 Apr 2010 20:01:53 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004262001.o3QK1rG4085883@svn.freebsd.org>
From: Kip Macy 
Date: Mon, 26 Apr 2010 20:01:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207246 - user/kmacy/head_page_lock_2/sys/amd64/amd64
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Apr 2010 20:01:53 -0000

Author: kmacy
Date: Mon Apr 26 20:01:52 2010
New Revision: 207246
URL: http://svn.freebsd.org/changeset/base/207246

Log:
  fix condition associated with decrementing resident_count on pv_list allocation failure

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 26 19:19:29 2010	(r207245)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 26 20:01:52 2010	(r207246)
@@ -675,7 +675,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 	/* Initialize the PAT MSR. */
 	pmap_init_pat();
 
-		/* Setup page locks. */
+	/* Setup page locks. */
 	for (i = 0; i < PA_LOCK_COUNT; i++)
 		mtx_init(&pa_lock[i].vp_lock, "page lock", NULL,
 		    MTX_DEF | MTX_RECURSE | MTX_DUPOK);
@@ -2560,11 +2560,13 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t 
 	pt_entry_t *firstpte, newpte;
 	vm_paddr_t mptepa;
 	vm_page_t free, mpte;
+	boolean_t inc;
 
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
 	oldpde = *pde;
 	KASSERT((oldpde & (PG_PS | PG_V)) == (PG_PS | PG_V),
 	    ("pmap_demote_pde: oldpde is missing PG_PS and/or PG_V"));
+	inc = FALSE;
 	mpte = pmap_lookup_pt_page(pmap, va);
 	if (mpte != NULL)
 		pmap_remove_pt_page(pmap, mpte);
@@ -2597,12 +2599,14 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t 
 			    " in pmap %p", va, pmap);
 			return (FALSE);
 		}
-		if (va < VM_MAXUSER_ADDRESS)
+		if (va < VM_MAXUSER_ADDRESS) {
 			pmap_resident_count_inc(pmap, 1);
+			inc = TRUE;
+		}
 	}
 	if (TAILQ_EMPTY(pv_list) && ((oldpde & PG_MANAGED) != 0)) {
 		if (pmap_pv_list_try_alloc(pmap, NPTEPG-1, pv_list) == FALSE) {
-			if (mpte == NULL && (va < VM_MAXUSER_ADDRESS))
+			if (inc)
 				pmap_resident_count_dec(pmap, 1);
 			return (FALSE);
 		}

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 26 20:46:33 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6FD85106566C;
	Mon, 26 Apr 2010 20:46:33 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5DF428FC1C;
	Mon, 26 Apr 2010 20:46:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3QKkXeO095912;
	Mon, 26 Apr 2010 20:46:33 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3QKkX7c095906;
	Mon, 26 Apr 2010 20:46:33 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004262046.o3QKkX7c095906@svn.freebsd.org>
From: Juli Mallett 
Date: Mon, 26 Apr 2010 20:46:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207249 - in user/jmallett/octeon/sys: conf
	contrib/octeon-sdk mips/cavium mips/conf
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Apr 2010 20:46:33 -0000

Author: jmallett
Date: Mon Apr 26 20:46:33 2010
New Revision: 207249
URL: http://svn.freebsd.org/changeset/base/207249

Log:
  o) Add an OCTEON_BOARD_CAPK_0100ND config option, which builds for the
     CAPK-0100ND at compile time.  As Cavium notes in the Simple Executive, it's
     one of the many boards from a vendor that didn't bother allocating a board
     ID for themselves and instead mangled an existing one.  We have to know
     we're running on it at compile time.
  o) Add a CAPK_0100ND kernel config which just includes OCTEON1-32 (n32 kernel.)
  o) Fix the TX and RX clock rates for OCTEON_BOARD_CAPK_0100ND, resulting in a
     10% receive performance improvement with ttcp, it seems.
  o) Map IPD port numbers to PHY numbers for OCTEON_BOARD_CAPK_0100ND.  This was
     determined empirically since the vendor's patch to the Simple Executive
     seems to get it wrong.

Added:
  user/jmallett/octeon/sys/mips/conf/CAPK_0100ND
Modified:
  user/jmallett/octeon/sys/conf/options.mips
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-board.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c
  user/jmallett/octeon/sys/mips/cavium/cvmx_config.h

Modified: user/jmallett/octeon/sys/conf/options.mips
==============================================================================
--- user/jmallett/octeon/sys/conf/options.mips	Mon Apr 26 20:19:49 2010	(r207248)
+++ user/jmallett/octeon/sys/conf/options.mips	Mon Apr 26 20:46:33 2010	(r207249)
@@ -63,3 +63,8 @@ COMPAT_FREEBSD32	opt_compat.h
 # The highest memory address that can be used by the kernel in units of KB.
 #
 MAXMEM			opt_global.h
+
+#
+# Options that control the Cavium Simple Executive.
+#
+OCTEON_BOARD_CAPK_0100ND	opt_cvmx.h

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-board.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-board.c	Mon Apr 26 20:19:49 2010	(r207248)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-board.c	Mon Apr 26 20:46:33 2010	(r207249)
@@ -85,6 +85,26 @@ CVMX_SHARED cvmx_helper_link_info_t (*cv
  */
 int cvmx_helper_board_get_mii_address(int ipd_port)
 {
+    /*
+     * Board types we have to know at compile-time.
+     */
+#ifdef OCTEON_BOARD_CAPK_0100ND
+    switch (ipd_port) {
+    case 0:
+	return 2;
+    case 1:
+	return 3;
+    case 2:
+	/* XXX Switch PHY?  */
+	return -1;
+    default:
+	return -1;
+    }
+#endif
+
+    /*
+     * For board types we can determine at runtime.
+     */
     switch (cvmx_sysinfo_get()->board_type)
     {
         case CVMX_BOARD_TYPE_SIM:
@@ -195,6 +215,7 @@ cvmx_helper_link_info_t __cvmx_helper_bo
     /* Unless we fix it later, all links are defaulted to down */
     result.u64 = 0;
 
+#if !defined(OCTEON_BOARD_CAPK_0100ND)
     /* This switch statement should handle all ports that either don't use
         Marvell PHYS, or don't support in-band status */
     switch (cvmx_sysinfo_get()->board_type)
@@ -249,6 +270,7 @@ cvmx_helper_link_info_t __cvmx_helper_bo
             }
             break;
     }
+#endif
 
     phy_addr = cvmx_helper_board_get_mii_address(ipd_port);
     if (phy_addr != -1)
@@ -322,7 +344,11 @@ cvmx_helper_link_info_t __cvmx_helper_bo
                 and set the resolved bit (bit 11) */
             if (phy_status & (1<<11))
             {
+#if defined(OCTEON_BOARD_CAPK_0100ND)
+                result.s.link_up = (phy_status>>10)&1;
+#else
                 result.s.link_up = 1;
+#endif
                 result.s.full_duplex = ((phy_status>>13)&1);
                 switch ((phy_status>>14)&3)
                 {

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c	Mon Apr 26 20:19:49 2010	(r207248)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c	Mon Apr 26 20:46:33 2010	(r207249)
@@ -199,6 +199,16 @@ int __cvmx_helper_rgmii_enable(int inter
         cvmx_write_csr(CVMX_GMXX_TXX_PAUSE_PKT_TIME(port, interface), 20000);
         cvmx_write_csr(CVMX_GMXX_TXX_PAUSE_PKT_INTERVAL(port, interface), 19000);
 
+        /*
+         * Board types we have to know at compile-time.
+         */
+#if defined(OCTEON_BOARD_CAPK_0100ND)
+        cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(port, interface), 26);
+        cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(port, interface), 26);
+#else
+        /*
+         * For board types we can determine at runtime.
+         */
         if (OCTEON_IS_MODEL(OCTEON_CN50XX))
         {
             cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(port, interface), 16);
@@ -209,6 +219,7 @@ int __cvmx_helper_rgmii_enable(int inter
             cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(port, interface), 24);
             cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(port, interface), 24);
         }
+#endif
     }
 
     __cvmx_helper_setup_gmx(interface, num_ports);

Modified: user/jmallett/octeon/sys/mips/cavium/cvmx_config.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/cvmx_config.h	Mon Apr 26 20:19:49 2010	(r207248)
+++ user/jmallett/octeon/sys/mips/cavium/cvmx_config.h	Mon Apr 26 20:46:33 2010	(r207249)
@@ -39,6 +39,8 @@
 #ifndef	_CVMX_CONFIG_H
 #define	_CVMX_CONFIG_H
 
+#include "opt_cvmx.h"
+
 #include 
 #include 
 #include 

Added: user/jmallett/octeon/sys/mips/conf/CAPK_0100ND
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/conf/CAPK_0100ND	Mon Apr 26 20:46:33 2010	(r207249)
@@ -0,0 +1,7 @@
+#
+# $FreeBSD$
+#
+
+options 	OCTEON_BOARD_CAPK_0100ND
+
+include		OCTEON1-32

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 26 21:10:10 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5C7921065680;
	Mon, 26 Apr 2010 21:10:10 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4BA138FC1A;
	Mon, 26 Apr 2010 21:10:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3QLAAeB001528;
	Mon, 26 Apr 2010 21:10:10 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3QLAA4r001526;
	Mon, 26 Apr 2010 21:10:10 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004262110.o3QLAA4r001526@svn.freebsd.org>
From: Juli Mallett 
Date: Mon, 26 Apr 2010 21:10:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207252 - user/jmallett/octeon/sys/mips/cavium/octe
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Apr 2010 21:10:10 -0000

Author: jmallett
Date: Mon Apr 26 21:10:10 2010
New Revision: 207252
URL: http://svn.freebsd.org/changeset/base/207252

Log:
  o) Remove comment about clearing OACTIVE.  We do that now (though through a
     callout, so perhaps not optimal.)
  o) Remove mbuf copying for BPF_MTAP.  We can live without it for now and it is
     a monumental performance hit.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/octe.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Mon Apr 26 21:08:15 2010	(r207251)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Mon Apr 26 21:10:10 2010	(r207252)
@@ -261,7 +261,7 @@ static void
 octe_start(struct ifnet *ifp)
 {
 	cvm_oct_private_t *priv;
-	struct mbuf *m, *n;
+	struct mbuf *m;
 	int error;
 
 	priv = ifp->if_softc;
@@ -295,7 +295,6 @@ octe_start(struct ifnet *ifp)
 		 * how to defrag mbufs for itself and that it will handle the
 		 * failure cases internally.
 		 */
-		n = m_dup(m, M_DONTWAIT);
 
 		if (priv->queue != -1) {
 			error = cvm_oct_xmit(m, ifp);
@@ -304,21 +303,9 @@ octe_start(struct ifnet *ifp)
 		}
 
 		if (error != 0) {
-			/*
-			 * XXX
-			 * Need to implement freeing and clearing of
-			 * OACTIVE at some point.
-			 */
-			if (n != NULL)
-				IFQ_DRV_PREPEND(&ifp->if_snd, n);
 			ifp->if_drv_flags |= IFF_DRV_OACTIVE;
 			return;
 		}
-
-		if (n != NULL) {
-			BPF_MTAP(ifp, n);
-			m_freem(n);
-		}
 	}
 }
 

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 26 23:57:07 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DD36C1065673;
	Mon, 26 Apr 2010 23:57:07 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CE0A78FC15;
	Mon, 26 Apr 2010 23:57:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3QNv745038355;
	Mon, 26 Apr 2010 23:57:07 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3QNv7HU038353;
	Mon, 26 Apr 2010 23:57:07 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004262357.o3QNv7HU038353@svn.freebsd.org>
From: Kip Macy 
Date: Mon, 26 Apr 2010 23:57:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207253 - user/kmacy/head_page_lock_2/sys/vm
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 26 Apr 2010 23:57:07 -0000

Author: kmacy
Date: Mon Apr 26 23:57:07 2010
New Revision: 207253
URL: http://svn.freebsd.org/changeset/base/207253

Log:
  sync whitespace and hold_count check with head

Modified:
  user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c	Mon Apr 26 21:10:10 2010	(r207252)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c	Mon Apr 26 23:57:07 2010	(r207253)
@@ -306,6 +306,7 @@ vm_pageout_clean(vm_page_t m)
 		vm_page_unlock(m);
 		return 0;
 	}
+
 	mc[vm_pageout_page_count] = m;
 	pageout_count = 1;
 	page_base = vm_pageout_page_count;
@@ -777,13 +778,14 @@ rescan0:
 		 * queue, most likely are being paged out.
 		 */
 		if (!VM_OBJECT_TRYLOCK(object) &&
-		    !vm_pageout_fallback_object_lock(m, &next)) {
+		    (!vm_pageout_fallback_object_lock(m, &next) ||
+			m->hold_count != 0)) {
 			VM_OBJECT_UNLOCK(object);
 			vm_page_unlock(m);
 			addl_page_shortage++;
 			continue;
 		}
-		if (m->busy || (m->oflags & VPO_BUSY) || m->hold_count) {
+		if (m->busy || (m->oflags & VPO_BUSY)) {
 			vm_page_unlock(m);
 			VM_OBJECT_UNLOCK(object);
 			addl_page_shortage++;

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 00:44:41 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6B8171065674;
	Tue, 27 Apr 2010 00:44:41 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 22CC68FC21;
	Tue, 27 Apr 2010 00:44:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3R0ifqn048816;
	Tue, 27 Apr 2010 00:44:41 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3R0ifxn048814;
	Tue, 27 Apr 2010 00:44:41 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004270044.o3R0ifxn048814@svn.freebsd.org>
From: Juli Mallett 
Date: Tue, 27 Apr 2010 00:44:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207254 - user/jmallett/octeon/sys/mips/cavium/octe
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 00:44:41 -0000

Author: jmallett
Date: Tue Apr 27 00:44:40 2010
New Revision: 207254
URL: http://svn.freebsd.org/changeset/base/207254

Log:
  Use a gather list to transmit a fragmented packet rather than defragging it.
  This improves transmit performance 100%.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c	Mon Apr 26 23:57:07 2010	(r207253)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c	Tue Apr 27 00:44:40 2010	(r207254)
@@ -74,6 +74,7 @@ int cvm_oct_xmit(struct mbuf *m, struct 
 #if REUSE_MBUFS_WITHOUT_FREE
 	unsigned char *fpa_head;
 #endif
+	cvmx_wqe_t *work;
 
 	/* Prefetch the private data structure.
 	   It is larger that one cache line */
@@ -130,28 +131,72 @@ int cvm_oct_xmit(struct mbuf *m, struct 
 		}
 	}
 
-	/* Build the PKO buffer pointer */
-	if (m->m_pkthdr.len != m->m_len) {
-		m = m_defrag(m, M_DONTWAIT);
-		if (m->m_pkthdr.len != m->m_len)
-			panic("%s: need to load multiple segments.", __func__);
-	}
+	/*
+	 * If the packet is not fragmented.
+	 */
+	if (m->m_pkthdr.len == m->m_len) {
+		/* Build the PKO buffer pointer */
+		hw_buffer.u64 = 0;
+		hw_buffer.s.addr = cvmx_ptr_to_phys(m->m_data);
+		hw_buffer.s.pool = 0;
+		hw_buffer.s.size = m->m_len;
+
+		/* Build the PKO command */
+		pko_command.u64 = 0;
+		pko_command.s.segs = 1;
 
-	hw_buffer.u64 = 0;
-	hw_buffer.s.addr = cvmx_ptr_to_phys(m->m_data);
-	hw_buffer.s.pool = 0;
-	hw_buffer.s.size = m->m_len;
+		work = NULL;
+	} else {
+		struct mbuf *n;
+		unsigned segs;
+		uint64_t *gp;
 
-	/* Build the PKO command */
-	pko_command.u64 = 0;
+		/*
+		 * The packet is fragmented, we need to send a list of segments
+		 * in memory we borrow from the WQE pool.
+		 */
+		work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
+		gp = (uint64_t *)work;
+
+		segs = 0;
+		for (n = m; n != NULL; n = n->m_next) {
+			if (segs == CVMX_FPA_WQE_POOL_SIZE / sizeof (uint64_t))
+				panic("%s: too many segments in packet; call m_collapse().", __func__);
+
+			/* Build the PKO buffer pointer */
+			hw_buffer.u64 = 0;
+			hw_buffer.s.addr = cvmx_ptr_to_phys(n->m_data);
+			hw_buffer.s.pool = 0;
+			hw_buffer.s.size = n->m_len;
+
+			*gp++ = hw_buffer.u64;
+			segs++;
+		}
+
+		/* Build the PKO buffer gather list pointer */
+		hw_buffer.u64 = 0;
+		hw_buffer.s.addr = cvmx_ptr_to_phys(work);
+		hw_buffer.s.pool = CVMX_FPA_WQE_POOL;
+		hw_buffer.s.size = segs;
+
+		/* Build the PKO command */
+		pko_command.u64 = 0;
+		pko_command.s.segs = segs;
+		pko_command.s.gather = 1;
+	}
+
+	/* Finish building the PKO command */
 	pko_command.s.n2 = 1; /* Don't pollute L2 with the outgoing packet */
-	pko_command.s.segs = 1;
+	pko_command.s.dontfree = 1;
+	pko_command.s.reg0 = priv->fau+qos*4;
+	pko_command.s.reg0 = priv->fau+qos*4;
 	pko_command.s.total_bytes = m->m_pkthdr.len;
 	pko_command.s.size0 = CVMX_FAU_OP_SIZE_32;
 	pko_command.s.subone0 = 1;
 
 	pko_command.s.dontfree = 1;
 	pko_command.s.reg0 = priv->fau+qos*4;
+
 	/* See if we can put this m in the FPA pool. Any strange behavior
 	   from the Linux networking stack will most likely be caused by a bug
 	   in the following code. If some field is in use by the network stack
@@ -311,6 +356,8 @@ dont_put_mbuf_in_hw:
 			IF_ENQUEUE(&priv->tx_free_queue[qos], m);
 		}
 	}
+	if (work != NULL)
+		cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, DONT_WRITEBACK(1));
 
 	/* Free mbufs not in use by the hardware */
 	if (_IF_QLEN(&priv->tx_free_queue[qos]) > in_use) {

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 00:58:19 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 77DB81065670;
	Tue, 27 Apr 2010 00:58:19 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 67F1C8FC0A;
	Tue, 27 Apr 2010 00:58:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3R0wJ3H051898;
	Tue, 27 Apr 2010 00:58:19 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3R0wJWX051894;
	Tue, 27 Apr 2010 00:58:19 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004270058.o3R0wJWX051894@svn.freebsd.org>
From: Juli Mallett 
Date: Tue, 27 Apr 2010 00:58:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207255 - user/jmallett/octeon/sys/mips/cavium/octe
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 00:58:19 -0000

Author: jmallett
Date: Tue Apr 27 00:58:19 2010
New Revision: 207255
URL: http://svn.freebsd.org/changeset/base/207255

Log:
  Turn on use of cvm_oct_common_set_multicast_list to handle IFF_ALLMULTI and
  IFF_PROMISC.
  
  Update a comment.  Fix some indentation.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h
  user/jmallett/octeon/sys/mips/cavium/octe/octe.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Tue Apr 27 00:44:40 2010	(r207254)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Tue Apr 27 00:58:19 2010	(r207255)
@@ -98,9 +98,8 @@ static struct ifnet_stats *cvm_oct_commo
  *
  * @param dev    Device to work on
  */
-static void cvm_oct_common_set_multicast_list(struct ifnet *ifp)
+void cvm_oct_common_set_multicast_list(struct ifnet *ifp)
 {
-#if 0
 	cvmx_gmxx_prtx_cfg_t gmx_cfg;
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	int interface = INTERFACE(priv->port);
@@ -111,13 +110,13 @@ static void cvm_oct_common_set_multicast
 		control.u64 = 0;
 		control.s.bcst = 1;     /* Allow broadcast MAC addresses */
 
-		if (ifp->mc_list || (ifp->flags&IFF_ALLMULTI) ||
-		    (ifp->flags & IFF_PROMISC))
+		if (/*ifp->mc_list || */(ifp->if_flags&IFF_ALLMULTI) ||
+		    (ifp->if_flags & IFF_PROMISC))
 			control.s.mcst = 2; /* Force accept multicast packets */
 		else
 			control.s.mcst = 1; /* Force reject multicat packets */
 
-		if (ifp->flags & IFF_PROMISC)
+		if (ifp->if_flags & IFF_PROMISC)
 			control.s.cam_mode = 0; /* Reject matches if promisc. Since CAM is shut off, should accept everything */
 		else
 			control.s.cam_mode = 1; /* Filter packets based on the CAM */
@@ -126,14 +125,13 @@ static void cvm_oct_common_set_multicast
 		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64 & ~1ull);
 
 		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CTL(index, interface), control.u64);
-		if (ifp->flags&IFF_PROMISC)
+		if (ifp->if_flags&IFF_PROMISC)
 			cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM_EN(index, interface), 0);
 		else
 			cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM_EN(index, interface), 1);
 
 		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
 	}
-#endif
 }
 
 
@@ -262,7 +260,6 @@ int cvm_oct_common_init(struct ifnet *if
 #if 0
 	ifp->get_stats          = cvm_oct_common_get_stats;
 	ifp->set_mac_address    = cvm_oct_common_set_mac_address;
-	ifp->set_multicast_list = cvm_oct_common_set_multicast_list;
 	ifp->features           |= NETIF_F_LLTX; /* We do our own locking, Linux doesn't need to */
 #ifdef CONFIG_NET_POLL_CONTROLLER
 	ifp->poll_controller    = cvm_oct_poll_controller;

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h	Tue Apr 27 00:44:40 2010	(r207254)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h	Tue Apr 27 00:58:19 2010	(r207255)
@@ -31,6 +31,7 @@ int cvm_oct_common_init(struct ifnet *if
 void cvm_oct_common_uninit(struct ifnet *ifp);
 
 int cvm_oct_common_change_mtu(struct ifnet *ifp, int new_mtu);
+void cvm_oct_common_set_multicast_list(struct ifnet *ifp);
 
 int cvm_oct_init_module(device_t);
 void cvm_oct_cleanup_module(void);

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Tue Apr 27 00:44:40 2010	(r207254)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Tue Apr 27 00:58:19 2010	(r207255)
@@ -238,8 +238,10 @@ octe_init(void *arg)
 	if (priv->miibus != NULL)
 		mii_mediachg(device_get_softc(priv->miibus));
 
-        ifp->if_drv_flags |= IFF_DRV_RUNNING;
-        ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+	cvm_oct_common_set_multicast_list(ifp);
+
+	ifp->if_drv_flags |= IFF_DRV_RUNNING;
+	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 }
 
 static void
@@ -279,21 +281,15 @@ octe_start(struct ifnet *ifp)
 		 * two very good reasons:
 		 * (1) immediately after our inserting it another CPU may be
 		 *     kind enough to free it for us.
-		 * (2) m_defrag gets called on m and we don't get back the
+		 * (2) m_collapse gets called on m and we don't get back the
 		 *     modified pointer.
 		 *
-		 * We have some options other than this m_dup route:
+		 * We have some options other than an m_dup route:
 		 * (1) use a mutex or spinlock to prevent another CPU from
 		 *     freeing it.  We could lock the tx_free_list's lock,
 		 *     that would make sense.
 		 * (2) get back the new mbuf pointer.
-		 * (3) do the defrag here.
-		 *
-		 * #3 makes sense in the long run when we have code that can
-		 * load mbufs into any number of segments, but for now the
-		 * transmit code is called with the assumption that it knows
-		 * how to defrag mbufs for itself and that it will handle the
-		 * failure cases internally.
+		 * (3) do the collapse here.
 		 */
 
 		if (priv->queue != -1) {

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 02:14:42 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A1C011065670;
	Tue, 27 Apr 2010 02:14:42 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9131F8FC14;
	Tue, 27 Apr 2010 02:14:42 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3R2Eg76068712;
	Tue, 27 Apr 2010 02:14:42 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3R2EgWp068709;
	Tue, 27 Apr 2010 02:14:42 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004270214.o3R2EgWp068709@svn.freebsd.org>
From: Juli Mallett 
Date: Tue, 27 Apr 2010 02:14:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207257 - user/jmallett/octeon/sys/mips/cavium/octe
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 02:14:42 -0000

Author: jmallett
Date: Tue Apr 27 02:14:42 2010
New Revision: 207257
URL: http://svn.freebsd.org/changeset/base/207257

Log:
  o) Remove the enabling of cvm_oct_common_set_multicast_list().  It's not quite
     ready and seems to basically not work.
  o) Avoid some gratuitous link state renegotiations since those are very, very
     slow.  (Inspired in part by em(4).)

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
  user/jmallett/octeon/sys/mips/cavium/octe/octe.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Tue Apr 27 01:00:22 2010	(r207256)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Tue Apr 27 02:14:42 2010	(r207257)
@@ -100,6 +100,7 @@ static struct ifnet_stats *cvm_oct_commo
  */
 void cvm_oct_common_set_multicast_list(struct ifnet *ifp)
 {
+#if 0
 	cvmx_gmxx_prtx_cfg_t gmx_cfg;
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	int interface = INTERFACE(priv->port);
@@ -132,6 +133,7 @@ void cvm_oct_common_set_multicast_list(s
 
 		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
 	}
+#endif
 }
 
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Tue Apr 27 01:00:22 2010	(r207256)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Tue Apr 27 02:14:42 2010	(r207257)
@@ -38,6 +38,8 @@
  *     attach the specific PHY for each interface without an miibus in between.
  */
 
+#include "opt_inet.h"
+
 #include 
 #include 
 #include 
@@ -58,6 +60,11 @@
 #include 
 #include 
 
+#ifdef INET
+#include 
+#include 
+#endif
+
 #include 
 #include 
 
@@ -230,7 +237,8 @@ octe_init(void *arg)
 	priv = arg;
 	ifp = priv->ifp;
 
-	octe_stop(priv);
+	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+		octe_stop(priv);
 
 	if (priv->open != NULL)
 		priv->open(ifp);
@@ -238,8 +246,6 @@ octe_init(void *arg)
 	if (priv->miibus != NULL)
 		mii_mediachg(device_get_softc(priv->miibus));
 
-	cvm_oct_common_set_multicast_list(ifp);
-
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 }
@@ -253,6 +259,9 @@ octe_stop(void *arg)
 	priv = arg;
 	ifp = priv->ifp;
 
+	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+		return;
+
 	if (priv->stop != NULL)
 		priv->stop(ifp);
 
@@ -394,12 +403,37 @@ octe_ioctl(struct ifnet *ifp, u_long cmd
 	cvm_oct_private_t *priv;
 	struct mii_data *mii;
 	struct ifreq *ifr;
+#ifdef INET
+	struct ifaddr *ifa;
+#endif
 	int error;
 
 	priv = ifp->if_softc;
 	ifr = (struct ifreq *)data;
+#ifdef INET
+	ifa = (struct ifaddr *)data;
+#endif
 
 	switch (cmd) {
+	case SIOCSIFADDR:
+#ifdef INET
+		/*
+		 * Avoid reinitialization unless it's necessary.
+		 */
+		if (ifa->ifa_addr->sa_family == AF_INET) {
+			ifp->if_flags |= IFF_UP;
+			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+				octe_init(priv);
+			arp_ifinit(ifp, ifa);
+
+			return (0);
+		}
+#endif
+		error = ether_ioctl(ifp, cmd, data);
+		if (error != 0)
+			return (error);
+		return (0);
+
 	case SIOCSIFFLAGS:
 		if ((ifp->if_flags & IFF_UP) != 0) {
 			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 02:17:48 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A895A106566C;
	Tue, 27 Apr 2010 02:17:48 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 989538FC1A;
	Tue, 27 Apr 2010 02:17:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3R2HmY9069458;
	Tue, 27 Apr 2010 02:17:48 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3R2HmCe069456;
	Tue, 27 Apr 2010 02:17:48 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004270217.o3R2HmCe069456@svn.freebsd.org>
From: Juli Mallett 
Date: Tue, 27 Apr 2010 02:17:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207258 - user/jmallett/octeon/sys/mips/cavium/octe
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 02:17:48 -0000

Author: jmallett
Date: Tue Apr 27 02:17:48 2010
New Revision: 207258
URL: http://svn.freebsd.org/changeset/base/207258

Log:
  Set the maximum sendq length.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/octe.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Tue Apr 27 02:14:42 2010	(r207257)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Tue Apr 27 02:17:48 2010	(r207258)
@@ -181,8 +181,8 @@ octe_attach(device_t dev)
 
 	ether_ifattach(ifp, priv->mac);
 
-	IFQ_SET_MAXLEN(&ifp->if_snd, 16);
-	ifp->if_snd.ifq_drv_maxlen = 16; /* XXX */
+	IFQ_SET_MAXLEN(&ifp->if_snd, MAX_OUT_QUEUE_DEPTH);
+	ifp->if_snd.ifq_drv_maxlen = MAX_OUT_QUEUE_DEPTH;
 	IFQ_SET_READY(&ifp->if_snd);
 
 	return (0);

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 02:52:20 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 317411065670;
	Tue, 27 Apr 2010 02:52:20 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1F2088FC08;
	Tue, 27 Apr 2010 02:52:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3R2qKCP077189;
	Tue, 27 Apr 2010 02:52:20 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3R2qKbj077186;
	Tue, 27 Apr 2010 02:52:20 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004270252.o3R2qKbj077186@svn.freebsd.org>
From: Juli Mallett 
Date: Tue, 27 Apr 2010 02:52:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207259 -
	user/jmallett/octeon/sys/mips/cavium/cryptocteon
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 02:52:20 -0000

Author: jmallett
Date: Tue Apr 27 02:52:19 2010
New Revision: 207259
URL: http://svn.freebsd.org/changeset/base/207259

Log:
  Add the Linux OCF "cryptocteon" driver, which I will be porting to FreeBSD.

Added:
  user/jmallett/octeon/sys/mips/cavium/cryptocteon/
  user/jmallett/octeon/sys/mips/cavium/cryptocteon/Makefile
  user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c
  user/jmallett/octeon/sys/mips/cavium/cryptocteon/cryptocteon.c

Added: user/jmallett/octeon/sys/mips/cavium/cryptocteon/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/cavium/cryptocteon/Makefile	Tue Apr 27 02:52:19 2010	(r207259)
@@ -0,0 +1,17 @@
+# for SGlinux builds
+-include $(ROOTDIR)/modules/.config
+
+obj-$(CONFIG_OCF_CRYPTOCTEON) += cryptocteon.o
+
+obj ?= .
+EXTRA_CFLAGS += -I$(obj)/.. -I$(obj)/
+
+ifdef CONFIG_OCF_CRYPTOCTEON
+# you need the cavium crypto component installed
+EXTRA_CFLAGS += -I/usr/local/Cavium_Networks/OCTEON-SDK/components/crypto-api/core/cryptolinux
+endif
+
+ifdef TOPDIR
+-include $(TOPDIR)/Rules.make
+endif
+

Added: user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/cavium/cryptocteon/cavium_crypto.c	Tue Apr 27 02:52:19 2010	(r207259)
@@ -0,0 +1,2217 @@
+/*
+ * Copyright (c) 2009 David McCullough 
+ *
+ * Copyright (c) 2003-2007 Cavium Networks (support@cavium.com). All rights
+ * reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Cavium Networks
+ * 4. Cavium Networks' name may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ * 
+ * This Software, including technical data, may be subject to U.S. export
+ * control laws, including the U.S. Export Administration Act and its
+ * associated regulations, and may be subject to export or import regulations
+ * in other countries. You warrant that You will comply strictly in all
+ * respects with all such regulations and acknowledge that you have the
+ * responsibility to obtain licenses to export, re-export or import the
+ * Software.
+ * 
+ * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" AND
+ * WITH ALL FAULTS AND CAVIUM MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES,
+ * EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE
+ * SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
+ * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
+ * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
+ * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
+ * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
+ * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
+ * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
+*/
+/****************************************************************************/
+
+#include 
+#include 
+#include "octeon-asm.h"
+
+/****************************************************************************/
+
+extern unsigned long octeon_crypto_enable(struct octeon_cop2_state *);
+extern void octeon_crypto_disable(struct octeon_cop2_state *, unsigned long);
+
+#define SG_INIT(s, p, i, l) \
+	{ \
+	    (i) = 0; \
+	    (l) = (s)[0].length; \
+	    (p) = (typeof(p)) sg_virt((s)); \
+		CVMX_PREFETCH0((p)); \
+	}
+
+#define SG_CONSUME(s, p, i, l) \
+	{ \
+		(p)++; \
+		(l) -= sizeof(*(p)); \
+		if ((l) < 0) { \
+			dprintk("%s, %d: l = %d\n", __FILE__, __LINE__, l); \
+		} else if ((l) == 0) { \
+		    (i)++; \
+		    (l) = (s)[0].length; \
+		    (p) = (typeof(p)) sg_virt(s); \
+			CVMX_PREFETCH0((p)); \
+		} \
+	}
+
+#define ESP_HEADER_LENGTH     8
+#define DES_CBC_IV_LENGTH     8
+#define AES_CBC_IV_LENGTH     16
+#define ESP_HMAC_LEN          12
+
+#define ESP_HEADER_LENGTH 8
+#define DES_CBC_IV_LENGTH 8
+
+/****************************************************************************/
+
+#define CVM_LOAD_SHA_UNIT(dat, next)  { \
+   if (next == 0) {                     \
+      next = 1;                         \
+      CVMX_MT_HSH_DAT (dat, 0);         \
+   } else if (next == 1) {              \
+      next = 2;                         \
+      CVMX_MT_HSH_DAT (dat, 1);         \
+   } else if (next == 2) {              \
+      next = 3;                    \
+      CVMX_MT_HSH_DAT (dat, 2);         \
+   } else if (next == 3) {              \
+      next = 4;                         \
+      CVMX_MT_HSH_DAT (dat, 3);         \
+   } else if (next == 4) {              \
+      next = 5;                           \
+      CVMX_MT_HSH_DAT (dat, 4);         \
+   } else if (next == 5) {              \
+      next = 6;                         \
+      CVMX_MT_HSH_DAT (dat, 5);         \
+   } else if (next == 6) {              \
+      next = 7;                         \
+      CVMX_MT_HSH_DAT (dat, 6);         \
+   } else {                             \
+     CVMX_MT_HSH_STARTSHA (dat);        \
+     next = 0;                          \
+   }                                    \
+}
+
+#define CVM_LOAD2_SHA_UNIT(dat1, dat2, next)  { \
+   if (next == 0) {                      \
+      CVMX_MT_HSH_DAT (dat1, 0);         \
+      CVMX_MT_HSH_DAT (dat2, 1);         \
+      next = 2;                          \
+   } else if (next == 1) {               \
+      CVMX_MT_HSH_DAT (dat1, 1);         \
+      CVMX_MT_HSH_DAT (dat2, 2);         \
+      next = 3;                          \
+   } else if (next == 2) {               \
+      CVMX_MT_HSH_DAT (dat1, 2);         \
+      CVMX_MT_HSH_DAT (dat2, 3);         \
+      next = 4;                          \
+   } else if (next == 3) {               \
+      CVMX_MT_HSH_DAT (dat1, 3);         \
+      CVMX_MT_HSH_DAT (dat2, 4);         \
+      next = 5;                          \
+   } else if (next == 4) {               \
+      CVMX_MT_HSH_DAT (dat1, 4);         \
+      CVMX_MT_HSH_DAT (dat2, 5);         \
+      next = 6;                          \
+   } else if (next == 5) {               \
+      CVMX_MT_HSH_DAT (dat1, 5);         \
+      CVMX_MT_HSH_DAT (dat2, 6);         \
+      next = 7;                          \
+   } else if (next == 6) {               \
+      CVMX_MT_HSH_DAT (dat1, 6);         \
+      CVMX_MT_HSH_STARTSHA (dat2);       \
+      next = 0;                          \
+   } else {                              \
+     CVMX_MT_HSH_STARTSHA (dat1);        \
+     CVMX_MT_HSH_DAT (dat2, 0);          \
+     next = 1;                           \
+   }                                     \
+}
+
+/****************************************************************************/
+
+#define CVM_LOAD_MD5_UNIT(dat, next)  { \
+   if (next == 0) {                     \
+      next = 1;                         \
+      CVMX_MT_HSH_DAT (dat, 0);         \
+   } else if (next == 1) {              \
+      next = 2;                         \
+      CVMX_MT_HSH_DAT (dat, 1);         \
+   } else if (next == 2) {              \
+      next = 3;                    \
+      CVMX_MT_HSH_DAT (dat, 2);         \
+   } else if (next == 3) {              \
+      next = 4;                         \
+      CVMX_MT_HSH_DAT (dat, 3);         \
+   } else if (next == 4) {              \
+      next = 5;                           \
+      CVMX_MT_HSH_DAT (dat, 4);         \
+   } else if (next == 5) {              \
+      next = 6;                         \
+      CVMX_MT_HSH_DAT (dat, 5);         \
+   } else if (next == 6) {              \
+      next = 7;                         \
+      CVMX_MT_HSH_DAT (dat, 6);         \
+   } else {                             \
+     CVMX_MT_HSH_STARTMD5 (dat);        \
+     next = 0;                          \
+   }                                    \
+}
+
+#define CVM_LOAD2_MD5_UNIT(dat1, dat2, next)  { \
+   if (next == 0) {                      \
+      CVMX_MT_HSH_DAT (dat1, 0);         \
+      CVMX_MT_HSH_DAT (dat2, 1);         \
+      next = 2;                          \
+   } else if (next == 1) {               \
+      CVMX_MT_HSH_DAT (dat1, 1);         \
+      CVMX_MT_HSH_DAT (dat2, 2);         \
+      next = 3;                          \
+   } else if (next == 2) {               \
+      CVMX_MT_HSH_DAT (dat1, 2);         \
+      CVMX_MT_HSH_DAT (dat2, 3);         \
+      next = 4;                          \
+   } else if (next == 3) {               \
+      CVMX_MT_HSH_DAT (dat1, 3);         \
+      CVMX_MT_HSH_DAT (dat2, 4);         \
+      next = 5;                          \
+   } else if (next == 4) {               \
+      CVMX_MT_HSH_DAT (dat1, 4);         \
+      CVMX_MT_HSH_DAT (dat2, 5);         \
+      next = 6;                          \
+   } else if (next == 5) {               \
+      CVMX_MT_HSH_DAT (dat1, 5);         \
+      CVMX_MT_HSH_DAT (dat2, 6);         \
+      next = 7;                          \
+   } else if (next == 6) {               \
+      CVMX_MT_HSH_DAT (dat1, 6);         \
+      CVMX_MT_HSH_STARTMD5 (dat2);       \
+      next = 0;                          \
+   } else {                              \
+     CVMX_MT_HSH_STARTMD5 (dat1);        \
+     CVMX_MT_HSH_DAT (dat2, 0);          \
+     next = 1;                           \
+   }                                     \
+}
+
+/****************************************************************************/
+
+static inline uint64_t
+swap64(uint64_t a)
+{
+    return ((a >> 56) |
+       (((a >> 48) & 0xfful) << 8) |
+       (((a >> 40) & 0xfful) << 16) |
+       (((a >> 32) & 0xfful) << 24) |
+       (((a >> 24) & 0xfful) << 32) |
+       (((a >> 16) & 0xfful) << 40) |
+       (((a >> 8) & 0xfful) << 48) | (((a >> 0) & 0xfful) << 56));
+}
+
+/****************************************************************************/
+
+void
+octo_calc_hash(__u8 auth, unsigned char *key, uint64_t *inner, uint64_t *outer)
+{
+    uint8_t hash_key[64];
+    uint64_t *key1;
+    register uint64_t xor1 = 0x3636363636363636ULL;
+    register uint64_t xor2 = 0x5c5c5c5c5c5c5c5cULL;
+    struct octeon_cop2_state state;
+    unsigned long flags;
+
+    dprintk("%s()\n", __FUNCTION__);
+
+    memset(hash_key, 0, sizeof(hash_key));
+    memcpy(hash_key, (uint8_t *) key, (auth ? 20 : 16));
+    key1 = (uint64_t *) hash_key;
+    flags = octeon_crypto_enable(&state);
+    if (auth) {
+       CVMX_MT_HSH_IV(0x67452301EFCDAB89ULL, 0);
+       CVMX_MT_HSH_IV(0x98BADCFE10325476ULL, 1);
+       CVMX_MT_HSH_IV(0xC3D2E1F000000000ULL, 2);
+    } else {
+       CVMX_MT_HSH_IV(0x0123456789ABCDEFULL, 0);
+       CVMX_MT_HSH_IV(0xFEDCBA9876543210ULL, 1);
+    }
+
+    CVMX_MT_HSH_DAT((*key1 ^ xor1), 0);
+    key1++;
+    CVMX_MT_HSH_DAT((*key1 ^ xor1), 1);
+    key1++;
+    CVMX_MT_HSH_DAT((*key1 ^ xor1), 2);
+    key1++;
+    CVMX_MT_HSH_DAT((*key1 ^ xor1), 3);
+    key1++;
+    CVMX_MT_HSH_DAT((*key1 ^ xor1), 4);
+    key1++;
+    CVMX_MT_HSH_DAT((*key1 ^ xor1), 5);
+    key1++;
+    CVMX_MT_HSH_DAT((*key1 ^ xor1), 6);
+    key1++;
+    if (auth)
+		CVMX_MT_HSH_STARTSHA((*key1 ^ xor1));
+    else
+		CVMX_MT_HSH_STARTMD5((*key1 ^ xor1));
+
+    CVMX_MF_HSH_IV(inner[0], 0);
+    CVMX_MF_HSH_IV(inner[1], 1);
+    if (auth) {
+		inner[2] = 0;
+		CVMX_MF_HSH_IV(((uint64_t *) inner)[2], 2);
+    }
+
+    memset(hash_key, 0, sizeof(hash_key));
+    memcpy(hash_key, (uint8_t *) key, (auth ? 20 : 16));
+    key1 = (uint64_t *) hash_key;
+    if (auth) {
+      CVMX_MT_HSH_IV(0x67452301EFCDAB89ULL, 0);
+      CVMX_MT_HSH_IV(0x98BADCFE10325476ULL, 1);
+      CVMX_MT_HSH_IV(0xC3D2E1F000000000ULL, 2);
+    } else {
+      CVMX_MT_HSH_IV(0x0123456789ABCDEFULL, 0);
+      CVMX_MT_HSH_IV(0xFEDCBA9876543210ULL, 1);
+    }
+
+    CVMX_MT_HSH_DAT((*key1 ^ xor2), 0);
+    key1++;
+    CVMX_MT_HSH_DAT((*key1 ^ xor2), 1);
+    key1++;
+    CVMX_MT_HSH_DAT((*key1 ^ xor2), 2);
+    key1++;
+    CVMX_MT_HSH_DAT((*key1 ^ xor2), 3);
+    key1++;
+    CVMX_MT_HSH_DAT((*key1 ^ xor2), 4);
+    key1++;
+    CVMX_MT_HSH_DAT((*key1 ^ xor2), 5);
+    key1++;
+    CVMX_MT_HSH_DAT((*key1 ^ xor2), 6);
+    key1++;
+    if (auth)
+       CVMX_MT_HSH_STARTSHA((*key1 ^ xor2));
+    else 
+       CVMX_MT_HSH_STARTMD5((*key1 ^ xor2));
+
+    CVMX_MF_HSH_IV(outer[0], 0);
+    CVMX_MF_HSH_IV(outer[1], 1);
+    if (auth) {
+      outer[2] = 0;
+      CVMX_MF_HSH_IV(outer[2], 2);
+    }
+    octeon_crypto_disable(&state, flags);
+    return;
+}
+
+/****************************************************************************/
+/* DES functions */
+
+int
+octo_des_cbc_encrypt(
+    struct octo_sess *od,
+    struct scatterlist *sg, int sg_len,
+    int auth_off, int auth_len,
+    int crypt_off, int crypt_len,
+    int icv_off, uint8_t *ivp)
+{
+    uint64_t *data;
+    int data_i, data_l;
+    struct octeon_cop2_state state;
+    unsigned long flags;
+
+    dprintk("%s()\n", __FUNCTION__);
+
+    if (unlikely(od == NULL || sg==NULL || sg_len==0 || ivp==NULL ||
+	    (crypt_off & 0x7) || (crypt_off + crypt_len > sg_len))) {
+	dprintk("%s: Bad parameters od=%p sg=%p sg_len=%d "
+		"auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d "
+		"icv_off=%d ivp=%p\n", __FUNCTION__, od, sg, sg_len,
+		auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp);
+	return -EINVAL;
+    }
+
+    SG_INIT(sg, data, data_i, data_l);
+
+    CVMX_PREFETCH0(ivp);
+    CVMX_PREFETCH0(od->octo_enckey);
+
+    flags = octeon_crypto_enable(&state);
+
+    /* load 3DES Key */
+    CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0);
+    if (od->octo_encklen == 24) {
+	CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[1], 1);
+	CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[2], 2);
+    } else if (od->octo_encklen == 8) {
+	CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1);
+	CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2);
+    } else {
+	octeon_crypto_disable(&state, flags);
+	dprintk("%s: Bad key length %d\n", __FUNCTION__, od->octo_encklen);
+	return -EINVAL;
+    }
+
+    CVMX_MT_3DES_IV(* (uint64_t *) ivp);
+
+    while (crypt_off > 0) {
+	SG_CONSUME(sg, data, data_i, data_l);
+	crypt_off -= 8;
+    }
+
+    while (crypt_len > 0) {
+	CVMX_MT_3DES_ENC_CBC(*data);
+	CVMX_MF_3DES_RESULT(*data);
+	SG_CONSUME(sg, data, data_i, data_l);
+	crypt_len -= 8;
+    }
+
+    octeon_crypto_disable(&state, flags);
+    return 0;
+}
+
+
+int
+octo_des_cbc_decrypt(
+    struct octo_sess *od,
+    struct scatterlist *sg, int sg_len,
+    int auth_off, int auth_len,
+    int crypt_off, int crypt_len,
+    int icv_off, uint8_t *ivp)
+{
+    uint64_t *data;
+    int data_i, data_l;
+    struct octeon_cop2_state state;
+    unsigned long flags;
+
+    dprintk("%s()\n", __FUNCTION__);
+
+    if (unlikely(od == NULL || sg==NULL || sg_len==0 || ivp==NULL ||
+	    (crypt_off & 0x7) || (crypt_off + crypt_len > sg_len))) {
+	dprintk("%s: Bad parameters od=%p sg=%p sg_len=%d "
+		"auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d "
+		"icv_off=%d ivp=%p\n", __FUNCTION__, od, sg, sg_len,
+		auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp);
+	return -EINVAL;
+    }
+
+    SG_INIT(sg, data, data_i, data_l);
+
+    CVMX_PREFETCH0(ivp);
+    CVMX_PREFETCH0(od->octo_enckey);
+
+    flags = octeon_crypto_enable(&state);
+
+    /* load 3DES Key */
+    CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0);
+    if (od->octo_encklen == 24) {
+	CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[1], 1);
+	CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[2], 2);
+    } else if (od->octo_encklen == 8) {
+	CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1);
+	CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2);
+    } else {
+	octeon_crypto_disable(&state, flags);
+	dprintk("%s: Bad key length %d\n", __FUNCTION__, od->octo_encklen);
+	return -EINVAL;
+    }
+
+    CVMX_MT_3DES_IV(* (uint64_t *) ivp);
+
+    while (crypt_off > 0) {
+	SG_CONSUME(sg, data, data_i, data_l);
+	crypt_off -= 8;
+    }
+
+    while (crypt_len > 0) {
+	CVMX_MT_3DES_DEC_CBC(*data);
+	CVMX_MF_3DES_RESULT(*data);
+	SG_CONSUME(sg, data, data_i, data_l);
+	crypt_len -= 8;
+    }
+
+    octeon_crypto_disable(&state, flags);
+    return 0;
+}
+
+/****************************************************************************/
+/* AES functions */
+
+int
+octo_aes_cbc_encrypt(
+    struct octo_sess *od,
+    struct scatterlist *sg, int sg_len,
+    int auth_off, int auth_len,
+    int crypt_off, int crypt_len,
+    int icv_off, uint8_t *ivp)
+{
+    uint64_t *data, *pdata;
+    int data_i, data_l;
+    struct octeon_cop2_state state;
+    unsigned long flags;
+
+    dprintk("%s()\n", __FUNCTION__);
+
+    if (unlikely(od == NULL || sg==NULL || sg_len==0 || ivp==NULL ||
+	    (crypt_off & 0x7) || (crypt_off + crypt_len > sg_len))) {
+	dprintk("%s: Bad parameters od=%p sg=%p sg_len=%d "
+		"auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d "
+		"icv_off=%d ivp=%p\n", __FUNCTION__, od, sg, sg_len,
+		auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp);
+	return -EINVAL;
+    }
+
+    SG_INIT(sg, data, data_i, data_l);
+
+    CVMX_PREFETCH0(ivp);
+    CVMX_PREFETCH0(od->octo_enckey);
+
+    flags = octeon_crypto_enable(&state);
+
+    /* load AES Key */
+    CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0);
+    CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[1], 1);
+
+    if (od->octo_encklen == 16) {
+	CVMX_MT_AES_KEY(0x0, 2);
+	CVMX_MT_AES_KEY(0x0, 3);
+    } else if (od->octo_encklen == 24) {
+	CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2);
+	CVMX_MT_AES_KEY(0x0, 3);
+    } else if (od->octo_encklen == 32) {
+	CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2);
+	CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3);
+    } else {
+	octeon_crypto_disable(&state, flags);
+	dprintk("%s: Bad key length %d\n", __FUNCTION__, od->octo_encklen);
+	return -EINVAL;
+    }
+    CVMX_MT_AES_KEYLENGTH(od->octo_encklen / 8 - 1);
+
+    CVMX_MT_AES_IV(((uint64_t *) ivp)[0], 0);
+    CVMX_MT_AES_IV(((uint64_t *) ivp)[1], 1);
+
+    while (crypt_off > 0) {
+	SG_CONSUME(sg, data, data_i, data_l);
+	crypt_off -= 8;
+    }
+
+    while (crypt_len > 0) {
+	pdata = data;
+	CVMX_MT_AES_ENC_CBC0(*data);
+	SG_CONSUME(sg, data, data_i, data_l);
+	CVMX_MT_AES_ENC_CBC1(*data);
+	CVMX_MF_AES_RESULT(*pdata, 0);
+	CVMX_MF_AES_RESULT(*data, 1);
+	SG_CONSUME(sg, data, data_i, data_l);
+	crypt_len -= 16;
+    }
+
+    octeon_crypto_disable(&state, flags);
+    return 0;
+}
+
+
+int
+octo_aes_cbc_decrypt(
+    struct octo_sess *od,
+    struct scatterlist *sg, int sg_len,
+    int auth_off, int auth_len,
+    int crypt_off, int crypt_len,
+    int icv_off, uint8_t *ivp)
+{
+    uint64_t *data, *pdata;
+    int data_i, data_l;
+    struct octeon_cop2_state state;
+    unsigned long flags;
+
+    dprintk("%s()\n", __FUNCTION__);
+
+    if (unlikely(od == NULL || sg==NULL || sg_len==0 || ivp==NULL ||
+	    (crypt_off & 0x7) || (crypt_off + crypt_len > sg_len))) {
+	dprintk("%s: Bad parameters od=%p sg=%p sg_len=%d "
+		"auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d "
+		"icv_off=%d ivp=%p\n", __FUNCTION__, od, sg, sg_len,
+		auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp);
+	return -EINVAL;
+    }
+
+    SG_INIT(sg, data, data_i, data_l);
+
+    CVMX_PREFETCH0(ivp);
+    CVMX_PREFETCH0(od->octo_enckey);
+
+    flags = octeon_crypto_enable(&state);
+
+    /* load AES Key */
+    CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0);
+    CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[1], 1);
+
+    if (od->octo_encklen == 16) {
+	CVMX_MT_AES_KEY(0x0, 2);
+	CVMX_MT_AES_KEY(0x0, 3);
+    } else if (od->octo_encklen == 24) {
+	CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2);
+	CVMX_MT_AES_KEY(0x0, 3);
+    } else if (od->octo_encklen == 32) {
+	CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2);
+	CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3);
+    } else {
+	octeon_crypto_disable(&state, flags);
+	dprintk("%s: Bad key length %d\n", __FUNCTION__, od->octo_encklen);
+	return -EINVAL;
+    }
+    CVMX_MT_AES_KEYLENGTH(od->octo_encklen / 8 - 1);
+
+    CVMX_MT_AES_IV(((uint64_t *) ivp)[0], 0);
+    CVMX_MT_AES_IV(((uint64_t *) ivp)[1], 1);
+
+    while (crypt_off > 0) {
+	SG_CONSUME(sg, data, data_i, data_l);
+	crypt_off -= 8;
+    }
+
+    while (crypt_len > 0) {
+	pdata = data;
+	CVMX_MT_AES_DEC_CBC0(*data);
+	SG_CONSUME(sg, data, data_i, data_l);
+	CVMX_MT_AES_DEC_CBC1(*data);
+	CVMX_MF_AES_RESULT(*pdata, 0);
+	CVMX_MF_AES_RESULT(*data, 1);
+	SG_CONSUME(sg, data, data_i, data_l);
+	crypt_len -= 16;
+    }
+
+    octeon_crypto_disable(&state, flags);
+    return 0;
+}
+
+/****************************************************************************/
+/* MD5 */
+
+int
+octo_null_md5_encrypt(
+    struct octo_sess *od,
+    struct scatterlist *sg, int sg_len,
+    int auth_off, int auth_len,
+    int crypt_off, int crypt_len,
+    int icv_off, uint8_t *ivp)
+{
+    register int next = 0;
+    uint64_t *data;
+    uint64_t tmp1, tmp2;
+    int data_i, data_l, alen = auth_len;
+    struct octeon_cop2_state state;
+    unsigned long flags;
+
+    dprintk("%s()\n", __FUNCTION__);
+
+    if (unlikely(od == NULL || sg==NULL || sg_len==0 ||
+	    (auth_off & 0x7) || (auth_off + auth_len > sg_len))) {
+	dprintk("%s: Bad parameters od=%p sg=%p sg_len=%d "
+		"auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d "
+		"icv_off=%d ivp=%p\n", __FUNCTION__, od, sg, sg_len,
+		auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp);
+	return -EINVAL;
+    }
+
+    SG_INIT(sg, data, data_i, data_l);
+
+    flags = octeon_crypto_enable(&state);
+
+    /* Load MD5 IV */
+    CVMX_MT_HSH_IV(od->octo_hminner[0], 0);
+    CVMX_MT_HSH_IV(od->octo_hminner[1], 1);
+
+    while (auth_off > 0) {
+	SG_CONSUME(sg, data, data_i, data_l);
+	auth_off -= 8;
+    }
+
+    while (auth_len > 0) {
+	CVM_LOAD_MD5_UNIT(*data, next);
+	auth_len -= 8;
+	SG_CONSUME(sg, data, data_i, data_l);
+    }
+
+    /* finish the hash */
+    CVMX_PREFETCH0(od->octo_hmouter);
+#if 0
+    if (unlikely(inplen)) {
+	uint64_t tmp = 0;
+	uint8_t *p = (uint8_t *) & tmp;
+	p[inplen] = 0x80;
+	do {
+	    inplen--;
+	    p[inplen] = ((uint8_t *) data)[inplen];
+	} while (inplen);
+	CVM_LOAD_MD5_UNIT(tmp, next);
+    } else {
+	CVM_LOAD_MD5_UNIT(0x8000000000000000ULL, next);
+    }
+#else
+    CVM_LOAD_MD5_UNIT(0x8000000000000000ULL, next);
+#endif
+
+    /* Finish Inner hash */
+    while (next != 7) {
+	CVM_LOAD_MD5_UNIT(((uint64_t) 0x0ULL), next);
+    }
+    CVMX_ES64(tmp1, ((alen + 64) << 3));
+    CVM_LOAD_MD5_UNIT(tmp1, next);
+
+    /* Get the inner hash of HMAC */
+    CVMX_MF_HSH_IV(tmp1, 0);
+    CVMX_MF_HSH_IV(tmp2, 1);
+
+    /* Initialize hash unit */
+    CVMX_MT_HSH_IV(od->octo_hmouter[0], 0);
+    CVMX_MT_HSH_IV(od->octo_hmouter[1], 1);
+
+    CVMX_MT_HSH_DAT(tmp1, 0);
+    CVMX_MT_HSH_DAT(tmp2, 1);
+    CVMX_MT_HSH_DAT(0x8000000000000000ULL, 2);
+    CVMX_MT_HSH_DATZ(3);
+    CVMX_MT_HSH_DATZ(4);
+    CVMX_MT_HSH_DATZ(5);
+    CVMX_MT_HSH_DATZ(6);
+    CVMX_ES64(tmp1, ((64 + 16) << 3));
+    CVMX_MT_HSH_STARTMD5(tmp1);
+
+    /* save the HMAC */
+    SG_INIT(sg, data, data_i, data_l);
+    while (icv_off > 0) {
+	SG_CONSUME(sg, data, data_i, data_l);
+	icv_off -= 8;
+    }
+    CVMX_MF_HSH_IV(*data, 0);
+    SG_CONSUME(sg, data, data_i, data_l);
+    CVMX_MF_HSH_IV(tmp1, 1);
+    *(uint32_t *)data = (uint32_t) (tmp1 >> 32);
+
+    octeon_crypto_disable(&state, flags);
+    return 0;
+}
+
+/****************************************************************************/
+/* SHA1 */
+
+int
+octo_null_sha1_encrypt(
+    struct octo_sess *od,
+    struct scatterlist *sg, int sg_len,
+    int auth_off, int auth_len,
+    int crypt_off, int crypt_len,
+    int icv_off, uint8_t *ivp)
+{
+    register int next = 0;
+    uint64_t *data;
+    uint64_t tmp1, tmp2, tmp3;
+    int data_i, data_l, alen = auth_len;
+    struct octeon_cop2_state state;
+    unsigned long flags;
+
+    dprintk("%s()\n", __FUNCTION__);
+
+    if (unlikely(od == NULL || sg==NULL || sg_len==0 ||
+	    (auth_off & 0x7) || (auth_off + auth_len > sg_len))) {
+	dprintk("%s: Bad parameters od=%p sg=%p sg_len=%d "
+		"auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d "
+		"icv_off=%d ivp=%p\n", __FUNCTION__, od, sg, sg_len,
+		auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp);
+	return -EINVAL;
+    }
+
+    SG_INIT(sg, data, data_i, data_l);
+
+    flags = octeon_crypto_enable(&state);
+
+    /* Load SHA1 IV */
+    CVMX_MT_HSH_IV(od->octo_hminner[0], 0);
+    CVMX_MT_HSH_IV(od->octo_hminner[1], 1);
+    CVMX_MT_HSH_IV(od->octo_hminner[2], 2);
+
+    while (auth_off > 0) {
+	SG_CONSUME(sg, data, data_i, data_l);
+	auth_off -= 8;
+    }
+
+    while (auth_len > 0) {
+	CVM_LOAD_SHA_UNIT(*data, next);
+	auth_len -= 8;
+	SG_CONSUME(sg, data, data_i, data_l);
+    }
+
+    /* finish the hash */
+    CVMX_PREFETCH0(od->octo_hmouter);
+#if 0
+    if (unlikely(inplen)) {
+	uint64_t tmp = 0;
+	uint8_t *p = (uint8_t *) & tmp;
+	p[inplen] = 0x80;
+	do {
+	    inplen--;
+	    p[inplen] = ((uint8_t *) data)[inplen];
+	} while (inplen);
+	CVM_LOAD_MD5_UNIT(tmp, next);
+    } else {
+	CVM_LOAD_MD5_UNIT(0x8000000000000000ULL, next);
+    }
+#else
+    CVM_LOAD_SHA_UNIT(0x8000000000000000ULL, next);
+#endif
+
+    /* Finish Inner hash */
+    while (next != 7) {
+	CVM_LOAD_SHA_UNIT(((uint64_t) 0x0ULL), next);
+    }
+	CVM_LOAD_SHA_UNIT((uint64_t) ((alen + 64) << 3), next);
+
+    /* Get the inner hash of HMAC */
+    CVMX_MF_HSH_IV(tmp1, 0);
+    CVMX_MF_HSH_IV(tmp2, 1);
+    tmp3 = 0;
+    CVMX_MF_HSH_IV(tmp3, 2);
+
+    /* Initialize hash unit */
+    CVMX_MT_HSH_IV(od->octo_hmouter[0], 0);
+    CVMX_MT_HSH_IV(od->octo_hmouter[1], 1);
+    CVMX_MT_HSH_IV(od->octo_hmouter[2], 2);
+
+    CVMX_MT_HSH_DAT(tmp1, 0);
+    CVMX_MT_HSH_DAT(tmp2, 1);
+    tmp3 |= 0x0000000080000000;
+    CVMX_MT_HSH_DAT(tmp3, 2);
+    CVMX_MT_HSH_DATZ(3);
+    CVMX_MT_HSH_DATZ(4);
+    CVMX_MT_HSH_DATZ(5);
+    CVMX_MT_HSH_DATZ(6);
+    CVMX_MT_HSH_STARTSHA((uint64_t) ((64 + 20) << 3));
+
+    /* save the HMAC */
+    SG_INIT(sg, data, data_i, data_l);
+    while (icv_off > 0) {
+	SG_CONSUME(sg, data, data_i, data_l);
+	icv_off -= 8;
+    }
+    CVMX_MF_HSH_IV(*data, 0);
+    SG_CONSUME(sg, data, data_i, data_l);
+    CVMX_MF_HSH_IV(tmp1, 1);
+    *(uint32_t *)data = (uint32_t) (tmp1 >> 32);
+
+    octeon_crypto_disable(&state, flags);
+    return 0;
+}
+
+/****************************************************************************/
+/* DES MD5 */
+
+int
+octo_des_cbc_md5_encrypt(
+    struct octo_sess *od,
+    struct scatterlist *sg, int sg_len,
+    int auth_off, int auth_len,
+    int crypt_off, int crypt_len,
+    int icv_off, uint8_t *ivp)
+{
+    register int next = 0;
+    union {
+	uint32_t data32[2];
+	uint64_t data64[1];
+    } mydata;
+    uint64_t *data = &mydata.data64[0];
+    uint32_t *data32;
+    uint64_t tmp1, tmp2;
+    int data_i, data_l, alen = auth_len;
+    struct octeon_cop2_state state;
+    unsigned long flags;
+
+    dprintk("%s()\n", __FUNCTION__);
+
+    if (unlikely(od == NULL || sg==NULL || sg_len==0 || ivp==NULL ||
+	    (crypt_off & 0x3) || (crypt_off + crypt_len > sg_len) ||
+	    (crypt_len  & 0x7) ||
+	    (auth_len  & 0x7) ||
+	    (auth_off & 0x3) || (auth_off + auth_len > sg_len))) {
+	dprintk("%s: Bad parameters od=%p sg=%p sg_len=%d "
+		"auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d "
+		"icv_off=%d ivp=%p\n", __FUNCTION__, od, sg, sg_len,
+		auth_off, auth_len, crypt_off, crypt_len, icv_off, ivp);
+	return -EINVAL;
+    }
+
+    SG_INIT(sg, data32, data_i, data_l);
+
+    CVMX_PREFETCH0(ivp);
+    CVMX_PREFETCH0(od->octo_enckey);
+
+    flags = octeon_crypto_enable(&state);
+
+    /* load 3DES Key */
+    CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0);
+    if (od->octo_encklen == 24) {
+	CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[1], 1);
+	CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[2], 2);
+    } else if (od->octo_encklen == 8) {
+	CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1);
+	CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2);
+    } else {
+	octeon_crypto_disable(&state, flags);
+	dprintk("%s: Bad key length %d\n", __FUNCTION__, od->octo_encklen);
+	return -EINVAL;
+    }
+
+    CVMX_MT_3DES_IV(* (uint64_t *) ivp);
+
+    /* Load MD5 IV */
+    CVMX_MT_HSH_IV(od->octo_hminner[0], 0);
+    CVMX_MT_HSH_IV(od->octo_hminner[1], 1);
+
+    while (crypt_off > 0 && auth_off > 0) {
+	SG_CONSUME(sg, data32, data_i, data_l);
+	crypt_off -= 4;
+	auth_off -= 4;
+    }
+
+    while (crypt_len > 0 || auth_len > 0) {
+    	uint32_t *first = data32;
+	mydata.data32[0] = *first;
+	SG_CONSUME(sg, data32, data_i, data_l);
+	mydata.data32[1] = *data32;
+    	if (crypt_off <= 0) {
+	    if (crypt_len > 0) {
+		CVMX_MT_3DES_ENC_CBC(*data);
+		CVMX_MF_3DES_RESULT(*data);
+		crypt_len -= 8;
+	    }
+	} else
+	    crypt_off -= 8;
+    	if (auth_off <= 0) {
+	    if (auth_len > 0) {
+		CVM_LOAD_MD5_UNIT(*data, next);
+		auth_len -= 8;
+	    }
+	} else
+	    auth_off -= 8;
+	*first = mydata.data32[0];
+	*data32 = mydata.data32[1];
+	SG_CONSUME(sg, data32, data_i, data_l);
+    }
+
+    /* finish the hash */
+    CVMX_PREFETCH0(od->octo_hmouter);
+#if 0
+    if (unlikely(inplen)) {
+	uint64_t tmp = 0;
+	uint8_t *p = (uint8_t *) & tmp;
+	p[inplen] = 0x80;
+	do {
+	    inplen--;
+	    p[inplen] = ((uint8_t *) data)[inplen];
+	} while (inplen);
+	CVM_LOAD_MD5_UNIT(tmp, next);
+    } else {
+	CVM_LOAD_MD5_UNIT(0x8000000000000000ULL, next);
+    }
+#else
+    CVM_LOAD_MD5_UNIT(0x8000000000000000ULL, next);
+#endif
+
+    /* Finish Inner hash */
+    while (next != 7) {
+	CVM_LOAD_MD5_UNIT(((uint64_t) 0x0ULL), next);
+    }
+    CVMX_ES64(tmp1, ((alen + 64) << 3));
+    CVM_LOAD_MD5_UNIT(tmp1, next);
+
+    /* Get the inner hash of HMAC */
+    CVMX_MF_HSH_IV(tmp1, 0);
+    CVMX_MF_HSH_IV(tmp2, 1);
+
+    /* Initialize hash unit */
+    CVMX_MT_HSH_IV(od->octo_hmouter[0], 0);
+    CVMX_MT_HSH_IV(od->octo_hmouter[1], 1);
+
+    CVMX_MT_HSH_DAT(tmp1, 0);
+    CVMX_MT_HSH_DAT(tmp2, 1);
+    CVMX_MT_HSH_DAT(0x8000000000000000ULL, 2);
+    CVMX_MT_HSH_DATZ(3);
+    CVMX_MT_HSH_DATZ(4);
+    CVMX_MT_HSH_DATZ(5);
+    CVMX_MT_HSH_DATZ(6);
+    CVMX_ES64(tmp1, ((64 + 16) << 3));
+    CVMX_MT_HSH_STARTMD5(tmp1);
+
+    /* save the HMAC */
+    SG_INIT(sg, data32, data_i, data_l);
+    while (icv_off > 0) {
+	SG_CONSUME(sg, data32, data_i, data_l);
+	icv_off -= 4;
+    }
+    CVMX_MF_HSH_IV(tmp1, 0);
+    *data32 = (uint32_t) (tmp1 >> 32);
+    SG_CONSUME(sg, data32, data_i, data_l);
+    *data32 = (uint32_t) tmp1;
+    SG_CONSUME(sg, data32, data_i, data_l);
+    CVMX_MF_HSH_IV(tmp1, 1);
+    *data32 = (uint32_t) (tmp1 >> 32);
+
+    octeon_crypto_disable(&state, flags);
+    return 0;
+}
+
+int
+octo_des_cbc_md5_decrypt(

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 05:18:03 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B93C51065680;
	Tue, 27 Apr 2010 05:18:03 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8EF9C8FC1A;
	Tue, 27 Apr 2010 05:18:03 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3R5I3Jk009758;
	Tue, 27 Apr 2010 05:18:03 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3R5I2Vj009757;
	Tue, 27 Apr 2010 05:18:02 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004270518.o3R5I2Vj009757@svn.freebsd.org>
From: Kip Macy 
Date: Tue, 27 Apr 2010 05:18:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207261 - user/kmacy/head_page_lock_incr
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 05:18:03 -0000

Author: kmacy
Date: Tue Apr 27 05:18:02 2010
New Revision: 207261
URL: http://svn.freebsd.org/changeset/base/207261

Log:
  branch for incremental global (all architectures) integration of page lock

Added:
     - copied from r207260, head/
Directory Properties:
  user/kmacy/head_page_lock_incr/   (props changed)

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 05:39:14 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2B6511065676;
	Tue, 27 Apr 2010 05:39:14 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F0EAC8FC15;
	Tue, 27 Apr 2010 05:39:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3R5dDqK014651;
	Tue, 27 Apr 2010 05:39:13 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3R5dD0S014618;
	Tue, 27 Apr 2010 05:39:13 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004270539.o3R5dD0S014618@svn.freebsd.org>
From: Kip Macy 
Date: Tue, 27 Apr 2010 05:39:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207264 - in user/kmacy/head_page_lock_incr/sys:
	amd64/amd64 amd64/include arm/arm arm/include dev/drm
	i386/i386 i386/include kern mips/include mips/mips net
	powerpc/aim powerpc/booke p...
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 05:39:14 -0000

Author: kmacy
Date: Tue Apr 27 05:39:13 2010
New Revision: 207264
URL: http://svn.freebsd.org/changeset/base/207264

Log:
  As it stands now, with the exception of hold_count, all vm_page
  modification  acquires both the page queue lock and the appropriate
  page lock. The assumption being that over time we can incrementally
  wean ourselves from the page queue mutex where possible. The next
  field to rely strictly on page_lock will be wire_count.
  
  This currently appears to work ok on normal compile workloads in
  addition to stress2's swap.

Modified:
  user/kmacy/head_page_lock_incr/sys/amd64/amd64/pmap.c
  user/kmacy/head_page_lock_incr/sys/amd64/include/pmap.h
  user/kmacy/head_page_lock_incr/sys/amd64/include/vmparam.h
  user/kmacy/head_page_lock_incr/sys/arm/arm/pmap.c
  user/kmacy/head_page_lock_incr/sys/arm/include/pmap.h
  user/kmacy/head_page_lock_incr/sys/dev/drm/via_dmablit.c
  user/kmacy/head_page_lock_incr/sys/i386/i386/pmap.c
  user/kmacy/head_page_lock_incr/sys/i386/include/pmap.h
  user/kmacy/head_page_lock_incr/sys/kern/kern_exec.c
  user/kmacy/head_page_lock_incr/sys/kern/subr_witness.c
  user/kmacy/head_page_lock_incr/sys/kern/sys_pipe.c
  user/kmacy/head_page_lock_incr/sys/kern/sys_process.c
  user/kmacy/head_page_lock_incr/sys/kern/uipc_cow.c
  user/kmacy/head_page_lock_incr/sys/kern/vfs_bio.c
  user/kmacy/head_page_lock_incr/sys/mips/include/pmap.h
  user/kmacy/head_page_lock_incr/sys/mips/mips/pmap.c
  user/kmacy/head_page_lock_incr/sys/net/bpf_zerocopy.c
  user/kmacy/head_page_lock_incr/sys/powerpc/aim/mmu_oea.c
  user/kmacy/head_page_lock_incr/sys/powerpc/aim/mmu_oea64.c
  user/kmacy/head_page_lock_incr/sys/powerpc/booke/pmap.c
  user/kmacy/head_page_lock_incr/sys/powerpc/include/pmap.h
  user/kmacy/head_page_lock_incr/sys/sparc64/include/pmap.h
  user/kmacy/head_page_lock_incr/sys/sparc64/sparc64/pmap.c
  user/kmacy/head_page_lock_incr/sys/sun4v/include/pmap.h
  user/kmacy/head_page_lock_incr/sys/sun4v/sun4v/pmap.c
  user/kmacy/head_page_lock_incr/sys/vm/device_pager.c
  user/kmacy/head_page_lock_incr/sys/vm/sg_pager.c
  user/kmacy/head_page_lock_incr/sys/vm/swap_pager.c
  user/kmacy/head_page_lock_incr/sys/vm/uma_core.c
  user/kmacy/head_page_lock_incr/sys/vm/vm_contig.c
  user/kmacy/head_page_lock_incr/sys/vm/vm_fault.c
  user/kmacy/head_page_lock_incr/sys/vm/vm_glue.c
  user/kmacy/head_page_lock_incr/sys/vm/vm_kern.c
  user/kmacy/head_page_lock_incr/sys/vm/vm_mmap.c
  user/kmacy/head_page_lock_incr/sys/vm/vm_object.c
  user/kmacy/head_page_lock_incr/sys/vm/vm_page.c
  user/kmacy/head_page_lock_incr/sys/vm/vm_page.h
  user/kmacy/head_page_lock_incr/sys/vm/vm_pageout.c
  user/kmacy/head_page_lock_incr/sys/vm/vm_param.h
  user/kmacy/head_page_lock_incr/sys/vm/vnode_pager.c

Modified: user/kmacy/head_page_lock_incr/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/amd64/amd64/pmap.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/amd64/amd64/pmap.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -793,7 +793,6 @@ static u_long pmap_pdpe_demotions;
 SYSCTL_ULONG(_vm_pmap_pdpe, OID_AUTO, demotions, CTLFLAG_RD,
     &pmap_pdpe_demotions, 0, "1GB page demotions");
 
-
 /***************************************************
  * Low level helper routines.....
  ***************************************************/
@@ -1201,14 +1200,19 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
 	pd_entry_t pde, *pdep;
 	pt_entry_t pte;
 	vm_page_t m;
+	vm_paddr_t pa;
 
+	pa = 0;
 	m = NULL;
-	vm_page_lock_queues();
 	PMAP_LOCK(pmap);
+retry:	
 	pdep = pmap_pde(pmap, va);
 	if (pdep != NULL && (pde = *pdep)) {
 		if (pde & PG_PS) {
 			if ((pde & PG_RW) || (prot & VM_PROT_WRITE) == 0) {
+				if (vm_page_pa_tryrelock(pmap, (pde & PG_PS_FRAME) |
+				       (va & PDRMASK), &pa))
+					goto retry;
 				m = PHYS_TO_VM_PAGE((pde & PG_PS_FRAME) |
 				    (va & PDRMASK));
 				vm_page_hold(m);
@@ -1217,12 +1221,14 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
 			pte = *pmap_pde_to_pte(pdep, va);
 			if ((pte & PG_V) &&
 			    ((pte & PG_RW) || (prot & VM_PROT_WRITE) == 0)) {
+				if (vm_page_pa_tryrelock(pmap, pte & PG_FRAME, &pa))
+					goto retry;
 				m = PHYS_TO_VM_PAGE(pte & PG_FRAME);
 				vm_page_hold(m);
 			}
 		}
 	}
-	vm_page_unlock_queues();
+	PA_UNLOCK_COND(pa);
 	PMAP_UNLOCK(pmap);
 	return (m);
 }
@@ -3143,9 +3149,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
 	 * In the case that a page table page is not
 	 * resident, we are creating it here.
 	 */
-	if (va < VM_MAXUSER_ADDRESS) {
+	if (va < VM_MAXUSER_ADDRESS)
 		mpte = pmap_allocpte(pmap, va, M_WAITOK);
-	}
 
 	pde = pmap_pde(pmap, va);
 	if (pde != NULL && (*pde & PG_V) != 0) {
@@ -3393,7 +3398,7 @@ pmap_enter_object(pmap_t pmap, vm_offset
 			    mpte);
 		m = TAILQ_NEXT(m, listq);
 	}
- 	PMAP_UNLOCK(pmap);
+	PMAP_UNLOCK(pmap);
 }
 
 /*

Modified: user/kmacy/head_page_lock_incr/sys/amd64/include/pmap.h
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/amd64/include/pmap.h	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/amd64/include/pmap.h	Tue Apr 27 05:39:13 2010	(r207264)
@@ -245,6 +245,8 @@ struct pmap {
 	pml4_entry_t		*pm_pml4;	/* KVA of level 4 page table */
 	TAILQ_HEAD(,pv_chunk)	pm_pvchunk;	/* list of mappings in pmap */
 	u_int			pm_active;	/* active on cpus */
+	uint32_t		pm_gen_count;	/* generation count (pmap lock dropped) */
+	u_int			pm_retries;
 	/* spare u_int here due to padding */
 	struct pmap_statistics	pm_stats;	/* pmap statistics */
 	vm_page_t		pm_root;	/* spare page table pages */

Modified: user/kmacy/head_page_lock_incr/sys/amd64/include/vmparam.h
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/amd64/include/vmparam.h	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/amd64/include/vmparam.h	Tue Apr 27 05:39:13 2010	(r207264)
@@ -145,6 +145,10 @@
 #define	VM_LEVEL_0_ORDER	9
 #endif
 
+#ifdef	SMP
+#define	PA_LOCK_COUNT	256
+#endif
+
 /*
  * Virtual addresses of things.  Derived from the page directory and
  * page table indexes from pmap.h for precision.

Modified: user/kmacy/head_page_lock_incr/sys/arm/arm/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/arm/arm/pmap.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/arm/arm/pmap.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -3740,13 +3740,14 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
 	struct l2_dtable *l2;
 	pd_entry_t l1pd;
 	pt_entry_t *ptep, pte;
-	vm_paddr_t pa;
+	vm_paddr_t pa, paddr;
 	vm_page_t m = NULL;
 	u_int l1idx;
 	l1idx = L1_IDX(va);
+	paddr = 0;
 
-	vm_page_lock_queues();
  	PMAP_LOCK(pmap);
+retry:
 	l1pd = pmap->pm_l1->l1_kva[l1idx];
 	if (l1pte_section_p(l1pd)) {
 		/*
@@ -3758,6 +3759,8 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
 			pa = (l1pd & L1_SUP_FRAME) | (va & L1_SUP_OFFSET);
 		else
 			pa = (l1pd & L1_S_FRAME) | (va & L1_S_OFFSET);
+		if (vm_page_pa_tryrelock(pmap, pa & PG_FRAME, &paddr))
+			goto retry;
 		if (l1pd & L1_S_PROT_W || (prot & VM_PROT_WRITE) == 0) {
 			m = PHYS_TO_VM_PAGE(pa);
 			vm_page_hold(m);
@@ -3774,7 +3777,6 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
 		if (l2 == NULL ||
 		    (ptep = l2->l2_bucket[L2_BUCKET(l1idx)].l2b_kva) == NULL) {
 		 	PMAP_UNLOCK(pmap);
-			vm_page_unlock_queues();
 			return (NULL);
 		}
 
@@ -3783,7 +3785,6 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
 
 		if (pte == 0) {
 		 	PMAP_UNLOCK(pmap);
-			vm_page_unlock_queues();
 			return (NULL);
 		}
 		if (pte & L2_S_PROT_W || (prot & VM_PROT_WRITE) == 0) {
@@ -3796,13 +3797,15 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
 				pa = (pte & L2_S_FRAME) | (va & L2_S_OFFSET);
 				break;
 			}
+			if (vm_page_pa_tryrelock(pmap, pa & PG_FRAME, &paddr))
+				goto retry;		
 			m = PHYS_TO_VM_PAGE(pa);
 			vm_page_hold(m);
 		}
 	}
 
  	PMAP_UNLOCK(pmap);
-	vm_page_unlock_queues();
+	PA_UNLOCK_COND(paddr);
 	return (m);
 }
 

Modified: user/kmacy/head_page_lock_incr/sys/arm/include/pmap.h
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/arm/include/pmap.h	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/arm/include/pmap.h	Tue Apr 27 05:39:13 2010	(r207264)
@@ -134,6 +134,8 @@ struct	pmap {
 	struct l1_ttable	*pm_l1;
 	struct l2_dtable	*pm_l2[L2_SIZE];
 	pd_entry_t		*pm_pdir;	/* KVA of page directory */
+	uint32_t		pm_gen_count;	/* generation count (pmap lock dropped) */
+	u_int			pm_retries;
 	int			pm_active;	/* active on cpus */
 	struct pmap_statistics	pm_stats;	/* pmap statictics */
 	TAILQ_HEAD(,pv_entry)	pm_pvlist;	/* list of mappings in pmap */

Modified: user/kmacy/head_page_lock_incr/sys/dev/drm/via_dmablit.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/dev/drm/via_dmablit.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/dev/drm/via_dmablit.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -248,10 +248,12 @@ via_lock_all_dma_pages(drm_via_sg_info_t
 		    (vm_offset_t)xfer->mem_addr + IDX_TO_OFF(i), VM_PROT_RW);
 		if (m == NULL)
 			break;
+		vm_page_lock(m);
 		vm_page_lock_queues();
 		vm_page_wire(m);
 		vm_page_unhold(m);
 		vm_page_unlock_queues();
+		vm_page_unlock(m);
 		vsg->pages[i] = m;
 	}
 	vsg->state = dr_via_pages_locked;

Modified: user/kmacy/head_page_lock_incr/sys/i386/i386/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/i386/i386/pmap.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/i386/i386/pmap.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -1346,14 +1346,19 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
 	pd_entry_t pde;
 	pt_entry_t pte;
 	vm_page_t m;
+	vm_paddr_t pa;
 
+	pa = 0;
 	m = NULL;
-	vm_page_lock_queues();
 	PMAP_LOCK(pmap);
+retry:
 	pde = *pmap_pde(pmap, va);
 	if (pde != 0) {
 		if (pde & PG_PS) {
 			if ((pde & PG_RW) || (prot & VM_PROT_WRITE) == 0) {
+				if (vm_page_pa_tryrelock(pmap, (pde & PG_PS_FRAME) |
+				       (va & PDRMASK), &pa))
+					goto retry;
 				m = PHYS_TO_VM_PAGE((pde & PG_PS_FRAME) |
 				    (va & PDRMASK));
 				vm_page_hold(m);
@@ -1363,13 +1368,15 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
 			pte = *pmap_pte_quick(pmap, va);
 			if (pte != 0 &&
 			    ((pte & PG_RW) || (prot & VM_PROT_WRITE) == 0)) {
+				if (vm_page_pa_tryrelock(pmap, pte & PG_FRAME, &pa))
+					goto retry;
 				m = PHYS_TO_VM_PAGE(pte & PG_FRAME);
 				vm_page_hold(m);
 			}
 			sched_unpin();
 		}
 	}
-	vm_page_unlock_queues();
+	PA_UNLOCK_COND(pa);
 	PMAP_UNLOCK(pmap);
 	return (m);
 }

Modified: user/kmacy/head_page_lock_incr/sys/i386/include/pmap.h
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/i386/include/pmap.h	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/i386/include/pmap.h	Tue Apr 27 05:39:13 2010	(r207264)
@@ -420,11 +420,14 @@ struct pmap {
 	u_int			pm_active;	/* active on cpus */
 	struct pmap_statistics	pm_stats;	/* pmap statistics */
 	LIST_ENTRY(pmap) 	pm_list;	/* List of all pmaps */
+	uint32_t		pm_gen_count;	/* generation count (pmap lock dropped) */
+	u_int			pm_retries;
 #ifdef PAE
 	pdpt_entry_t		*pm_pdpt;	/* KVA of page director pointer
 						   table */
 #endif
 	vm_page_t		pm_root;	/* spare page table pages */
+
 };
 
 typedef struct pmap	*pmap_t;

Modified: user/kmacy/head_page_lock_incr/sys/kern/kern_exec.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/kern/kern_exec.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/kern/kern_exec.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -957,9 +957,9 @@ exec_map_first_page(imgp)
 			return (EIO);
 		}
 	}
-	vm_page_lock_queues();
+	vm_page_lock(ma[0]);
 	vm_page_hold(ma[0]);
-	vm_page_unlock_queues();
+	vm_page_unlock(ma[0]);
 	vm_page_wakeup(ma[0]);
 	VM_OBJECT_UNLOCK(object);
 
@@ -979,9 +979,9 @@ exec_unmap_first_page(imgp)
 		m = sf_buf_page(imgp->firstpage);
 		sf_buf_free(imgp->firstpage);
 		imgp->firstpage = NULL;
-		vm_page_lock_queues();
+		vm_page_lock(m);
 		vm_page_unhold(m);
-		vm_page_unlock_queues();
+		vm_page_unlock(m);
 	}
 }
 

Modified: user/kmacy/head_page_lock_incr/sys/kern/subr_witness.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/kern/subr_witness.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/kern/subr_witness.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -597,6 +597,15 @@ static struct witness_order_list_entry o
 	{ "cdev", &lock_class_mtx_sleep },
 	{ NULL, NULL },
 	/*
+	 * VM
+	 * 
+	 */
+	{ "vm object", &lock_class_mtx_sleep },
+	{ "page lock", &lock_class_mtx_sleep },
+	{ "vm page queue mutex", &lock_class_mtx_sleep },
+	{ "pmap", &lock_class_mtx_sleep },
+	{ NULL, NULL },
+	/*
 	 * kqueue/VFS interaction
 	 */
 	{ "kqueue", &lock_class_mtx_sleep },

Modified: user/kmacy/head_page_lock_incr/sys/kern/sys_pipe.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/kern/sys_pipe.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/kern/sys_pipe.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -773,10 +773,12 @@ pipe_build_write_buffer(wpipe, uio)
 		 */
 	race:
 		if (vm_fault_quick((caddr_t)addr, VM_PROT_READ) < 0) {
-			vm_page_lock_queues();
-			for (j = 0; j < i; j++)
+			
+			for (j = 0; j < i; j++) {
+				vm_page_lock(wpipe->pipe_map.ms[j]);
 				vm_page_unhold(wpipe->pipe_map.ms[j]);
-			vm_page_unlock_queues();
+				vm_page_unlock(wpipe->pipe_map.ms[j]);
+			}
 			return (EFAULT);
 		}
 		wpipe->pipe_map.ms[i] = pmap_extract_and_hold(pmap, addr,
@@ -816,11 +818,11 @@ pipe_destroy_write_buffer(wpipe)
 	int i;
 
 	PIPE_LOCK_ASSERT(wpipe, MA_OWNED);
-	vm_page_lock_queues();
 	for (i = 0; i < wpipe->pipe_map.npages; i++) {
+		vm_page_lock(wpipe->pipe_map.ms[i]);
 		vm_page_unhold(wpipe->pipe_map.ms[i]);
+		vm_page_unlock(wpipe->pipe_map.ms[i]);
 	}
-	vm_page_unlock_queues();
 	wpipe->pipe_map.npages = 0;
 }
 

Modified: user/kmacy/head_page_lock_incr/sys/kern/sys_process.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/kern/sys_process.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/kern/sys_process.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -349,9 +349,9 @@ proc_rwmem(struct proc *p, struct uio *u
 		/*
 		 * Release the page.
 		 */
-		vm_page_lock_queues();
+		vm_page_lock(m);
 		vm_page_unhold(m);
-		vm_page_unlock_queues();
+		vm_page_unlock(m);
 
 	} while (error == 0 && uio->uio_resid > 0);
 

Modified: user/kmacy/head_page_lock_incr/sys/kern/uipc_cow.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/kern/uipc_cow.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/kern/uipc_cow.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -128,10 +128,12 @@ socow_setup(struct mbuf *m0, struct uio 
 	/* 
 	 * set up COW
 	 */
+	vm_page_lock(pp);
 	vm_page_lock_queues();
 	if (vm_page_cowsetup(pp) != 0) {
 		vm_page_unhold(pp);
 		vm_page_unlock_queues();
+		vm_page_unlock(pp);
 		return (0);
 	}
 
@@ -141,7 +143,7 @@ socow_setup(struct mbuf *m0, struct uio 
 	vm_page_wire(pp);
 	vm_page_unhold(pp);
 	vm_page_unlock_queues();
-
+	vm_page_unlock(pp);
 	/*
 	 * Allocate an sf buf
 	 */

Modified: user/kmacy/head_page_lock_incr/sys/kern/vfs_bio.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/kern/vfs_bio.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/kern/vfs_bio.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -3860,12 +3860,12 @@ vmapbuf(struct buf *bp)
 retry:
 		if (vm_fault_quick(addr >= bp->b_data ? addr : bp->b_data,
 		    prot) < 0) {
-			vm_page_lock_queues();
 			for (i = 0; i < pidx; ++i) {
+				vm_page_lock(bp->b_pages[i]);
 				vm_page_unhold(bp->b_pages[i]);
+				vm_page_unlock(bp->b_pages[i]);
 				bp->b_pages[i] = NULL;
 			}
-			vm_page_unlock_queues();
 			return(-1);
 		}
 		m = pmap_extract_and_hold(pmap, (vm_offset_t)addr, prot);
@@ -3896,11 +3896,12 @@ vunmapbuf(struct buf *bp)
 
 	npages = bp->b_npages;
 	pmap_qremove(trunc_page((vm_offset_t)bp->b_data), npages);
-	vm_page_lock_queues();
-	for (pidx = 0; pidx < npages; pidx++)
+	for (pidx = 0; pidx < npages; pidx++) {
+		vm_page_lock(bp->b_pages[pidx]);
 		vm_page_unhold(bp->b_pages[pidx]);
-	vm_page_unlock_queues();
-
+		vm_page_unlock(bp->b_pages[pidx]);
+	}
+	
 	bp->b_data = bp->b_saveaddr;
 }
 

Modified: user/kmacy/head_page_lock_incr/sys/mips/include/pmap.h
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/mips/include/pmap.h	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/mips/include/pmap.h	Tue Apr 27 05:39:13 2010	(r207264)
@@ -88,6 +88,8 @@ struct pmap {
 	pd_entry_t *pm_segtab;	/* KVA of segment table */
 	TAILQ_HEAD(, pv_entry) pm_pvlist;	/* list of mappings in
 						 * pmap */
+	uint32_t	pm_gen_count;	/* generation count (pmap lock dropped) */
+	u_int		pm_retries;
 	int pm_active;		/* active on cpus */
 	struct {
 		u_int32_t asid:ASID_BITS;	/* TLB address space tag */

Modified: user/kmacy/head_page_lock_incr/sys/mips/mips/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/mips/mips/pmap.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/mips/mips/pmap.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -147,7 +147,6 @@ unsigned pmap_max_asid;		/* max ASID sup
 
 #define	PMAP_ASID_RESERVED	0
 
-
 vm_offset_t kernel_vm_end;
 
 static struct tlb tlbstash[MAXCPU][MIPS_MAX_TLB_ENTRIES];
@@ -710,18 +709,22 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
 {
 	pt_entry_t pte;
 	vm_page_t m;
+	vm_paddr_t pa;
 
 	m = NULL;
-	vm_page_lock_queues();
+	pa = 0;
 	PMAP_LOCK(pmap);
-
+retry:
 	pte = *pmap_pte(pmap, va);
 	if (pte != 0 && pmap_pte_v(&pte) &&
 	    ((pte & PTE_RW) || (prot & VM_PROT_WRITE) == 0)) {
+		if (vm_page_pa_tryrelock(pmap, mips_tlbpfn_to_paddr(pte), &pa))
+			goto retry;
+
 		m = PHYS_TO_VM_PAGE(mips_tlbpfn_to_paddr(pte));
 		vm_page_hold(m);
 	}
-	vm_page_unlock_queues();
+	PA_UNLOCK_COND(pa);
 	PMAP_UNLOCK(pmap);
 	return (m);
 }

Modified: user/kmacy/head_page_lock_incr/sys/net/bpf_zerocopy.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/net/bpf_zerocopy.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/net/bpf_zerocopy.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -168,10 +168,12 @@ zbuf_sfbuf_get(struct vm_map *map, vm_of
 	    VM_PROT_WRITE);
 	if (pp == NULL)
 		return (NULL);
+	vm_page_lock(pp);
 	vm_page_lock_queues();
 	vm_page_wire(pp);
 	vm_page_unhold(pp);
 	vm_page_unlock_queues();
+	vm_page_unlock(pp);
 	sf = sf_buf_alloc(pp, SFB_NOWAIT);
 	if (sf == NULL) {
 		zbuf_page_free(pp);

Modified: user/kmacy/head_page_lock_incr/sys/powerpc/aim/mmu_oea.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/powerpc/aim/mmu_oea.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/powerpc/aim/mmu_oea.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -1241,18 +1241,22 @@ moea_extract_and_hold(mmu_t mmu, pmap_t 
 {
 	struct	pvo_entry *pvo;
 	vm_page_t m;
-        
+        vm_paddr_t pa;
+
 	m = NULL;
-	vm_page_lock_queues();
+	pa = 0;
 	PMAP_LOCK(pmap);
+retry:
 	pvo = moea_pvo_find_va(pmap, va & ~ADDR_POFF, NULL);
 	if (pvo != NULL && (pvo->pvo_pte.pte.pte_hi & PTE_VALID) &&
 	    ((pvo->pvo_pte.pte.pte_lo & PTE_PP) == PTE_RW ||
 	     (prot & VM_PROT_WRITE) == 0)) {
+		if (vm_page_pa_tryrelock(pmap, pvo->pvo_pte.pte.pte_lo & PTE_RPGN, &pa))
+			goto retry;
 		m = PHYS_TO_VM_PAGE(pvo->pvo_pte.pte.pte_lo & PTE_RPGN);
 		vm_page_hold(m);
 	}
-	vm_page_unlock_queues();
+	PA_UNLOCK_COND(pa);
 	PMAP_UNLOCK(pmap);
 	return (m);
 }

Modified: user/kmacy/head_page_lock_incr/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/powerpc/aim/mmu_oea64.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/powerpc/aim/mmu_oea64.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -1374,18 +1374,22 @@ moea64_extract_and_hold(mmu_t mmu, pmap_
 {
 	struct	pvo_entry *pvo;
 	vm_page_t m;
+        vm_paddr_t pa;
         
 	m = NULL;
-	vm_page_lock_queues();
+	pa = 0;
 	PMAP_LOCK(pmap);
 	pvo = moea64_pvo_find_va(pmap, va & ~ADDR_POFF, NULL);
 	if (pvo != NULL && (pvo->pvo_pte.lpte.pte_hi & LPTE_VALID) &&
 	    ((pvo->pvo_pte.lpte.pte_lo & LPTE_PP) == LPTE_RW ||
 	     (prot & VM_PROT_WRITE) == 0)) {
+		if (vm_page_pa_tryrelock(pmap,
+			pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN, &pa))
+			goto retry;
 		m = PHYS_TO_VM_PAGE(pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN);
 		vm_page_hold(m);
 	}
-	vm_page_unlock_queues();
+	PA_UNLOCK_COND(pa);
 	PMAP_UNLOCK(pmap);
 	return (m);
 }

Modified: user/kmacy/head_page_lock_incr/sys/powerpc/booke/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/powerpc/booke/pmap.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/powerpc/booke/pmap.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -2034,11 +2034,12 @@ mmu_booke_extract_and_hold(mmu_t mmu, pm
 	pte_t *pte;
 	vm_page_t m;
 	uint32_t pte_wbit;
-
+	vm_paddr_t pa;
+	
 	m = NULL;
-	vm_page_lock_queues();
+	pa = 0;	
 	PMAP_LOCK(pmap);
-
+retry:
 	pte = pte_find(mmu, pmap, va);
 	if ((pte != NULL) && PTE_ISVALID(pte)) {
 		if (pmap == kernel_pmap)
@@ -2047,12 +2048,14 @@ mmu_booke_extract_and_hold(mmu_t mmu, pm
 			pte_wbit = PTE_UW;
 
 		if ((pte->flags & pte_wbit) || ((prot & VM_PROT_WRITE) == 0)) {
+			if (vm_page_pa_tryrelock(pmap, PTE_PA(pte), &pa))
+				goto retry;
 			m = PHYS_TO_VM_PAGE(PTE_PA(pte));
 			vm_page_hold(m);
 		}
 	}
 
-	vm_page_unlock_queues();
+	PA_UNLOCK_COND(pa);
 	PMAP_UNLOCK(pmap);
 	return (m);
 }

Modified: user/kmacy/head_page_lock_incr/sys/powerpc/include/pmap.h
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/powerpc/include/pmap.h	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/powerpc/include/pmap.h	Tue Apr 27 05:39:13 2010	(r207264)
@@ -88,6 +88,8 @@ struct	pmap {
 	struct	mtx	pm_mtx;
 	u_int		pm_sr[16];
 	u_int		pm_active;
+	uint32_t	pm_gen_count;	/* generation count (pmap lock dropped) */
+	u_int		pm_retries;
 	u_int		pm_context;
 
 	struct pmap	*pmap_phys;

Modified: user/kmacy/head_page_lock_incr/sys/sparc64/include/pmap.h
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/sparc64/include/pmap.h	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/sparc64/include/pmap.h	Tue Apr 27 05:39:13 2010	(r207264)
@@ -62,6 +62,8 @@ struct pmap {
 	struct	tte *pm_tsb;
 	vm_object_t pm_tsb_obj;
 	u_int	pm_active;
+	uint32_t	pm_gen_count;	/* generation count (pmap lock dropped) */
+	u_int			pm_retries;
 	u_int	pm_context[MAXCPU];
 	struct	pmap_statistics pm_stats;
 };

Modified: user/kmacy/head_page_lock_incr/sys/sparc64/sparc64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/sparc64/sparc64/pmap.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/sparc64/sparc64/pmap.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -694,13 +694,17 @@ pmap_extract_and_hold(pmap_t pm, vm_offs
 {
 	struct tte *tp;
 	vm_page_t m;
+	vm_paddr_t pa;
 
 	m = NULL;
-	vm_page_lock_queues();
+	pa = 0;
+	PMAP_LOCK(pm);
+retry:
 	if (pm == kernel_pmap) {
 		if (va >= VM_MIN_DIRECT_ADDRESS) {
 			tp = NULL;
 			m = PHYS_TO_VM_PAGE(TLB_DIRECT_TO_PHYS(va));
+			(void)vm_page_pa_tryrelock(pmap, TLB_DIRECT_TO_PHYS(va), &pa);
 			vm_page_hold(m);
 		} else {
 			tp = tsb_kvtotte(va);
@@ -708,17 +712,17 @@ pmap_extract_and_hold(pmap_t pm, vm_offs
 				tp = NULL;
 		}
 	} else {
-		PMAP_LOCK(pm);
 		tp = tsb_tte_lookup(pm, va);
 	}
 	if (tp != NULL && ((tp->tte_data & TD_SW) ||
 	    (prot & VM_PROT_WRITE) == 0)) {
+		if (vm_page_pa_tryrelock(pmap, TTE_GET_PA(tp), &pa))
+			goto retry;
 		m = PHYS_TO_VM_PAGE(TTE_GET_PA(tp));
 		vm_page_hold(m);
 	}
-	vm_page_unlock_queues();
-	if (pm != kernel_pmap)
-		PMAP_UNLOCK(pm);
+	PA_UNLOCK_COND(pa);
+	PMAP_UNLOCK(pm);
 	return (m);
 }
 

Modified: user/kmacy/head_page_lock_incr/sys/sun4v/include/pmap.h
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/sun4v/include/pmap.h	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/sun4v/include/pmap.h	Tue Apr 27 05:39:13 2010	(r207264)
@@ -75,6 +75,8 @@ struct pmap {
 	struct tte_hash        *pm_hash;
 	TAILQ_HEAD(,pv_entry)	pm_pvlist;	/* list of mappings in pmap */
 	struct hv_tsb_info      pm_tsb;
+	uint32_t		pm_gen_count;	/* generation count (pmap lock dropped) */
+	u_int			pm_retries;
 	pmap_cpumask_t          pm_active;      /* mask of cpus currently using pmap */
 	pmap_cpumask_t          pm_tlbactive;   /* mask of cpus that have used this pmap */
 	struct	pmap_statistics pm_stats;

Modified: user/kmacy/head_page_lock_incr/sys/sun4v/sun4v/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/sun4v/sun4v/pmap.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/sun4v/sun4v/pmap.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -1275,17 +1275,21 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
 {
 	tte_t tte_data;
 	vm_page_t m;
+	vm_paddr_t pa;
 
 	m = NULL;
-	vm_page_lock_queues();
+	pa = 0;
 	PMAP_LOCK(pmap);
+retry:	
 	tte_data = tte_hash_lookup(pmap->pm_hash, va);
 	if (tte_data != 0 && 
 	    ((tte_data & VTD_SW_W) || (prot & VM_PROT_WRITE) == 0)) {
+		if (vm_page_pa_tryrelock(pmap, TTE_GET_PA(tte_data), &pa))
+			goto retry;
 		m = PHYS_TO_VM_PAGE(TTE_GET_PA(tte_data));
 		vm_page_hold(m);
 	}
-	vm_page_unlock_queues();
+	PA_UNLOCK_COND(pa);
 	PMAP_UNLOCK(pmap);
 
 	return (m);

Modified: user/kmacy/head_page_lock_incr/sys/vm/device_pager.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/vm/device_pager.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/vm/device_pager.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -251,12 +251,16 @@ dev_pager_getpages(object, m, count, req
 		VM_OBJECT_LOCK(object);
 		dev_pager_updatefake(page, paddr, memattr);
 		if (count > 1) {
-			vm_page_lock_queues();
+
 			for (i = 0; i < count; i++) {
-				if (i != reqpage)
+				if (i != reqpage) {
+					vm_page_lock(m[i]);
+					vm_page_lock_queues();		
 					vm_page_free(m[i]);
+					vm_page_unlock_queues();
+					vm_page_unlock(m[i]);
+				}
 			}
-			vm_page_unlock_queues();
 		}
 	} else {
 		/*
@@ -266,10 +270,13 @@ dev_pager_getpages(object, m, count, req
 		page = dev_pager_getfake(paddr, memattr);
 		VM_OBJECT_LOCK(object);
 		TAILQ_INSERT_TAIL(&object->un_pager.devp.devp_pglist, page, pageq);
-		vm_page_lock_queues();
-		for (i = 0; i < count; i++)
+		for (i = 0; i < count; i++) {
+			vm_page_lock(m[i]);
+			vm_page_lock_queues();
 			vm_page_free(m[i]);
-		vm_page_unlock_queues();
+			vm_page_unlock_queues();
+			vm_page_unlock(m[i]);
+		}
 		vm_page_insert(page, object, offset);
 		m[reqpage] = page;
 	}

Modified: user/kmacy/head_page_lock_incr/sys/vm/sg_pager.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/vm/sg_pager.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/vm/sg_pager.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -198,10 +198,13 @@ sg_pager_getpages(vm_object_t object, vm
 	TAILQ_INSERT_TAIL(&object->un_pager.sgp.sgp_pglist, page, pageq);
 
 	/* Free the original pages and insert this fake page into the object. */
-	vm_page_lock_queues();
-	for (i = 0; i < count; i++)
+	for (i = 0; i < count; i++) {
+		vm_page_lock(m[i]);
+		vm_page_lock_queues();
 		vm_page_free(m[i]);
-	vm_page_unlock_queues();
+		vm_page_unlock_queues();
+		vm_page_unlock(m[i]);
+	}
 	vm_page_insert(page, object, offset);
 	m[reqpage] = page;
 	page->valid = VM_PAGE_BITS_ALL;

Modified: user/kmacy/head_page_lock_incr/sys/vm/swap_pager.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/vm/swap_pager.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/vm/swap_pager.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -1130,10 +1130,16 @@ swap_pager_getpages(vm_object_t object, 
 		int k;
 
 		vm_page_lock_queues();
-		for (k = 0; k < i; ++k)
+		for (k = 0; k < i; ++k) {
+			vm_page_lock(m[k]);
 			vm_page_free(m[k]);
-		for (k = j; k < count; ++k)
+			vm_page_unlock(m[k]);
+		}
+		for (k = j; k < count; ++k) {
+			vm_page_lock(m[k]);
 			vm_page_free(m[k]);
+			vm_page_unlock(m[k]);
+		}
 		vm_page_unlock_queues();
 	}
 
@@ -1489,7 +1495,7 @@ swp_pager_async_iodone(struct buf *bp)
 		object = bp->b_pages[0]->object;
 		VM_OBJECT_LOCK(object);
 	}
-	vm_page_lock_queues();
+
 	/*
 	 * cleanup pages.  If an error occurs writing to swap, we are in
 	 * very serious trouble.  If it happens to be a disk error, though,
@@ -1501,6 +1507,8 @@ swp_pager_async_iodone(struct buf *bp)
 	for (i = 0; i < bp->b_npages; ++i) {
 		vm_page_t m = bp->b_pages[i];
 
+		vm_page_lock(m);
+		vm_page_lock_queues();
 		m->oflags &= ~VPO_SWAPINPROG;
 
 		if (bp->b_ioflags & BIO_ERROR) {
@@ -1597,8 +1605,9 @@ swp_pager_async_iodone(struct buf *bp)
 			if (vm_page_count_severe())
 				vm_page_try_to_cache(m);
 		}
+		vm_page_unlock_queues();
+		vm_page_unlock(m);
 	}
-	vm_page_unlock_queues();
 
 	/*
 	 * adjust pip.  NOTE: the original parent may still have its own
@@ -1694,10 +1703,12 @@ swp_pager_force_pagein(vm_object_t objec
 	m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL|VM_ALLOC_RETRY);
 	if (m->valid == VM_PAGE_BITS_ALL) {
 		vm_object_pip_subtract(object, 1);
+		vm_page_lock(m);
 		vm_page_lock_queues();
 		vm_page_activate(m);
 		vm_page_dirty(m);
 		vm_page_unlock_queues();
+		vm_page_unlock(m);
 		vm_page_wakeup(m);
 		vm_pager_page_unswapped(m);
 		return;
@@ -1706,10 +1717,12 @@ swp_pager_force_pagein(vm_object_t objec
 	if (swap_pager_getpages(object, &m, 1, 0) != VM_PAGER_OK)
 		panic("swap_pager_force_pagein: read from swap failed");/*XXX*/
 	vm_object_pip_subtract(object, 1);
+	vm_page_lock(m);
 	vm_page_lock_queues();
 	vm_page_dirty(m);
 	vm_page_dontneed(m);
 	vm_page_unlock_queues();
+	vm_page_unlock(m);
 	vm_page_wakeup(m);
 	vm_pager_page_unswapped(m);
 }

Modified: user/kmacy/head_page_lock_incr/sys/vm/uma_core.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/vm/uma_core.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/vm/uma_core.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -1022,10 +1022,12 @@ obj_alloc(uma_zone_t zone, int bytes, u_
 			while (pages != startpages) {
 				pages--;
 				p = TAILQ_LAST(&object->memq, pglist);
+				vm_page_lock(p);
 				vm_page_lock_queues();
 				vm_page_unwire(p, 0);
 				vm_page_free(p);
 				vm_page_unlock_queues();
+				vm_page_unlock(p);
 			}
 			retkva = 0;
 			goto done;

Modified: user/kmacy/head_page_lock_incr/sys/vm/vm_contig.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/vm/vm_contig.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/vm/vm_contig.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -257,9 +257,11 @@ retry:
 				i -= PAGE_SIZE;
 				m = vm_page_lookup(object, OFF_TO_IDX(offset +
 				    i));
+				vm_page_lock(m);
 				vm_page_lock_queues();
 				vm_page_free(m);
 				vm_page_unlock_queues();
+				vm_page_unlock(m);
 			}
 			VM_OBJECT_UNLOCK(object);
 			vm_map_delete(map, addr, addr + size);

Modified: user/kmacy/head_page_lock_incr/sys/vm/vm_fault.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/vm/vm_fault.c	Tue Apr 27 05:38:26 2010	(r207263)
+++ user/kmacy/head_page_lock_incr/sys/vm/vm_fault.c	Tue Apr 27 05:39:13 2010	(r207264)
@@ -137,9 +137,11 @@ release_page(struct faultstate *fs)
 {
 
 	vm_page_wakeup(fs->m);
+	vm_page_lock(fs->m);
 	vm_page_lock_queues();
 	vm_page_deactivate(fs->m);
 	vm_page_unlock_queues();
+	vm_page_unlock(fs->m);
 	fs->m = NULL;
 }
 
@@ -161,9 +163,11 @@ unlock_and_deallocate(struct faultstate 
 	VM_OBJECT_UNLOCK(fs->object);
 	if (fs->object != fs->first_object) {
 		VM_OBJECT_LOCK(fs->first_object);
+		vm_page_lock(fs->first_m);
 		vm_page_lock_queues();
 		vm_page_free(fs->first_m);
 		vm_page_unlock_queues();
+		vm_page_unlock(fs->first_m);
 		vm_object_pip_wakeup(fs->first_object);
 		VM_OBJECT_UNLOCK(fs->first_object);
 		fs->first_m = NULL;
@@ -305,12 +309,14 @@ RetryFault:;
 			 * removes the page from the backing object, 
 			 * which is not what we want.
 			 */
+			vm_page_lock(fs.m);
 			vm_page_lock_queues();
 			if ((fs.m->cow) && 
 			    (fault_type & VM_PROT_WRITE) &&
 			    (fs.object == fs.first_object)) {
 				vm_page_cowfault(fs.m);
 				vm_page_unlock_queues();
+				vm_page_unlock(fs.m);
 				unlock_and_deallocate(&fs);
 				goto RetryFault;
 			}
@@ -333,12 +339,15 @@ RetryFault:;
 			 */
 			if ((fs.m->oflags & VPO_BUSY) || fs.m->busy) {
 				vm_page_unlock_queues();
+				vm_page_unlock(fs.m);
 				VM_OBJECT_UNLOCK(fs.object);
 				if (fs.object != fs.first_object) {
 					VM_OBJECT_LOCK(fs.first_object);
+					vm_page_lock(fs.first_m);
 					vm_page_lock_queues();
 					vm_page_free(fs.first_m);
 					vm_page_unlock_queues();
+					vm_page_unlock(fs.first_m);
 					vm_object_pip_wakeup(fs.first_object);
 					VM_OBJECT_UNLOCK(fs.first_object);
 					fs.first_m = NULL;
@@ -358,6 +367,7 @@ RetryFault:;
 			}
 			vm_pageq_remove(fs.m);
 			vm_page_unlock_queues();
+			vm_page_unlock(fs.m);
 
 			/*
 			 * Mark page busy for other processes, and the 
@@ -481,17 +491,25 @@ readrest:
 						continue;
 					if (!are_queues_locked) {
 						are_queues_locked = TRUE;
+						vm_page_lock(mt);
+						vm_page_lock_queues();
+					} else {
+						vm_page_unlock_queues();
+						vm_page_lock(mt);
 						vm_page_lock_queues();
 					}
 					if (mt->hold_count ||
-						mt->wire_count) 
+					    mt->wire_count) {
+						vm_page_unlock(mt);
 						continue;
+					}
 					pmap_remove_all(mt);
 					if (mt->dirty) {
 						vm_page_deactivate(mt);
 					} else {
 						vm_page_cache(mt);
 					}
+					vm_page_unlock(mt);
 				}
 				if (are_queues_locked)
 					vm_page_unlock_queues();
@@ -623,17 +641,21 @@ vnode_locked:
 			 */
 			if (((fs.map != kernel_map) && (rv == VM_PAGER_ERROR)) ||
 				(rv == VM_PAGER_BAD)) {
+				vm_page_lock(fs.m);
 				vm_page_lock_queues();
 				vm_page_free(fs.m);
 				vm_page_unlock_queues();
+				vm_page_unlock(fs.m);
 				fs.m = NULL;
 				unlock_and_deallocate(&fs);
 				return ((rv == VM_PAGER_ERROR) ? KERN_FAILURE : KERN_PROTECTION_FAILURE);
 			}
 			if (fs.object != fs.first_object) {
+				vm_page_lock(fs.m);
 				vm_page_lock_queues();
 				vm_page_free(fs.m);
 				vm_page_unlock_queues();
+				vm_page_unlock(fs.m);
 				fs.m = NULL;
 				/*
 				 * XXX - we cannot just fall out at this
@@ -746,18 +768,24 @@ vnode_locked:
 				 * We don't chase down the shadow chain
 				 */
 			    fs.object == fs.first_object->backing_object) {
+				vm_page_lock(fs.first_m);
 				vm_page_lock_queues();
 				/*
 				 * get rid of the unnecessary page
 				 */
 				vm_page_free(fs.first_m);
+				vm_page_unlock_queues();
+				vm_page_unlock(fs.first_m);
 				/*
 				 * grab the page and put it into the 
 				 * process'es object.  The page is 
 				 * automatically made dirty.
 				 */
+				vm_page_lock(fs.m);
+				vm_page_lock_queues();
 				vm_page_rename(fs.m, fs.first_object, fs.first_pindex);
 				vm_page_unlock_queues();
+				vm_page_unlock(fs.m);
 				vm_page_busy(fs.m);
 				fs.first_m = fs.m;
 				fs.m = NULL;
@@ -770,10 +798,17 @@ vnode_locked:
 				fs.first_m->valid = VM_PAGE_BITS_ALL;
 				if (wired && (fault_flags &
 				    VM_FAULT_CHANGE_WIRING) == 0) {
+					vm_page_lock(fs.first_m);
 					vm_page_lock_queues();
 					vm_page_wire(fs.first_m);
+					vm_page_unlock_queues();
+					vm_page_unlock(fs.first_m);
+					
+					vm_page_lock(fs.m);
+					vm_page_lock_queues();
 					vm_page_unwire(fs.m, FALSE);
 					vm_page_unlock_queues();
+					vm_page_unlock(fs.m);
 				}
 				/*
 				 * We no longer need the old page or object.
@@ -923,6 +958,7 @@ vnode_locked:
 	if ((fault_flags & VM_FAULT_CHANGE_WIRING) == 0 && wired == 0)
 		vm_fault_prefault(fs.map->pmap, vaddr, fs.entry);
 	VM_OBJECT_LOCK(fs.object);
+	vm_page_lock(fs.m);
 	vm_page_lock_queues();
 	vm_page_flag_set(fs.m, PG_REFERENCED);
 
@@ -939,6 +975,7 @@ vnode_locked:
 		vm_page_activate(fs.m);
 	}
 	vm_page_unlock_queues();
+	vm_page_unlock(fs.m);
 	vm_page_wakeup(fs.m);
 
 	/*
@@ -1015,9 +1052,11 @@ vm_fault_prefault(pmap_t pmap, vm_offset
 		}
 		if (m->valid == VM_PAGE_BITS_ALL &&
 		    (m->flags & PG_FICTITIOUS) == 0) {
+			vm_page_lock(m);
 			vm_page_lock_queues();
 			pmap_enter_quick(pmap, addr, m, entry->protection);
 			vm_page_unlock_queues();
+			vm_page_unlock(m);
 		}
 		VM_OBJECT_UNLOCK(lobject);
 	}
@@ -1093,9 +1132,11 @@ vm_fault_unwire(vm_map_t map, vm_offset_
 		if (pa != 0) {
 			pmap_change_wiring(pmap, va, FALSE);
 			if (!fictitious) {
+				vm_page_lock(PHYS_TO_VM_PAGE(pa));
 				vm_page_lock_queues();
 				vm_page_unwire(PHYS_TO_VM_PAGE(pa), 1);
 				vm_page_unlock_queues();
+				vm_page_unlock(PHYS_TO_VM_PAGE(pa));
 			}
 		}
 	}
@@ -1238,13 +1279,26 @@ vm_fault_copy_entry(vm_map_t dst_map, vm
 		 * Mark it no longer busy, and put it on the active list.
 		 */
 		VM_OBJECT_LOCK(dst_object);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 06:42:29 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BBA9A106566B;
	Tue, 27 Apr 2010 06:42:29 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 911B48FC13;
	Tue, 27 Apr 2010 06:42:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3R6gTcn028633;
	Tue, 27 Apr 2010 06:42:29 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3R6gT0J028631;
	Tue, 27 Apr 2010 06:42:29 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004270642.o3R6gT0J028631@svn.freebsd.org>
From: Juli Mallett 
Date: Tue, 27 Apr 2010 06:42:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207266 - user/jmallett/octeon/sys/mips/cavium
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 06:42:29 -0000

Author: jmallett
Date: Tue Apr 27 06:42:29 2010
New Revision: 207266
URL: http://svn.freebsd.org/changeset/base/207266

Log:
  Print features this board supports at startup.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Tue Apr 27 06:14:30 2010	(r207265)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Tue Apr 27 06:42:29 2010	(r207266)
@@ -80,9 +80,31 @@ __FBSDID("$FreeBSD$");
 #define MAX_APP_DESC_ADDR     0xafffffff
 #endif
 
+struct octeon_feature_description {
+	octeon_feature_t ofd_feature;
+	const char *ofd_string;
+};
+
 extern int	*edata;
 extern int	*end;
 
+static struct octeon_feature_description octeon_feature_descriptions[] = {
+	{ OCTEON_FEATURE_SAAD,			"SAAD" },
+	{ OCTEON_FEATURE_ZIP,			"ZIP" },
+	{ OCTEON_FEATURE_CRYPTO,		"CRYPTO" },
+	{ OCTEON_FEATURE_PCIE,			"PCIE" },
+	{ OCTEON_FEATURE_KEY_MEMORY,		"KEY_MEMORY" },
+	{ OCTEON_FEATURE_LED_CONTROLLER,	"LED_CONTROLLER" },
+	{ OCTEON_FEATURE_TRA,			"TRA" },
+	{ OCTEON_FEATURE_MGMT_PORT,		"MGMT_PORT" },
+	{ OCTEON_FEATURE_RAID,			"RAID" },
+	{ OCTEON_FEATURE_USB,			"USB" },
+	{ OCTEON_FEATURE_NO_WPTR,		"NO_WPTR" },
+	{ OCTEON_FEATURE_DFA,			"DFA" },
+	{ OCTEON_FEATURE_MDIO_CLAUSE_45,	"MDIO_CLAUSE_45" },
+	{ 0,					NULL }
+};
+
 uint64_t ciu_get_en_reg_addr_new(int corenum, int intx, int enx, int ciu_ip);
 void ciu_dump_interrutps_enabled(int core_num, int intx, int enx, int ciu_ip);
 
@@ -268,6 +290,7 @@ void
 platform_start(__register_t a0, __register_t a1, __register_t a2 __unused,
     __register_t a3)
 {
+	struct octeon_feature_description *ofd;
 	uint64_t platform_counter_freq;
 
 	/* Initialize pcpu stuff */
@@ -308,6 +331,13 @@ platform_start(__register_t a0, __regist
 	 */
 	oct_write64(CVMX_CIU_MBOX_CLRX(0), 0xffffffff);
 #endif
+
+	printf("Available Octeon features:");
+	for (ofd = octeon_feature_descriptions; ofd->ofd_string != NULL; ofd++) {
+		if (octeon_has_feature(ofd->ofd_feature))
+			printf(" %s", ofd->ofd_string);
+	}
+	printf("\n");
 }
 
 /* impSTART: This stuff should move back into the Cavium SDK */

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 07:34:20 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DF2921065675;
	Tue, 27 Apr 2010 07:34:20 +0000 (UTC)
	(envelope-from lstewart@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B53748FC08;
	Tue, 27 Apr 2010 07:34:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3R7YKri039945;
	Tue, 27 Apr 2010 07:34:20 GMT
	(envelope-from lstewart@svn.freebsd.org)
Received: (from lstewart@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3R7YKSk039944;
	Tue, 27 Apr 2010 07:34:20 GMT
	(envelope-from lstewart@svn.freebsd.org)
Message-Id: <201004270734.o3R7YKSk039944@svn.freebsd.org>
From: Lawrence Stewart 
Date: Tue, 27 Apr 2010 07:34:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207267 - in user/lstewart: alq_varlen_7.x
	alq_varlen_8.x alq_varlen_head
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 07:34:21 -0000

Author: lstewart
Date: Tue Apr 27 07:34:20 2010
New Revision: 207267
URL: http://svn.freebsd.org/changeset/base/207267

Log:
  Relevant bits now in head except for some regression testing code which will
  follow later. Branches no longer required.

Deleted:
  user/lstewart/alq_varlen_7.x/
  user/lstewart/alq_varlen_8.x/
  user/lstewart/alq_varlen_head/

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 17:29:44 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0E73F1065673;
	Tue, 27 Apr 2010 17:29:44 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id D1F878FC24;
	Tue, 27 Apr 2010 17:29:43 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 8716846B5B;
	Tue, 27 Apr 2010 13:29:43 -0400 (EDT)
Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id A985A8A025;
	Tue, 27 Apr 2010 13:29:42 -0400 (EDT)
From: John Baldwin 
To: Kip Macy 
Date: Tue, 27 Apr 2010 13:06:49 -0400
User-Agent: KMail/1.12.1 (FreeBSD/7.3-CBSD-20100217; KDE/4.3.1; amd64; ; )
References: <201004240503.o3O53g0D028732@svn.freebsd.org>
In-Reply-To: <201004240503.o3O53g0D028732@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <201004271306.49294.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Tue, 27 Apr 2010 13:29:42 -0400 (EDT)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham
	version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: Re: svn commit: r207140 - in user/kmacy/head_page_lock_2/sys:
	amd64/amd64 kern sys
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 17:29:44 -0000

On Saturday 24 April 2010 1:03:42 am Kip Macy wrote:
> Author: kmacy
> Date: Sat Apr 24 05:03:42 2010
> New Revision: 207140
> URL: http://svn.freebsd.org/changeset/base/207140
> 
> Log:
>   generalize lock stack operations and move to subr_lock.c
> 
> Modified:
>   user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
>   user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c
>   user/kmacy/head_page_lock_2/sys/kern/subr_lock.c
>   user/kmacy/head_page_lock_2/sys/sys/lock.h
> 
> Modified: user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c
> 
==============================================================================
> --- user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c	Sat Apr 24 03:11:35 
2010	(r207139)
> +++ user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c	Sat Apr 24 05:03:42 
2010	(r207140)
> @@ -160,7 +185,7 @@ unlock_mtx(struct lock_object *lock)
>  	struct mtx *m;
>  
>  	m = (struct mtx *)lock;
> -	mtx_assert(m, MA_OWNED | MA_NOTRECURSED);
> +	mtx_assert(m, MA_OWNED);
>  	mtx_unlock(m);
>  	return (0);
>  }

Note that this breaks the assertion used to prevent passing a recursed mutex 
to mtx_sleep() or cv_wait().

-- 
John Baldwin

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 19:44:07 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 457E3106564A;
	Tue, 27 Apr 2010 19:44:07 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 35DEE8FC0A;
	Tue, 27 Apr 2010 19:44:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3RJi60q004077;
	Tue, 27 Apr 2010 19:44:06 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3RJi63Y004073;
	Tue, 27 Apr 2010 19:44:06 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004271944.o3RJi63Y004073@svn.freebsd.org>
From: Kip Macy 
Date: Tue, 27 Apr 2010 19:44:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207288 - in user/kmacy/head_page_lock_2/sys: kern sys
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 19:44:07 -0000

Author: kmacy
Date: Tue Apr 27 19:44:06 2010
New Revision: 207288
URL: http://svn.freebsd.org/changeset/base/207288

Log:
  add separate lock class function for recursed mutexes

Modified:
  user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c
  user/kmacy/head_page_lock_2/sys/kern/subr_lock.c
  user/kmacy/head_page_lock_2/sys/sys/lock.h

Modified: user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c	Tue Apr 27 18:41:16 2010	(r207287)
+++ user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c	Tue Apr 27 19:44:06 2010	(r207288)
@@ -97,6 +97,7 @@ static void	lock_spin(struct lock_object
 static int	owner_mtx(struct lock_object *lock, struct thread **owner);
 #endif
 static int	unlock_mtx(struct lock_object *lock);
+static int	unlock_recursable_mtx(struct lock_object *lock);
 static int	unlock_spin(struct lock_object *lock);
 
 /*
@@ -111,6 +112,7 @@ struct lock_class lock_class_mtx_sleep =
 #endif
 	.lc_lock = lock_mtx,
 	.lc_unlock = unlock_mtx,
+	.lc_unlock_recursable = unlock_recursable_mtx,
 #ifdef KDTRACE_HOOKS
 	.lc_owner = owner_mtx,
 #endif
@@ -185,6 +187,17 @@ unlock_mtx(struct lock_object *lock)
 	struct mtx *m;
 
 	m = (struct mtx *)lock;
+	mtx_assert(m, MA_NOTRECURSED|MA_OWNED);
+	mtx_unlock(m);
+	return (0);
+}
+
+int
+unlock_recursable_mtx(struct lock_object *lock)
+{
+	struct mtx *m;
+
+	m = (struct mtx *)lock;
 	mtx_assert(m, MA_OWNED);
 	mtx_unlock(m);
 	return (0);

Modified: user/kmacy/head_page_lock_2/sys/kern/subr_lock.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/kern/subr_lock.c	Tue Apr 27 18:41:16 2010	(r207287)
+++ user/kmacy/head_page_lock_2/sys/kern/subr_lock.c	Tue Apr 27 19:44:06 2010	(r207288)
@@ -714,7 +714,7 @@ ls_pop(struct lock_stack *ls)
 	ls->ls_top--;
 	lock = ls->ls_array[ls->ls_top].lse_lock;
 	class = ls->ls_array[ls->ls_top].lse_class;	
-	class->lc_unlock(lock);
+	class->lc_unlock_recursable(lock);
 }
 
 void
@@ -729,7 +729,7 @@ ls_popa(struct lock_stack *ls)
 		ls->ls_top--;
 		lock = ls->ls_array[ls->ls_top].lse_lock;
 		class = ls->ls_array[ls->ls_top].lse_class;
-		class->lc_unlock(lock);
+		class->lc_unlock_recursable(lock);
 	}
 }
 

Modified: user/kmacy/head_page_lock_2/sys/sys/lock.h
==============================================================================
--- user/kmacy/head_page_lock_2/sys/sys/lock.h	Tue Apr 27 18:41:16 2010	(r207287)
+++ user/kmacy/head_page_lock_2/sys/sys/lock.h	Tue Apr 27 19:44:06 2010	(r207288)
@@ -65,6 +65,7 @@ struct lock_class {
 	int	(*lc_unlock)(struct lock_object *lock);
 	void	(*lc_lock_full)(struct lock_object *lock, char *file, int line);
 	int	(*lc_trylock)(struct lock_object *lock);
+	int	(*lc_unlock_recursable)(struct lock_object *lock);	
 };
 
 #define	LC_SLEEPLOCK	0x00000001	/* Sleep lock. */

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 19:45:16 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7EC961065673;
	Tue, 27 Apr 2010 19:45:16 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 55A198FC1F;
	Tue, 27 Apr 2010 19:45:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3RJjG6s004377;
	Tue, 27 Apr 2010 19:45:16 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3RJjGof004375;
	Tue, 27 Apr 2010 19:45:16 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004271945.o3RJjGof004375@svn.freebsd.org>
From: Juli Mallett 
Date: Tue, 27 Apr 2010 19:45:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207289 - user/jmallett/octeon/sys/mips/cavium
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 19:45:16 -0000

Author: jmallett
Date: Tue Apr 27 19:45:16 2010
New Revision: 207289
URL: http://svn.freebsd.org/changeset/base/207289

Log:
  Instead of using a local clone of the Linux ATA parameter structure, use the
  one in .

Deleted:
  user/jmallett/octeon/sys/mips/cavium/driveid.h
Modified:
  user/jmallett/octeon/sys/mips/cavium/octeon_ebt3000_cf.c

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_ebt3000_cf.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_ebt3000_cf.c	Tue Apr 27 19:44:06 2010	(r207288)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_ebt3000_cf.c	Tue Apr 27 19:45:16 2010	(r207289)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -66,7 +67,6 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "octeon_ebt3000_cf.h"
-#include "driveid.h"
 #include 
 
 /* ATA Commands */
@@ -97,8 +97,6 @@ __FBSDID("$FreeBSD$");
 #define WAIT_DELAY		1000
 #define NR_TRIES		1000
 #define SWAP_SHORT(x)		((x << 8) | (x >> 8))
-#define SWAP_LONG(x)		(((x << 24) & 0xFF000000) | ((x <<  8) & 0x00FF0000) | \
-				 ((x >> 8) & 0x0000FF00)  | ((x << 24) & 0x000000FF) )
 #define MODEL_STR_SIZE		40
 
 
@@ -122,7 +120,7 @@ struct cf_priv {
 struct drive_param{
 	union {
 		char buf[SECTOR_SIZE];
-		struct hd_driveid driveid;
+		struct ata_params driveid;
 	} u;
 
 	char model[MODEL_STR_SIZE];
@@ -415,10 +413,11 @@ static int cf_cmd_identify (void)
 	cf_swap_ascii(drive_param.u.driveid.model, drive_param.model);
 
 	drive_param.sector_size =  512;   //=  SWAP_SHORT (drive_param.u.driveid.sector_bytes);
-	drive_param.heads 	=  SWAP_SHORT (drive_param.u.driveid.cur_heads);
-	drive_param.tracks	=  SWAP_SHORT (drive_param.u.driveid.cur_cyls); 
-	drive_param.sec_track   =  SWAP_SHORT (drive_param.u.driveid.cur_sectors);
-	drive_param.nr_sectors  =  SWAP_LONG  (drive_param.u.driveid.lba_capacity);
+	drive_param.heads 	=  SWAP_SHORT (drive_param.u.driveid.current_heads);
+	drive_param.tracks	=  SWAP_SHORT (drive_param.u.driveid.current_cylinders); 
+	drive_param.sec_track   =  SWAP_SHORT (drive_param.u.driveid.current_sectors);
+	drive_param.nr_sectors  = (uint32_t)SWAP_SHORT (drive_param.u.driveid.lba_size_1) |
+	    ((uint32_t)SWAP_SHORT (drive_param.u.driveid.lba_size_2));
 
 	return (0);
 }

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 19:47:36 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0D23F1065679;
	Tue, 27 Apr 2010 19:47:36 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id D0C628FC20;
	Tue, 27 Apr 2010 19:47:35 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 7FB2E46B1A;
	Tue, 27 Apr 2010 15:47:35 -0400 (EDT)
Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id 863238A025;
	Tue, 27 Apr 2010 15:47:34 -0400 (EDT)
From: John Baldwin 
To: kmacy@freebsd.org
Date: Tue, 27 Apr 2010 15:47:15 -0400
User-Agent: KMail/1.12.1 (FreeBSD/7.3-CBSD-20100217; KDE/4.3.1; amd64; ; )
References: <201004240503.o3O53g0D028732@svn.freebsd.org>
	<201004271306.49294.jhb@freebsd.org>
	
In-Reply-To: 
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <201004271547.15634.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Tue, 27 Apr 2010 15:47:34 -0400 (EDT)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham
	version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: Re: svn commit: r207140 - in user/kmacy/head_page_lock_2/sys:
	amd64/amd64 kern sys
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 19:47:36 -0000

On Tuesday 27 April 2010 3:29:06 pm K. Macy wrote:
> On Tue, Apr 27, 2010 at 10:06 AM, John Baldwin  wrote:
> > On Saturday 24 April 2010 1:03:42 am Kip Macy wrote:
> >> Author: kmacy
> >> Date: Sat Apr 24 05:03:42 2010
> >> New Revision: 207140
> >> URL: http://svn.freebsd.org/changeset/base/207140
> >>
> >> Log:
> >>   generalize lock stack operations and move to subr_lock.c
> >>
> >> Modified:
> >>   user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
> >>   user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c
> >>   user/kmacy/head_page_lock_2/sys/kern/subr_lock.c
> >>   user/kmacy/head_page_lock_2/sys/sys/lock.h
> >>
> >> Modified: user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c
> >>
> > ==============================================================================
> >> --- user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c Sat Apr 24 03:11:35
> > 2010    (r207139)
> >> +++ user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c Sat Apr 24 05:03:42
> > 2010    (r207140)
> >> @@ -160,7 +185,7 @@ unlock_mtx(struct lock_object *lock)
> >>       struct mtx *m;
> >>
> >>       m = (struct mtx *)lock;
> >> -     mtx_assert(m, MA_OWNED | MA_NOTRECURSED);
> >> +     mtx_assert(m, MA_OWNED);
> >>       mtx_unlock(m);
> >>       return (0);
> >>  }
> >
> > Note that this breaks the assertion used to prevent passing a recursed mutex
> > to mtx_sleep() or cv_wait().
> >
> 
> Thanks. MA_NOTRECURSED breaks its use in lock_stack, I'll add another
> function for it too.

Yes, the fault may be that lc_unlock and lc_lock are not truly generic.  They
were only really designed to handle unlock/lock pairs in mtx_sleep() and friends.

-- 
John Baldwin

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 19:47:39 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C706B106567F;
	Tue, 27 Apr 2010 19:47:39 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B7B958FC1D;
	Tue, 27 Apr 2010 19:47:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3RJldWg004954;
	Tue, 27 Apr 2010 19:47:39 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3RJldRU004952;
	Tue, 27 Apr 2010 19:47:39 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004271947.o3RJldRU004952@svn.freebsd.org>
From: Kip Macy 
Date: Tue, 27 Apr 2010 19:47:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207290 - user/kmacy/head_page_lock_2/sys/vm
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 19:47:39 -0000

Author: kmacy
Date: Tue Apr 27 19:47:39 2010
New Revision: 207290
URL: http://svn.freebsd.org/changeset/base/207290

Log:
  add missed unlocks in vm_object_clean

Modified:
  user/kmacy/head_page_lock_2/sys/vm/vm_object.c

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_object.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_object.c	Tue Apr 27 19:45:16 2010	(r207289)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_object.c	Tue Apr 27 19:47:39 2010	(r207290)
@@ -844,6 +844,7 @@ vm_object_page_clean(vm_object_t object,
 			 * page (i.e. had to sleep) and always unlocks p.
 			 */
 			tscan += vm_object_page_collect_flush(object, p, curgeneration, pagerflags);
+			vm_page_unlock(p);
 		}
 
 		/*
@@ -920,17 +921,21 @@ again:
 		/* Always unlocks p. */
 		n = vm_object_page_collect_flush(object, p,
 			curgeneration, pagerflags);
-		if (n == 0)
+		if (n == 0) {
+			vm_page_unlock(p);
 			goto rescan;
+		}
 
-		if (object->generation != curgeneration)
+		if (object->generation != curgeneration) {
+			vm_page_unlock(p);
 			goto rescan;
-
+		}
 		/*
 		 * Try to optimize the next page.  If we can't we pick up
 		 * our (random) scan where we left off.
 		 */
 		if (msync_flush_flags & MSYNC_FLUSH_SOFTSEQ) {
+			vm_page_unlock(p);
 			if ((p = vm_page_lookup(object, pi + n)) != NULL)
 				goto again;
 		}

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 19:53:47 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 23BF41065672
	for ; Tue, 27 Apr 2010 19:53:47 +0000 (UTC)
	(envelope-from kmatthew.macy@gmail.com)
Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com
	[209.85.221.181])
	by mx1.freebsd.org (Postfix) with ESMTP id CEB258FC1A
	for ; Tue, 27 Apr 2010 19:53:46 +0000 (UTC)
Received: by qyk11 with SMTP id 11so17066633qyk.13
	for ; Tue, 27 Apr 2010 12:53:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:received:sender:reply-to:received
	:in-reply-to:references:date:x-google-sender-auth:message-id:subject
	:from:to:cc:content-type:content-transfer-encoding;
	bh=hFy5LgWrF8vnzW6oLg1RLxH2AbDPAAbnRfzNdy7eEFQ=;
	b=MsBfwomhqnly209lFtylBXj2zKSauzM4/34FIq/XYFzNEidjdaKRA7UP0mDQUj745D
	KLDZ480njWCvZKrBA8TPS4Q6GFSTTSpYvYaUyW5QD4JA8+rji/gIu5LITQnFdl2qSqXy
	rJzsF0hn88NgV4zbQ7Q70dlqneLz21gKStvbY=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:reply-to:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	b=O/Bf/iIk/Idq5czT6LDtnyOUZvoz0OaFk90YlJlUmZW2P2WD+89xVRpk4jPEkqvqgA
	TODGiIn+nlrhi9bz4NmH7hntYR1dgCNr7lTZzpfRCjzdVWjpqynmjiU4zdAUMSTD3kCu
	m7uza9xNzOIdSyFeJF+jbxCSL0ANnHnzm2U5o=
MIME-Version: 1.0
Received: by 10.229.237.204 with SMTP id kp12mr425167qcb.27.1272396547221; 
	Tue, 27 Apr 2010 12:29:07 -0700 (PDT)
Sender: kmatthew.macy@gmail.com
Received: by 10.229.231.18 with HTTP; Tue, 27 Apr 2010 12:29:06 -0700 (PDT)
In-Reply-To: <201004271306.49294.jhb@freebsd.org>
References: <201004240503.o3O53g0D028732@svn.freebsd.org>
	<201004271306.49294.jhb@freebsd.org>
Date: Tue, 27 Apr 2010 12:29:06 -0700
X-Google-Sender-Auth: 4cadcb71789d8beb
Message-ID: 
From: "K. Macy" 
To: John Baldwin 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: Re: svn commit: r207140 - in user/kmacy/head_page_lock_2/sys: 
	amd64/amd64 kern sys
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: kmacy@freebsd.org
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 19:53:47 -0000

On Tue, Apr 27, 2010 at 10:06 AM, John Baldwin  wrote:
> On Saturday 24 April 2010 1:03:42 am Kip Macy wrote:
>> Author: kmacy
>> Date: Sat Apr 24 05:03:42 2010
>> New Revision: 207140
>> URL: http://svn.freebsd.org/changeset/base/207140
>>
>> Log:
>> =A0 generalize lock stack operations and move to subr_lock.c
>>
>> Modified:
>> =A0 user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
>> =A0 user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c
>> =A0 user/kmacy/head_page_lock_2/sys/kern/subr_lock.c
>> =A0 user/kmacy/head_page_lock_2/sys/sys/lock.h
>>
>> Modified: user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c
>>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
>> --- user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c Sat Apr 24 03:11:3=
5
> 2010 =A0 =A0(r207139)
>> +++ user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c Sat Apr 24 05:03:4=
2
> 2010 =A0 =A0(r207140)
>> @@ -160,7 +185,7 @@ unlock_mtx(struct lock_object *lock)
>> =A0 =A0 =A0 struct mtx *m;
>>
>> =A0 =A0 =A0 m =3D (struct mtx *)lock;
>> - =A0 =A0 mtx_assert(m, MA_OWNED | MA_NOTRECURSED);
>> + =A0 =A0 mtx_assert(m, MA_OWNED);
>> =A0 =A0 =A0 mtx_unlock(m);
>> =A0 =A0 =A0 return (0);
>> =A0}
>
> Note that this breaks the assertion used to prevent passing a recursed mu=
tex
> to mtx_sleep() or cv_wait().
>

Thanks. MA_NOTRECURSED breaks its use in lock_stack, I'll add another
function for it too.

-Kip

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 20:18:10 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4DD63106564A;
	Tue, 27 Apr 2010 20:18:10 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3E8F98FC1B;
	Tue, 27 Apr 2010 20:18:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3RKIAKc011781;
	Tue, 27 Apr 2010 20:18:10 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3RKIAih011779;
	Tue, 27 Apr 2010 20:18:10 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004272018.o3RKIAih011779@svn.freebsd.org>
From: Kip Macy 
Date: Tue, 27 Apr 2010 20:18:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207291 - user/kmacy/head_page_lock_2/sys/kern
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 20:18:10 -0000

Author: kmacy
Date: Tue Apr 27 20:18:09 2010
New Revision: 207291
URL: http://svn.freebsd.org/changeset/base/207291

Log:
  white space cleanup

Modified:
  user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c

Modified: user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c	Tue Apr 27 19:47:39 2010	(r207290)
+++ user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c	Tue Apr 27 20:18:09 2010	(r207291)
@@ -118,9 +118,8 @@ struct lock_class lock_class_mtx_sleep =
 #endif
 	.lc_lock_full = lock_full_mtx,
 	.lc_trylock = trylock_mtx,
-	
-	
 };
+
 struct lock_class lock_class_mtx_spin = {
 	.lc_name = "spin mutex",
 	.lc_flags = LC_SPINLOCK | LC_RECURSABLE,

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 20:50:32 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B770E106564A;
	Tue, 27 Apr 2010 20:50:32 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8EF668FC1E;
	Tue, 27 Apr 2010 20:50:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3RKoWbX018979;
	Tue, 27 Apr 2010 20:50:32 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3RKoWOO018977;
	Tue, 27 Apr 2010 20:50:32 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004272050.o3RKoWOO018977@svn.freebsd.org>
From: Juli Mallett 
Date: Tue, 27 Apr 2010 20:50:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207293 - user/jmallett/octeon/sys/mips/cavium
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 20:50:32 -0000

Author: jmallett
Date: Tue Apr 27 20:50:32 2010
New Revision: 207293
URL: http://svn.freebsd.org/changeset/base/207293

Log:
  o) Use structures from the SDK rather than local copies.
  o) Get the CF base address from the bootloader rather than hard-coding it.

Deleted:
  user/jmallett/octeon/sys/mips/cavium/octeon_ebt3000_cf.h
Modified:
  user/jmallett/octeon/sys/mips/cavium/octeon_ebt3000_cf.c

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_ebt3000_cf.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_ebt3000_cf.c	Tue Apr 27 20:18:54 2010	(r207292)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_ebt3000_cf.c	Tue Apr 27 20:50:32 2010	(r207293)
@@ -66,9 +66,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "octeon_ebt3000_cf.h"
 #include 
 
+#include 
+
 /* ATA Commands */
 #define CMD_READ_SECTOR		0x20
 #define CMD_WRITE_SECTOR	0x30
@@ -99,6 +100,8 @@ __FBSDID("$FreeBSD$");
 #define SWAP_SHORT(x)		((x << 8) | (x >> 8))
 #define MODEL_STR_SIZE		40
 
+/* XXX */
+extern cvmx_bootinfo_t *octeon_bootinfo;
 
 /* Globals */
 int	bus_width;
@@ -582,19 +585,19 @@ static void cf_identify (driver_t *drv, 
 	uint8_t status;
         int bus_region;
 	int count = 0;
-        octeon_mio_boot_reg_cfgx_t cfg;
+        cvmx_mio_boot_reg_cfgx_t cfg;
 
     	if (octeon_is_simulation())
 		return;
 
-	base_addr = (void *) MIPS_PHYS_TO_KSEG0(OCTEON_CF_COMMON_BASE_ADDR);
+	base_addr = cvmx_phys_to_ptr(octeon_bootinfo->compact_flash_common_base_addr);
 
         for (bus_region = 0; bus_region < 8; bus_region++)
         {
-                cfg.word64 = oct_read64(OCTEON_MIO_BOOT_REG_CFGX(bus_region));
-                if (cfg.bits.base == OCTEON_CF_COMMON_BASE_ADDR >> 16)
+                cfg.u64 = oct_read64(CVMX_MIO_BOOT_REG_CFGX(bus_region));
+                if (cfg.s.base == octeon_bootinfo->compact_flash_common_base_addr >> 16)
                 {
-                        bus_width = (cfg.bits.width) ? 16: 8;
+                        bus_width = (cfg.s.width) ? 16: 8;
                         printf("Compact flash found in bootbus region %d (%d bit).\n", bus_region, bus_width);
                         break;
                 }

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 20:53:33 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D13AC106564A;
	Tue, 27 Apr 2010 20:53:33 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A84EE8FC15;
	Tue, 27 Apr 2010 20:53:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3RKrXuV019705;
	Tue, 27 Apr 2010 20:53:33 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3RKrXNX019699;
	Tue, 27 Apr 2010 20:53:33 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004272053.o3RKrXNX019699@svn.freebsd.org>
From: Juli Mallett 
Date: Tue, 27 Apr 2010 20:53:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207295 - in user/jmallett/octeon/sys/mips: cavium
	cavium/dev conf
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 20:53:33 -0000

Author: jmallett
Date: Tue Apr 27 20:53:33 2010
New Revision: 207295
URL: http://svn.freebsd.org/changeset/base/207295

Log:
  Retire the rgmi[ix] driver, octe is now lagging behind only in trivial
  functionality.

Deleted:
  user/jmallett/octeon/sys/mips/cavium/dev/
Modified:
  user/jmallett/octeon/sys/mips/cavium/files.octeon1
  user/jmallett/octeon/sys/mips/conf/OCTEON1
  user/jmallett/octeon/sys/mips/conf/OCTEON1-32
  user/jmallett/octeon/sys/mips/conf/OCTEON1-o32

Modified: user/jmallett/octeon/sys/mips/cavium/files.octeon1
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/files.octeon1	Tue Apr 27 20:51:50 2010	(r207294)
+++ user/jmallett/octeon/sys/mips/cavium/files.octeon1	Tue Apr 27 20:53:33 2010	(r207295)
@@ -13,11 +13,6 @@ mips/cavium/uart_dev_oct16550.c			option
 mips/mips/intr_machdep.c			standard
 mips/mips/tick.c				standard
 
-#mips/cavium/dev/rgmii/octeon_fpa.c		optional rgmii
-#mips/cavium/dev/rgmii/octeon_ipd.c 		optional rgmii
-#mips/cavium/dev/rgmii/octeon_pko.c		optional rgmii
-#mips/cavium/dev/rgmii/octeon_rgmx.c		optional rgmii
-
 mips/cavium/octe/ethernet.c			optional octe
 mips/cavium/octe/ethernet-common.c		optional octe
 mips/cavium/octe/ethernet-mdio.c		optional octe

Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1
==============================================================================
--- user/jmallett/octeon/sys/mips/conf/OCTEON1	Tue Apr 27 20:51:50 2010	(r207294)
+++ user/jmallett/octeon/sys/mips/conf/OCTEON1	Tue Apr 27 20:53:33 2010	(r207295)
@@ -84,7 +84,6 @@ device		md
 device		uart
 nodevice	uart_ns8250
 device		octe
-#device		rgmii
 #options 	VERBOSE_SYSINIT
 
 device		bpf

Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32
==============================================================================
--- user/jmallett/octeon/sys/mips/conf/OCTEON1-32	Tue Apr 27 20:51:50 2010	(r207294)
+++ user/jmallett/octeon/sys/mips/conf/OCTEON1-32	Tue Apr 27 20:53:33 2010	(r207295)
@@ -73,7 +73,6 @@ device		ether
 device		md
 device		uart
 nodevice	uart_ns8250
-#device		rgmii
 device		octe
 #options 	VERBOSE_SYSINIT
 

Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-o32
==============================================================================
--- user/jmallett/octeon/sys/mips/conf/OCTEON1-o32	Tue Apr 27 20:51:50 2010	(r207294)
+++ user/jmallett/octeon/sys/mips/conf/OCTEON1-o32	Tue Apr 27 20:53:33 2010	(r207295)
@@ -74,7 +74,6 @@ device		md
 device		uart
 nodevice	uart_ns8250
 device		octe
-#device		rgmii
 #options 	VERBOSE_SYSINIT
 
 device		bpf

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 20:55:57 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0F747106566C;
	Tue, 27 Apr 2010 20:55:57 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EA5548FC1B;
	Tue, 27 Apr 2010 20:55:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3RKtu2F020280;
	Tue, 27 Apr 2010 20:55:56 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3RKtuUn020277;
	Tue, 27 Apr 2010 20:55:56 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004272055.o3RKtuUn020277@svn.freebsd.org>
From: Juli Mallett 
Date: Tue, 27 Apr 2010 20:55:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207296 - user/jmallett/octeon/sys/mips/cavium
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 20:55:57 -0000

Author: jmallett
Date: Tue Apr 27 20:55:56 2010
New Revision: 207296
URL: http://svn.freebsd.org/changeset/base/207296

Log:
  Remove unused defines and move the last used one in pcmap_regs.h to be with
  its counterpart in octeon_machdep.c.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
  user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Tue Apr 27 20:53:33 2010	(r207295)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Tue Apr 27 20:55:56 2010	(r207296)
@@ -207,7 +207,6 @@ octeon_led_write_hex(uint32_t wl)
 	octeon_led_write_string(nbuf);
 }
 
-
 /*
  * octeon_debug_symbol
  *
@@ -418,11 +417,8 @@ static octeon_boot_descriptor_t *app_des
 #define OCTEON_BOARD_TYPE_SIM  			1
 #define	OCTEON_BOARD_TYPE_CN3010_EVB_HS5	11
 
-#define OCTEON_CLOCK_MIN     (100 * 1000 * 1000)
-#define OCTEON_CLOCK_MAX     (800 * 1000 * 1000)
+#define OCTEON_CLOCK_DEFAULT (500 * 1000 * 1000)
 #define OCTEON_DRAM_DEFAULT  (256 * 1024 * 1024)
-#define OCTEON_DRAM_MIN	     30
-#define OCTEON_DRAM_MAX	     3000
 
 int
 octeon_is_simulation(void)

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h	Tue Apr 27 20:53:33 2010	(r207295)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h	Tue Apr 27 20:55:56 2010	(r207296)
@@ -275,14 +275,6 @@ static inline void oct_write32 (uint64_t
 
 #define	oct_readint32(a)	((int32_t)oct_read32((a)))
 
-/* ------------------------------------------------------------------- *
- *                      octeon_get_chipid()                               *
- * ------------------------------------------------------------------- */
-#define OCTEON_CN31XX_CHIP  0x000d0100
-#define OCTEON_CN30XX_CHIP  0x000d0200
-#define OCTEON_CN3020_CHIP  0x000d0112
-#define OCTEON_CN5020_CHIP  0x000d0601
-
 /*
  * octeon_machdep.c
  *
@@ -303,31 +295,9 @@ extern void octeon_ciu_reset(void);
 extern int octeon_is_simulation(void);
 #endif	/* LOCORE */
 
-
-#define OCTEON_CLOCK_DEFAULT (500 * 1000 * 1000)
-
 /*
  * EBT3000 LED Unit
  */
 #define  OCTEON_CHAR_LED_BASE_ADDR	(0x1d020000 | (0x1ffffffffull << 31))
 
-/*
- * Physical Memory Banks
- */
-/* 1st BANK */
-#define OCTEON_DRAM_FIRST_256_START	0x00000000ull
-#define OCTEON_DRAM_FIRST_256_END	(0x10000000ull - 1ull)
-#define OCTEON_DRAM_RESERVED_END        0X1FFF000ULL	/* 32 Meg Reserved for Mips Kernel MD Ops */
-#define OCTEON_DRAM_FIRST_BANK_SIZE	(OCTEON_DRAM_FIRST_256_END - OCTEON_DRAM_FIRST_256_START + 1)
-
-/* 2nd BANK */
-#define OCTEON_DRAM_SECOND_256_START	(0x0000000410000000ull)
-#define OCTEON_DRAM_SECOND_256_END	(0x0000000420000000ull - 1ull)  /* Requires 64 bit paddr */
-#define OCTEON_DRAM_SECOND_BANK_SIZE	(OCTEON_DRAM_SECOND_256_END - OCTEON_DRAM_SECOND_256_START + 1ull)
-
-/* 3rd BANK */
-#define OCTEON_DRAM_ABOVE_512_START	0x20000000ull
-#define OCTEON_DRAM_ABOVE_512_END	(0x0000000300000000ull - 1ull)  /* To be calculated as remaining */
-#define OCTEON_DRAM_THIRD_BANK_SIZE	(OCTEON_DRAM_ABOVE_512_END - OCTEON_DRAM_ABOVE_512_START + 1ull)
-
 #endif /* !OCTEON_PCMAP_REGS_H__ */

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 21:06:17 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6A1E9106566B;
	Tue, 27 Apr 2010 21:06:17 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5AD948FC16;
	Tue, 27 Apr 2010 21:06:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3RL6H6g022562;
	Tue, 27 Apr 2010 21:06:17 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3RL6HTN022558;
	Tue, 27 Apr 2010 21:06:17 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004272106.o3RL6HTN022558@svn.freebsd.org>
From: Juli Mallett 
Date: Tue, 27 Apr 2010 21:06:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207297 - user/jmallett/octeon/sys/mips/cavium
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 21:06:17 -0000

Author: jmallett
Date: Tue Apr 27 21:06:17 2010
New Revision: 207297
URL: http://svn.freebsd.org/changeset/base/207297

Log:
  o) Don't use oct_* where cvmx_*_csr will suffice.
  o) Fix compile of octeon_machdep.c by reordering macros.
  o) Constify octeon_feature_descriptions as suggested by rpaulo.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octeon_ebt3000_cf.c
  user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
  user/jmallett/octeon/sys/mips/cavium/octeon_mp.c

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_ebt3000_cf.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_ebt3000_cf.c	Tue Apr 27 20:55:56 2010	(r207296)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_ebt3000_cf.c	Tue Apr 27 21:06:17 2010	(r207297)
@@ -594,7 +594,7 @@ static void cf_identify (driver_t *drv, 
 
         for (bus_region = 0; bus_region < 8; bus_region++)
         {
-                cfg.u64 = oct_read64(CVMX_MIO_BOOT_REG_CFGX(bus_region));
+                cfg.u64 = cvmx_read_csr(CVMX_MIO_BOOT_REG_CFGX(bus_region));
                 if (cfg.s.base == octeon_bootinfo->compact_flash_common_base_addr >> 16)
                 {
                         bus_width = (cfg.s.width) ? 16: 8;

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Tue Apr 27 20:55:56 2010	(r207296)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Tue Apr 27 21:06:17 2010	(r207297)
@@ -80,6 +80,9 @@ __FBSDID("$FreeBSD$");
 #define MAX_APP_DESC_ADDR     0xafffffff
 #endif
 
+#define OCTEON_CLOCK_DEFAULT (500 * 1000 * 1000)
+#define OCTEON_DRAM_DEFAULT  (256 * 1024 * 1024)
+
 struct octeon_feature_description {
 	octeon_feature_t ofd_feature;
 	const char *ofd_string;
@@ -88,7 +91,7 @@ struct octeon_feature_description {
 extern int	*edata;
 extern int	*end;
 
-static struct octeon_feature_description octeon_feature_descriptions[] = {
+static const struct octeon_feature_description octeon_feature_descriptions[] = {
 	{ OCTEON_FEATURE_SAAD,			"SAAD" },
 	{ OCTEON_FEATURE_ZIP,			"ZIP" },
 	{ OCTEON_FEATURE_CRYPTO,		"CRYPTO" },
@@ -122,7 +125,7 @@ platform_cpu_init()
 void
 platform_reset(void)
 {
-	oct_write64(CVMX_CIU_SOFT_RST, 1);
+	cvmx_write_csr(CVMX_CIU_SOFT_RST, 1);
 }
 
 void
@@ -182,7 +185,7 @@ octeon_led_write_string(const char *str)
 			oct_write8_x8(ptr, *str++);
 		else
 			oct_write8_x8(ptr, ' ');
-		oct_read64(CVMX_MIO_BOOT_BIST_STAT);
+		(void)cvmx_read_csr(CVMX_MIO_BOOT_BIST_STAT);
 	}
 }
 
@@ -289,7 +292,7 @@ void
 platform_start(__register_t a0, __register_t a1, __register_t a2 __unused,
     __register_t a3)
 {
-	struct octeon_feature_description *ofd;
+	const struct octeon_feature_description *ofd;
 	uint64_t platform_counter_freq;
 
 	/* Initialize pcpu stuff */
@@ -328,7 +331,7 @@ platform_start(__register_t a0, __regist
 	/*
 	 * Clear any pending IPIs.
 	 */
-	oct_write64(CVMX_CIU_MBOX_CLRX(0), 0xffffffff);
+	cvmx_write_csr(CVMX_CIU_MBOX_CLRX(0), 0xffffffff);
 #endif
 
 	printf("Available Octeon features:");
@@ -417,9 +420,6 @@ static octeon_boot_descriptor_t *app_des
 #define OCTEON_BOARD_TYPE_SIM  			1
 #define	OCTEON_BOARD_TYPE_CN3010_EVB_HS5	11
 
-#define OCTEON_CLOCK_DEFAULT (500 * 1000 * 1000)
-#define OCTEON_DRAM_DEFAULT  (256 * 1024 * 1024)
-
 int
 octeon_is_simulation(void)
 {

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_mp.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_mp.c	Tue Apr 27 20:55:56 2010	(r207296)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_mp.c	Tue Apr 27 21:06:17 2010	(r207297)
@@ -46,7 +46,7 @@ unsigned octeon_ap_boot = ~0;
 void
 platform_ipi_send(int cpuid)
 {
-	oct_write64(CVMX_CIU_MBOX_SETX(cpuid), 1);
+	cvmx_write_csr(CVMX_CIU_MBOX_SETX(cpuid), 1);
 	mips_wbflush();
 }
 
@@ -55,9 +55,9 @@ platform_ipi_clear(void)
 {
 	uint64_t action;
 
-	action = oct_read64(CVMX_CIU_MBOX_CLRX(PCPU_GET(cpuid)));
+	action = cvmx_read_csr(CVMX_CIU_MBOX_CLRX(PCPU_GET(cpuid)));
 	KASSERT(action == 1, ("unexpected IPIs: %#jx", (uintmax_t)action));
-	oct_write64(CVMX_CIU_MBOX_CLRX(PCPU_GET(cpuid)), action);
+	cvmx_write_csr(CVMX_CIU_MBOX_CLRX(PCPU_GET(cpuid)), action);
 }
 
 int
@@ -77,7 +77,7 @@ platform_init_ap(int cpuid)
 	/*
 	 * Clear any pending IPIs.
 	 */
-	oct_write64(CVMX_CIU_MBOX_CLRX(cpuid), 0xffffffff);
+	cvmx_write_csr(CVMX_CIU_MBOX_CLRX(cpuid), 0xffffffff);
 
 	/*
 	 * Set up interrupts.

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 21:10:43 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D5DB4106564A;
	Tue, 27 Apr 2010 21:10:43 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C57568FC12;
	Tue, 27 Apr 2010 21:10:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3RLAhcj023591;
	Tue, 27 Apr 2010 21:10:43 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3RLAhqW023585;
	Tue, 27 Apr 2010 21:10:43 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004272110.o3RLAhqW023585@svn.freebsd.org>
From: Kip Macy 
Date: Tue, 27 Apr 2010 21:10:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207298 - in user/kmacy/head_page_lock_2/sys:
	amd64/amd64 amd64/include vm
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 21:10:44 -0000

Author: kmacy
Date: Tue Apr 27 21:10:43 2010
New Revision: 207298
URL: http://svn.freebsd.org/changeset/base/207298

Log:
  bring page lock branch more in line with page lock incr branch by making the page lock
  array global

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
  user/kmacy/head_page_lock_2/sys/amd64/include/vmparam.h
  user/kmacy/head_page_lock_2/sys/vm/vm_page.c
  user/kmacy/head_page_lock_2/sys/vm/vm_page.h
  user/kmacy/head_page_lock_2/sys/vm/vm_param.h

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Tue Apr 27 21:06:17 2010	(r207297)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Tue Apr 27 21:10:43 2010	(r207298)
@@ -166,35 +166,9 @@ __FBSDID("$FreeBSD$");
 #define PV_STAT(x)	do { } while (0)
 #endif
 
-#define	PA_LOCK_PAD	CACHE_LINE_SIZE
-
-struct vp_lock {
-	struct mtx	vp_lock;
-	unsigned char	pad[(PA_LOCK_PAD - sizeof(struct mtx))];
-};
-
-#define	pa_index(pa)	((pa) >> PDRSHIFT)
-#define	pa_to_pvh(pa)	(&pv_table[pa_index(pa)])
-
-#define	PA_LOCKPTR(pa)	&pa_lock[pa_index((pa)) % PA_LOCK_COUNT].vp_lock
-#define	PA_LOCKOBJPTR(pa)	((struct lock_object *)PA_LOCKPTR((pa)))
-#define	PA_LOCK(pa)	mtx_lock(PA_LOCKPTR(pa))
-#define	PA_TRYLOCK(pa)	mtx_trylock(PA_LOCKPTR(pa))
-#define	PA_UNLOCK(pa)	mtx_unlock(PA_LOCKPTR(pa))
-#define PA_UNLOCK_COND(pa) 			\
-	do {		   			\
-		if (pa) 			\
-			PA_UNLOCK(pa);		\
-	} while (0)
-
-#define	PA_LOCK_ASSERT(pa, a)	mtx_assert(PA_LOCKPTR(pa), (a))
+#define	pa_to_pvh(pa)		(&pv_table[pa_index(pa)])
 #define	PMAP_LOCKOBJPTR(pmap)	((struct lock_object *)(&(pmap)->pm_mtx))
 
-#define	PA_LOCK_COUNT	256
-
-struct vp_lock pa_lock[PA_LOCK_COUNT] __aligned(CACHE_LINE_SIZE);
-
-
 struct pmap kernel_pmap_store;
 
 vm_offset_t virtual_avail;	/* VA of first avail page (after kernel bss) */
@@ -213,19 +187,6 @@ static int pg_ps_enabled = 1;
 SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN, &pg_ps_enabled, 0,
     "Are large page mappings enabled?");
 
-static uint64_t pmap_tryrelock_calls;
-SYSCTL_QUAD(_vm_pmap, OID_AUTO, tryrelock_calls, CTLFLAG_RD,
-    &pmap_tryrelock_calls, 0, "Number of tryrelock calls");
-
-static int pmap_tryrelock_restart;
-SYSCTL_INT(_vm_pmap, OID_AUTO, tryrelock_restart, CTLFLAG_RD,
-    &pmap_tryrelock_restart, 0, "Number of tryrelock restarts");
-
-static int pmap_tryrelock_race;
-SYSCTL_INT(_vm_pmap, OID_AUTO, tryrelock_race, CTLFLAG_RD,
-    &pmap_tryrelock_race, 0, "Number of tryrelock pmap race cases");
-
-
 static u_int64_t	KPTphys;	/* phys addr of kernel level 1 */
 static u_int64_t	KPDphys;	/* phys addr of kernel level 2 */
 u_int64_t		KPDPphys;	/* phys addr of kernel level 3 */
@@ -477,44 +438,6 @@ vtopde(vm_offset_t va)
 	return (PDmap + ((va >> PDRSHIFT) & mask));
 }
 
-/*
- * Try to acquire a physical address lock while a pmap is locked.  If we
- * fail to trylock we unlock and lock the pmap directly and cache the
- * locked pa in *locked.  The caller should then restart their loop in case
- * the virtual to physical mapping has changed.
- */
-static int
-pa_tryrelock(pmap_t pmap, vm_paddr_t pa, vm_paddr_t *locked)
-{
-	vm_paddr_t lockpa;
-	uint32_t gen_count;
-
-	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
-	gen_count = pmap->pm_gen_count;
-	atomic_add_long((volatile long *)&pmap_tryrelock_calls, 1);
-	lockpa = *locked;
-	*locked = pa;
-	if (lockpa) {
-		PA_LOCK_ASSERT(lockpa, MA_OWNED);
-		if (PA_LOCKPTR(pa) == PA_LOCKPTR(lockpa))
-			return (0);
-		PA_UNLOCK(lockpa);
-	}
-	if (PA_TRYLOCK(pa))
-		return (0);
-	PMAP_UNLOCK(pmap);
-	atomic_add_int((volatile int *)&pmap_tryrelock_restart, 1);
-	PA_LOCK(pa);
-	PMAP_LOCK(pmap);
-
-	if (pmap->pm_gen_count != gen_count + 1) {
-		pmap->pm_retries++;
-		atomic_add_int((volatile int *)&pmap_tryrelock_race, 1);
-		return (EAGAIN);
-	}
-	return (0);
-}
-
 static u_int64_t
 allocpages(vm_paddr_t *firstaddr, int n)
 {
@@ -624,7 +547,6 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 {
 	vm_offset_t va;
 	pt_entry_t *pte, *unused;
-	int i;	
 
 	/*
 	 * Create an initial set of page tables to run the kernel in.
@@ -674,12 +596,6 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 
 	/* Initialize the PAT MSR. */
 	pmap_init_pat();
-
-	/* Setup page locks. */
-	for (i = 0; i < PA_LOCK_COUNT; i++)
-		mtx_init(&pa_lock[i].vp_lock, "page lock", NULL,
-		    MTX_DEF | MTX_RECURSE | MTX_DUPOK);
-
 }
 
 /*
@@ -753,14 +669,6 @@ pmap_page_init(vm_page_t m)
 	m->md.pat_mode = PAT_WRITE_BACK;
 }
 
-struct mtx *
-pmap_page_lockptr(vm_page_t m)
-{
-
-	KASSERT(m != NULL, ("pmap_page_lockptr: NULL page"));
-	return (PA_LOCKPTR(VM_PAGE_TO_PHYS(m)));
-}
-
 /*
  *	Initialize the pmap module.
  *	Called by vm_init, to initialize any structures that the pmap
@@ -887,7 +795,6 @@ static u_long pmap_pdpe_demotions;
 SYSCTL_ULONG(_vm_pmap_pdpe, OID_AUTO, demotions, CTLFLAG_RD,
     &pmap_pdpe_demotions, 0, "1GB page demotions");
 
-
 /***************************************************
  * Low level helper routines.....
  ***************************************************/
@@ -1305,7 +1212,7 @@ retry:
 	if (pdep != NULL && (pde = *pdep)) {
 		if (pde & PG_PS) {
 			if ((pde & PG_RW) || (prot & VM_PROT_WRITE) == 0) {
-				if (pa_tryrelock(pmap, (pde & PG_PS_FRAME) |
+				if (vm_page_pa_tryrelock(pmap, (pde & PG_PS_FRAME) |
 				       (va & PDRMASK), &pa))
 					goto retry;
 				m = PHYS_TO_VM_PAGE((pde & PG_PS_FRAME) |
@@ -1316,7 +1223,7 @@ retry:
 			pte = *pmap_pde_to_pte(pdep, va);
 			if ((pte & PG_V) &&
 			    ((pte & PG_RW) || (prot & VM_PROT_WRITE) == 0)) {
-				if (pa_tryrelock(pmap, pte & PG_FRAME, &pa))
+				if (vm_page_pa_tryrelock(pmap, pte & PG_FRAME, &pa))
 					goto retry;
 				m = PHYS_TO_VM_PAGE(pte & PG_FRAME);
 				vm_page_hold(m);
@@ -2408,7 +2315,7 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse
 	TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
 	/* We open ourselves up to an LOR by doing the page lock acquisitions
 	 * with the pmap lock held - which raises the question as to whether
-	 * we should use pa_tryrelock (can the pmap be corrupted if we allow it
+	 * we should use vm_page_pa_tryrelock (can the pmap be corrupted if we allow it
 	 * to be changed during a demotion?) or should we lock the entire range
 	 * in advance? Either option is a bit awkward.
 	 */
@@ -2422,7 +2329,7 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse
 		pv = TAILQ_FIRST(pv_list);
 		TAILQ_REMOVE(pv_list, pv, pv_list);
 		pv->pv_va = va;
-		pa_tryrelock(pmap, VM_PAGE_TO_PHYS(m), &pa);
+		vm_page_pa_tryrelock(pmap, VM_PAGE_TO_PHYS(m), &pa);
 		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
 	} while (va < va_last);
 	PA_UNLOCK_COND(pa);
@@ -2710,7 +2617,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t 
 			if ((oldpde & PG_A) ||
 			    (TAILQ_EMPTY(&m->md.pv_list) &&
 				TAILQ_EMPTY(&pvh->pv_list)))
-				pa_tryrelock(pmap, paddr, &pa);
+				vm_page_pa_tryrelock(pmap, paddr, &pa);
 
 			if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW))
 				vm_page_dirty(m);
@@ -2794,7 +2701,7 @@ pmap_remove_page(pmap_t pmap, vm_offset_
 	if ((*pte & PG_V) == 0)
 		return;
 	if  (*pte & PG_MANAGED)
-		(void)pa_tryrelock(pmap, *pte & PG_FRAME, &pa);
+		(void)vm_page_pa_tryrelock(pmap, *pte & PG_FRAME, &pa);
 
 	pmap_remove_pte(pmap, pte, va, *pde, free);
 	PA_UNLOCK_COND(pa);
@@ -2900,7 +2807,7 @@ restart:
 			 * also potentially need the whole range so this
 			 * acquisition may provide no benefit at all
 			 */
-			if (pa_tryrelock(pmap, ptpaddr & PG_FRAME, &pa)) {
+			if (vm_page_pa_tryrelock(pmap, ptpaddr & PG_FRAME, &pa)) {
 				va_next = sva;
 				continue;
 			}
@@ -2944,7 +2851,7 @@ restart:
 				continue;
 
 			if  ((*pte & PG_MANAGED) &&
-			    pa_tryrelock(pmap, *pte & PG_FRAME, &pa))
+			    vm_page_pa_tryrelock(pmap, *pte & PG_FRAME, &pa))
 				goto restart;
 			/*
 			 * The TLB entry for a PG_G mapping is invalidated
@@ -3175,7 +3082,7 @@ retry:
 				if ((pbits & (PG_MANAGED | PG_M | PG_RW)) ==
 				    (PG_MANAGED | PG_M | PG_RW)) {
 					m = PHYS_TO_VM_PAGE(pbits & PG_FRAME);
-					if (pa_tryrelock(pmap, pbits & PG_FRAME, &pa))
+					if (vm_page_pa_tryrelock(pmap, pbits & PG_FRAME, &pa))
 					    goto restart;
 					vm_page_dirty(m);
 				}
@@ -3644,7 +3551,7 @@ pmap_enter_object(pmap_t pmap, vm_offset
 restart:	
 	while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) {
 		va = start + ptoa(diff);
-		if (pa_tryrelock(pmap, VM_PAGE_TO_PHYS(m), &pa))
+		if (vm_page_pa_tryrelock(pmap, VM_PAGE_TO_PHYS(m), &pa))
 			goto restart;
 		if ((va & PDRMASK) == 0 && va + NBPDR <= end &&
 		    (VM_PAGE_TO_PHYS(m) & PDRMASK) == 0 &&
@@ -3912,7 +3819,7 @@ retry:
 		if (TAILQ_EMPTY(&pv_list) &&
 		    pmap_pv_list_alloc(pmap, NPTEPG-1, &pv_list))
 			goto retry;
-		if (pa_tryrelock(pmap, *pde & PG_FRAME, &pa))
+		if (vm_page_pa_tryrelock(pmap, *pde & PG_FRAME, &pa))
 			goto retry;
 	}
 	if ((*pde & PG_PS) != 0) {
@@ -4321,7 +4228,7 @@ restart:
 					continue;
 				}
 
-				if (pa_tryrelock(pmap, tpte & PG_FRAME, &pa))
+				if (vm_page_pa_tryrelock(pmap, tpte & PG_FRAME, &pa))
 					goto restart;
 
 				m = PHYS_TO_VM_PAGE(tpte & PG_FRAME);

Modified: user/kmacy/head_page_lock_2/sys/amd64/include/vmparam.h
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/include/vmparam.h	Tue Apr 27 21:06:17 2010	(r207297)
+++ user/kmacy/head_page_lock_2/sys/amd64/include/vmparam.h	Tue Apr 27 21:10:43 2010	(r207298)
@@ -151,6 +151,10 @@
 #define	VM_LEVEL_0_ORDER	9
 #endif
 
+#ifdef	SMP
+#define	PA_LOCK_COUNT	256
+#endif
+
 /*
  * Virtual addresses of things.  Derived from the page directory and
  * page table indexes from pmap.h for precision.

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_page.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_page.c	Tue Apr 27 21:06:17 2010	(r207297)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_page.c	Tue Apr 27 21:10:43 2010	(r207298)
@@ -129,6 +129,24 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#if defined(__amd64__) || defined (__i386__) 
+extern struct sysctl_oid_list sysctl__vm_pmap_children;
+#else
+SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters");
+#endif
+
+static uint64_t pmap_tryrelock_calls;
+SYSCTL_QUAD(_vm_pmap, OID_AUTO, tryrelock_calls, CTLFLAG_RD,
+    &pmap_tryrelock_calls, 0, "Number of tryrelock calls");
+
+static int pmap_tryrelock_restart;
+SYSCTL_INT(_vm_pmap, OID_AUTO, tryrelock_restart, CTLFLAG_RD,
+    &pmap_tryrelock_restart, 0, "Number of tryrelock restarts");
+
+static int pmap_tryrelock_race;
+SYSCTL_INT(_vm_pmap, OID_AUTO, tryrelock_race, CTLFLAG_RD,
+    &pmap_tryrelock_race, 0, "Number of tryrelock pmap race cases");
+
 /*
  *	Associated with page of user-allocatable memory is a
  *	page structure.
@@ -137,6 +155,7 @@ __FBSDID("$FreeBSD$");
 struct vpgqueues vm_page_queues[PQ_COUNT];
 struct vpglocks vm_page_queue_lock;
 struct vpglocks vm_page_queue_free_lock;
+struct vpglocks	pa_lock[PA_LOCK_COUNT] __aligned(CACHE_LINE_SIZE);
 
 vm_page_t vm_page_array = 0;
 int vm_page_array_size = 0;
@@ -158,6 +177,44 @@ CTASSERT(sizeof(u_long) >= 8);
 #endif
 
 /*
+ * Try to acquire a physical address lock while a pmap is locked.  If we
+ * fail to trylock we unlock and lock the pmap directly and cache the
+ * locked pa in *locked.  The caller should then restart their loop in case
+ * the virtual to physical mapping has changed.
+ */
+int
+vm_page_pa_tryrelock(pmap_t pmap, vm_paddr_t pa, vm_paddr_t *locked)
+{
+	vm_paddr_t lockpa;
+	uint32_t gen_count;
+
+	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
+	gen_count = pmap->pm_gen_count;
+	atomic_add_long((volatile long *)&pmap_tryrelock_calls, 1);
+	lockpa = *locked;
+	*locked = pa;
+	if (lockpa) {
+		PA_LOCK_ASSERT(lockpa, MA_OWNED);
+		if (PA_LOCKPTR(pa) == PA_LOCKPTR(lockpa))
+			return (0);
+		PA_UNLOCK(lockpa);
+	}
+	if (PA_TRYLOCK(pa))
+		return (0);
+	PMAP_UNLOCK(pmap);
+	atomic_add_int((volatile int *)&pmap_tryrelock_restart, 1);
+	PA_LOCK(pa);
+	PMAP_LOCK(pmap);
+
+	if (pmap->pm_gen_count != gen_count + 1) {
+		pmap->pm_retries++;
+		atomic_add_int((volatile int *)&pmap_tryrelock_race, 1);
+		return (EAGAIN);
+	}
+	return (0);
+}
+
+/*
  *	vm_set_page_size:
  *
  *	Sets the page size, perhaps based upon the memory
@@ -271,6 +328,11 @@ vm_page_startup(vm_offset_t vaddr)
 	mtx_init(&vm_page_queue_free_mtx, "vm page queue free mutex", NULL,
 	    MTX_DEF);
 
+	/* Setup page locks. */
+	for (i = 0; i < PA_LOCK_COUNT; i++)
+		mtx_init(&pa_lock[i].data, "page lock", NULL,
+		    MTX_DEF | MTX_RECURSE | MTX_DUPOK);
+
 	/*
 	 * Initialize the queue headers for the hold queue, the active queue,
 	 * and the inactive queue.

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_page.h
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_page.h	Tue Apr 27 21:06:17 2010	(r207297)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_page.h	Tue Apr 27 21:10:43 2010	(r207298)
@@ -177,6 +177,27 @@ struct vpglocks {
 } __aligned(CACHE_LINE_SIZE);
 
 extern struct vpglocks vm_page_queue_free_lock;
+extern struct vpglocks pa_lock[];
+
+#define	pa_index(pa)	((pa) >> PDRSHIFT)
+#define	PA_LOCKPTR(pa)	&pa_lock[pa_index((pa)) % PA_LOCK_COUNT].data
+#define	PA_LOCKOBJPTR(pa)	((struct lock_object *)PA_LOCKPTR((pa)))
+#define	PA_LOCK(pa)	mtx_lock(PA_LOCKPTR(pa))
+#define	PA_TRYLOCK(pa)	mtx_trylock(PA_LOCKPTR(pa))
+#define	PA_UNLOCK(pa)	mtx_unlock(PA_LOCKPTR(pa))
+#define	PA_UNLOCK_COND(pa) 			\
+	do {		   			\
+		if (pa) 			\
+			PA_UNLOCK(pa);		\
+	} while (0)
+
+#define	PA_LOCK_ASSERT(pa, a)	mtx_assert(PA_LOCKPTR(pa), (a))
+
+#define	vm_page_lockptr(m)	(PA_LOCKPTR(VM_PAGE_TO_PHYS((m))))
+#define	vm_page_lock(m)		mtx_lock(vm_page_lockptr((m)))
+#define	vm_page_unlock(m)	mtx_unlock(vm_page_lockptr((m)))
+#define	vm_page_trylock(m)	mtx_trylock(vm_page_lockptr((m)))
+#define	vm_page_lock_assert(m, a)	mtx_assert(vm_page_lockptr((m)), (a))
 
 #define	vm_page_queue_free_mtx	vm_page_queue_free_lock.data
 
@@ -273,13 +294,11 @@ extern struct vpglocks vm_page_queue_loc
 #define vm_page_unlock_queues() mtx_unlock(&vm_page_queue_mtx)
 #define	vm_page_trylock_queues() mtx_trylock(&vm_page_queue_mtx)
 #ifdef VM_PAGE_LOCK
-#define	vm_page_lockptr(m)			pmap_page_lockptr(m)
 #define	vm_page_lock_queues_assert_notowned()   mtx_assert(&vm_page_queue_mtx, MA_NOTOWNED)
 #define	vm_page_lock_assert_notowned(m)   	vm_page_lock_assert((m), MA_NOTOWNED)
 #define	vm_page_lock_queues_cond(x)
 #define	vm_page_unlock_queues_cond(x)
 #else
-#define	vm_page_lockptr(m)		(&vm_page_queue_mtx)
 #define	vm_page_lock_queues_assert_notowned()
 #define	vm_page_lock_assert_notowned(m)  
 #define	vm_page_lock_queues_cond(x)			\
@@ -359,6 +378,7 @@ void vm_page_deactivate (vm_page_t);
 void vm_page_deactivate_locked (vm_page_t);
 void vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t);
 vm_page_t vm_page_lookup (vm_object_t, vm_pindex_t);
+int vm_page_pa_tryrelock(pmap_t, vm_paddr_t, vm_paddr_t *);
 void vm_page_remove (vm_page_t);
 void vm_page_rename (vm_page_t, vm_object_t, vm_pindex_t);
 void vm_page_requeue(vm_page_t m);

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_param.h
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_param.h	Tue Apr 27 21:06:17 2010	(r207297)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_param.h	Tue Apr 27 21:10:43 2010	(r207298)
@@ -126,6 +126,14 @@ struct xswdev {
 #define	KERN_NOT_RECEIVER	7
 #define	KERN_NO_ACCESS		8
 
+#ifndef PA_LOCK_COUNT
+#ifdef SMP
+#define	PA_LOCK_COUNT	32
+#else
+#define PA_LOCK_COUNT	1
+#endif	/* !SMP */
+#endif	/* !PA_LOCK_COUNT */
+
 #ifndef ASSEMBLER
 #ifdef _KERNEL
 #define num_pages(x) \

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 21:29:30 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CD4F9106564A;
	Tue, 27 Apr 2010 21:29:30 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BDE428FC13;
	Tue, 27 Apr 2010 21:29:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3RLTU3T027893;
	Tue, 27 Apr 2010 21:29:30 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3RLTUGG027889;
	Tue, 27 Apr 2010 21:29:30 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004272129.o3RLTUGG027889@svn.freebsd.org>
From: Juli Mallett 
Date: Tue, 27 Apr 2010 21:29:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207299 - user/jmallett/octeon/sys/mips/cavium
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 21:29:30 -0000

Author: jmallett
Date: Tue Apr 27 21:29:30 2010
New Revision: 207299
URL: http://svn.freebsd.org/changeset/base/207299

Log:
  o) Get more things directly from octeon_bootinfo rather than global variables.
  o) Remove unknown descriptor version hacks that cannot possibly work.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
  user/jmallett/octeon/sys/mips/cavium/octeon_mp.c
  user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Tue Apr 27 21:10:43 2010	(r207298)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Tue Apr 27 21:29:30 2010	(r207299)
@@ -81,7 +81,6 @@ __FBSDID("$FreeBSD$");
 #endif
 
 #define OCTEON_CLOCK_DEFAULT (500 * 1000 * 1000)
-#define OCTEON_DRAM_DEFAULT  (256 * 1024 * 1024)
 
 struct octeon_feature_description {
 	octeon_feature_t ofd_feature;
@@ -408,10 +407,7 @@ typedef struct {
 	uint64_t cvmx_desc_vaddr;
 } octeon_boot_descriptor_t;
 
-uint64_t octeon_dram;
-static uint32_t octeon_bd_ver = 0, octeon_cvmx_bd_ver = 0;
-uint8_t octeon_mac_addr[6] = { 0 };
-int octeon_core_mask, octeon_mac_addr_count;
+int octeon_core_mask;
 cvmx_bootinfo_t *octeon_bootinfo;
 
 static octeon_boot_descriptor_t *app_desc_ptr;
@@ -443,57 +439,23 @@ octeon_is_simulation(void)
 }
 
 static void
-octeon_process_app_desc_ver_unknown(void)
-{
-    	printf(" Unknown Boot-Descriptor: Using Defaults\n");
-
-        octeon_dram = OCTEON_DRAM_DEFAULT;
-        octeon_core_mask = 1;
-        octeon_mac_addr[0] = 0x00; octeon_mac_addr[1] = 0x0f;
-        octeon_mac_addr[2] = 0xb7; octeon_mac_addr[3] = 0x10;
-        octeon_mac_addr[4] = 0x09; octeon_mac_addr[5] = 0x06;
-        octeon_mac_addr_count = 1;
-
-	cvmx_sysinfo_minimal_initialize(NULL, CVMX_BOARD_TYPE_NULL,
-					0, 0, OCTEON_CLOCK_DEFAULT);
-}
-
-static int
 octeon_process_app_desc_ver_6(void)
 {
 	void *phy_mem_desc_ptr;
 
 	/* XXX Why is 0x00000000ffffffffULL a bad value?  */
 	if (app_desc_ptr->cvmx_desc_vaddr == 0 ||
-	    app_desc_ptr->cvmx_desc_vaddr == 0xfffffffful) {
-            	printf ("Bad octeon_bootinfo %p\n", octeon_bootinfo);
-                return 1;
-	}
+	    app_desc_ptr->cvmx_desc_vaddr == 0xfffffffful)
+            	panic("Bad octeon_bootinfo %p", octeon_bootinfo);
+
     	octeon_bootinfo =
 	    (cvmx_bootinfo_t *)(intptr_t)app_desc_ptr->cvmx_desc_vaddr;
         octeon_bootinfo =
 	    (cvmx_bootinfo_t *) ((intptr_t)octeon_bootinfo | MIPS_KSEG0_START);
-        octeon_cvmx_bd_ver = (octeon_bootinfo->major_version * 100) +
-	    octeon_bootinfo->minor_version;
-        if (octeon_bootinfo->major_version != 1) {
-            	panic("Incompatible CVMX descriptor from bootloader: %d.%d %p\n",
+        if (octeon_bootinfo->major_version != 1)
+            	panic("Incompatible CVMX descriptor from bootloader: %d.%d %p",
                        (int) octeon_bootinfo->major_version,
                        (int) octeon_bootinfo->minor_version, octeon_bootinfo);
-        }
-
-        octeon_core_mask = octeon_bootinfo->core_mask;
-        octeon_mac_addr[0] = octeon_bootinfo->mac_addr_base[0];
-        octeon_mac_addr[1] = octeon_bootinfo->mac_addr_base[1];
-        octeon_mac_addr[2] = octeon_bootinfo->mac_addr_base[2];
-        octeon_mac_addr[3] = octeon_bootinfo->mac_addr_base[3];
-        octeon_mac_addr[4] = octeon_bootinfo->mac_addr_base[4];
-        octeon_mac_addr[5] = octeon_bootinfo->mac_addr_base[5];
-        octeon_mac_addr_count = octeon_bootinfo->mac_addr_count;
-
-        if (app_desc_ptr->dram_size > 16*1024*1024)
-            	octeon_dram = (uint64_t)app_desc_ptr->dram_size;
-	else
-            	octeon_dram = (uint64_t)app_desc_ptr->dram_size << 20;
 
 	phy_mem_desc_ptr =
 	    (void *)MIPS_PHYS_TO_KSEG0(octeon_bootinfo->phy_mem_desc_addr);
@@ -502,47 +464,43 @@ octeon_process_app_desc_ver_6(void)
 					octeon_bootinfo->board_rev_major,
 					octeon_bootinfo->board_rev_minor,
 					octeon_bootinfo->eclock_hz);
-        return 0;
 }
 
 static void
 octeon_boot_params_init(register_t ptr)
 {
-	int bad_desc = 1;
-	
-    	if (ptr != 0 && ptr < MAX_APP_DESC_ADDR) {
-	        app_desc_ptr = (octeon_boot_descriptor_t *)(intptr_t)ptr;
-		octeon_bd_ver = app_desc_ptr->desc_version;
-		if (app_desc_ptr->desc_version < 6)
-			panic("Your boot code is too old to be supported.\n");
-		if (app_desc_ptr->desc_version >= 6)
-			bad_desc = octeon_process_app_desc_ver_6();
-        }
-        if (bad_desc)
-        	octeon_process_app_desc_ver_unknown();
+	if (ptr == 0 || ptr >= MAX_APP_DESC_ADDR)
+		panic("app descriptor passed at invalid address %#jx", (uintmax_t)ptr);
+
+	app_desc_ptr = (octeon_boot_descriptor_t *)(intptr_t)ptr;
+	if (app_desc_ptr->desc_version < 6)
+		panic("Your boot code is too old to be supported.");
+	octeon_process_app_desc_ver_6();
+
+	KASSERT(octeon_bootinfo != NULL, ("octeon_bootinfo should be set"));
 
 	if (cvmx_sysinfo_get()->phy_mem_desc_ptr == NULL)
-		panic("Your boot loader did not supply a memory descriptor.\n");
+		panic("Your boot loader did not supply a memory descriptor.");
 	cvmx_bootmem_init(cvmx_sysinfo_get()->phy_mem_desc_ptr);
 
         printf("Boot Descriptor Ver: %u -> %u/%u",
-               octeon_bd_ver, octeon_cvmx_bd_ver / 100,
-	       octeon_cvmx_bd_ver % 100);
+               app_desc_ptr->desc_version, octeon_bootinfo->major_version,
+	       octeon_bootinfo->minor_version);
         printf("  CPU clock: %uMHz  Core Mask: %#x\n",
-	       cvmx_sysinfo_get()->cpu_clock_hz / 1000000, octeon_core_mask);
-        printf("  Dram: %u MB", (uint32_t)(octeon_dram >> 20));
+	       cvmx_sysinfo_get()->cpu_clock_hz / 1000000,
+	       cvmx_sysinfo_get()->core_mask);
         printf("  Board Type: %u  Revision: %u/%u\n",
                cvmx_sysinfo_get()->board_type,
 	       cvmx_sysinfo_get()->board_rev_major,
 	       cvmx_sysinfo_get()->board_rev_minor);
-#if 0
-        printf("  Octeon Chip: %u  Rev %u/%u",
-               octeon_chip_type, octeon_chip_rev_major, octeon_chip_rev_minor);
-#endif
 
         printf("  Mac Address %02X.%02X.%02X.%02X.%02X.%02X (%d)\n",
-	    octeon_mac_addr[0], octeon_mac_addr[1], octeon_mac_addr[2],
-	    octeon_mac_addr[3], octeon_mac_addr[4], octeon_mac_addr[5],
-	    octeon_mac_addr_count);
+	    octeon_bootinfo->mac_addr_base[0],
+	    octeon_bootinfo->mac_addr_base[1],
+	    octeon_bootinfo->mac_addr_base[2],
+	    octeon_bootinfo->mac_addr_base[3],
+	    octeon_bootinfo->mac_addr_base[4],
+	    octeon_bootinfo->mac_addr_base[5],
+	    octeon_bootinfo->mac_addr_count);
 }
 /* impEND: This stuff should move back into the Cavium SDK */

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_mp.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_mp.c	Tue Apr 27 21:10:43 2010	(r207298)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_mp.c	Tue Apr 27 21:29:30 2010	(r207299)
@@ -41,6 +41,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+/* XXX */
+extern cvmx_bootinfo_t *octeon_bootinfo;
+
 unsigned octeon_ap_boot = ~0;
 
 void
@@ -90,7 +93,7 @@ platform_init_ap(int cpuid)
 int
 platform_num_processors(void)
 {
-	return (fls(octeon_core_mask));
+	return (fls(octeon_bootinfo->core_mask));
 }
 
 int

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h	Tue Apr 27 21:10:43 2010	(r207298)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h	Tue Apr 27 21:29:30 2010	(r207299)
@@ -288,9 +288,6 @@ extern void octeon_reset(void);
 extern void octeon_led_write_char0(char val);
 extern void octeon_led_run_wheel(int *pos, int led_position);
 extern void octeon_debug_symbol(void);
-extern uint64_t octeon_dram;
-extern uint8_t octeon_mac_addr[6];
-extern int octeon_core_mask, octeon_mac_addr_count;
 extern void octeon_ciu_reset(void);
 extern int octeon_is_simulation(void);
 #endif	/* LOCORE */

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 22:04:40 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0271F1065674;
	Tue, 27 Apr 2010 22:04:40 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CDA178FC18;
	Tue, 27 Apr 2010 22:04:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3RM4dqf035592;
	Tue, 27 Apr 2010 22:04:39 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3RM4dpL035589;
	Tue, 27 Apr 2010 22:04:39 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004272204.o3RM4dpL035589@svn.freebsd.org>
From: Juli Mallett 
Date: Tue, 27 Apr 2010 22:04:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207300 - user/jmallett/octeon/sys/mips/cavium
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 22:04:40 -0000

Author: jmallett
Date: Tue Apr 27 22:04:39 2010
New Revision: 207300
URL: http://svn.freebsd.org/changeset/base/207300

Log:
  o) Print model string at startup.
  o) Fix build without octe by linking in more of the SDK that we use now.

Modified:
  user/jmallett/octeon/sys/mips/cavium/files.octeon1
  user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c

Modified: user/jmallett/octeon/sys/mips/cavium/files.octeon1
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/files.octeon1	Tue Apr 27 21:29:30 2010	(r207299)
+++ user/jmallett/octeon/sys/mips/cavium/files.octeon1	Tue Apr 27 22:04:39 2010	(r207300)
@@ -26,7 +26,6 @@ mips/cavium/octe/ethernet-xaui.c		option
 mips/cavium/octe/octe.c				optional octe
 mips/cavium/octe/octebus.c			optional octe
 
-contrib/octeon-sdk/cvmx-bootmem.c		optional octe
 contrib/octeon-sdk/cvmx-cmd-queue.c		optional octe
 contrib/octeon-sdk/cvmx-fpa.c			optional octe
 contrib/octeon-sdk/cvmx-helper.c		optional octe
@@ -44,6 +43,8 @@ contrib/octeon-sdk/cvmx-pko.c			optional
 contrib/octeon-sdk/cvmx-spi.c			optional octe
 contrib/octeon-sdk/cvmx-spi4000.c		optional octe
 contrib/octeon-sdk/cvmx-twsi.c			optional octe
-contrib/octeon-sdk/cvmx-warn.c			optional octe
 
+contrib/octeon-sdk/cvmx-bootmem.c		standard
 contrib/octeon-sdk/cvmx-sysinfo.c		standard
+contrib/octeon-sdk/cvmx-warn.c			standard
+contrib/octeon-sdk/octeon-model.c		standard

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Tue Apr 27 21:29:30 2010	(r207299)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Tue Apr 27 22:04:39 2010	(r207300)
@@ -299,6 +299,8 @@ platform_start(__register_t a0, __regist
 	mips_timer_early_init(OCTEON_CLOCK_DEFAULT);
 	cninit();
 
+	printf("Model: %s\n", octeon_model_get_string(cvmx_get_proc_id()));
+
 	octeon_ciu_reset();
 	octeon_boot_params_init(a3);
 	bootverbose = 1;

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 22:50:46 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 22102106564A;
	Tue, 27 Apr 2010 22:50:46 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 12DE98FC0C;
	Tue, 27 Apr 2010 22:50:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3RMojlD045741;
	Tue, 27 Apr 2010 22:50:45 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3RMojOG045738;
	Tue, 27 Apr 2010 22:50:45 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004272250.o3RMojOG045738@svn.freebsd.org>
From: Juli Mallett 
Date: Tue, 27 Apr 2010 22:50:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207301 - in user/jmallett/octeon/sys/mips: cavium conf
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 22:50:46 -0000

Author: jmallett
Date: Tue Apr 27 22:50:45 2010
New Revision: 207301
URL: http://svn.freebsd.org/changeset/base/207301

Log:
  Attach obio to ciu to avoid sending lots of stray interrupts to the UART
  handlers.  (It used to simply connect to the same interrupt as CIU's 0 line
  and unmask the UART interrupts in CIU.)

Modified:
  user/jmallett/octeon/sys/mips/cavium/obio.c
  user/jmallett/octeon/sys/mips/conf/OCTEON1.hints

Modified: user/jmallett/octeon/sys/mips/cavium/obio.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/obio.c	Tue Apr 27 22:04:39 2010	(r207300)
+++ user/jmallett/octeon/sys/mips/cavium/obio.c	Tue Apr 27 22:50:45 2010	(r207301)
@@ -57,29 +57,29 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 
 extern struct bus_space octeon_uart_tag;
 
-int	obio_probe(device_t);
-int	obio_attach(device_t);
+static void	obio_identify(driver_t *, device_t);
+static int	obio_probe(device_t);
+static int	obio_attach(device_t);
 
-/*
- * We need only one obio.  Any other device hanging off of it,
- * shouldn't cause multiple of these to be found.
- */
-static int have_one = 0;
+static void
+obio_identify(driver_t *drv, device_t parent)
+{
+	BUS_ADD_CHILD(parent, 0, "obio", 0);
+}
 
-int
+static int
 obio_probe(device_t dev)
 {
-	if (!have_one) {
-		have_one = 1;
-		return 0;
-	}
-	return (ENXIO);
+	if (device_get_unit(dev) != 0)
+		return (ENXIO);
+	return (0);
 }
 
-int
+static int
 obio_attach(device_t dev)
 {
 	struct obio_softc *sc = device_get_softc(dev);
@@ -104,10 +104,10 @@ obio_attach(device_t dev)
 
 	/* 
 	 * This module is intended for UART purposes only and
-	 * it's IRQ is 0  corresponding to IP2.
+	 * manages IRQs for UART0 and UART1.
 	 */
 	if (rman_init(&sc->oba_irq_rman) != 0 ||
-	    rman_manage_region(&sc->oba_irq_rman, 0, 0) != 0)
+	    rman_manage_region(&sc->oba_irq_rman, CVMX_IRQ_UART0, CVMX_IRQ_UART1) != 0)
 		panic("obio_attach: failed to set up IRQ rman");
 
 	device_add_child(dev, "uart", 1);  /* Setup Uart-1 first. */
@@ -129,6 +129,16 @@ obio_alloc_resource(device_t bus, device
 
 	switch (type) {
 	case SYS_RES_IRQ:
+		switch (device_get_unit(child)) {
+		case 0:
+			start = end = CVMX_IRQ_UART0;
+			break;
+		case 1:
+			start = end = CVMX_IRQ_UART1;
+			break;
+		default:
+			return (NULL);
+		}
 		rm = &sc->oba_irq_rman;
 		break;
 	case SYS_RES_MEMORY:
@@ -171,11 +181,14 @@ obio_activate_resource(device_t bus, dev
 	return (0);
 }
 static device_method_t obio_methods[] = {
-	DEVMETHOD(device_probe, obio_probe),
-	DEVMETHOD(device_attach, obio_attach),
-
-	DEVMETHOD(bus_alloc_resource, obio_alloc_resource),
-	DEVMETHOD(bus_activate_resource, obio_activate_resource),
+	/* Device methods */
+	DEVMETHOD(device_identify,	obio_identify),
+	DEVMETHOD(device_probe,		obio_probe),
+	DEVMETHOD(device_attach,	obio_attach),
+
+	/* Bus methods */
+	DEVMETHOD(bus_alloc_resource,	obio_alloc_resource),
+	DEVMETHOD(bus_activate_resource,obio_activate_resource),
 	DEVMETHOD(bus_setup_intr,	bus_generic_setup_intr),
 	DEVMETHOD(bus_teardown_intr,	bus_generic_teardown_intr),
 
@@ -189,4 +202,4 @@ static driver_t obio_driver = {
 };
 static devclass_t obio_devclass;
 
-DRIVER_MODULE(obio, nexus, obio_driver, obio_devclass, 0, 0);
+DRIVER_MODULE(obio, ciu, obio_driver, obio_devclass, 0, 0);

Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1.hints
==============================================================================
--- user/jmallett/octeon/sys/mips/conf/OCTEON1.hints	Tue Apr 27 22:04:39 2010	(r207300)
+++ user/jmallett/octeon/sys/mips/conf/OCTEON1.hints	Tue Apr 27 22:50:45 2010	(r207301)
@@ -3,7 +3,7 @@
 # All these values are complete nonsense...
 hw.uart.console="io:0x1"
 hint.ciu.0.at="nexus"
-hint.obio.0.at="nexus"
+hint.obio.0.at="ciu"
 hint.obio.0.maddr="0x1"
 hint.obio.0.msize="0x1"
 hint.obio.0.flags="0x1"

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 27 23:22:13 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 236A1106566C;
	Tue, 27 Apr 2010 23:22:13 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 14EB78FC17;
	Tue, 27 Apr 2010 23:22:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3RNMCZb052634;
	Tue, 27 Apr 2010 23:22:12 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3RNMCiV052620;
	Tue, 27 Apr 2010 23:22:12 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004272322.o3RNMCiV052620@svn.freebsd.org>
From: Juli Mallett 
Date: Tue, 27 Apr 2010 23:22:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207302 - user/jmallett/octeon/sys/mips/cavium
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Apr 2010 23:22:13 -0000

Author: jmallett
Date: Tue Apr 27 23:22:12 2010
New Revision: 207302
URL: http://svn.freebsd.org/changeset/base/207302

Log:
  Make CIU_IRQ_ENx_END the last IRQ rather than one past it since that's what
  rman actually wants.
  
  Add interrupt counters for CIU interrupts.

Modified:
  user/jmallett/octeon/sys/mips/cavium/ciu.c

Modified: user/jmallett/octeon/sys/mips/cavium/ciu.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/ciu.c	Tue Apr 27 22:50:45 2010	(r207301)
+++ user/jmallett/octeon/sys/mips/cavium/ciu.c	Tue Apr 27 23:22:12 2010	(r207302)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD: user/jmallett/octeon
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -52,18 +53,23 @@ __FBSDID("$FreeBSD: user/jmallett/octeon
 #define	CIU_IRQ_HARD		(0)
 
 #define	CIU_IRQ_EN0_BEGIN	CVMX_IRQ_WORKQ0
-#define	CIU_IRQ_EN0_END		(CVMX_IRQ_BOOTDMA + 1)
+#define	CIU_IRQ_EN0_END		CVMX_IRQ_BOOTDMA
+#define	CIU_IRQ_EN0_COUNT	((CIU_IRQ_EN0_END - CIU_IRQ_EN0_BEGIN) + 1)
 
 #define	CIU_IRQ_EN1_BEGIN	CVMX_IRQ_WDOG0
-#define	CIU_IRQ_EN1_END		(CVMX_IRQ_WDOG15 + 1)
+#define	CIU_IRQ_EN1_END		CVMX_IRQ_WDOG15
+#define	CIU_IRQ_EN1_COUNT	((CIU_IRQ_EN1_END - CIU_IRQ_EN1_BEGIN) + 1)
 
 struct ciu_softc {
 	struct rman irq_rman;
 	struct resource *ciu_irq;
 };
 
-static struct intr_event *ciu_en0_intr_events[CIU_IRQ_EN0_END - CIU_IRQ_EN0_BEGIN];
-static struct intr_event *ciu_en1_intr_events[CIU_IRQ_EN1_END - CIU_IRQ_EN1_BEGIN];
+static mips_intrcnt_t ciu_en0_intrcnt[CIU_IRQ_EN0_COUNT];
+static mips_intrcnt_t ciu_en1_intrcnt[CIU_IRQ_EN1_COUNT];
+
+static struct intr_event *ciu_en0_intr_events[CIU_IRQ_EN0_COUNT];
+static struct intr_event *ciu_en1_intr_events[CIU_IRQ_EN1_COUNT];
 
 static int		ciu_probe(device_t);
 static int		ciu_attach(device_t);
@@ -95,7 +101,9 @@ ciu_probe(device_t dev)
 static int
 ciu_attach(device_t dev)
 {
+	char name[MAXCOMLEN + 1];
 	struct ciu_softc *sc;
+	unsigned i;
 	int error;
 	int rid;
 
@@ -131,6 +139,16 @@ ciu_attach(device_t dev)
 	if (error != 0)
 		return (error);
 
+	for (i = 0; i < CIU_IRQ_EN0_COUNT; i++) {
+		snprintf(name, sizeof name, "int%d:", i + CIU_IRQ_EN0_BEGIN);
+		ciu_en0_intrcnt[i] = mips_intrcnt_create(name);
+	}
+
+	for (i = 0; i < CIU_IRQ_EN1_COUNT; i++) {
+		snprintf(name, sizeof name, "int%d:", i + CIU_IRQ_EN1_BEGIN);
+		ciu_en1_intrcnt[i] = mips_intrcnt_create(name);
+	}
+
 	bus_generic_probe(dev);
 	bus_generic_attach(dev);
 
@@ -176,16 +194,19 @@ ciu_setup_intr(device_t bus, device_t ch
 	struct intr_event *event, **eventp;
 	void (*mask_func)(void *);
 	void (*unmask_func)(void *);
+	mips_intrcnt_t intrcnt;
 	int error;
 	int irq;
 
 	irq = rman_get_start(res);
-	if (irq < CIU_IRQ_EN0_END) {
+	if (irq <= CIU_IRQ_EN0_END) {
 		eventp = &ciu_en0_intr_events[irq - CIU_IRQ_EN0_BEGIN];
+		intrcnt = ciu_en0_intrcnt[irq - CIU_IRQ_EN0_BEGIN];
 		mask_func = ciu_en0_intr_mask;
 		unmask_func = ciu_en0_intr_unmask;
 	} else {
 		eventp = &ciu_en1_intr_events[irq - CIU_IRQ_EN1_BEGIN];
+		intrcnt = ciu_en1_intrcnt[irq - CIU_IRQ_EN1_BEGIN];
 		mask_func = ciu_en1_intr_mask;
 		unmask_func = ciu_en1_intr_unmask;
 	}
@@ -204,6 +225,8 @@ ciu_setup_intr(device_t bus, device_t ch
 	intr_event_add_handler(event, device_get_nameunit(child),
 	    filter, intr, arg, intr_priority(flags), flags, cookiep);
 
+	mips_intrcnt_setname(intrcnt, event->ie_fullname);
+
 	return (0);
 }
 
@@ -290,6 +313,8 @@ ciu_intr(void *arg)
 		if ((en0_sum & 1) == 0)
 			continue;
 
+		mips_intrcnt_inc(ciu_en0_intrcnt[irq_index]);
+
 		error = intr_event_handle(ciu_en0_intr_events[irq_index], NULL);
 		if (error != 0)
 			printf("%s: stray en0 irq%d\n", __func__, irq_index);
@@ -300,6 +325,8 @@ ciu_intr(void *arg)
 		if ((en1_sum & 1) == 0)
 			continue;
 
+		mips_intrcnt_inc(ciu_en1_intrcnt[irq_index]);
+
 		error = intr_event_handle(ciu_en1_intr_events[irq_index], NULL);
 		if (error != 0)
 			printf("%s: stray en1 irq%d\n", __func__, irq_index);

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 28 08:58:23 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 58963106566C;
	Wed, 28 Apr 2010 08:58:23 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2F0158FC1C;
	Wed, 28 Apr 2010 08:58:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3S8wNv6079938;
	Wed, 28 Apr 2010 08:58:23 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3S8wNoO079936;
	Wed, 28 Apr 2010 08:58:23 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <201004280858.o3S8wNoO079936@svn.freebsd.org>
From: Dag-Erling Smorgrav 
Date: Wed, 28 Apr 2010 08:58:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207313 - user/des/fmerge
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Apr 2010 08:58:23 -0000

Author: des
Date: Wed Apr 28 08:58:22 2010
New Revision: 207313
URL: http://svn.freebsd.org/changeset/base/207313

Log:
  Add support for merging vendor / user / project branches into head:
  instead of setting $src_branch to head by default, leave it undefined
  and try to guess it from existing mergeinfo.

Modified:
  user/des/fmerge/fmerge.pl

Modified: user/des/fmerge/fmerge.pl
==============================================================================
--- user/des/fmerge/fmerge.pl	Wed Apr 28 08:39:12 2010	(r207312)
+++ user/des/fmerge/fmerge.pl	Wed Apr 28 08:58:22 2010	(r207313)
@@ -35,7 +35,7 @@ our $already;
 our $debug;
 our $pretend;
 
-our $src_branch = "head";	# where we merge from
+our $src_branch;		# where we merge from
 our $src_path;			# path relative to source branch
 our $src_url;			# source URL
 our $tgt_branch;		# where we merge to
@@ -58,11 +58,15 @@ sub debug(@) {
 	if $debug;
 }
 
+sub error(@) {
+    info(@_);
+    exit(1);
+}
+
 sub svn_check($@) {
     my ($cond, @msg) = @_;
     if (!$cond) {
-	info(@msg);
-	exit(1);
+	error(@msg);
     }
 }
 
@@ -126,9 +130,19 @@ sub examine() {
     $fh = svn_catch('propget', 'svn:mergeinfo', $tgt_dir);
     while (<$fh>) {
 	chomp();
-	debug("'$_' =~ m\@^\Q/$src_branch\E((?:/[\\w.-]+)*):\@");
-	next unless m@^\Q/$src_branch\E((?:/[\w.-]+)*):@;
-	my $subdir = $1;
+	my $subdir;
+	if ($src_branch) {
+	    debug("have src_branch = $src_branch");
+	    debug("'$_' =~ m\@^\Q/$src_branch\E((?:/[\\w.-]+)*):\@");
+	    next unless m@^\Q/$src_branch\E((?:/[\w.-]+)*):@;
+	    $subdir = 1;
+	} else {
+	    debug("no src_branch");
+	    next unless m@^((?:/[\w.-]+)*):@;
+	    $src_branch = $1;
+	    $subdir = "";
+	}
+	debug("subdir = $subdir");
 	debug("'$svn_path' =~ m\@^((?:/[\\w.-]+)+)\Q$subdir\E\$\@");
 	next unless $svn_path =~ m@^((?:/[\w.-]+)+)\Q$subdir\E$@;
 	$svn_path = $subdir;
@@ -137,6 +151,10 @@ sub examine() {
     }
     close($fh);
 
+    if (!$src_branch) {
+	error("not enough information to deduce source or target");
+    }
+
     if (!$tgt_branch) {
 	# try to guess a stable / releng / release branch
 	debug("guessing target branch");

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 28 09:01:23 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 339C4106566C;
	Wed, 28 Apr 2010 09:01:23 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2366E8FC14;
	Wed, 28 Apr 2010 09:01:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3S91Nb6080654;
	Wed, 28 Apr 2010 09:01:23 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3S91Nnj080652;
	Wed, 28 Apr 2010 09:01:23 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <201004280901.o3S91Nnj080652@svn.freebsd.org>
From: Dag-Erling Smorgrav 
Date: Wed, 28 Apr 2010 09:01:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207314 - user/des/fmerge
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Apr 2010 09:01:23 -0000

Author: des
Date: Wed Apr 28 09:01:22 2010
New Revision: 207314
URL: http://svn.freebsd.org/changeset/base/207314

Log:
  get rid of svn_check()

Modified:
  user/des/fmerge/fmerge.pl

Modified: user/des/fmerge/fmerge.pl
==============================================================================
--- user/des/fmerge/fmerge.pl	Wed Apr 28 08:58:22 2010	(r207313)
+++ user/des/fmerge/fmerge.pl	Wed Apr 28 09:01:22 2010	(r207314)
@@ -63,13 +63,6 @@ sub error(@) {
     exit(1);
 }
 
-sub svn_check($@) {
-    my ($cond, @msg) = @_;
-    if (!$cond) {
-	error(@msg);
-    }
-}
-
 sub svn_do(@) {
     my @argv = @_;
     unshift(@argv, '--dry-run')
@@ -114,7 +107,9 @@ sub examine() {
 	my ($key, $value) = split(/:\s+/, $_, 2);
 	next unless $key && $value;
 	if ($key eq 'Path') {
-	    svn_check($value eq $tgt_dir, "path mismatch: $value != $tgt_dir");
+	    if (!$value eq $tgt_dir) {
+		error("path mismatch: $value != $tgt_dir");
+	    }
 	} elsif ($key eq 'URL') {
 	    $tgt_url = $value;
 	} elsif ($key eq 'Repository Root') {
@@ -123,7 +118,8 @@ sub examine() {
     }
     close($fh);
 
-    svn_check($tgt_url =~ m@^\Q$svn_root\E(/.*)$@, "invalid svn URL: $tgt_url");
+    $tgt_url =~ m@^\Q$svn_root\E(/.*)$@
+	or error("invalid svn URL: $tgt_url");
     $svn_path = $1;
 
     debug("guessing merge source / target directory");
@@ -150,7 +146,6 @@ sub examine() {
 	last;
     }
     close($fh);
-
     if (!$src_branch) {
 	error("not enough information to deduce source or target");
     }
@@ -162,7 +157,9 @@ sub examine() {
 	$svn_path =~ s@^/(head|\w+/\d+(?:\.\d+)*)/?@@;
 	$tgt_branch = $1;
     }
-    svn_check($tgt_branch, "unable to figure out source branch");
+    if (!$tgt_branch) {
+	error("unable to figure out source branch");
+    }
     debug("tgt_branch = '$tgt_branch'");
     debug("svn_path = '$svn_path'");
 }

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 28 09:53:55 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 18FA6106566C;
	Wed, 28 Apr 2010 09:53:55 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 08E128FC16;
	Wed, 28 Apr 2010 09:53:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3S9rsdH092260;
	Wed, 28 Apr 2010 09:53:54 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3S9rsPb092258;
	Wed, 28 Apr 2010 09:53:54 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201004280953.o3S9rsPb092258@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 28 Apr 2010 09:53:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207315 - user/kib/vm6/sys/vm
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Apr 2010 09:53:55 -0000

Author: kib
Date: Wed Apr 28 09:53:54 2010
New Revision: 207315
URL: http://svn.freebsd.org/changeset/base/207315

Log:
  The reserved page cannot be used by anybody other there, so clear
  PG_UNMANAGED slightly earlier (to avoid exposure) and without
  page_queue lock.

Modified:
  user/kib/vm6/sys/vm/vm_readwrite.c

Modified: user/kib/vm6/sys/vm/vm_readwrite.c
==============================================================================
--- user/kib/vm6/sys/vm/vm_readwrite.c	Wed Apr 28 09:01:22 2010	(r207314)
+++ user/kib/vm6/sys/vm/vm_readwrite.c	Wed Apr 28 09:53:54 2010	(r207315)
@@ -437,13 +437,11 @@ vnode_grab_pages(struct vnode *vp, vm_pa
 				m = *reserv;
 				*reserv = NULL;
 				atomic_add_int(&vmio_reserv_used, 1);
+				m->flags &= ~PG_UNMANAGED;
 				if (object->memattr != VM_MEMATTR_DEFAULT)
 					pmap_page_set_memattr(m,
 					    object->memattr);
 				vm_page_insert(m, object, pindex);
-				vm_page_lock_queues();
-				vm_page_flag_clear(m, PG_UNMANAGED);
-				vm_page_unlock_queues();
 				ma[i] = m;
 				i++;
 			}

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 28 18:55:46 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A15B01065672;
	Wed, 28 Apr 2010 18:55:46 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 90A908FC08;
	Wed, 28 Apr 2010 18:55:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3SItktV015627;
	Wed, 28 Apr 2010 18:55:46 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3SItkx1015625;
	Wed, 28 Apr 2010 18:55:46 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201004281855.o3SItkx1015625@svn.freebsd.org>
From: Doug Barton 
Date: Wed, 28 Apr 2010 18:55:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207336 - user/dougb/portmaster
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Apr 2010 18:55:46 -0000

Author: dougb
Date: Wed Apr 28 18:55:46 2010
New Revision: 207336
URL: http://svn.freebsd.org/changeset/base/207336

Log:
  Add error-checking to parse_index() so that if we don't find a line for
  the port we return an error code.
  
  Check for the error in the callers.
  
  Inspiration and some code from the PR.
  
  PR:		ports/145984
  Submitted by:	mandree

Modified:
  user/dougb/portmaster/portmaster

Modified: user/dougb/portmaster/portmaster
==============================================================================
--- user/dougb/portmaster/portmaster	Wed Apr 28 18:49:45 2010	(r207335)
+++ user/dougb/portmaster/portmaster	Wed Apr 28 18:55:46 2010	(r207336)
@@ -1153,7 +1153,7 @@ parse_index () {
 
 	[ -z "$pd" -a -n "$PM_INDEX_ONLY" ] && pd=/usr/ports
 
-	line=`grep -m1 .*\|${pd}/${1}\|.* $PM_INDEX`
+	line=`grep -m1 .*\|${pd}/${1}\|.* $PM_INDEX` || return 1
 
 	case "$2" in
 	name)		echo ${line%%|*} ;;
@@ -1205,8 +1205,12 @@ check_for_updates () {
 	origin=${2:-`origin_from_pdb $iport`} || return 0
 
 	if [ -n "$PM_INDEX" ]; then
-		port_ver=`parse_index $origin name`
-		check_pkg_version $iport $port_ver || { do_update=update_index ; }
+		if port_ver=`parse_index $origin name`; then
+			check_pkg_version $iport $port_ver ||
+				{ do_update=update_index ; }
+		else
+			echo "	===>>> Warning: No INDEX entry for $origin"
+		fi
 	fi
 
 	if [ -d "$pd/$origin" -a -z "$do_update" -a -z "$PM_INDEX_ONLY" ]; then
@@ -1880,7 +1884,8 @@ update_build_l () {
 	if [ -z "$PM_INDEX_ONLY" ]; then
 		pm_cd $pd/$origin && new_port=`pm_make -V PKGNAME`
 	else
-		new_port=`parse_index $origin name`
+		new_port=`parse_index $origin name` ||
+			fail "No INDEX entry for $origin"
 	fi
 
 	case `pkg_version -t $iport $new_port 2>/dev/null` in
@@ -2916,7 +2921,8 @@ if [ -z "$new_port" ]; then
 	if [ -z "$PM_INDEX_ONLY" ]; then
 		new_port=`pm_make -V PKGNAME`
 	else
-		new_port=`parse_index $portdir name`
+		new_port=`parse_index $portdir name` ||
+			fail "No INDEX entry for $origin"
 	fi
 fi
 

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 28 19:36:26 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 38A22106564A;
	Wed, 28 Apr 2010 19:36:26 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2680F8FC2B;
	Wed, 28 Apr 2010 19:36:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3SJaQmn025077;
	Wed, 28 Apr 2010 19:36:26 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3SJaPCI025075;
	Wed, 28 Apr 2010 19:36:25 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201004281936.o3SJaPCI025075@svn.freebsd.org>
From: Doug Barton 
Date: Wed, 28 Apr 2010 19:36:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207338 - user/dougb/portmaster
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Apr 2010 19:36:26 -0000

Author: dougb
Date: Wed Apr 28 19:36:25 2010
New Revision: 207338
URL: http://svn.freebsd.org/changeset/base/207338

Log:
  Add error checking to pm_mktemp, and the stray mktemp call. According to
  a private report from a user it can actually fail.

Modified:
  user/dougb/portmaster/portmaster

Modified: user/dougb/portmaster/portmaster
==============================================================================
--- user/dougb/portmaster/portmaster	Wed Apr 28 19:22:52 2010	(r207337)
+++ user/dougb/portmaster/portmaster	Wed Apr 28 19:36:25 2010	(r207338)
@@ -369,7 +369,8 @@ pm_make   () { ( unset -v CUR_DEPS INSTA
 		 unset -v MASTER_RB_LIST CONFIG_SEEN_LIST;
 		 /usr/bin/make $PM_MAKE_ARGS $*; ); }
 pm_make_b () { /usr/bin/make $PM_MAKE_ARGS BEFOREPORTMK=bpm $*; }
-pm_mktemp () { /usr/bin/mktemp -t f-${PM_PARENT_PID}-$1; }
+pm_mktemp () { /usr/bin/mktemp -t f-${PM_PARENT_PID}-$1 ||
+		fail "mktemp for $1 failed"; }
 pm_unlink () { /bin/test -e $1 && /bin/unlink $1; }
 
 # Superuser versions for commands that need root privileges
@@ -3161,7 +3162,8 @@ if [ -z "$use_package" ]; then
 	unset sleep
 
 	if [ -n "$HIDE_BUILD" ]; then
-		port_log=`mktemp -t port_log-${PM_PARENT_PID}-${portdir#*/}`
+		port_log=`mktemp -t port_log-${PM_PARENT_PID}-${portdir#*/}` ||
+			fail "mktemp for $1 failed"
 		port_log_args=">> $port_log 2>&1"
 		echo "===>>> Logging build to $port_log"
 	fi

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 28 22:06:23 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F09DE1065675;
	Wed, 28 Apr 2010 22:06:23 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DEE088FC1E;
	Wed, 28 Apr 2010 22:06:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3SM6Nrf060215;
	Wed, 28 Apr 2010 22:06:23 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3SM6NZd060211;
	Wed, 28 Apr 2010 22:06:23 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004282206.o3SM6NZd060211@svn.freebsd.org>
From: Kip Macy 
Date: Wed, 28 Apr 2010 22:06:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207342 - user/kmacy/head_page_lock_2/sys/amd64/amd64
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Apr 2010 22:06:24 -0000

Author: kmacy
Date: Wed Apr 28 22:06:22 2010
New Revision: 207342
URL: http://svn.freebsd.org/changeset/base/207342

Log:
  - change cases where pmap_demote_pde can't fail and pv_list has to be passed
    to pmap_demote_pde_pv_list
  - make pmap_demote_pde a wrapper around pmap_demote_pde_pv_list
  
  suggested by: kib@

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Wed Apr 28 21:51:53 2010	(r207341)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Wed Apr 28 22:06:22 2010	(r207342)
@@ -224,10 +224,10 @@ static void	pmap_pvh_free(struct md_page
 static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap,
 		    vm_offset_t va);
 static int	pmap_pvh_wired_mappings(struct md_page *pvh, int count);
-
-static int pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode);
-static boolean_t pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va,
-	struct pv_list_head *pv_list);
+static int pmap_change_attr_locked(vm_offset_t, vm_size_t, int);
+static boolean_t pmap_demote_pde_pv_list(pmap_t, pd_entry_t *, vm_offset_t,
+	struct pv_list_head *);
+static boolean_t pmap_demote_pde(pmap_t, pd_entry_t *, vm_offset_t);
 static boolean_t pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe,
     vm_offset_t va);
 static boolean_t pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t m,
@@ -1793,7 +1793,6 @@ pmap_allocpte(pmap_t pmap, vm_paddr_t pa
 	vm_pindex_t ptepindex;
 	pd_entry_t *pd;
 	vm_page_t m;
-	struct pv_list_head pv_list;
 
 	KASSERT((flags & (M_NOWAIT | M_WAITOK)) == M_NOWAIT ||
 	    (flags & (M_NOWAIT | M_WAITOK)) == M_WAITOK,
@@ -1814,8 +1813,7 @@ retry:
 	 * normal 4K page.
 	 */
 	if (pd != NULL && (*pd & (PG_PS | PG_V)) == (PG_PS | PG_V)) {
-		TAILQ_INIT(&pv_list);
-		if (!pmap_demote_pde(pmap, pd, va, &pv_list)) {
+		if (!pmap_demote_pde(pmap, pd, va)) {
 			/*
 			 * Invalidation of the 2MB page mapping may have caused
 			 * the deallocation of the underlying PD page.
@@ -2460,20 +2458,18 @@ pmap_fill_ptp(pt_entry_t *firstpte, pt_e
  * mapping is invalidated.
  */
 static boolean_t
-pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va,
+pmap_demote_pde_pv_list(pmap_t pmap, pd_entry_t *pde, vm_offset_t va,
 	struct pv_list_head *pv_list)
 {
 	pd_entry_t newpde, oldpde;
 	pt_entry_t *firstpte, newpte;
 	vm_paddr_t mptepa;
 	vm_page_t free, mpte;
-	boolean_t inc;
 
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
 	oldpde = *pde;
 	KASSERT((oldpde & (PG_PS | PG_V)) == (PG_PS | PG_V),
 	    ("pmap_demote_pde: oldpde is missing PG_PS and/or PG_V"));
-	inc = FALSE;
 	mpte = pmap_lookup_pt_page(pmap, va);
 	if (mpte != NULL)
 		pmap_remove_pt_page(pmap, mpte);
@@ -2506,17 +2502,8 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t 
 			    " in pmap %p", va, pmap);
 			return (FALSE);
 		}
-		if (va < VM_MAXUSER_ADDRESS) {
+		if (va < VM_MAXUSER_ADDRESS)
 			pmap_resident_count_inc(pmap, 1);
-			inc = TRUE;
-		}
-	}
-	if (TAILQ_EMPTY(pv_list) && ((oldpde & PG_MANAGED) != 0)) {
-		if (pmap_pv_list_try_alloc(pmap, NPTEPG-1, pv_list) == FALSE) {
-			if (inc)
-				pmap_resident_count_dec(pmap, 1);
-			return (FALSE);
-		}
 	}
 	mptepa = VM_PAGE_TO_PHYS(mpte);
 	firstpte = (pt_entry_t *)PHYS_TO_DMAP(mptepa);
@@ -2571,15 +2558,35 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t 
 	 * must have already changed from mapping the 2mpage to
 	 * referencing the page table page.
 	 */
-	if ((oldpde & PG_MANAGED) != 0)
+	if ((oldpde & PG_MANAGED) != 0) {
+		KASSERT(!TAILQ_EMPTY(pv_list), ("passed empty pv_list"));
 		pmap_pv_demote_pde(pmap, va, oldpde & PG_PS_FRAME, pv_list);
-
+	}
 	pmap_pde_demotions++;
 	CTR2(KTR_PMAP, "pmap_demote_pde: success for va %#lx"
 	    " in pmap %p", va, pmap);
 	return (TRUE);
 }
-	
+
+static boolean_t
+pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va)
+{
+	struct pv_list_head pv_list;
+	boolean_t ret;
+
+	TAILQ_INIT(&pv_list);
+	if ((*pde & PG_MANAGED) != 0) {
+		if (pmap_pv_list_try_alloc(pmap, NPTEPG-1, &pv_list) == FALSE) 
+			return (FALSE);
+	}
+
+	ret = pmap_demote_pde_pv_list(pmap, pde, va, &pv_list);
+	if (!TAILQ_EMPTY(&pv_list))
+		pmap_pv_list_free(pmap, &pv_list);
+
+	return (ret);
+}
+
 /*
  * pmap_remove_pde: do the things to unmap a superpage in a process
  */
@@ -2635,7 +2642,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t 
 		 * Our inability to fail here implies that we should
 		 * always be passed a pv_list if pmap == kernel_pmap
 		 */
-		if (!pmap_demote_pde(pmap, pdq, sva, pv_list))
+		if (!pmap_demote_pde_pv_list(pmap, pdq, sva, pv_list))
 			panic("pmap_remove_pde: failed demotion");
 	} else {
 		mpte = pmap_lookup_pt_page(pmap, sva);
@@ -2825,7 +2832,7 @@ restart:
 					anyvalid = 1;
 				pmap_remove_pde(pmap, pde, sva, &free, &pv_list);
 				continue;
-			} else if (!pmap_demote_pde(pmap, pde, sva, &pv_list)) {
+			} else if (!pmap_demote_pde(pmap, pde, sva)) {
 				/* The large page mapping was destroyed. */
 				continue;
 			} else
@@ -2897,9 +2904,7 @@ pmap_remove_all(vm_page_t m)
 	pd_entry_t *pde;
 	vm_offset_t va;
 	vm_page_t free;
-	struct pv_list_head pv_list;
 	
-	TAILQ_INIT(&pv_list);
 	KASSERT((m->flags & PG_FICTITIOUS) == 0,
 	    ("pmap_remove_all: page %p is fictitious", m));
 	vm_page_lock_assert(m, MA_OWNED);
@@ -2909,7 +2914,7 @@ pmap_remove_all(vm_page_t m)
 		PMAP_LOCK(pmap);
 		va = pv->pv_va;
 		pde = pmap_pde(pmap, va);
-		(void)pmap_demote_pde(pmap, pde, va, &pv_list);
+		(void)pmap_demote_pde(pmap, pde, va);
 		PMAP_UNLOCK(pmap);
 	}
 	while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) {
@@ -2995,7 +3000,6 @@ pmap_protect(pmap_t pmap, vm_offset_t sv
 	pt_entry_t *pte;
 	int anychanged;
 	vm_paddr_t pa;
-	struct pv_list_head pv_list;
 
 	if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
 		pmap_remove(pmap, sva, eva);
@@ -3006,7 +3010,6 @@ pmap_protect(pmap_t pmap, vm_offset_t sv
 	    (VM_PROT_WRITE|VM_PROT_EXECUTE))
 		return;
 
-	TAILQ_INIT(&pv_list);
 	pa = 0;
 	anychanged = 0;
 
@@ -3059,7 +3062,7 @@ restart:	
 				if (pmap_protect_pde(pmap, pde, sva, prot))
 					anychanged = 1;
 				continue;
-			} else if (!pmap_demote_pde(pmap, pde, sva, &pv_list)) {
+			} else if (!pmap_demote_pde(pmap, pde, sva)) {
 				/* The large page mapping was destroyed. */
 				continue;
 			}
@@ -3825,7 +3828,7 @@ retry:
 	if ((*pde & PG_PS) != 0) {
 		if (!wired != ((*pde & PG_W) == 0)) {
 			gen_count = pmap->pm_gen_count;
-			if (!pmap_demote_pde(pmap, pde, va, &pv_list))
+			if (!pmap_demote_pde_pv_list(pmap, pde, va, &pv_list))
 				panic("pmap_change_wiring: demotion failed");
 			if (gen_count != pmap->pm_gen_count)
 				goto retry;
@@ -4433,13 +4436,11 @@ pmap_remove_write(vm_page_t m)
 	pd_entry_t *pde;
 	pt_entry_t oldpte, *pte;
 	vm_offset_t va;
-	struct pv_list_head pv_list;
 
 	if ((m->flags & PG_FICTITIOUS) != 0 ||
 	    (m->flags & PG_WRITEABLE) == 0)
 		return;
 
-	TAILQ_INIT(&pv_list);
 	vm_page_lock_assert(m, MA_OWNED);
 	pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
 	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, next_pv) {
@@ -4448,7 +4449,7 @@ pmap_remove_write(vm_page_t m)
 		va = pv->pv_va;
 		pde = pmap_pde(pmap, va);
 		if ((*pde & PG_RW) != 0)
-			(void)pmap_demote_pde(pmap, pde, va, &pv_list);
+			(void)pmap_demote_pde(pmap, pde, va);
 		PMAP_UNLOCK(pmap);
 	}
 	TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
@@ -4495,12 +4496,10 @@ pmap_ts_referenced(vm_page_t m)
 	pt_entry_t *pte;
 	vm_offset_t va;
 	int rtval = 0;
-	struct pv_list_head pv_list;
 
 	if (m->flags & PG_FICTITIOUS)
 		return (rtval);
 
-	TAILQ_INIT(&pv_list);
 	vm_page_lock_assert(m, MA_OWNED);
 	pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
 	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, pvn) {
@@ -4510,7 +4509,7 @@ pmap_ts_referenced(vm_page_t m)
 		pde = pmap_pde(pmap, va);
 		oldpde = *pde;
 		if ((oldpde & PG_A) != 0) {
-			if (pmap_demote_pde(pmap, pde, va, &pv_list)) {
+			if (pmap_demote_pde(pmap, pde, va)) {
 				if ((oldpde & PG_W) == 0) {
 					/*
 					 * Remove the mapping to a single page
@@ -4570,11 +4569,9 @@ pmap_clear_modify(vm_page_t m)
 	pd_entry_t oldpde, *pde;
 	pt_entry_t oldpte, *pte;
 	vm_offset_t va;
-	struct pv_list_head pv_list;
 
 	if ((m->flags & PG_FICTITIOUS) != 0)
 		return;
-	TAILQ_INIT(&pv_list);
 	vm_page_lock_assert(m, MA_OWNED);
 	pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
 	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, next_pv) {
@@ -4584,7 +4581,7 @@ pmap_clear_modify(vm_page_t m)
 		pde = pmap_pde(pmap, va);
 		oldpde = *pde;
 		if ((oldpde & PG_RW) != 0) {
-			if (pmap_demote_pde(pmap, pde, va, &pv_list)) {
+			if (pmap_demote_pde(pmap, pde, va)) {
 				if ((oldpde & PG_W) == 0) {
 					/*
 					 * Write protect the mapping to a
@@ -4637,11 +4634,9 @@ pmap_clear_reference(vm_page_t m)
 	pd_entry_t oldpde, *pde;
 	pt_entry_t *pte;
 	vm_offset_t va;
-	struct pv_list_head pv_list;
 
 	if ((m->flags & PG_FICTITIOUS) != 0)
 		return;
-	TAILQ_INIT(&pv_list);
 	vm_page_lock_assert(m, MA_OWNED);
 	pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
 	TAILQ_FOREACH_SAFE(pv, &pvh->pv_list, pv_list, next_pv) {
@@ -4651,7 +4646,7 @@ pmap_clear_reference(vm_page_t m)
 		pde = pmap_pde(pmap, va);
 		oldpde = *pde;
 		if ((oldpde & PG_A) != 0) {
-			if (pmap_demote_pde(pmap, pde, va, &pv_list)) {
+			if (pmap_demote_pde(pmap, pde, va)) {
 				/*
 				 * Remove the mapping to a single page so
 				 * that a subsequent access may repromote.
@@ -4898,7 +4893,6 @@ pmap_change_attr_locked(vm_offset_t va, 
 	pt_entry_t *pte;
 	int cache_bits_pte, cache_bits_pde, error;
 	boolean_t changed;
-	struct pv_list_head pv_list;
 
 	PMAP_LOCK_ASSERT(kernel_pmap, MA_OWNED);
 	base = trunc_page(va);
@@ -4915,7 +4909,6 @@ pmap_change_attr_locked(vm_offset_t va, 
 	cache_bits_pde = pmap_cache_bits(mode, 1);
 	cache_bits_pte = pmap_cache_bits(mode, 0);
 	changed = FALSE;
-	TAILQ_INIT(&pv_list);
 
 	/*
 	 * Pages that aren't mapped aren't supported.  Also break down 2MB pages
@@ -4977,7 +4970,7 @@ pmap_change_attr_locked(vm_offset_t va, 
 			 * XXX do we need to check if the lock was dropped
 			 *
 			 */
-			if (!pmap_demote_pde(kernel_pmap, pde, tmpva, &pv_list))
+			if (!pmap_demote_pde(kernel_pmap, pde, tmpva))
 				return (ENOMEM);
 		}
 		pte = pmap_pde_to_pte(pde, tmpva);

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 29 05:55:38 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DA8B81065670;
	Thu, 29 Apr 2010 05:55:38 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C9E968FC08;
	Thu, 29 Apr 2010 05:55:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3T5tc3t084994;
	Thu, 29 Apr 2010 05:55:38 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3T5tcTk084992;
	Thu, 29 Apr 2010 05:55:38 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201004290555.o3T5tcTk084992@svn.freebsd.org>
From: Doug Barton 
Date: Thu, 29 Apr 2010 05:55:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207353 - user/dougb/portmaster
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Apr 2010 05:55:39 -0000

Author: dougb
Date: Thu Apr 29 05:55:38 2010
New Revision: 207353
URL: http://svn.freebsd.org/changeset/base/207353

Log:
  For -o mode:
     Going back a long ways upg_port was (ab)used to indicate the currently
     installed version of the old port for -o. Originally this was safe since
     it's very rare to have the new port installed already, and it saved a
     little bit of code complexity. However, as more and more features were
     added that utilized the value of upg_port it became increasingly
     unsafe. Particularly, at this time there are 2 related bugs manifest.
     First the wrong information appears in the confirm list (upgrade of
     the old port vs. install of the new) and parsing the old port
     directory. The latter was (mostly) harmless, although in the case of
     an old port directory being DEPRECATED resulted in a fatal error
     when trying to upgrade.
  
  So, make the following changes:
  1. Make upg_port an installed version of the new port, if it exists.
  2. Introduce ro_upg_port for the existing version of the old port.
  3. Factor out some code that was related to how to handle lack of an
     installed version of the old port (since we're already checking that).
  4. In the stage after the build of the new port and before the pkg_delete
     of the old port test for upg_port OR ro_upg_port and run the various
     features (library backup for -w, pkg_delete, etc.) as needed for both.
  5. In install_failed() notify the user about the backup port for the old
     version.
  6. I discoverd in regression testing that the code to invoke -o for MOVED
     ports that we get to as dependencies was still working, but the code to
     automatically invoke -o for a parent port was broken. The problem is
     that we can't just exec a new version if we're the parent, we have to
     cleanly shut down background fetches and other processes, delete temp
     files, etc. So split the parts of safe_exit() that relate to these
     elements into their own function, parent_exit(), and call it both
     from safe_exit() and before exec'ing a new version for -o in this case.

Modified:
  user/dougb/portmaster/portmaster

Modified: user/dougb/portmaster/portmaster
==============================================================================
--- user/dougb/portmaster/portmaster	Thu Apr 29 00:38:15 2010	(r207352)
+++ user/dougb/portmaster/portmaster	Thu Apr 29 05:55:38 2010	(r207353)
@@ -128,87 +128,85 @@ kill_bad_children () {
 	done
 }
 
-safe_exit () {
+parent_exit () {
 	local files p f show_list
 
-	if [ "$$" -eq "$PM_PARENT_PID" ]; then
-		if [ -s "$DI_FILES" ]; then
-			grep -q '%%%%%%%%%%%%' $DI_FILES || kill_bad_children
-		fi
-		[ -n "$FETCH_ONLY" -a -z "$FETCH_ONLY_DONE" ] &&
-			kill_bad_children
-
-		if [ -z "$TRAP" ]; then
-			if [ -n "$UPDATE_REQ_BYS" -o -n "$PM_FORCE" ]; then
-	# Outdent
-	[ -n "$UPDATE_REQ_BYS" -o -n "$PM_FORCE" ] &&
-		files=`find $pdb -type f -name PM_UPGRADE_DONE_FLAG`
-	if [ -n "$files" ]; then
-		pm_sv Deleting \'install complete\' flags
-		pm_find_s $pdb -type f -name PM_UPGRADE_DONE_FLAG -delete
+	if [ -s "$DI_FILES" ]; then
+		grep -q '%%%%%%%%%%%%' $DI_FILES || kill_bad_children
 	fi
-	# Outdent
-			fi
-			if [ -z "$BACKUP" -a -z "$NO_BACKUP" -a \
-			    -n "$NB_DELETE" ]; then
-				pm_sv Deleting safety packages for successful installs
-				pm_cd $pbu || fail "Cannot cd to $pbu"
-				pm_rm_s $NB_DELETE
+	[ -n "$FETCH_ONLY" -a -z "$FETCH_ONLY_DONE" ] && kill_bad_children
+
+	if [ -z "$TRAP" ]; then
+		if [ -n "$UPDATE_REQ_BYS" -o -n "$PM_FORCE" ]; then
+			[ -n "$UPDATE_REQ_BYS" -o -n "$PM_FORCE" ] &&
+				files=`find $pdb -type f -name PM_UPGRADE_DONE_FLAG`
+			if [ -n "$files" ]; then
+				pm_sv Deleting \'install complete\' flags
+				pm_find_s $pdb -type f -name PM_UPGRADE_DONE_FLAG -delete
 			fi
 		fi
-
-		[ -n "$pbu" ] && pbu=`find $pbu -type d -empty 2>/dev/null`
-		if [ -d "$pbu" ]; then
-			pm_sv Removing empty backup package directory
-			pm_rmdir_s $pbu
+		if [ -z "$BACKUP" -a -z "$NO_BACKUP" -a -n "$NB_DELETE" ]; then
+			pm_sv Deleting safety packages for successful installs
+			pm_cd $pbu || fail "Cannot cd to $pbu"
+			pm_rm_s $NB_DELETE
 		fi
+	fi
 
-		for f in ${TMPDIR}/f-${PM_PARENT_PID}-*; do pm_unlink $f ; done
+	[ -n "$pbu" ] && pbu=`find $pbu -type d -empty 2>/dev/null`
+	if [ -d "$pbu" ]; then
+		pm_sv Removing empty backup package directory
+		pm_rmdir_s $pbu
+	fi
 
-		case "$DISPLAY_LIST" in
-		*' '*)	if [ -n "$TRAP" ]; then
-	echo "===>>> There are messages from installed ports to display,"
-	echo "       but first take a moment to review the error messages"
-	echo -n "       above.  Then press Enter when ready to proceed. "
-				read DISCARD
-				echo ''
-			fi
+	for f in ${TMPDIR}/f-${PM_PARENT_PID}-*; do pm_unlink $f ; done
 
-			[ -n "$PAGER" ] && p=$PAGER || p='less -e'
-			( for f in $DISPLAY_LIST; do
-				echo "===>>> pkg-message for $f"
-					cat $pdb/$f/+DISPLAY
-					echo ''
-				done
-			echo "===>>> Done displaying pkg-message files" ) | $p
-			;;
-		esac
+	case "$DISPLAY_LIST" in
+	*' '*)	if [ -n "$TRAP" ]; then
+			echo "===>>> There are messages from installed ports to display,"
+			echo "       but first take a moment to review the error messages"
+			echo -n "       above.  Then press Enter when ready to proceed. "
+			read DISCARD
+			echo ''
+		fi
 
-		if [ -n "$INSTALLED_LIST" ]; then
-			if [ -n "$UPDATE_ALL" -o -n "$PM_MULTI_PORTS" ]; then
-				show_list=all
-			else
-				case "$INSTALLED_LIST" in
-				*\\n\\t*)	show_list=all ;;
-				*\\n)		show_list=one ;;
-				esac
-			fi
-			case "$show_list" in
-			all) echo "===>>> The following actions were performed:"
-				echo -e $INSTALLED_LIST ;;
-			one)	echo "===>>> $ilist complete" ; echo '' ;;
+		[ -n "$PAGER" ] && p=$PAGER || p='less -e'
+		( for f in $DISPLAY_LIST; do
+			echo "===>>> pkg-message for $f" ; cat $pdb/$f/+DISPLAY ; echo ''
+		done
+		echo "===>>> Done displaying pkg-message files" ) | $p
+		;;
+	esac
+
+	if [ -n "$INSTALLED_LIST" ]; then
+		if [ -n "$UPDATE_ALL" -o -n "$PM_MULTI_PORTS" ]; then
+			show_list=all
+		else
+			case "$INSTALLED_LIST" in
+			*\\n\\t*)	show_list=all ;;
+			*\\n)		show_list=one ;;
 			esac
 		fi
+		case "$show_list" in
+		all)	echo "===>>> The following actions were performed:"
+			echo -e $INSTALLED_LIST ;;
+		one)	echo "===>>> $ilist complete" ; echo '' ;;
+		esac
+	fi
 
-		if [ -n "$build_deps_il" ]; then
+	if [ -n "$build_deps_il" ]; then
 		echo "===>>> Deleting installed build-only dependencies"
-			cd
-			for f in $build_deps_il; do
-				[ -n "$PM_VERBOSE" ] && echo "       $f"
-				pm_pkg_delete_s -f $f
-			done
-			echo ''
-		fi
+		cd
+		for f in $build_deps_il; do
+			[ -n "$PM_VERBOSE" ] && echo "       $f"
+			pm_pkg_delete_s -f $f
+		done
+		echo ''
+	fi
+}
+
+safe_exit () {
+	if [ "$$" -eq "$PM_PARENT_PID" ]; then
+		parent_exit
 	else
 		[ -n "$grep_deps" ] && pm_unlink $grep_deps
 
@@ -2614,25 +2612,24 @@ else
 		echo "===>>> The first argument to -o must be a directory in $pd"
 		echo '' ; no_valid_port; }
 
+	upg_port=`iport_from_origin $portdir`
+
 	arg2=${2#$pd/} ; arg2=${arg2#$pdb/} ; arg2=${arg2%/}
 
 	case "$arg2" in
-	*/*)	ro_opd=$arg2 ; upg_port=`iport_from_origin $ro_opd` ;;
+	*/*)	ro_opd=$arg2 ; ro_upg_port=`iport_from_origin $ro_opd` ;;
 	*)	if [ -d "$pdb/$arg2" ]; then
-			upg_port=$arg2
+			ro_upg_port=$arg2
 		else
-			find_glob_dirs $arg2 && upg_port=${glob_dirs#$pdb/}
+			find_glob_dirs $arg2 && ro_upg_port=${glob_dirs#$pdb/}
 			unset glob_dirs
 		fi
-		[ -n "$upg_port" ] && ro_opd=`origin_from_pdb $upg_port`
+		[ -n "$ro_upg_port" ] && ro_opd=`origin_from_pdb $ro_upg_port`
 	esac
 	unset arg2
 
-	if [ -z "$upg_port" ]; then
-		if grep -ql "DEPORIGIN:$ro_opd$" $pdb/*/+CONTENTS; then
-			unset upg_port
-			PM_MAKE_ARGS="-DFORCE_PKG_REGISTER $PM_MAKE_ARGS"
-		else
+	if [ -z "$ro_upg_port" ]; then
+		if ! grep -ql "DEPORIGIN:$ro_opd$" $pdb/*/+CONTENTS; then
 			echo ''
 			echo "===>>> The second argument to -o can be a port in $pdb,"
 			echo "       or a port directory from $pd"
@@ -2643,7 +2640,7 @@ else
 	PM_MAKE_ARGS="-DDISABLE_CONFLICTS $PM_MAKE_ARGS"
 fi
 
-if [ -n "$upg_port" -a -z "$REPLACE_ORIGIN" ]; then
+if [ -n "$upg_port" -a -z "$portdir" ]; then
 	portdir=`origin_from_pdb $upg_port` || {
 	case "$?" in
 	3)	echo ''
@@ -2663,12 +2660,8 @@ if [ ! -d "$pd/$portdir" -a -z "$PM_INDE
 	[ -n "$moved_npd" ] || no_valid_port
 	[ -d "$pd/$moved_npd" ] || no_valid_port
 
-	if [ "$$" -eq "$PM_PARENT_PID" ]; then
-		$0 $ARGS -o $moved_npd $upg_port
-		safe_exit
-	else
-		exec $0 $ARGS -o $moved_npd $upg_port
-	fi
+	[ "$$" -eq "$PM_PARENT_PID" ] && parent_exit
+	exec $0 $ARGS -o $moved_npd $upg_port
 fi
 [ -z "$upg_port" -a -z "$REPLACE_ORIGIN" ] &&
 	upg_port=`iport_from_origin ${portdir}`
@@ -3176,12 +3169,14 @@ else
 fi
 
 # Ignore if no old port exists
-if [ -n "$upg_port" ]; then
+if [ -n "$upg_port" -o -n "$ro_upg_port" ]; then
 	UPGRADE_PORT=$upg_port
+	[ -n "$ro_upg_port" ] && UPGRADE_PORT="$ro_upg_port"
+
 	UPGRADE_PORT_VER=`echo $UPGRADE_PORT | sed 's#.*-\(.*\)#\1#'`
 	export UPGRADE_PORT UPGRADE_PORT_VER
 
-	[ -z "$NO_BACKUP" ] && pm_pkg_create $pbu $upg_port
+	[ -z "$NO_BACKUP" ] && pm_pkg_create $pbu $UPGRADE_PORT
 
 	if [ -n "$SAVE_SHARED" ]; then
 		ldconfig_out=`pm_mktemp ldconfig`
@@ -3189,7 +3184,7 @@ if [ -n "$upg_port" ]; then
 		    grep -v ^$LOCALBASE_COMPAT > $ldconfig_out
 
 		unset temp
-		for file in `pkg_info -q -L $upg_port | sort - $ldconfig_out | \
+		for file in `pkg_info -q -L $UPGRADE_PORT | sort - $ldconfig_out | \
 		    uniq -d`; do
 			temp="${temp}$file "
 		done
@@ -3208,18 +3203,18 @@ if [ -n "$upg_port" ]; then
 
 	find_dl_distfiles $portdir
 
-	if [ -n "$REPLACE_ORIGIN" ]; then
-		# upg_port will be the port we are replacing
-		# Delete any existing versions of the new port
-		iport=`iport_from_origin $portdir`
-		if [ -n "$iport" ]; then
-			pm_sv Running pkg_delete for $iport
-			pm_pkg_delete_s -f $iport
-		fi
+	if [ -n "$REPLACE_ORIGIN" -a -n "$ro_upg_port" ]; then
+		# Delete any existing versions of the old port
+		pm_sv Running pkg_delete for $ro_upg_port
+		pm_pkg_delete_s -f $ro_upg_port
+	fi
+
+	# Could be empty if -o
+	if [ -n "$upg_port" ]; then
+		pm_sv Running pkg_delete for $upg_port
+		pm_pkg_delete_s -f $upg_port
 	fi
 
-	pm_sv Running pkg_delete for $upg_port
-	pm_pkg_delete_s -f $upg_port
 	[ -z "$PM_INDEX_ONLY" ] && pm_cd_pd $portdir
 fi
 
@@ -3230,6 +3225,10 @@ if [ -z "$RECURSE_THOROUGH" -a -z "$NO_D
 fi
 
 install_failed () {
+	local upg_port
+
+	[ -n "$ro_upg_port" ] && upg_port="$ro_upg_port"
+
 	if [ -z "$NO_BACKUP" -a -n "$upg_port" ]; then
 		echo ''
 		echo "===>>> A backup package for $upg_port should"

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 29 06:46:03 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A60E7106566B;
	Thu, 29 Apr 2010 06:46:03 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 956768FC1B;
	Thu, 29 Apr 2010 06:46:03 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3T6k33Q033287;
	Thu, 29 Apr 2010 06:46:03 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3T6k3HP033284;
	Thu, 29 Apr 2010 06:46:03 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004290646.o3T6k3HP033284@svn.freebsd.org>
From: Juli Mallett 
Date: Thu, 29 Apr 2010 06:46:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207356 - in user/jmallett/octeon/sys: conf mips/conf
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Apr 2010 06:46:03 -0000

Author: jmallett
Date: Thu Apr 29 06:46:03 2010
New Revision: 207356
URL: http://svn.freebsd.org/changeset/base/207356

Log:
  Add an option to include vendor-specific changes for Lanner.

Added:
  user/jmallett/octeon/sys/mips/conf/MR_320
Modified:
  user/jmallett/octeon/sys/conf/options.mips

Modified: user/jmallett/octeon/sys/conf/options.mips
==============================================================================
--- user/jmallett/octeon/sys/conf/options.mips	Thu Apr 29 06:22:07 2010	(r207355)
+++ user/jmallett/octeon/sys/conf/options.mips	Thu Apr 29 06:46:03 2010	(r207356)
@@ -67,4 +67,5 @@ MAXMEM			opt_global.h
 #
 # Options that control the Cavium Simple Executive.
 #
+OCTEON_VENDOR_LANNER		opt_cvmx.h
 OCTEON_BOARD_CAPK_0100ND	opt_cvmx.h

Added: user/jmallett/octeon/sys/mips/conf/MR_320
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/conf/MR_320	Thu Apr 29 06:46:03 2010	(r207356)
@@ -0,0 +1,7 @@
+#
+# $FreeBSD$
+#
+
+options 	OCTEON_VENDOR_LANNER
+
+include		OCTEON1-32

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 29 07:07:44 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 15402106564A;
	Thu, 29 Apr 2010 07:07:44 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 04CF58FC0A;
	Thu, 29 Apr 2010 07:07:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3T77h86053506;
	Thu, 29 Apr 2010 07:07:43 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3T77hDx053503;
	Thu, 29 Apr 2010 07:07:43 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004290707.o3T77hDx053503@svn.freebsd.org>
From: Juli Mallett 
Date: Thu, 29 Apr 2010 07:07:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207357 - user/jmallett/octeon/sys/contrib/octeon-sdk
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Apr 2010 07:07:44 -0000

Author: jmallett
Date: Thu Apr 29 07:07:43 2010
New Revision: 207357
URL: http://svn.freebsd.org/changeset/base/207357

Log:
  Add sections for Lanner boards and add basic support for detecting the PHYs
  and link state on the MR320.

Modified:
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-app-init.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-board.c

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-app-init.h
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-app-init.h	Thu Apr 29 06:46:03 2010	(r207356)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-app-init.h	Thu Apr 29 07:07:43 2010	(r207357)
@@ -194,6 +194,9 @@ enum cvmx_board_types_enum {
     /* Set aside a range for customer private use.  The SDK won't
     ** use any numbers in this range. */
     CVMX_BOARD_TYPE_CUST_PRIVATE_MIN = 20001,
+#if defined(OCTEON_VENDOR_LANNER)
+    CVMX_BOARD_TYPE_CUST_LANNER_MR320= 20002,
+#endif
     CVMX_BOARD_TYPE_CUST_PRIVATE_MAX = 30000,
 
     /* The remaining range is reserved for future use. */
@@ -265,6 +268,9 @@ static inline const char *cvmx_board_typ
 
         /* Customer private range */
         ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MIN)
+#if defined(OCTEON_VENDOR_LANNER)
+	ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_LANNER_MR320)
+#endif
         ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MAX)
     }
     return "Unsupported Board";

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-board.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-board.c	Thu Apr 29 06:46:03 2010	(r207356)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-board.c	Thu Apr 29 07:07:43 2010	(r207357)
@@ -174,6 +174,22 @@ int cvmx_helper_board_get_mii_address(in
                 return -1;
         case CVMX_BOARD_TYPE_BBGW_REF:
             return -1;  /* No PHYs are connected to Octeon, everything is through switch */
+
+	/* Private vendor-defined boards.  */
+#if defined(OCTEON_VENDOR_LANNER)
+	case CVMX_BOARD_TYPE_CUST_LANNER_MR320:
+	    switch (ipd_port) {
+	    case 0:
+		/* XXX Switch PHY?  */
+		return -1;
+	    case 1:
+		return 1;
+	    case 2:
+		return 2;
+	    default:
+		return -1;
+	    }
+#endif
     }
 
     /* Some unknown board. Somebody forgot to update this function... */
@@ -269,6 +285,19 @@ cvmx_helper_link_info_t __cvmx_helper_bo
                 return result;
             }
             break;
+	/* Private vendor-defined boards.  */
+#if defined(OCTEON_VENDOR_LANNER)
+	case CVMX_BOARD_TYPE_CUST_LANNER_MR320:
+	    /* Port 0 connects to the switch */
+	    if (ipd_port == 0)
+	    {
+                result.s.link_up = 1;
+                result.s.full_duplex = 1;
+                result.s.speed = 1000;
+		return result;
+	    }
+	    break;
+#endif
     }
 #endif
 

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 29 07:23:14 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 071561065679;
	Thu, 29 Apr 2010 07:23:14 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EAEBC8FC22;
	Thu, 29 Apr 2010 07:23:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3T7NDbu067579;
	Thu, 29 Apr 2010 07:23:13 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3T7NDKf067577;
	Thu, 29 Apr 2010 07:23:13 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004290723.o3T7NDKf067577@svn.freebsd.org>
From: Juli Mallett 
Date: Thu, 29 Apr 2010 07:23:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207358 - user/jmallett/octeon/sys/contrib/octeon-sdk
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Apr 2010 07:23:14 -0000

Author: jmallett
Date: Thu Apr 29 07:23:13 2010
New Revision: 207358
URL: http://svn.freebsd.org/changeset/base/207358

Log:
  Set vendor-specified rx and tx timings for MR320.

Modified:
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c	Thu Apr 29 07:07:43 2010	(r207357)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c	Thu Apr 29 07:23:13 2010	(r207358)
@@ -206,6 +206,21 @@ int __cvmx_helper_rgmii_enable(int inter
         cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(port, interface), 26);
         cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(port, interface), 26);
 #else
+	/*
+	 * Vendor-defined board types.
+	 */
+#if defined(OCTEON_VENDOR_LANNER)
+	switch (cvmx_sysinfo_get()->board_type) {
+	case CVMX_BOARD_TYPE_CUST_LANNER_MR320:
+            if (port == 0) {
+                cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(port, interface), 4);
+	    } else {
+                cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(port, interface), 7);
+            }
+            cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(port, interface), 0);
+	    break;
+	}
+#else
         /*
          * For board types we can determine at runtime.
          */
@@ -220,6 +235,7 @@ int __cvmx_helper_rgmii_enable(int inter
             cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(port, interface), 24);
         }
 #endif
+#endif
     }
 
     __cvmx_helper_setup_gmx(interface, num_ports);

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 29 09:16:05 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 91D00106566C;
	Thu, 29 Apr 2010 09:16:05 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 81AEB8FC18;
	Thu, 29 Apr 2010 09:16:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3T9G5tX074226;
	Thu, 29 Apr 2010 09:16:05 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3T9G5Rq074224;
	Thu, 29 Apr 2010 09:16:05 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004290916.o3T9G5Rq074224@svn.freebsd.org>
From: Juli Mallett 
Date: Thu, 29 Apr 2010 09:16:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207361 - user/jmallett/octeon/sys/mips/cavium
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Apr 2010 09:16:05 -0000

Author: jmallett
Date: Thu Apr 29 09:16:04 2010
New Revision: 207361
URL: http://svn.freebsd.org/changeset/base/207361

Log:
  o) Fix style bugs.
  o) Don't try to be clever about what's simulator and what isn't.  Treat
     things that identify themselves as the simulator like the simulator.
  o) Remove obsolete core mask global.
  o) Print board information including blowing up if we have a CAPK-0100ND
     build but a board with something other than the (wrong) board type.
  o) Add some notes to myself in the future.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Thu Apr 29 09:02:46 2010	(r207360)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Thu Apr 29 09:16:04 2010	(r207361)
@@ -294,15 +294,30 @@ platform_start(__register_t a0, __regist
 	const struct octeon_feature_description *ofd;
 	uint64_t platform_counter_freq;
 
+	/*
+	 * XXX
+	 * octeon_boot_params_init() should be called before anything else,
+	 * certainly before any output; we may find out from the boot
+	 * descriptor's flags that we're supposed to use the PCI or UART1
+	 * consoles rather than UART0.  No point doing that reorganization
+	 * until we actually intercept UART_DEV_CONSOLE for the UART1 case
+	 * and somehow handle the PCI console, which we lack code for
+	 * entirely.
+	 */
+
 	/* Initialize pcpu stuff */
 	mips_pcpu0_init();
 	mips_timer_early_init(OCTEON_CLOCK_DEFAULT);
 	cninit();
 
-	printf("Model: %s\n", octeon_model_get_string(cvmx_get_proc_id()));
-
 	octeon_ciu_reset();
 	octeon_boot_params_init(a3);
+	/*
+	 * XXX
+	 * We can certainly parse command line arguments or U-Boot environment
+	 * to determine whether to bootverbose / single user / ...  I think
+	 * stass has patches to add support for loader things to U-Boot even.
+	 */
 	bootverbose = 1;
 
 	/*
@@ -336,10 +351,9 @@ platform_start(__register_t a0, __regist
 #endif
 
 	printf("Available Octeon features:");
-	for (ofd = octeon_feature_descriptions; ofd->ofd_string != NULL; ofd++) {
+	for (ofd = octeon_feature_descriptions; ofd->ofd_string != NULL; ofd++)
 		if (octeon_has_feature(ofd->ofd_feature))
 			printf(" %s", ofd->ofd_string);
-	}
 	printf("\n");
 }
 
@@ -409,33 +423,17 @@ typedef struct {
 	uint64_t cvmx_desc_vaddr;
 } octeon_boot_descriptor_t;
 
-int octeon_core_mask;
 cvmx_bootinfo_t *octeon_bootinfo;
 
 static octeon_boot_descriptor_t *app_desc_ptr;
 
-#define OCTEON_BOARD_TYPE_NONE 			0
-#define OCTEON_BOARD_TYPE_SIM  			1
-#define	OCTEON_BOARD_TYPE_CN3010_EVB_HS5	11
-
 int
 octeon_is_simulation(void)
 {
 	switch (cvmx_sysinfo_get()->board_type) {
-	case OCTEON_BOARD_TYPE_NONE:
-	case OCTEON_BOARD_TYPE_SIM:
+	case CVMX_BOARD_TYPE_SIM:
 		return 1;
-	case OCTEON_BOARD_TYPE_CN3010_EVB_HS5:
-		/*
-		 * XXX
-		 * The CAM-0100 identifies itself as type 11, revision 0.0,
-		 * despite its being rather real.  Disable the revision check
-		 * for type 11.
-		 */
-		return 0;
 	default:
-		if (cvmx_sysinfo_get()->board_rev_major == 0)
-			return 1;
 		return 0;
 	}
 }
@@ -472,7 +470,8 @@ static void
 octeon_boot_params_init(register_t ptr)
 {
 	if (ptr == 0 || ptr >= MAX_APP_DESC_ADDR)
-		panic("app descriptor passed at invalid address %#jx", (uintmax_t)ptr);
+		panic("app descriptor passed at invalid address %#jx",
+		    (uintmax_t)ptr);
 
 	app_desc_ptr = (octeon_boot_descriptor_t *)(intptr_t)ptr;
 	if (app_desc_ptr->desc_version < 6)
@@ -504,5 +503,15 @@ octeon_boot_params_init(register_t ptr)
 	    octeon_bootinfo->mac_addr_base[4],
 	    octeon_bootinfo->mac_addr_base[5],
 	    octeon_bootinfo->mac_addr_count);
+
+#if defined(OCTEON_BOARD_CAPK_0100ND)
+	if (cvmx_sysinfo_get()->board_type != CVMX_BOARD_TYPE_CN3010_EVB_HS5)
+		printf("Compiled for CAPK-0100ND, but board type is %s\n",
+		    cvmx_board_type_to_string(cvmx_sysinfo_get()->board_type));
+#else
+	printf("Board: %s\n",
+	    cvmx_board_type_to_string(cvmx_sysinfo_get()->board_type));
+#endif
+	printf("Model: %s\n", octeon_model_get_string(cvmx_get_proc_id()));
 }
 /* impEND: This stuff should move back into the Cavium SDK */

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 29 10:26:54 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4558A106566B;
	Thu, 29 Apr 2010 10:26:54 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 33AEE8FC12;
	Thu, 29 Apr 2010 10:26:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3TAQsba043824;
	Thu, 29 Apr 2010 10:26:54 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3TAQsqP043817;
	Thu, 29 Apr 2010 10:26:54 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004291026.o3TAQsqP043817@svn.freebsd.org>
From: Juli Mallett 
Date: Thu, 29 Apr 2010 10:26:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207367 - in user/jmallett/octeon/sys/mips: cavium conf
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Apr 2010 10:26:54 -0000

Author: jmallett
Date: Thu Apr 29 10:26:53 2010
New Revision: 207367
URL: http://svn.freebsd.org/changeset/base/207367

Log:
  Start work on PCI.  Enough to enumerate the devices in my systems.

Added:
  user/jmallett/octeon/sys/mips/cavium/octopci.c
  user/jmallett/octeon/sys/mips/cavium/octopcireg.h
Modified:
  user/jmallett/octeon/sys/mips/cavium/files.octeon1
  user/jmallett/octeon/sys/mips/cavium/std.octeon1
  user/jmallett/octeon/sys/mips/conf/OCTEON1.hints

Modified: user/jmallett/octeon/sys/mips/cavium/files.octeon1
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/files.octeon1	Thu Apr 29 10:04:00 2010	(r207366)
+++ user/jmallett/octeon/sys/mips/cavium/files.octeon1	Thu Apr 29 10:26:53 2010	(r207367)
@@ -26,6 +26,8 @@ mips/cavium/octe/ethernet-xaui.c		option
 mips/cavium/octe/octe.c				optional octe
 mips/cavium/octe/octebus.c			optional octe
 
+mips/cavium/octopci.c				optional pci
+
 contrib/octeon-sdk/cvmx-cmd-queue.c		optional octe
 contrib/octeon-sdk/cvmx-fpa.c			optional octe
 contrib/octeon-sdk/cvmx-helper.c		optional octe

Added: user/jmallett/octeon/sys/mips/cavium/octopci.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/cavium/octopci.c	Thu Apr 29 10:26:53 2010	(r207367)
@@ -0,0 +1,230 @@
+/*-
+ * Copyright (c) 2010 Juli Mallett 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include "pcib_if.h"
+
+struct octopci_softc {
+	device_t sc_dev;
+	unsigned sc_domain;
+	unsigned sc_bus;
+};
+
+static void	octopci_identify(driver_t *, device_t);
+static int	octopci_probe(device_t);
+static int	octopci_attach(device_t);
+static int	octopci_read_ivar(device_t, device_t, int, uintptr_t *);
+static int	octopci_maxslots(device_t);
+static uint32_t	octopci_read_config(device_t, u_int, u_int, u_int, u_int, int);
+static void	octopci_write_config(device_t, u_int, u_int, u_int, u_int, uint32_t, int);
+
+static uint64_t	octopci_cs_addr(unsigned, unsigned, unsigned, unsigned);
+
+static void
+octopci_identify(driver_t *drv, device_t parent)
+{
+	BUS_ADD_CHILD(parent, 0, "pcib", 0);
+}
+
+static int
+octopci_probe(device_t dev)
+{
+	if (device_get_unit(dev) != 0)
+		return (ENXIO);
+	/* XXX Check sysinfo flag.  */
+	device_set_desc(dev, "Cavium Octeon PCI bridge");
+	return (0);
+}
+
+static int
+octopci_attach(device_t dev)
+{
+	struct octopci_softc *sc;
+
+	sc = device_get_softc(dev);
+	sc->sc_dev = dev;
+	sc->sc_domain = 0;
+	sc->sc_bus = 0;
+
+	device_add_child(dev, "pci", 0);
+
+	return (bus_generic_attach(dev));
+}
+
+static int
+octopci_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
+{
+	struct octopci_softc *sc;
+	
+	sc = device_get_softc(dev);
+
+	switch (which) {
+	case PCIB_IVAR_DOMAIN:
+		*result = sc->sc_domain;
+		return (0);
+	case PCIB_IVAR_BUS:
+		*result = sc->sc_bus;
+		return (0);
+		
+	}
+	return (ENOENT);
+}
+
+static int
+octopci_maxslots(device_t dev)
+{
+	return (PCI_SLOTMAX);
+}
+
+static uint32_t
+octopci_read_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg,
+    int bytes)
+{
+	struct octopci_softc *sc;
+	uint64_t addr;
+	uint32_t data;
+
+	sc = device_get_softc(dev);
+
+	addr = octopci_cs_addr(bus, slot, func, reg);
+
+	switch (bytes) {
+	case 4:
+		data = le32toh(cvmx_read64_uint32(addr));
+		return (data);
+	case 2:
+		data = le16toh(cvmx_read64_uint16(addr));
+		return (data);
+	case 1:
+		data = cvmx_read64_uint8(addr);
+		return (data);
+	default:
+		return ((uint32_t)-1);
+	}
+}
+
+static void
+octopci_write_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg,
+    uint32_t data, int bytes)
+{
+	struct octopci_softc *sc;
+	uint64_t addr;
+
+	sc = device_get_softc(dev);
+
+	addr = octopci_cs_addr(bus, slot, func, reg);
+
+	switch (bytes) {
+	case 4:
+		cvmx_write64_uint32(addr, htole32(data));
+		return;
+	case 2:
+		cvmx_write64_uint16(addr, htole16(data));
+		return;
+	case 1:
+		cvmx_write64_uint8(addr, data);
+		return;
+	default:
+		return;
+	}
+}
+
+static uint64_t
+octopci_cs_addr(unsigned bus, unsigned slot, unsigned func, unsigned reg)
+{
+	octeon_pci_config_space_address_t pci_addr;
+
+	pci_addr.u64 = 0;
+	pci_addr.s.upper = 2;
+	pci_addr.s.io = 1;
+	pci_addr.s.did = 3;
+	pci_addr.s.subdid = CVMX_OCT_SUBDID_PCI_CFG;
+	pci_addr.s.endian_swap = 1;
+	pci_addr.s.bus = bus;
+	pci_addr.s.dev = slot;
+	pci_addr.s.func = func;
+	pci_addr.s.reg = reg;
+
+	return (pci_addr.u64);
+}
+
+static device_method_t octopci_methods[] = {
+	/* Device interface */
+	DEVMETHOD(device_identify,	octopci_identify),
+	DEVMETHOD(device_probe,		octopci_probe),
+	DEVMETHOD(device_attach,	octopci_attach),
+
+	/* Bus interface */
+	DEVMETHOD(bus_read_ivar,	octopci_read_ivar),
+	DEVMETHOD(bus_print_child,	bus_generic_print_child),
+
+	/* pcib interface */
+	DEVMETHOD(pcib_maxslots,	octopci_maxslots),
+	DEVMETHOD(pcib_read_config,	octopci_read_config),
+	DEVMETHOD(pcib_write_config,	octopci_write_config),
+
+	{0, 0}
+};
+
+static driver_t octopci_driver = {
+	"pcib",
+	octopci_methods,
+	sizeof(struct octopci_softc),
+};
+static devclass_t octopci_devclass;
+DRIVER_MODULE(octopci, ciu, octopci_driver, octopci_devclass, 0, 0);

Added: user/jmallett/octeon/sys/mips/cavium/octopcireg.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/cavium/octopcireg.h	Thu Apr 29 10:26:53 2010	(r207367)
@@ -0,0 +1,98 @@
+/***********************license start************************************
+ * Copyright (c) 2005-2007 Cavium Networks (support@cavium.com). All rights
+ * reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ *       copyright notice, this list of conditions and the following
+ *       disclaimer in the documentation and/or other materials provided
+ *       with the distribution.
+ *
+ *     * Neither the name of Cavium Networks nor the names of
+ *       its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written
+ *       permission.
+ *
+ * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
+ * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
+ * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
+ * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
+ * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
+ * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
+ * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
+ * PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
+ * POSSESSION OR CORRESPONDENCE TO DESCRIPTION.  THE ENTIRE RISK ARISING OUT
+ * OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
+ *
+ *
+ * For any questions regarding licensing please contact marketing@caviumnetworks.com
+ *
+ ***********************license end**************************************/
+
+#ifndef	_CAVIUM_OCTOPCIREG_H_
+#define	_CAVIUM_OCTOPCIREG_H_
+
+/**
+ * This is the bit decoding used for the Octeon PCI controller addresses for config space
+ */
+typedef union
+{
+    uint64_t    u64;
+    uint64_t *  u64_ptr;
+    uint32_t *  u32_ptr;
+    uint16_t *  u16_ptr;
+    uint8_t *   u8_ptr;
+    struct
+    {
+        uint64_t    upper       : 2;
+        uint64_t    reserved    : 13;
+        uint64_t    io          : 1;
+        uint64_t    did         : 5;
+        uint64_t    subdid      : 3;
+        uint64_t    reserved2   : 4;
+        uint64_t    endian_swap : 2;
+        uint64_t    reserved3   : 10;
+        uint64_t    bus         : 8;
+        uint64_t    dev         : 5;
+        uint64_t    func        : 3;
+        uint64_t    reg         : 8;
+    } s;
+} octeon_pci_config_space_address_t;
+
+typedef union
+{
+    uint64_t    u64;
+    uint32_t *  u32_ptr;
+    uint16_t *  u16_ptr;
+    uint8_t *   u8_ptr;
+    struct
+    {
+        uint64_t    upper       : 2;
+        uint64_t    reserved    : 13;
+        uint64_t    io          : 1;
+        uint64_t    did         : 5;
+        uint64_t    subdid      : 3;
+        uint64_t    reserved2   : 4;
+        uint64_t    endian_swap : 2;
+        uint64_t    res1        : 1;
+        uint64_t    port        : 1;
+        uint64_t    addr        : 32;
+    } s;
+} octeon_pci_io_space_address_t;
+
+
+#define CVMX_OCT_SUBDID_PCI_CFG     1
+#define CVMX_OCT_SUBDID_PCI_IO      2
+#define CVMX_OCT_SUBDID_PCI_MEM1    3
+#define CVMX_OCT_SUBDID_PCI_MEM2    4
+#define CVMX_OCT_SUBDID_PCI_MEM3    5
+#define CVMX_OCT_SUBDID_PCI_MEM4    6
+
+#endif /* !_CAVIUM_OCTOPCIREG_H_ */

Modified: user/jmallett/octeon/sys/mips/cavium/std.octeon1
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/std.octeon1	Thu Apr 29 10:04:00 2010	(r207366)
+++ user/jmallett/octeon/sys/mips/cavium/std.octeon1	Thu Apr 29 10:26:53 2010	(r207367)
@@ -10,7 +10,7 @@ files	"../cavium/files.octeon1"
 # 
 #
 cpu     CPU_MIPS4KC
-#device	pci
+device	pci
 #device	ata
 #device	atadisk
 

Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1.hints
==============================================================================
--- user/jmallett/octeon/sys/mips/conf/OCTEON1.hints	Thu Apr 29 10:04:00 2010	(r207366)
+++ user/jmallett/octeon/sys/mips/conf/OCTEON1.hints	Thu Apr 29 10:26:53 2010	(r207367)
@@ -10,5 +10,3 @@ hint.obio.0.flags="0x1"
 hint.uart.0.at="obio"
 hint.uart.0.maddr="0x1"
 hint.uart.0.flags="0x1"
-hint.pcib.0.at="nexus"
-hint.pci.0.at="pcib"

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 29 10:34:54 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D11651065670;
	Thu, 29 Apr 2010 10:34:54 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C10018FC17;
	Thu, 29 Apr 2010 10:34:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3TAYs98051631;
	Thu, 29 Apr 2010 10:34:54 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3TAYsHV051629;
	Thu, 29 Apr 2010 10:34:54 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004291034.o3TAYsHV051629@svn.freebsd.org>
From: Juli Mallett 
Date: Thu, 29 Apr 2010 10:34:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207368 - user/jmallett/octeon/sys/mips/conf
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Apr 2010 10:34:54 -0000

Author: jmallett
Date: Thu Apr 29 10:34:54 2010
New Revision: 207368
URL: http://svn.freebsd.org/changeset/base/207368

Log:
  Add some devices that I can watch fail and start working on support for for PCI.

Modified:
  user/jmallett/octeon/sys/mips/conf/OCTEON1-32

Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32
==============================================================================
--- user/jmallett/octeon/sys/mips/conf/OCTEON1-32	Thu Apr 29 10:26:53 2010	(r207367)
+++ user/jmallett/octeon/sys/mips/conf/OCTEON1-32	Thu Apr 29 10:34:54 2010	(r207368)
@@ -79,6 +79,26 @@ device		octe
 device		bpf
 device		random
 
+# Wireless NIC cards
+device		wlan		# 802.11 support
+options 	IEEE80211_DEBUG	# enable debug msgs
+options 	IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's
+options 	IEEE80211_SUPPORT_MESH	# enable 802.11s draft support
+device		wlan_wep	# 802.11 WEP support
+device		wlan_ccmp	# 802.11 CCMP support
+device		wlan_tkip	# 802.11 TKIP support
+device		wlan_amrr	# AMRR transmit rate control algorithm
+device		ath		# Atheros pci/cardbus NIC's
+device		ath_hal		# pci/cardbus chip support
+options 	AH_SUPPORT_AR5416	# enable AR5416 tx/rx descriptors
+device		ath_rate_sample	# SampleRate tx rate control for ath
+
+# USB support
+device		uhci		# UHCI PCI->USB interface
+device		ohci		# OHCI PCI->USB interface
+device		ehci		# EHCI PCI->USB interface (USB 2.0)
+device		usb		# USB Bus (required)
+
 #
 # Use the following for  Compact Flash file-system
 device 		cf

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 29 20:08:49 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 5B29C106564A;
	Thu, 29 Apr 2010 20:08:49 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id 4AF748FC2A;
	Thu, 29 Apr 2010 20:08:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3TK8nW1046206;
	Thu, 29 Apr 2010 20:08:49 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3TK8nKU046204;
	Thu, 29 Apr 2010 20:08:49 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004292008.o3TK8nKU046204@svn.freebsd.org>
From: Kip Macy 
Date: Thu, 29 Apr 2010 20:08:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207388 - user/kmacy/head_page_lock_incr/sys/kern
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Apr 2010 20:08:49 -0000

Author: kmacy
Date: Thu Apr 29 20:08:49 2010
New Revision: 207388
URL: http://svn.freebsd.org/changeset/base/207388

Log:
  hold page lock when doing vm_page_hold

Modified:
  user/kmacy/head_page_lock_incr/sys/kern/sys_process.c

Modified: user/kmacy/head_page_lock_incr/sys/kern/sys_process.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/kern/sys_process.c	Thu Apr 29 19:13:42 2010	(r207387)
+++ user/kmacy/head_page_lock_incr/sys/kern/sys_process.c	Thu Apr 29 20:08:49 2010	(r207388)
@@ -328,9 +328,9 @@ proc_rwmem(struct proc *p, struct uio *u
 		/*
 		 * Hold the page in memory.
 		 */
-		vm_page_lock_queues();
+		vm_page_lock(m);
 		vm_page_hold(m);
-		vm_page_unlock_queues();
+		vm_page_unlock(m);
 
 		/*
 		 * We're done with tmap now.

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 29 22:03:10 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 211801065672;
	Thu, 29 Apr 2010 22:03:10 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id EB8678FC12;
	Thu, 29 Apr 2010 22:03:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3TM39Rk071442;
	Thu, 29 Apr 2010 22:03:09 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3TM393N071441;
	Thu, 29 Apr 2010 22:03:09 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004292203.o3TM393N071441@svn.freebsd.org>
From: Juli Mallett 
Date: Thu, 29 Apr 2010 22:03:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207392 - user/jmallett/octeon/sys/mips/include
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Apr 2010 22:03:10 -0000

Author: jmallett
Date: Thu Apr 29 22:03:09 2010
New Revision: 207392
URL: http://svn.freebsd.org/changeset/base/207392

Log:
  Remove unused include.

Deleted:
  user/jmallett/octeon/sys/mips/include/_bus_octeon.h

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 29 22:13:27 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id B5F431065672;
	Thu, 29 Apr 2010 22:13:27 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id A53508FC0A;
	Thu, 29 Apr 2010 22:13:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3TMDREG073866;
	Thu, 29 Apr 2010 22:13:27 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3TMDRRh073863;
	Thu, 29 Apr 2010 22:13:27 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004292213.o3TMDRRh073863@svn.freebsd.org>
From: Kip Macy 
Date: Thu, 29 Apr 2010 22:13:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207393 - user/kmacy/head_page_lock_incr/sys/vm
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Apr 2010 22:13:27 -0000

Author: kmacy
Date: Thu Apr 29 22:13:27 2010
New Revision: 207393
URL: http://svn.freebsd.org/changeset/base/207393

Log:
  - define PDRSHIFT for !x86
  - add page lock assert in dirty check

Modified:
  user/kmacy/head_page_lock_incr/sys/vm/vm_page.c
  user/kmacy/head_page_lock_incr/sys/vm/vm_page.h

Modified: user/kmacy/head_page_lock_incr/sys/vm/vm_page.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/vm/vm_page.c	Thu Apr 29 22:03:09 2010	(r207392)
+++ user/kmacy/head_page_lock_incr/sys/vm/vm_page.c	Thu Apr 29 22:13:27 2010	(r207393)
@@ -2179,6 +2179,7 @@ vm_page_is_valid(vm_page_t m, int base, 
 void
 vm_page_test_dirty(vm_page_t m)
 {
+	vm_page_lock_assert(m, MA_OWNED);
 	if ((m->dirty != VM_PAGE_BITS_ALL) && pmap_is_modified(m)) {
 		vm_page_dirty(m);
 	}

Modified: user/kmacy/head_page_lock_incr/sys/vm/vm_page.h
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/vm/vm_page.h	Thu Apr 29 22:03:09 2010	(r207392)
+++ user/kmacy/head_page_lock_incr/sys/vm/vm_page.h	Thu Apr 29 22:13:27 2010	(r207393)
@@ -179,6 +179,12 @@ struct vpglocks {
 extern struct vpglocks vm_page_queue_free_lock;
 extern struct vpglocks pa_lock[];
 
+#if defined(__arm__)
+#define	PDRSHIFT	PDR_SHIFT
+#elif !defined(PDRSHIFT)
+#define PDRSHIFT	21
+#endif
+
 #define	pa_index(pa)	((pa) >> PDRSHIFT)
 #define	PA_LOCKPTR(pa)	&pa_lock[pa_index((pa)) % PA_LOCK_COUNT].data
 #define	PA_LOCKOBJPTR(pa)	((struct lock_object *)PA_LOCKPTR((pa)))

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 29 22:16:08 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id B65C6106566B;
	Thu, 29 Apr 2010 22:16:08 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id A5C1C8FC16;
	Thu, 29 Apr 2010 22:16:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3TMG89b074580;
	Thu, 29 Apr 2010 22:16:08 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3TMG88f074578;
	Thu, 29 Apr 2010 22:16:08 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004292216.o3TMG88f074578@svn.freebsd.org>
From: Kip Macy 
Date: Thu, 29 Apr 2010 22:16:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207394 - user/kmacy/head_page_lock_incr/sys/vm
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Apr 2010 22:16:08 -0000

Author: kmacy
Date: Thu Apr 29 22:16:08 2010
New Revision: 207394
URL: http://svn.freebsd.org/changeset/base/207394

Log:
  PMAP_LOCK_ASSERT not always defined

Modified:
  user/kmacy/head_page_lock_incr/sys/vm/vm_page.c

Modified: user/kmacy/head_page_lock_incr/sys/vm/vm_page.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/vm/vm_page.c	Thu Apr 29 22:13:27 2010	(r207393)
+++ user/kmacy/head_page_lock_incr/sys/vm/vm_page.c	Thu Apr 29 22:16:08 2010	(r207394)
@@ -190,7 +190,6 @@ vm_page_pa_tryrelock(pmap_t pmap, vm_pad
 	vm_paddr_t lockpa;
 	uint32_t gen_count;
 
-	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
 	gen_count = pmap->pm_gen_count;
 	atomic_add_long((volatile long *)&pmap_tryrelock_calls, 1);
 	lockpa = *locked;

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 29 22:24:52 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id A7ACD106564A;
	Thu, 29 Apr 2010 22:24:52 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id 96C718FC13;
	Thu, 29 Apr 2010 22:24:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3TMOqWl076561;
	Thu, 29 Apr 2010 22:24:52 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3TMOq0A076559;
	Thu, 29 Apr 2010 22:24:52 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004292224.o3TMOq0A076559@svn.freebsd.org>
From: Kip Macy 
Date: Thu, 29 Apr 2010 22:24:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207395 - user/kmacy/head_page_lock_incr/sys/powerpc/aim
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Apr 2010 22:24:52 -0000

Author: kmacy
Date: Thu Apr 29 22:24:52 2010
New Revision: 207395
URL: http://svn.freebsd.org/changeset/base/207395

Log:
  add retry target

Modified:
  user/kmacy/head_page_lock_incr/sys/powerpc/aim/mmu_oea64.c

Modified: user/kmacy/head_page_lock_incr/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/powerpc/aim/mmu_oea64.c	Thu Apr 29 22:16:08 2010	(r207394)
+++ user/kmacy/head_page_lock_incr/sys/powerpc/aim/mmu_oea64.c	Thu Apr 29 22:24:52 2010	(r207395)
@@ -1379,6 +1379,7 @@ moea64_extract_and_hold(mmu_t mmu, pmap_
 	m = NULL;
 	pa = 0;
 	PMAP_LOCK(pmap);
+retry:
 	pvo = moea64_pvo_find_va(pmap, va & ~ADDR_POFF, NULL);
 	if (pvo != NULL && (pvo->pvo_pte.lpte.pte_hi & LPTE_VALID) &&
 	    ((pvo->pvo_pte.lpte.pte_lo & LPTE_PP) == LPTE_RW ||

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 29 22:31:00 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 48CE71065674;
	Thu, 29 Apr 2010 22:31:00 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id 37C878FC12;
	Thu, 29 Apr 2010 22:31:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3TMV0xF077933;
	Thu, 29 Apr 2010 22:31:00 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3TMV0p9077931;
	Thu, 29 Apr 2010 22:31:00 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004292231.o3TMV0p9077931@svn.freebsd.org>
From: Kip Macy 
Date: Thu, 29 Apr 2010 22:31:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207396 -
	user/kmacy/head_page_lock_incr/sys/sparc64/sparc64
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Apr 2010 22:31:00 -0000

Author: kmacy
Date: Thu Apr 29 22:30:59 2010
New Revision: 207396
URL: http://svn.freebsd.org/changeset/base/207396

Log:
  pmap argument is pm not pmap

Modified:
  user/kmacy/head_page_lock_incr/sys/sparc64/sparc64/pmap.c

Modified: user/kmacy/head_page_lock_incr/sys/sparc64/sparc64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/sparc64/sparc64/pmap.c	Thu Apr 29 22:24:52 2010	(r207395)
+++ user/kmacy/head_page_lock_incr/sys/sparc64/sparc64/pmap.c	Thu Apr 29 22:30:59 2010	(r207396)
@@ -704,7 +704,7 @@ retry:
 		if (va >= VM_MIN_DIRECT_ADDRESS) {
 			tp = NULL;
 			m = PHYS_TO_VM_PAGE(TLB_DIRECT_TO_PHYS(va));
-			(void)vm_page_pa_tryrelock(pmap, TLB_DIRECT_TO_PHYS(va), &pa);
+			(void)vm_page_pa_tryrelock(pm, TLB_DIRECT_TO_PHYS(va), &pa);
 			vm_page_hold(m);
 		} else {
 			tp = tsb_kvtotte(va);
@@ -716,7 +716,7 @@ retry:
 	}
 	if (tp != NULL && ((tp->tte_data & TD_SW) ||
 	    (prot & VM_PROT_WRITE) == 0)) {
-		if (vm_page_pa_tryrelock(pmap, TTE_GET_PA(tp), &pa))
+		if (vm_page_pa_tryrelock(pm, TTE_GET_PA(tp), &pa))
 			goto retry;
 		m = PHYS_TO_VM_PAGE(TTE_GET_PA(tp));
 		vm_page_hold(m);

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 29 22:42:19 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 564211065670;
	Thu, 29 Apr 2010 22:42:19 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id 453068FC13;
	Thu, 29 Apr 2010 22:42:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3TMgJuG080534;
	Thu, 29 Apr 2010 22:42:19 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3TMgJeV080532;
	Thu, 29 Apr 2010 22:42:19 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004292242.o3TMgJeV080532@svn.freebsd.org>
From: Kip Macy 
Date: Thu, 29 Apr 2010 22:42:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207398 - user/kmacy/head_page_lock_incr/sys/ia64/ia64
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Apr 2010 22:42:19 -0000

Author: kmacy
Date: Thu Apr 29 22:42:18 2010
New Revision: 207398
URL: http://svn.freebsd.org/changeset/base/207398

Log:
  add page lock hold support to ia64

Modified:
  user/kmacy/head_page_lock_incr/sys/ia64/ia64/pmap.c

Modified: user/kmacy/head_page_lock_incr/sys/ia64/ia64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/ia64/ia64/pmap.c	Thu Apr 29 22:40:12 2010	(r207397)
+++ user/kmacy/head_page_lock_incr/sys/ia64/ia64/pmap.c	Thu Apr 29 22:42:18 2010	(r207398)
@@ -1028,18 +1028,22 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
 	struct ia64_lpte *pte;
 	pmap_t oldpmap;
 	vm_page_t m;
+	vm_paddr_t pa;
 
+	pa = 0;
 	m = NULL;
-	vm_page_lock_queues();
 	PMAP_LOCK(pmap);
 	oldpmap = pmap_switch(pmap);
+retry:
 	pte = pmap_find_vhpt(va);
 	if (pte != NULL && pmap_present(pte) &&
 	    (pmap_prot(pte) & prot) == prot) {
 		m = PHYS_TO_VM_PAGE(pmap_ppn(pte));
+		if (vm_page_pa_tryrelock(pmap, pmap_ppn(pte), &pa))
+			goto retry;
 		vm_page_hold(m);
 	}
-	vm_page_unlock_queues();
+	PA_UNLOCK_COND(pa);
 	pmap_switch(oldpmap);
 	PMAP_UNLOCK(pmap);
 	return (m);

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 29 22:48:17 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 106D11065670;
	Thu, 29 Apr 2010 22:48:17 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id F36958FC18;
	Thu, 29 Apr 2010 22:48:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3TMmGDQ082047;
	Thu, 29 Apr 2010 22:48:16 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3TMmGVO082045;
	Thu, 29 Apr 2010 22:48:16 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004292248.o3TMmGVO082045@svn.freebsd.org>
From: Kip Macy 
Date: Thu, 29 Apr 2010 22:48:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207401 -
	user/kmacy/head_page_lock_incr/sys/ia64/include
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Apr 2010 22:48:17 -0000

Author: kmacy
Date: Thu Apr 29 22:48:16 2010
New Revision: 207401
URL: http://svn.freebsd.org/changeset/base/207401

Log:
  add gen_count and retries to pmap

Modified:
  user/kmacy/head_page_lock_incr/sys/ia64/include/pmap.h

Modified: user/kmacy/head_page_lock_incr/sys/ia64/include/pmap.h
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/ia64/include/pmap.h	Thu Apr 29 22:47:01 2010	(r207400)
+++ user/kmacy/head_page_lock_incr/sys/ia64/include/pmap.h	Thu Apr 29 22:48:16 2010	(r207401)
@@ -77,6 +77,8 @@ struct pmap {
 	TAILQ_HEAD(,pv_entry)	pm_pvlist;	/* list of mappings in pmap */
 	u_int32_t		pm_rid[5];	/* base RID for pmap */
 	struct pmap_statistics	pm_stats;	/* pmap statistics */
+	uint32_t		pm_gen_count;	/* generation count (pmap lock dropped) */
+	u_int			pm_retries;
 };
 
 typedef struct pmap	*pmap_t;

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 29 23:22:39 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 0B3601065674;
	Thu, 29 Apr 2010 23:22:39 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id ED6478FC1B;
	Thu, 29 Apr 2010 23:22:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3TNMcDv089839;
	Thu, 29 Apr 2010 23:22:38 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3TNMcbK089836;
	Thu, 29 Apr 2010 23:22:38 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004292322.o3TNMcbK089836@svn.freebsd.org>
From: Juli Mallett 
Date: Thu, 29 Apr 2010 23:22:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207405 - user/jmallett/octeon/sys/mips/cavium
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Apr 2010 23:22:39 -0000

Author: jmallett
Date: Thu Apr 29 23:22:38 2010
New Revision: 207405
URL: http://svn.freebsd.org/changeset/base/207405

Log:
  Checkpoint trivial IO port and memory allocation/mapping.  Just enough to do
  some mapping and then panic.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octopci.c
  user/jmallett/octeon/sys/mips/cavium/octopcireg.h

Modified: user/jmallett/octeon/sys/mips/cavium/octopci.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octopci.c	Thu Apr 29 22:51:18 2010	(r207404)
+++ user/jmallett/octeon/sys/mips/cavium/octopci.c	Thu Apr 29 23:22:38 2010	(r207405)
@@ -61,17 +61,28 @@ __FBSDID("$FreeBSD$");
 
 struct octopci_softc {
 	device_t sc_dev;
+
 	unsigned sc_domain;
 	unsigned sc_bus;
+
+	struct rman sc_io;
+	struct rman sc_irq;
+	struct rman sc_mem1;
 };
 
-static void	octopci_identify(driver_t *, device_t);
-static int	octopci_probe(device_t);
-static int	octopci_attach(device_t);
-static int	octopci_read_ivar(device_t, device_t, int, uintptr_t *);
+static void		octopci_identify(driver_t *, device_t);
+static int		octopci_probe(device_t);
+static int		octopci_attach(device_t);
+static int		octopci_read_ivar(device_t, device_t, int,
+					  uintptr_t *);
+static struct resource	*octopci_alloc_resource(device_t, device_t, int, int *,
+						u_long, u_long, u_long, u_int);
+static int		octopci_activate_resource(device_t, device_t, int, int,
+						  struct resource *);
 static int	octopci_maxslots(device_t);
 static uint32_t	octopci_read_config(device_t, u_int, u_int, u_int, u_int, int);
-static void	octopci_write_config(device_t, u_int, u_int, u_int, u_int, uint32_t, int);
+static void	octopci_write_config(device_t, u_int, u_int, u_int, u_int,
+				     uint32_t, int);
 
 static uint64_t	octopci_cs_addr(unsigned, unsigned, unsigned, unsigned);
 
@@ -95,12 +106,37 @@ static int
 octopci_attach(device_t dev)
 {
 	struct octopci_softc *sc;
+	int error;
 
 	sc = device_get_softc(dev);
 	sc->sc_dev = dev;
 	sc->sc_domain = 0;
 	sc->sc_bus = 0;
 
+	sc->sc_io.rm_type = RMAN_ARRAY;
+	sc->sc_io.rm_descr = "Cavium Octeon PCI I/O Ports";
+	error = rman_init(&sc->sc_io);
+	if (error != 0)
+		return (error);
+
+	error = rman_manage_region(&sc->sc_io, CVMX_OCT_PCI_IO_BASE,
+	    CVMX_OCT_PCI_IO_BASE + CVMX_OCT_PCI_IO_SIZE);
+	if (error != 0)
+		return (error);
+
+	sc->sc_mem1.rm_type = RMAN_ARRAY;
+	sc->sc_mem1.rm_descr = "Cavium Octeon PCI Memory";
+	error = rman_init(&sc->sc_mem1);
+	if (error != 0)
+		return (error);
+
+	error = rman_manage_region(&sc->sc_mem1, CVMX_OCT_PCI_MEM1_BASE,
+	    CVMX_OCT_PCI_MEM1_BASE + CVMX_OCT_PCI_MEM1_SIZE);
+	if (error != 0)
+		return (error);
+
+	/* XXX IRQs? */
+
 	device_add_child(dev, "pci", 0);
 
 	return (bus_generic_attach(dev));
@@ -125,6 +161,87 @@ octopci_read_ivar(device_t dev, device_t
 	return (ENOENT);
 }
 
+static struct resource *
+octopci_alloc_resource(device_t bus, device_t child, int type, int *rid,
+    u_long start, u_long end, u_long count, u_int flags)
+{
+	struct octopci_softc *sc;
+	struct resource *res;
+	struct rman *rm;
+	int error;
+
+	sc = device_get_softc(bus);
+
+	switch (type) {
+	case SYS_RES_IRQ:
+		rm = &sc->sc_irq;
+		break;
+	case SYS_RES_MEMORY:
+		rm = &sc->sc_mem1;
+		break;
+	case SYS_RES_IOPORT:
+		rm = &sc->sc_io;
+		break;
+	default:
+		return (NULL);
+	}
+
+	res = rman_reserve_resource(rm, start, end, count, flags, child);
+	if (res == NULL)
+		return (NULL);
+
+	if (type == SYS_RES_IRQ)
+		return (res);
+	
+	rman_set_rid(res, *rid);
+	rman_set_bustag(res, mips_bus_space_generic);
+
+	switch (type) {
+	case SYS_RES_MEMORY:
+		rman_set_bushandle(res, CVMX_ADDR_DID(CVMX_FULL_DID(CVMX_OCT_DID_PCI, CVMX_OCT_SUBDID_PCI_MEM1)));
+		break;
+	case SYS_RES_IOPORT:
+		rman_set_bushandle(res, CVMX_ADDR_DID(CVMX_FULL_DID(CVMX_OCT_DID_PCI, CVMX_OCT_SUBDID_PCI_IO)));
+		break;
+	}
+
+	if ((flags & RF_ACTIVE) != 0) {
+		error = bus_activate_resource(child, type, *rid, res);
+		if (error != 0) {
+			rman_release_resource(res);
+			return (NULL);
+		}
+	}
+
+	return (res);
+}
+
+static int
+octopci_activate_resource(device_t bus, device_t child, int type, int rid,
+    struct resource *res)
+{
+	bus_space_handle_t bh;
+	int error;
+
+	switch (type) {
+	case SYS_RES_MEMORY:
+	case SYS_RES_IOPORT:
+		error = bus_space_map(rman_get_bustag(res),
+		    rman_get_bushandle(res), rman_get_size(res), 0, &bh);
+		if (error != 0)
+			return (error);
+		rman_set_bushandle(res, bh);
+		break;
+	default:
+		break;
+	}
+
+	error = rman_activate_resource(res);
+	if (error != 0)
+		return (error);
+	return (0);
+}
+
 static int
 octopci_maxslots(device_t dev)
 {
@@ -159,8 +276,8 @@ octopci_read_config(device_t dev, u_int 
 }
 
 static void
-octopci_write_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg,
-    uint32_t data, int bytes)
+octopci_write_config(device_t dev, u_int bus, u_int slot, u_int func,
+    u_int reg, uint32_t data, int bytes)
 {
 	struct octopci_softc *sc;
 	uint64_t addr;
@@ -212,6 +329,10 @@ static device_method_t octopci_methods[]
 	/* Bus interface */
 	DEVMETHOD(bus_read_ivar,	octopci_read_ivar),
 	DEVMETHOD(bus_print_child,	bus_generic_print_child),
+	DEVMETHOD(bus_alloc_resource,	octopci_alloc_resource),
+	DEVMETHOD(bus_release_resource,	bus_generic_release_resource),
+	DEVMETHOD(bus_activate_resource,octopci_activate_resource),
+	DEVMETHOD(bus_deactivate_resource,bus_generic_deactivate_resource),
 
 	/* pcib interface */
 	DEVMETHOD(pcib_maxslots,	octopci_maxslots),

Modified: user/jmallett/octeon/sys/mips/cavium/octopcireg.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octopcireg.h	Thu Apr 29 22:51:18 2010	(r207404)
+++ user/jmallett/octeon/sys/mips/cavium/octopcireg.h	Thu Apr 29 23:22:38 2010	(r207405)
@@ -95,4 +95,10 @@ typedef union
 #define CVMX_OCT_SUBDID_PCI_MEM3    5
 #define CVMX_OCT_SUBDID_PCI_MEM4    6
 
+#define	CVMX_OCT_PCI_IO_BASE	0x00001000
+#define	CVMX_OCT_PCI_IO_SIZE	0x08000000
+
+#define	CVMX_OCT_PCI_MEM1_BASE	0x80000000
+#define	CVMX_OCT_PCI_MEM1_SIZE	0x40000000
+
 #endif /* !_CAVIUM_OCTOPCIREG_H_ */

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 30 00:06:50 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 217FC106566C;
	Fri, 30 Apr 2010 00:06:50 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id 101C78FC1A;
	Fri, 30 Apr 2010 00:06:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3U06nGK099548;
	Fri, 30 Apr 2010 00:06:49 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3U06nbG099546;
	Fri, 30 Apr 2010 00:06:49 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004300006.o3U06nbG099546@svn.freebsd.org>
From: Juli Mallett 
Date: Fri, 30 Apr 2010 00:06:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207407 - user/jmallett/octeon/sys/mips/cavium
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Apr 2010 00:06:50 -0000

Author: jmallett
Date: Fri Apr 30 00:06:49 2010
New Revision: 207407
URL: http://svn.freebsd.org/changeset/base/207407

Log:
  Actually initialize the IRQ rman, even though I'm not populating it yet.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octopci.c

Modified: user/jmallett/octeon/sys/mips/cavium/octopci.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octopci.c	Thu Apr 29 23:48:09 2010	(r207406)
+++ user/jmallett/octeon/sys/mips/cavium/octopci.c	Fri Apr 30 00:06:49 2010	(r207407)
@@ -136,6 +136,11 @@ octopci_attach(device_t dev)
 		return (error);
 
 	/* XXX IRQs? */
+	sc->sc_irq.rm_type = RMAN_ARRAY;
+	sc->sc_irq.rm_descr = "Cavium Octeon PCI Interrupts";
+	error = rman_init(&sc->sc_irq);
+	if (error != 0)
+		return (error);
 
 	device_add_child(dev, "pci", 0);
 

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 30 00:30:29 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 8764C106566B;
	Fri, 30 Apr 2010 00:30:29 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id 763408FC0C;
	Fri, 30 Apr 2010 00:30:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3U0UTKm004813;
	Fri, 30 Apr 2010 00:30:29 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3U0UTNr004811;
	Fri, 30 Apr 2010 00:30:29 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004300030.o3U0UTNr004811@svn.freebsd.org>
From: Kip Macy 
Date: Fri, 30 Apr 2010 00:30:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207408 - user/kmacy/head_page_lock_incr/sys/i386/xen
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Apr 2010 00:30:29 -0000

Author: kmacy
Date: Fri Apr 30 00:30:29 2010
New Revision: 207408
URL: http://svn.freebsd.org/changeset/base/207408

Log:
  convert xen's pmap_extract_and_hold

Modified:
  user/kmacy/head_page_lock_incr/sys/i386/xen/pmap.c

Modified: user/kmacy/head_page_lock_incr/sys/i386/xen/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/i386/xen/pmap.c	Fri Apr 30 00:06:49 2010	(r207407)
+++ user/kmacy/head_page_lock_incr/sys/i386/xen/pmap.c	Fri Apr 30 00:30:29 2010	(r207408)
@@ -1219,14 +1219,19 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
 	pd_entry_t pde;
 	pt_entry_t pte;
 	vm_page_t m;
+	vm_paddr_t pa;
 
+	pa = 0;
 	m = NULL;
-	vm_page_lock_queues();
 	PMAP_LOCK(pmap);
+retry:
 	pde = PT_GET(pmap_pde(pmap, va));
 	if (pde != 0) {
 		if (pde & PG_PS) {
 			if ((pde & PG_RW) || (prot & VM_PROT_WRITE) == 0) {
+				if (vm_page_pa_tryrelock(pmap, (pde & PG_PS_FRAME) |
+				       (va & PDRMASK), &pa))
+					goto retry;
 				m = PHYS_TO_VM_PAGE((pde & PG_PS_FRAME) |
 				    (va & PDRMASK));
 				vm_page_hold(m);
@@ -1238,13 +1243,15 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
 				PT_SET_MA(PADDR1, 0);
 			if ((pte & PG_V) &&
 			    ((pte & PG_RW) || (prot & VM_PROT_WRITE) == 0)) {
+				if (vm_page_pa_tryrelock(pmap, pte & PG_FRAME, &pa))
+					goto retry;
 				m = PHYS_TO_VM_PAGE(pte & PG_FRAME);
 				vm_page_hold(m);
 			}
 			sched_unpin();
 		}
 	}
-	vm_page_unlock_queues();
+	PA_UNLOCK_COND(pa);
 	PMAP_UNLOCK(pmap);
 	return (m);
 }

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 30 03:04:09 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id A8E45106564A;
	Fri, 30 Apr 2010 03:04:09 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id 989078FC14;
	Fri, 30 Apr 2010 03:04:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3U349W4038886;
	Fri, 30 Apr 2010 03:04:09 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3U349PP038884;
	Fri, 30 Apr 2010 03:04:09 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004300304.o3U349PP038884@svn.freebsd.org>
From: Juli Mallett 
Date: Fri, 30 Apr 2010 03:04:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207413 - user/jmallett/octeon/sys/mips/cavium
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Apr 2010 03:04:09 -0000

Author: jmallett
Date: Fri Apr 30 03:04:09 2010
New Revision: 207413
URL: http://svn.freebsd.org/changeset/base/207413

Log:
  Set up interrupt routing for Lanner boards.  This brings us to our next
  exciting crash.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octopci.c

Modified: user/jmallett/octeon/sys/mips/cavium/octopci.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octopci.c	Fri Apr 30 02:46:49 2010	(r207412)
+++ user/jmallett/octeon/sys/mips/cavium/octopci.c	Fri Apr 30 03:04:09 2010	(r207413)
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -66,7 +67,6 @@ struct octopci_softc {
 	unsigned sc_bus;
 
 	struct rman sc_io;
-	struct rman sc_irq;
 	struct rman sc_mem1;
 };
 
@@ -83,6 +83,7 @@ static int	octopci_maxslots(device_t);
 static uint32_t	octopci_read_config(device_t, u_int, u_int, u_int, u_int, int);
 static void	octopci_write_config(device_t, u_int, u_int, u_int, u_int,
 				     uint32_t, int);
+static int	octopci_route_interrupt(device_t, device_t, int);
 
 static uint64_t	octopci_cs_addr(unsigned, unsigned, unsigned, unsigned);
 
@@ -135,13 +136,6 @@ octopci_attach(device_t dev)
 	if (error != 0)
 		return (error);
 
-	/* XXX IRQs? */
-	sc->sc_irq.rm_type = RMAN_ARRAY;
-	sc->sc_irq.rm_descr = "Cavium Octeon PCI Interrupts";
-	error = rman_init(&sc->sc_irq);
-	if (error != 0)
-		return (error);
-
 	device_add_child(dev, "pci", 0);
 
 	return (bus_generic_attach(dev));
@@ -179,8 +173,11 @@ octopci_alloc_resource(device_t bus, dev
 
 	switch (type) {
 	case SYS_RES_IRQ:
-		rm = &sc->sc_irq;
-		break;
+		res = bus_generic_alloc_resource(bus, child, type, rid, start,
+		    end, count, flags);
+		if (res != NULL)
+			return (res);
+		return (NULL);
 	case SYS_RES_MEMORY:
 		rm = &sc->sc_mem1;
 		break;
@@ -195,9 +192,6 @@ octopci_alloc_resource(device_t bus, dev
 	if (res == NULL)
 		return (NULL);
 
-	if (type == SYS_RES_IRQ)
-		return (res);
-	
 	rman_set_rid(res, *rid);
 	rman_set_bustag(res, mips_bus_space_generic);
 
@@ -229,6 +223,12 @@ octopci_activate_resource(device_t bus, 
 	int error;
 
 	switch (type) {
+	case SYS_RES_IRQ:
+		error = bus_generic_activate_resource(bus, child, type, rid,
+						      res);
+		if (error != 0)
+			return (error);
+		return (0);
 	case SYS_RES_MEMORY:
 	case SYS_RES_IOPORT:
 		error = bus_space_map(rman_get_bustag(res),
@@ -238,7 +238,7 @@ octopci_activate_resource(device_t bus, 
 		rman_set_bushandle(res, bh);
 		break;
 	default:
-		break;
+		return (ENXIO);
 	}
 
 	error = rman_activate_resource(res);
@@ -306,6 +306,34 @@ octopci_write_config(device_t dev, u_int
 	}
 }
 
+static int
+octopci_route_interrupt(device_t dev, device_t child, int pin)
+{
+	struct octopci_softc *sc;
+	unsigned bus, slot, func;
+	unsigned irq;
+
+	sc = device_get_softc(dev);
+
+        bus = pci_get_bus(child);
+        slot = pci_get_slot(child);
+        func = pci_get_function(child);
+
+#if defined(OCTEON_VENDOR_LANNER)
+	if (slot < 32) {
+		if (slot == 3)
+			irq = pin;
+		else
+			irq = pin - 1;
+		return (CVMX_IRQ_PCI_INT0 + (irq & 3));
+	}
+#endif
+
+	irq = slot + pin - 3;
+
+	return (CVMX_IRQ_PCI_INT0 + (irq & 3));
+}
+
 static uint64_t
 octopci_cs_addr(unsigned bus, unsigned slot, unsigned func, unsigned reg)
 {
@@ -338,11 +366,13 @@ static device_method_t octopci_methods[]
 	DEVMETHOD(bus_release_resource,	bus_generic_release_resource),
 	DEVMETHOD(bus_activate_resource,octopci_activate_resource),
 	DEVMETHOD(bus_deactivate_resource,bus_generic_deactivate_resource),
+	DEVMETHOD(bus_setup_intr,	bus_generic_setup_intr),
 
 	/* pcib interface */
 	DEVMETHOD(pcib_maxslots,	octopci_maxslots),
 	DEVMETHOD(pcib_read_config,	octopci_read_config),
 	DEVMETHOD(pcib_write_config,	octopci_write_config),
+	DEVMETHOD(pcib_route_interrupt,	octopci_route_interrupt),
 
 	{0, 0}
 };

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 30 03:06:53 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 9BAEF106564A;
	Fri, 30 Apr 2010 03:06:53 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id 8BF598FC12;
	Fri, 30 Apr 2010 03:06:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3U36rTN039547;
	Fri, 30 Apr 2010 03:06:53 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3U36rYB039545;
	Fri, 30 Apr 2010 03:06:53 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004300306.o3U36rYB039545@svn.freebsd.org>
From: Juli Mallett 
Date: Fri, 30 Apr 2010 03:06:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207414 - user/jmallett/octeon/sys/mips/cavium
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Apr 2010 03:06:53 -0000

Author: jmallett
Date: Fri Apr 30 03:06:53 2010
New Revision: 207414
URL: http://svn.freebsd.org/changeset/base/207414

Log:
  Also adjust mapping for slot 9.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octopci.c

Modified: user/jmallett/octeon/sys/mips/cavium/octopci.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octopci.c	Fri Apr 30 03:04:09 2010	(r207413)
+++ user/jmallett/octeon/sys/mips/cavium/octopci.c	Fri Apr 30 03:06:53 2010	(r207414)
@@ -321,7 +321,7 @@ octopci_route_interrupt(device_t dev, de
 
 #if defined(OCTEON_VENDOR_LANNER)
 	if (slot < 32) {
-		if (slot == 3)
+		if (slot == 3 || slot == 9)
 			irq = pin;
 		else
 			irq = pin - 1;

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 30 03:14:47 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id DAC97106566B;
	Fri, 30 Apr 2010 03:14:47 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id CB3E68FC15;
	Fri, 30 Apr 2010 03:14:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3U3ElwA041545;
	Fri, 30 Apr 2010 03:14:47 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3U3Eluq041543;
	Fri, 30 Apr 2010 03:14:47 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004300314.o3U3Eluq041543@svn.freebsd.org>
From: Juli Mallett 
Date: Fri, 30 Apr 2010 03:14:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207417 - user/jmallett/octeon/sys/mips/mips
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Apr 2010 03:14:47 -0000

Author: jmallett
Date: Fri Apr 30 03:14:47 2010
New Revision: 207417
URL: http://svn.freebsd.org/changeset/base/207417

Log:
  Use the right bus overrides for the generic bus space until I can be bothered
  to put an Octeon-specific one in place.
  
  We need to be able to access 64-bit addresses via bus_space, but we don't need
  to do everything with 64-bit accesses.  That's just the uart code, which seems
  to use its own bus space anyway.

Modified:
  user/jmallett/octeon/sys/mips/mips/bus_space_generic.c

Modified: user/jmallett/octeon/sys/mips/mips/bus_space_generic.c
==============================================================================
--- user/jmallett/octeon/sys/mips/mips/bus_space_generic.c	Fri Apr 30 03:13:24 2010	(r207416)
+++ user/jmallett/octeon/sys/mips/mips/bus_space_generic.c	Fri Apr 30 03:14:47 2010	(r207417)
@@ -199,13 +199,13 @@ static struct bus_space generic_space = 
 /* Ultra-gross kludge */
 #include "opt_cputype.h"
 #if defined(TARGET_OCTEON) && (defined(__mips_n32) || defined(__mips_o32))
-#include 
-#define rd8(a) oct_read8(a)
-#define rd16(a) oct_read16(a)
-#define rd32(a) oct_read32(a)
-#define wr8(a, v) oct_write8(a, v)
-#define wr16(a, v) oct_write16(a, v)
-#define wr32(a, v) oct_write32(a, v)
+#include 
+#define rd8(a) cvmx_read64_uint8(a)
+#define rd16(a) cvmx_read64_uint16(a)
+#define rd32(a) cvmx_read64_uint32(a)
+#define wr8(a, v) cvmx_write64_uint8(a, v)
+#define wr16(a, v) cvmx_write64_uint16(a, v)
+#define wr32(a, v) cvmx_write64_uint32(a, v)
 #elif defined(CPU_SB1) && _BYTE_ORDER == _BIG_ENDIAN
 #include 
 #define rd8(a) sb_big_endian_read8(a)

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 30 03:35:06 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 3AFD5106566C;
	Fri, 30 Apr 2010 03:35:06 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id 2BAE08FC15;
	Fri, 30 Apr 2010 03:35:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3U3Z6Ba046087;
	Fri, 30 Apr 2010 03:35:06 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3U3Z6wk046085;
	Fri, 30 Apr 2010 03:35:06 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004300335.o3U3Z6wk046085@svn.freebsd.org>
From: Juli Mallett 
Date: Fri, 30 Apr 2010 03:35:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207420 - user/jmallett/octeon/sys/mips/cavium
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Apr 2010 03:35:06 -0000

Author: jmallett
Date: Fri Apr 30 03:35:05 2010
New Revision: 207420
URL: http://svn.freebsd.org/changeset/base/207420

Log:
  Add start address to base address when setting bus handle.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octopci.c

Modified: user/jmallett/octeon/sys/mips/cavium/octopci.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octopci.c	Fri Apr 30 03:26:12 2010	(r207419)
+++ user/jmallett/octeon/sys/mips/cavium/octopci.c	Fri Apr 30 03:35:05 2010	(r207420)
@@ -197,10 +197,10 @@ octopci_alloc_resource(device_t bus, dev
 
 	switch (type) {
 	case SYS_RES_MEMORY:
-		rman_set_bushandle(res, CVMX_ADDR_DID(CVMX_FULL_DID(CVMX_OCT_DID_PCI, CVMX_OCT_SUBDID_PCI_MEM1)));
+		rman_set_bushandle(res, CVMX_ADDR_DID(CVMX_FULL_DID(CVMX_OCT_DID_PCI, CVMX_OCT_SUBDID_PCI_MEM1)) + rman_get_start(res));
 		break;
 	case SYS_RES_IOPORT:
-		rman_set_bushandle(res, CVMX_ADDR_DID(CVMX_FULL_DID(CVMX_OCT_DID_PCI, CVMX_OCT_SUBDID_PCI_IO)));
+		rman_set_bushandle(res, CVMX_ADDR_DID(CVMX_FULL_DID(CVMX_OCT_DID_PCI, CVMX_OCT_SUBDID_PCI_IO)) + rman_get_start(res));
 		break;
 	}
 

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 30 03:53:00 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 8D86A1065675;
	Fri, 30 Apr 2010 03:53:00 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 506138FC18;
	Fri, 30 Apr 2010 03:53:00 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o3U3nrGU015049;
	Thu, 29 Apr 2010 21:49:54 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Thu, 29 Apr 2010 21:50:06 -0600 (MDT)
Message-Id: <20100429.215006.342007108973685078.imp@bsdimp.com>
To: jmallett@freebsd.org
From: "M. Warner Losh" 
In-Reply-To: <201004300314.o3U3Eluq041543@svn.freebsd.org>
References: <201004300314.o3U3Eluq041543@svn.freebsd.org>
X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: Re: svn commit: r207417 - user/jmallett/octeon/sys/mips/mips
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Apr 2010 03:53:00 -0000

In message: <201004300314.o3U3Eluq041543@svn.freebsd.org>
            Juli Mallett  writes:
: That's just the uart code, which seems to use its own bus space
: anyway.

The UART code needs to have its own space.  The uart*.c code is mostly
setup to read bytes from the uart device.  We use bus space to spread
out the bytes (which uart could do itself, but we tell it not to), as
well as insure that the 64-bit registers are accessed as 64-bit
registers.  This is important for the Octeon take on a 16550 since
byte reads/writes cause problems, at least on some members of the
family.  The bus space code bridges these two worlds.  It also solves
the 'big endian' issues that the atheros code still has...

Warner


From owner-svn-src-user@FreeBSD.ORG  Fri Apr 30 06:31:39 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 417BB106564A;
	Fri, 30 Apr 2010 06:31:39 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id 1853E8FC19;
	Fri, 30 Apr 2010 06:31:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3U6Vc75084822;
	Fri, 30 Apr 2010 06:31:38 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3U6Vc7s084821;
	Fri, 30 Apr 2010 06:31:38 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004300631.o3U6Vc7s084821@svn.freebsd.org>
From: Kip Macy 
Date: Fri, 30 Apr 2010 06:31:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207423 - user/kmacy/head_page_lock_incr
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Apr 2010 06:31:39 -0000

Author: kmacy
Date: Fri Apr 30 06:31:38 2010
New Revision: 207423
URL: http://svn.freebsd.org/changeset/base/207423

Log:
  delete branch to make way for refresh

Deleted:
  user/kmacy/head_page_lock_incr/

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 30 06:32:37 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 7AF4E1065672;
	Fri, 30 Apr 2010 06:32:37 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id 51E8B8FC0A;
	Fri, 30 Apr 2010 06:32:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3U6WbDl085054;
	Fri, 30 Apr 2010 06:32:37 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3U6Wbfm085053;
	Fri, 30 Apr 2010 06:32:37 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004300632.o3U6Wbfm085053@svn.freebsd.org>
From: Kip Macy 
Date: Fri, 30 Apr 2010 06:32:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207424 - user/kmacy/head_page_lock_incr
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Apr 2010 06:32:37 -0000

Author: kmacy
Date: Fri Apr 30 06:32:37 2010
New Revision: 207424
URL: http://svn.freebsd.org/changeset/base/207424

Log:
  new branch for merging incremental page lock support

Added:
     - copied from r207423, head/
Directory Properties:
  user/kmacy/head_page_lock_incr/   (props changed)

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 30 06:43:36 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 7ED85106564A;
	Fri, 30 Apr 2010 06:43:36 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id 6C0D08FC12;
	Fri, 30 Apr 2010 06:43:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3U6hatS087506;
	Fri, 30 Apr 2010 06:43:36 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3U6habn087486;
	Fri, 30 Apr 2010 06:43:36 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004300643.o3U6habn087486@svn.freebsd.org>
From: Kip Macy 
Date: Fri, 30 Apr 2010 06:43:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207425 - in user/kmacy/head_page_lock_incr/sys:
	amd64/amd64 dev/agp dev/drm dev/ti fs/tmpfs i386/i386
	i386/xen kern net vm
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Apr 2010 06:43:36 -0000

Author: kmacy
Date: Fri Apr 30 06:43:35 2010
New Revision: 207425
URL: http://svn.freebsd.org/changeset/base/207425

Log:
  Peel the page queue mutex away from vm_page_{wire, unwire}

Modified:
  user/kmacy/head_page_lock_incr/sys/amd64/amd64/pmap.c
  user/kmacy/head_page_lock_incr/sys/dev/agp/agp.c
  user/kmacy/head_page_lock_incr/sys/dev/agp/agp_i810.c
  user/kmacy/head_page_lock_incr/sys/dev/drm/via_dmablit.c
  user/kmacy/head_page_lock_incr/sys/dev/ti/if_ti.c
  user/kmacy/head_page_lock_incr/sys/fs/tmpfs/tmpfs_vnops.c
  user/kmacy/head_page_lock_incr/sys/i386/i386/pmap.c
  user/kmacy/head_page_lock_incr/sys/i386/xen/pmap.c
  user/kmacy/head_page_lock_incr/sys/kern/uipc_cow.c
  user/kmacy/head_page_lock_incr/sys/kern/uipc_syscalls.c
  user/kmacy/head_page_lock_incr/sys/kern/vfs_bio.c
  user/kmacy/head_page_lock_incr/sys/net/bpf_zerocopy.c
  user/kmacy/head_page_lock_incr/sys/vm/swap_pager.c
  user/kmacy/head_page_lock_incr/sys/vm/uma_core.c
  user/kmacy/head_page_lock_incr/sys/vm/vm_fault.c
  user/kmacy/head_page_lock_incr/sys/vm/vm_glue.c
  user/kmacy/head_page_lock_incr/sys/vm/vm_kern.c
  user/kmacy/head_page_lock_incr/sys/vm/vm_page.c
  user/kmacy/head_page_lock_incr/sys/vm/vm_page.h

Modified: user/kmacy/head_page_lock_incr/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/amd64/amd64/pmap.c	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/amd64/amd64/pmap.c	Fri Apr 30 06:43:35 2010	(r207425)
@@ -2123,7 +2123,7 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv
 	/* entire chunk is free, return it */
 	m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc));
 	dump_drop_page(m->phys_addr);
-	vm_page_unwire(m, 0);
+	vm_page_unwire_exclusive(m, 0);
 	vm_page_free(m);
 }
 
@@ -4101,7 +4101,7 @@ pmap_remove_pages(pmap_t pmap)
 			TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
 			m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc));
 			dump_drop_page(m->phys_addr);
-			vm_page_unwire(m, 0);
+			vm_page_unwire_exclusive(m, 0);
 			vm_page_free(m);
 		}
 	}

Modified: user/kmacy/head_page_lock_incr/sys/dev/agp/agp.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/dev/agp/agp.c	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/dev/agp/agp.c	Fri Apr 30 06:43:35 2010	(r207425)
@@ -623,9 +623,9 @@ bad:
 		m = vm_page_lookup(mem->am_obj, OFF_TO_IDX(k));
 		if (k >= i)
 			vm_page_wakeup(m);
-		vm_page_lock_queues();
+		vm_page_lock(m);
 		vm_page_unwire(m, 0);
-		vm_page_unlock_queues();
+		vm_page_unlock(m);
 	}
 	VM_OBJECT_UNLOCK(mem->am_obj);
 
@@ -657,9 +657,9 @@ agp_generic_unbind_memory(device_t dev, 
 	VM_OBJECT_LOCK(mem->am_obj);
 	for (i = 0; i < mem->am_size; i += PAGE_SIZE) {
 		m = vm_page_lookup(mem->am_obj, atop(i));
-		vm_page_lock_queues();
+		vm_page_lock(m);
 		vm_page_unwire(m, 0);
-		vm_page_unlock_queues();
+		vm_page_unlock(m);
 	}
 	VM_OBJECT_UNLOCK(mem->am_obj);
 		

Modified: user/kmacy/head_page_lock_incr/sys/dev/agp/agp_i810.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/dev/agp/agp_i810.c	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/dev/agp/agp_i810.c	Fri Apr 30 06:43:35 2010	(r207425)
@@ -1011,9 +1011,9 @@ agp_i810_free_memory(device_t dev, struc
 			VM_OBJECT_LOCK(mem->am_obj);
 			m = vm_page_lookup(mem->am_obj, 0);
 			VM_OBJECT_UNLOCK(mem->am_obj);
-			vm_page_lock_queues();
+			vm_page_lock(m);
 			vm_page_unwire(m, 0);
-			vm_page_unlock_queues();
+			vm_page_unlock(m);
 		} else {
 			contigfree(sc->argb_cursor, mem->am_size, M_AGP);
 			sc->argb_cursor = NULL;

Modified: user/kmacy/head_page_lock_incr/sys/dev/drm/via_dmablit.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/dev/drm/via_dmablit.c	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/dev/drm/via_dmablit.c	Fri Apr 30 06:43:35 2010	(r207425)
@@ -178,9 +178,9 @@ via_free_sg_info(drm_via_sg_info_t *vsg)
 	case dr_via_pages_locked:
 		for (i=0; i < vsg->num_pages; ++i) {
 			if ( NULL != (page = vsg->pages[i])) {
-				vm_page_lock_queues();
+				vm_page_lock(page);
 				vm_page_unwire(page, 0);
-				vm_page_unlock_queues();
+				vm_page_unlock(page);
 			}
 		}
 	case dr_via_pages_alloc:
@@ -249,10 +249,8 @@ via_lock_all_dma_pages(drm_via_sg_info_t
 		if (m == NULL)
 			break;
 		vm_page_lock(m);
-		vm_page_lock_queues();
 		vm_page_wire(m);
 		vm_page_unhold(m);
-		vm_page_unlock_queues();
 		vm_page_unlock(m);
 		vsg->pages[i] = m;
 	}

Modified: user/kmacy/head_page_lock_incr/sys/dev/ti/if_ti.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/dev/ti/if_ti.c	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/dev/ti/if_ti.c	Fri Apr 30 06:43:35 2010	(r207425)
@@ -1488,10 +1488,12 @@ ti_newbuf_jumbo(sc, idx, m_old)
 			}
 			sf[i] = sf_buf_alloc(frame, SFB_NOWAIT);
 			if (sf[i] == NULL) {
-				vm_page_lock_queues();
+				vm_page_lock(frame);
 				vm_page_unwire(frame, 0);
+				vm_page_lock_queues();
 				vm_page_free(frame);
 				vm_page_unlock_queues();
+				vm_page_lock(frame);
 				device_printf(sc->ti_dev, "buffer allocation "
 				    "failed -- packet dropped!\n");
 				printf("      index %d page %d\n", idx, i);

Modified: user/kmacy/head_page_lock_incr/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/fs/tmpfs/tmpfs_vnops.c	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/fs/tmpfs/tmpfs_vnops.c	Fri Apr 30 06:43:35 2010	(r207425)
@@ -460,9 +460,9 @@ tmpfs_nocacheread(vm_object_t tobj, vm_p
 	error = uiomove_fromphys(&m, offset, tlen, uio);
 	VM_OBJECT_LOCK(tobj);
 out:
-	vm_page_lock_queues();
+	vm_page_lock(m);
 	vm_page_unwire(m, TRUE);
-	vm_page_unlock_queues();
+	vm_page_unlock(m);
 	vm_page_wakeup(m);
 	vm_object_pip_subtract(tobj, 1);
 	VM_OBJECT_UNLOCK(tobj);
@@ -667,14 +667,14 @@ nocache:
 out:
 	if (vobj != NULL)
 		VM_OBJECT_LOCK(vobj);
-	vm_page_lock_queues();
 	if (error == 0) {
 		KASSERT(tpg->valid == VM_PAGE_BITS_ALL,
 		    ("parts of tpg invalid"));
 		vm_page_dirty(tpg);
 	}
+	vm_page_lock(tpg);
 	vm_page_unwire(tpg, TRUE);
-	vm_page_unlock_queues();
+	vm_page_unlock(tpg);
 	vm_page_wakeup(tpg);
 	if (vpg != NULL)
 		vm_page_wakeup(vpg);

Modified: user/kmacy/head_page_lock_incr/sys/i386/i386/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/i386/i386/pmap.c	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/i386/i386/pmap.c	Fri Apr 30 06:43:35 2010	(r207425)
@@ -2231,7 +2231,7 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv
 	/* entire chunk is free, return it */
 	m = PHYS_TO_VM_PAGE(pmap_kextract((vm_offset_t)pc));
 	pmap_qremove((vm_offset_t)pc, 1);
-	vm_page_unwire(m, 0);
+	vm_page_unwire_exclusive(m, 0);
 	vm_page_free(m);
 	pmap_ptelist_free(&pv_vafree, (vm_offset_t)pc);
 }
@@ -4265,7 +4265,7 @@ pmap_remove_pages(pmap_t pmap)
 			TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
 			m = PHYS_TO_VM_PAGE(pmap_kextract((vm_offset_t)pc));
 			pmap_qremove((vm_offset_t)pc, 1);
-			vm_page_unwire(m, 0);
+			vm_page_unwire_exclusive(m, 0);
 			vm_page_free(m);
 			pmap_ptelist_free(&pv_vafree, (vm_offset_t)pc);
 		}

Modified: user/kmacy/head_page_lock_incr/sys/i386/xen/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/i386/xen/pmap.c	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/i386/xen/pmap.c	Fri Apr 30 06:43:35 2010	(r207425)
@@ -2128,7 +2128,7 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv
 	TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
 	m = PHYS_TO_VM_PAGE(pmap_kextract((vm_offset_t)pc));
 	pmap_qremove((vm_offset_t)pc, 1);
-	vm_page_unwire(m, 0);
+	vm_page_unwire_exclusive(m, 0);
 	vm_page_free(m);
 	pmap_ptelist_free(&pv_vafree, (vm_offset_t)pc);
 }
@@ -3637,7 +3637,7 @@ pmap_remove_pages(pmap_t pmap)
 			TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
 			m = PHYS_TO_VM_PAGE(pmap_kextract((vm_offset_t)pc));
 			pmap_qremove((vm_offset_t)pc, 1);
-			vm_page_unwire(m, 0);
+			vm_page_unwire_exclusive(m, 0);
 			vm_page_free(m);
 			pmap_ptelist_free(&pv_vafree, (vm_offset_t)pc);
 		}

Modified: user/kmacy/head_page_lock_incr/sys/kern/uipc_cow.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/kern/uipc_cow.c	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/kern/uipc_cow.c	Fri Apr 30 06:43:35 2010	(r207425)
@@ -80,17 +80,20 @@ socow_iodone(void *addr, void *args)
 	pp = sf_buf_page(sf);
 	sf_buf_free(sf);
 	/* remove COW mapping  */
-	vm_page_lock_queues();
+	vm_page_lock(pp);
 	vm_page_cowclear(pp);
 	vm_page_unwire(pp, 0);
+	vm_page_unlock(pp);
 	/*
 	 * Check for the object going away on us. This can
 	 * happen since we don't hold a reference to it.
 	 * If so, we're responsible for freeing the page.
 	 */
-	if (pp->wire_count == 0 && pp->object == NULL)
+	if (pp->wire_count == 0 && pp->object == NULL) {
+		vm_page_lock_queues();
 		vm_page_free(pp);
-	vm_page_unlock_queues();
+		vm_page_unlock_queues();
+	}
 	socow_stats.iodone++;
 }
 
@@ -131,35 +134,38 @@ socow_setup(struct mbuf *m0, struct uio 
 	vm_page_lock(pp);
 	vm_page_lock_queues();
 	if (vm_page_cowsetup(pp) != 0) {
-		vm_page_unhold(pp);
 		vm_page_unlock_queues();
+		vm_page_unhold(pp);
 		vm_page_unlock(pp);
 		return (0);
 	}
+	vm_page_unlock_queues();
 
 	/*
 	 * wire the page for I/O
 	 */
 	vm_page_wire(pp);
 	vm_page_unhold(pp);
-	vm_page_unlock_queues();
 	vm_page_unlock(pp);
 	/*
 	 * Allocate an sf buf
 	 */
 	sf = sf_buf_alloc(pp, SFB_CATCH);
 	if (!sf) {
-		vm_page_lock_queues();
+		vm_page_lock(pp);
 		vm_page_cowclear(pp);
 		vm_page_unwire(pp, 0);
+		vm_page_unlock(pp);
 		/*
 		 * Check for the object going away on us. This can
 		 * happen since we don't hold a reference to it.
 		 * If so, we're responsible for freeing the page.
 		 */
-		if (pp->wire_count == 0 && pp->object == NULL)
+		if (pp->wire_count == 0 && pp->object == NULL) {
+			vm_page_lock_queues();
 			vm_page_free(pp);
-		vm_page_unlock_queues();
+			vm_page_unlock_queues();
+		}
 		socow_stats.fail_sf_buf++;
 		return(0);
 	}

Modified: user/kmacy/head_page_lock_incr/sys/kern/uipc_syscalls.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/kern/uipc_syscalls.c	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/kern/uipc_syscalls.c	Fri Apr 30 06:43:35 2010	(r207425)
@@ -1715,16 +1715,19 @@ sf_buf_mext(void *addr, void *args)
 
 	m = sf_buf_page(args);
 	sf_buf_free(args);
-	vm_page_lock_queues();
+	vm_page_lock(m);
 	vm_page_unwire(m, 0);
+	vm_page_unlock(m);
 	/*
 	 * Check for the object going away on us. This can
 	 * happen since we don't hold a reference to it.
 	 * If so, we're responsible for freeing the page.
 	 */
-	if (m->wire_count == 0 && m->object == NULL)
+	if (m->wire_count == 0 && m->object == NULL) {
+		vm_page_lock_queues();
 		vm_page_free(m);
-	vm_page_unlock_queues();
+		vm_page_unlock_queues();
+	}
 	if (addr == NULL)
 		return;
 	sfs = addr;
@@ -2108,8 +2111,9 @@ retry_space:
 				mbstat.sf_iocnt++;
 			}
 			if (error) {
-				vm_page_lock_queues();
+				vm_page_lock(pg);
 				vm_page_unwire(pg, 0);
+				vm_page_unlock(pg);
 				/*
 				 * See if anyone else might know about
 				 * this page.  If not and it is not valid,
@@ -2118,9 +2122,10 @@ retry_space:
 				if (pg->wire_count == 0 && pg->valid == 0 &&
 				    pg->busy == 0 && !(pg->oflags & VPO_BUSY) &&
 				    pg->hold_count == 0) {
+					vm_page_lock_queues();
 					vm_page_free(pg);
+					vm_page_unlock_queues();
 				}
-				vm_page_unlock_queues();
 				VM_OBJECT_UNLOCK(obj);
 				if (error == EAGAIN)
 					error = 0;	/* not a real error */
@@ -2134,14 +2139,17 @@ retry_space:
 			if ((sf = sf_buf_alloc(pg,
 			    (mnw ? SFB_NOWAIT : SFB_CATCH))) == NULL) {
 				mbstat.sf_allocfail++;
-				vm_page_lock_queues();
+				vm_page_lock(pg);
 				vm_page_unwire(pg, 0);
+				vm_page_unlock(pg);
 				/*
 				 * XXX: Not same check as above!?
 				 */
-				if (pg->wire_count == 0 && pg->object == NULL)
+				if (pg->wire_count == 0 && pg->object == NULL) {
+					vm_page_lock_queues();
 					vm_page_free(pg);
-				vm_page_unlock_queues();
+					vm_page_unlock_queues();
+				}
 				error = (mnw ? EAGAIN : EINTR);
 				break;
 			}

Modified: user/kmacy/head_page_lock_incr/sys/kern/vfs_bio.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/kern/vfs_bio.c	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/kern/vfs_bio.c	Fri Apr 30 06:43:35 2010	(r207425)
@@ -1563,7 +1563,6 @@ vfs_vmio_release(struct buf *bp)
 	vm_page_t m;
 
 	VM_OBJECT_LOCK(bp->b_bufobj->bo_object);
-	vm_page_lock_queues();
 	for (i = 0; i < bp->b_npages; i++) {
 		m = bp->b_pages[i];
 		bp->b_pages[i] = NULL;
@@ -1571,16 +1570,19 @@ vfs_vmio_release(struct buf *bp)
 		 * In order to keep page LRU ordering consistent, put
 		 * everything on the inactive queue.
 		 */
+		vm_page_lock(m);
 		vm_page_unwire(m, 0);
 		/*
 		 * We don't mess with busy pages, it is
 		 * the responsibility of the process that
 		 * busied the pages to deal with them.
 		 */
-		if ((m->oflags & VPO_BUSY) || (m->busy != 0))
+		if ((m->oflags & VPO_BUSY) || (m->busy != 0)) {
+			vm_page_unlock(m);
 			continue;
-			
+		}
 		if (m->wire_count == 0) {
+			vm_page_lock_queues();
 			/*
 			 * Might as well free the page if we can and it has
 			 * no valid data.  We also free the page if the
@@ -1594,9 +1596,10 @@ vfs_vmio_release(struct buf *bp)
 			} else if (buf_vm_page_count_severe()) {
 				vm_page_try_to_cache(m);
 			}
+			vm_page_unlock_queues();
 		}
+		vm_page_unlock(m);
 	}
-	vm_page_unlock_queues();
 	VM_OBJECT_UNLOCK(bp->b_bufobj->bo_object);
 	pmap_qremove(trunc_page((vm_offset_t) bp->b_data), bp->b_npages);
 	
@@ -2942,7 +2945,6 @@ allocbuf(struct buf *bp, int size)
 				vm_page_t m;
 
 				VM_OBJECT_LOCK(bp->b_bufobj->bo_object);
-				vm_page_lock_queues();
 				for (i = desiredpages; i < bp->b_npages; i++) {
 					/*
 					 * the page is not freed here -- it
@@ -2953,12 +2955,13 @@ allocbuf(struct buf *bp, int size)
 					KASSERT(m != bogus_page,
 					    ("allocbuf: bogus page found"));
 					while (vm_page_sleep_if_busy(m, TRUE, "biodep"))
-						vm_page_lock_queues();
+						;
 
 					bp->b_pages[i] = NULL;
+					vm_page_lock(m);
 					vm_page_unwire(m, 0);
+					vm_page_unlock(m);
 				}
-				vm_page_unlock_queues();
 				VM_OBJECT_UNLOCK(bp->b_bufobj->bo_object);
 				pmap_qremove((vm_offset_t) trunc_page((vm_offset_t)bp->b_data) +
 				    (desiredpages << PAGE_SHIFT), (bp->b_npages - desiredpages));
@@ -3030,9 +3033,9 @@ allocbuf(struct buf *bp, int size)
 				/*
 				 * We have a good page.
 				 */
-				vm_page_lock_queues();
+				vm_page_lock(m);
 				vm_page_wire(m);
-				vm_page_unlock_queues();
+				vm_page_unlock(m);
 				bp->b_pages[bp->b_npages] = m;
 				++bp->b_npages;
 			}

Modified: user/kmacy/head_page_lock_incr/sys/net/bpf_zerocopy.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/net/bpf_zerocopy.c	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/net/bpf_zerocopy.c	Fri Apr 30 06:43:35 2010	(r207425)
@@ -111,12 +111,14 @@ struct zbuf {
 static void
 zbuf_page_free(vm_page_t pp)
 {
-
-	vm_page_lock_queues();
+	vm_page_lock(pp);
 	vm_page_unwire(pp, 0);
-	if (pp->wire_count == 0 && pp->object == NULL)
+	if (pp->wire_count == 0 && pp->object == NULL) {
+		vm_page_lock_queues();
 		vm_page_free(pp);
-	vm_page_unlock_queues();
+		vm_page_unlock_queues();
+	}
+	vm_page_unlock(pp);
 }
 
 /*
@@ -169,10 +171,8 @@ zbuf_sfbuf_get(struct vm_map *map, vm_of
 	if (pp == NULL)
 		return (NULL);
 	vm_page_lock(pp);
-	vm_page_lock_queues();
 	vm_page_wire(pp);
 	vm_page_unhold(pp);
-	vm_page_unlock_queues();
 	vm_page_unlock(pp);
 	sf = sf_buf_alloc(pp, SFB_NOWAIT);
 	if (sf == NULL) {

Modified: user/kmacy/head_page_lock_incr/sys/vm/swap_pager.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/vm/swap_pager.c	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/vm/swap_pager.c	Fri Apr 30 06:43:35 2010	(r207425)
@@ -1717,9 +1717,9 @@ swp_pager_force_pagein(vm_object_t objec
 		vm_page_lock(m);
 		vm_page_lock_queues();
 		vm_page_activate(m);
-		vm_page_dirty(m);
 		vm_page_unlock_queues();
 		vm_page_unlock(m);
+		vm_page_dirty(m);
 		vm_page_wakeup(m);
 		vm_pager_page_unswapped(m);
 		return;

Modified: user/kmacy/head_page_lock_incr/sys/vm/uma_core.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/vm/uma_core.c	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/vm/uma_core.c	Fri Apr 30 06:43:35 2010	(r207425)
@@ -1023,8 +1023,8 @@ obj_alloc(uma_zone_t zone, int bytes, u_
 				pages--;
 				p = TAILQ_LAST(&object->memq, pglist);
 				vm_page_lock(p);
-				vm_page_lock_queues();
 				vm_page_unwire(p, 0);
+				vm_page_lock_queues();
 				vm_page_free(p);
 				vm_page_unlock_queues();
 				vm_page_unlock(p);

Modified: user/kmacy/head_page_lock_incr/sys/vm/vm_fault.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/vm/vm_fault.c	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/vm/vm_fault.c	Fri Apr 30 06:43:35 2010	(r207425)
@@ -799,15 +799,11 @@ vnode_locked:
 				if (wired && (fault_flags &
 				    VM_FAULT_CHANGE_WIRING) == 0) {
 					vm_page_lock(fs.first_m);
-					vm_page_lock_queues();
 					vm_page_wire(fs.first_m);
-					vm_page_unlock_queues();
 					vm_page_unlock(fs.first_m);
 					
 					vm_page_lock(fs.m);
-					vm_page_lock_queues();
 					vm_page_unwire(fs.m, FALSE);
-					vm_page_unlock_queues();
 					vm_page_unlock(fs.m);
 				}
 				/*
@@ -959,7 +955,6 @@ vnode_locked:
 		vm_fault_prefault(fs.map->pmap, vaddr, fs.entry);
 	VM_OBJECT_LOCK(fs.object);
 	vm_page_lock(fs.m);
-	vm_page_lock_queues();
 
 	/*
 	 * If the page is not wired down, then put it where the pageout daemon
@@ -971,9 +966,10 @@ vnode_locked:
 		else
 			vm_page_unwire(fs.m, 1);
 	} else {
+		vm_page_lock_queues();
 		vm_page_activate(fs.m);
+		vm_page_unlock_queues();
 	}
-	vm_page_unlock_queues();
 	vm_page_unlock(fs.m);
 	vm_page_wakeup(fs.m);
 
@@ -1132,9 +1128,7 @@ vm_fault_unwire(vm_map_t map, vm_offset_
 			pmap_change_wiring(pmap, va, FALSE);
 			if (!fictitious) {
 				vm_page_lock(PHYS_TO_VM_PAGE(pa));
-				vm_page_lock_queues();
 				vm_page_unwire(PHYS_TO_VM_PAGE(pa), 1);
-				vm_page_unlock_queues();
 				vm_page_unlock(PHYS_TO_VM_PAGE(pa));
 			}
 		}
@@ -1281,21 +1275,15 @@ vm_fault_copy_entry(vm_map_t dst_map, vm
 		
 		if (upgrade) {
 			vm_page_lock(src_m);
-			vm_page_lock_queues();
 			vm_page_unwire(src_m, 0);
-			vm_page_unlock_queues();
 			vm_page_lock(src_m);
 
 			vm_page_lock(dst_m);
-			vm_page_lock_queues();
 			vm_page_wire(dst_m);
-			vm_page_unlock_queues();
 			vm_page_lock(dst_m);
 		} else {
 			vm_page_lock(dst_m);
-			vm_page_lock_queues();
 			vm_page_activate(dst_m);
-			vm_page_unlock_queues();
 			vm_page_lock(dst_m);
 		}
 		vm_page_wakeup(dst_m);

Modified: user/kmacy/head_page_lock_incr/sys/vm/vm_glue.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/vm/vm_glue.c	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/vm/vm_glue.c	Fri Apr 30 06:43:35 2010	(r207425)
@@ -437,8 +437,8 @@ vm_thread_stack_dispose(vm_object_t ksob
 		if (m == NULL)
 			panic("vm_thread_dispose: kstack already missing?");
 		vm_page_lock(m);
-		vm_page_lock_queues();
 		vm_page_unwire(m, 0);
+		vm_page_lock_queues();
 		vm_page_free(m);
 		vm_page_unlock_queues();
 		vm_page_unlock(m);
@@ -529,9 +529,7 @@ vm_thread_swapout(struct thread *td)
 			panic("vm_thread_swapout: kstack already missing?");
 		vm_page_dirty(m);
 		vm_page_lock(m);
-		vm_page_lock_queues();
 		vm_page_unwire(m, 0);
-		vm_page_unlock_queues();
 		vm_page_unlock(m);
 	}
 	VM_OBJECT_UNLOCK(ksobj);

Modified: user/kmacy/head_page_lock_incr/sys/vm/vm_kern.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/vm/vm_kern.c	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/vm/vm_kern.c	Fri Apr 30 06:43:35 2010	(r207425)
@@ -381,8 +381,8 @@ retry:
 				m = vm_page_lookup(kmem_object,
 						   OFF_TO_IDX(offset + i));
 				vm_page_lock(m);
-				vm_page_lock_queues();
 				vm_page_unwire(m, 0);
+				vm_page_lock_queues();
 				vm_page_free(m);
 				vm_page_unlock_queues();
 				vm_page_unlock(m);

Modified: user/kmacy/head_page_lock_incr/sys/vm/vm_page.c
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/vm/vm_page.c	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/vm/vm_page.c	Fri Apr 30 06:43:35 2010	(r207425)
@@ -1545,12 +1545,15 @@ vm_page_wire(vm_page_t m)
 	 * and only unqueue the page if it is on some queue (if it is unmanaged
 	 * it is already off the queues).
 	 */
-	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
 	if (m->flags & PG_FICTITIOUS)
 		return;
+	vm_page_lock_assert(m, MA_OWNED);
 	if (m->wire_count == 0) {
-		if ((m->flags & PG_UNMANAGED) == 0)
+		if ((m->flags & PG_UNMANAGED) == 0) {
+			vm_page_lock_queues();
 			vm_pageq_remove(m);
+			vm_page_unlock_queues();
+		}
 		atomic_add_int(&cnt.v_wire_count, 1);
 	}
 	m->wire_count++;
@@ -1586,31 +1589,46 @@ vm_page_wire(vm_page_t m)
  *	This routine may not block.
  */
 void
-vm_page_unwire(vm_page_t m, int activate)
+vm_page_unwire_exclusive(vm_page_t m, int activate)
 {
+	boolean_t locked;
 
-	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
 	if (m->flags & PG_FICTITIOUS)
 		return;
 	if (m->wire_count > 0) {
 		m->wire_count--;
 		if (m->wire_count == 0) {
 			atomic_subtract_int(&cnt.v_wire_count, 1);
+
 			if (m->flags & PG_UNMANAGED) {
-				;
-			} else if (activate)
+				locked = FALSE;
+			} else if (activate) {
+				locked = TRUE;
+				vm_page_lock_queues();
 				vm_page_enqueue(PQ_ACTIVE, m);
-			else {
+			} else {
+				locked = TRUE;
+				vm_page_lock_queues();
 				vm_page_flag_clear(m, PG_WINATCFLS);
 				vm_page_enqueue(PQ_INACTIVE, m);
 			}
+			if (locked)
+				vm_page_unlock_queues();
 		}
 	} else {
 		panic("vm_page_unwire: invalid wire count: %d", m->wire_count);
 	}
 }
 
+void
+vm_page_unwire(vm_page_t m, int activate)
+{
+
+	vm_page_lock_assert(m, MA_OWNED);
+	vm_page_unwire_exclusive(m, activate);
+}
 
+	
 /*
  * Move the specified page to the inactive queue.  If the page has
  * any associated swap, the swap is deallocated.
@@ -1902,9 +1920,9 @@ retrylookup:
 			goto retrylookup;
 		} else {
 			if ((allocflags & VM_ALLOC_WIRED) != 0) {
-				vm_page_lock_queues();
+				vm_page_lock(m);
 				vm_page_wire(m);
-				vm_page_unlock_queues();
+				vm_page_unlock(m);
 			}
 			if ((allocflags & VM_ALLOC_NOBUSY) == 0)
 				vm_page_busy(m);
@@ -2254,7 +2272,7 @@ void 
 vm_page_cowclear(vm_page_t m)
 {
 
-	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+	vm_page_lock_assert(m, MA_OWNED);
 	if (m->cow) {
 		m->cow--;
 		/* 
@@ -2270,6 +2288,7 @@ int
 vm_page_cowsetup(vm_page_t m)
 {
 
+	vm_page_lock_assert(m, MA_OWNED);
 	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
 	if (m->cow == USHRT_MAX - 1)
 		return (EBUSY);

Modified: user/kmacy/head_page_lock_incr/sys/vm/vm_page.h
==============================================================================
--- user/kmacy/head_page_lock_incr/sys/vm/vm_page.h	Fri Apr 30 06:32:37 2010	(r207424)
+++ user/kmacy/head_page_lock_incr/sys/vm/vm_page.h	Fri Apr 30 06:43:35 2010	(r207425)
@@ -359,6 +359,7 @@ void vm_page_sleep(vm_page_t m, const ch
 vm_page_t vm_page_splay(vm_pindex_t, vm_page_t);
 vm_offset_t vm_page_startup(vm_offset_t vaddr);
 void vm_page_unwire (vm_page_t, int);
+void vm_page_unwire_exclusive(vm_page_t, int);
 void vm_page_wire (vm_page_t);
 void vm_page_set_validclean (vm_page_t, int, int);
 void vm_page_clear_dirty (vm_page_t, int, int);

From owner-svn-src-user@FreeBSD.ORG  Sat May  1 01:56:33 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id E31B4106566B;
	Sat,  1 May 2010 01:56:33 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id D36368FC08;
	Sat,  1 May 2010 01:56:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o411uXS9043842;
	Sat, 1 May 2010 01:56:33 GMT (envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o411uXRU043840;
	Sat, 1 May 2010 01:56:33 GMT (envelope-from jmallett@svn.freebsd.org)
Message-Id: <201005010156.o411uXRU043840@svn.freebsd.org>
From: Juli Mallett 
Date: Sat, 1 May 2010 01:56:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207457 - user/jmallett/octeon/sys/mips/mips
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 01 May 2010 01:56:34 -0000

Author: jmallett
Date: Sat May  1 01:56:33 2010
New Revision: 207457
URL: http://svn.freebsd.org/changeset/base/207457

Log:
  Fix PMAP_LMEM_MAP2, per JC.

Modified:
  user/jmallett/octeon/sys/mips/mips/pmap.c

Modified: user/jmallett/octeon/sys/mips/mips/pmap.c
==============================================================================
--- user/jmallett/octeon/sys/mips/mips/pmap.c	Sat May  1 01:05:07 2010	(r207456)
+++ user/jmallett/octeon/sys/mips/mips/pmap.c	Sat May  1 01:56:33 2010	(r207457)
@@ -237,7 +237,7 @@ caddr_t virtual_sys_start = (caddr_t)0;
 	sysm = &sysmap_lmem[cpu];					\
 	va1 = sysm->base;						\
 	va2 = sysm->base + PAGE_SIZE;					\
-	npte = TLBLO_PA_TO_PFN(phys2) |					\
+	npte = TLBLO_PA_TO_PFN(phys1) |					\
 	    PG_D | PG_V | PG_G | PG_W | PG_C_CNC;			\
 	pte = pmap_pte(kernel_pmap, va1);				\
 	*pte = npte;							\

From owner-svn-src-user@FreeBSD.ORG  Sat May  1 02:49:16 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 61926106564A;
	Sat,  1 May 2010 02:49:16 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id 51BFB8FC17;
	Sat,  1 May 2010 02:49:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o412nGYN055390;
	Sat, 1 May 2010 02:49:16 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o412nGQX055388;
	Sat, 1 May 2010 02:49:16 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201005010249.o412nGQX055388@svn.freebsd.org>
From: Doug Barton 
Date: Sat, 1 May 2010 02:49:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207458 - user/dougb/portmaster
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 01 May 2010 02:49:16 -0000

Author: dougb
Date: Sat May  1 02:49:16 2010
New Revision: 207458
URL: http://svn.freebsd.org/changeset/base/207458

Log:
  Expand on an idea provided by mandree@ to use 'pkg_version -I' to quickly
  check what ports are out of date, and incorporate that check into the
  --index option. Feedback from users seems to indicate that this is what
  they expected the option did anyway, so the minor change to the feature
  does not seem to be a POLA violation, especially since INDEX support is
  still relatively new. Add the --index-first option to do what --index used
  to do in case anyone cares.
  
  Add a bunch more error checking for incompatible command line options.
  Add a new cross_idx() to handle checking the 3 --index* options and
  consolidate some of the old tests that were all relative to -G.
  
  We want to test the .bz2 version of INDEX to see if it's newer, and
  unzip it if it is.

Modified:
  user/dougb/portmaster/portmaster

Modified: user/dougb/portmaster/portmaster
==============================================================================
--- user/dougb/portmaster/portmaster	Sat May  1 01:56:33 2010	(r207457)
+++ user/dougb/portmaster/portmaster	Sat May  1 02:49:16 2010	(r207458)
@@ -250,7 +250,7 @@ usage () {
 	echo "    [[[--packages|-P]|[--packages-only|-PP]] | [--packages-build]]"
 	echo "    [--packages-if-newer] [--delete-build-only] [--always-fetch]"
 	echo "    [--local-packagedir=] [--delete-packages]"
-	echo "    [--no-confirm] [--no-term-title] [--index|--index-only]"
+	echo "    [--no-confirm] [--no-term-title] [--index|--index-first|--index-only]"
 	echo "    [-m ] [-x ]"
 	echo "${0##*/} [Common flags] "
 	echo "${0##*/} [Common flags] "
@@ -311,7 +311,8 @@ usage () {
 	echo '   installed and/or updated before proceeding'
 	echo '--no-term-title do not update the xterm title bar'
 	echo ''
-	echo '--index use INDEX-[6-9] to check if a port is out of date'
+	echo '--index use INDEX-[6-9] exclusively to check if a port is up to date'
+	echo '--index-first use the INDEX for status, but double-check with the port'
 	echo '--index-only do not try to use /usr/ports'
 	echo ''
 	echo '--show-work list what ports are and would be installed'
@@ -409,6 +410,18 @@ e2="The --packages-build option and the 
 	esac
 }
 
+cross_idx () {
+	local e1
+
+e1='The --index, --index-first, and --index-only options are mutually exclusive'
+
+	case "$1" in
+	index)		[ -n "$PM_INDEX_FIRST" -o -n "$PM_INDEX_ONLY" ] && fail $e1 ;;
+	first)		[ -n "$PM_INDEX" -o -n "$PM_INDEX_ONLY" ] && fail $e1 ;;
+	only)		[ -n "$PM_INDEX" -o -n "$PM_INDEX_FIRST" ] && fail $e1 ;;
+	esac
+}
+
 for var in "$@" ; do
 	case "$var" in
 	-PP[A-Za-z0-9]*|-*[A-Za-z0-9]PP*)
@@ -437,9 +450,11 @@ for var in "$@" ; do
 				export PM_NO_CONFIRM ;;
 	--no-term-title)	PM_NO_TERM_TITLE=pm_no_term_title
 				export PM_NO_TERM_TITLE ;;
-	--index)		PM_INDEX=pm_index ; export PM_INDEX ;;
+	--index)		cross_idx index ; PM_INDEX=pm_index ; export PM_INDEX ;;
+	--index-first)		PM_INDEX=pm_index ; PM_INDEX_FIRST=pm_index_first
+				cross_idx first ; export PM_INDEX PM_INDEX_FIRST ;;
 	--index-only)		PM_INDEX=pm_index ; PM_INDEX_ONLY=pm_index_only
-				export PM_INDEX PM_INDEX_ONLY ;;
+				cross_idx only ; export PM_INDEX PM_INDEX_ONLY ;;
 	--help)			usage 0 ;;
 	--version)		version ; exit 0 ;;
 	--clean-distfiles)	CLEAN_DISTFILES=clean_distfiles ;;
@@ -455,6 +470,11 @@ for var in "$@" ; do
 	esac
 done
 
+unset var
+
+[ -n "$PM_INDEX" -a -n "$CHECK_PORT_DBDIR" ] &&
+	fail 'The --index* and --check-port-dbdir options are mutually exclusive'
+
 # Do this here so it can use the fancy functions above, and default values
 # can be overridden in the rc files
 if [ "$$" -eq "$PM_PARENT_PID" ]; then
@@ -484,10 +504,10 @@ if [ "$$" -eq "$PM_PARENT_PID" ]; then
 		fi
 
 		PM_INDEX="${INDEXDIR}/${INDEXFILE}"
-		index_time=`stat -f '%Ua' $PM_INDEX 2>/dev/null`
+		index_time=`stat -f '%Ua' ${PM_INDEX}.bz2 2>/dev/null`
 		pm_sv Updating INDEX file
 		$PM_SU_CMD $FETCHINDEX ${PM_INDEX}.bz2 ${MASTER_SITE_INDEX}${INDEXFILE}.bz2
-		if [ $index_time -ne `stat -f '%Ua' $PM_INDEX 2>/dev/null` ]; then
+		if [ $index_time -ne `stat -f '%Ua' ${PM_INDEX}.bz2 2>/dev/null` ]; then
 			temp_index=`pm_mktemp index`
 			bunzip2 < ${PM_INDEX}.bz2 > $temp_index
 			pm_install_s $temp_index $PM_INDEX
@@ -495,6 +515,9 @@ if [ "$$" -eq "$PM_PARENT_PID" ]; then
 			unset temp_index
 		fi
 		unset index_time
+
+		PM_INDEX_PORTS=`pkg_version -Ivl\< $PM_INDEX | cut -f1 -d\<`
+		export PM_INDEX_PORTS
 	fi
 
 	if [ -z "$pd" ]; then
@@ -1039,7 +1062,7 @@ while getopts 'BCDFGHKLPRabde:fghilm:nop
 	C)	DONT_PRE_CLEAN=Copt; ARGS="-C $ARGS" ;;
 	D)	DONT_SCRUB_DISTFILES=Dopt; ARGS="-D $ARGS" ;;
 	F)	FETCH_ONLY=Fopt; ARGS="-F $ARGS" ;;
-	G)	NO_RECURSIVE_CONFIG=Gopt; unset FORCE_CONFIG; ARGS="-G $ARGS" ;;
+	G)	NO_RECURSIVE_CONFIG=Gopt; ARGS="-G $ARGS" ;;
 	H)	HIDE_BUILD=Hopt; ARGS="-H $ARGS" ;;
 	K)	DONT_POST_CLEAN=Kopt; ARGS="-K $ARGS" ;;
 	L)	LIST_PLUS=Lopt ;;
@@ -1085,7 +1108,7 @@ while getopts 'BCDFGHKLPRabde:fghilm:nop
 	esac
 done
 shift $(( $OPTIND - 1 ))
-unset -f packages_init
+unset -f packages_init cross_idx
 
 [ -n "$PM_EXCL" ] && export PM_EXCL
 
@@ -1118,13 +1141,15 @@ if [ -n "$ALWAYS_SCRUB_DISTFILES" -a -n 
 	test_command_line ALWAYS_SCRUB_DISTFILES DONT_SCRUB_DISTFILES ||
 		fail "The -d and -D options are mutually exclusive"
 fi
-[ -n "$FETCH_ONLY" -a -n "$NO_RECURSIVE_CONFIG" ] &&
-	unset NO_RECURSIVE_CONFIG
-[ -n "$NO_RECURSIVE_CONFIG" -a -n "$PM_PACKAGES_BUILD" ] &&
-	fail 'The --packages-build and -G options are mutually exclusive'
-[ -n "$NO_RECURSIVE_CONFIG" -a -n "$PM_DEL_BUILD_ONLY" ] &&
-	fail 'The --delete-build-only and -G options are mutually exclusive'
-
+if [ -n "$NO_RECURSIVE_CONFIG" ]; then
+	[ -n "$FETCH_ONLY" ] && unset NO_RECURSIVE_CONFIG
+	[ -n "$PM_PACKAGES_BUILD" ] &&
+		fail 'The --packages-build and -G options are mutually exclusive'
+	[ -n "$PM_DEL_BUILD_ONLY" ] &&
+		fail 'The --delete-build-only and -G options are mutually exclusive'
+	[ -n "$FORCE_CONFIG" ] &&
+		fail 'The --force-config and -G options are mutually exclusive'
+fi
 unset my_environment
 
 #=============== Begin functions for getopts features and main ===============
@@ -1195,7 +1220,7 @@ check_pkg_version () {
 
 check_for_updates () {
 	# Global: num_updates
-	local list_only nf iport origin port_ver udf do_update
+	local list_only nf iport origin port_ver skip udf do_update
 
 	[ "$1" = 'list' ] && { list_only=list_only; nf=nonfatal; shift; }
 
@@ -1204,15 +1229,14 @@ check_for_updates () {
 	origin=${2:-`origin_from_pdb $iport`} || return 0
 
 	if [ -n "$PM_INDEX" ]; then
-		if port_ver=`parse_index $origin name`; then
-			check_pkg_version $iport $port_ver ||
-				{ do_update=update_index ; }
-		else
-			echo "	===>>> Warning: No INDEX entry for $origin"
-		fi
+		case "$PM_INDEX_PORTS" in
+		*${iport}*) port_ver=`parse_index $origin name` ; do_update=upd_idx ;;
+		esac
+
+		[ -n "$PM_INDEX_FIRST" ] || skip=index_skip
 	fi
 
-	if [ -d "$pd/$origin" -a -z "$do_update" -a -z "$PM_INDEX_ONLY" ]; then
+	if [ -d "$pd/$origin" -a -z "$do_update" -a -z "$skip" ]; then
 		if ! pm_cd $pd/$origin; then
 			if [ -e "$pdb/$iport/+IGNOREME" ]; then
 			echo "	===>>> Warning: Unable to cd to $pd/$origin"
@@ -1224,7 +1248,14 @@ check_for_updates () {
 		fi
 		port_ver=`pm_make -V PKGNAME`
 		[ -z "$port_ver" ] && fail "Is $pd/$origin/Makefile missing?"
+	elif [ -z "$do_update" -a -z "$skip" ]; then
+		find_moved_port $origin $iport $nf
+
+		# If the port has moved, we have to update it, otherwise ignore
+		[ -n "$moved_npd" ] && do_update=do_update6
+	fi
 
+	if [ -z "$do_update" -a -n "$port_ver" ]; then
 		udf="$pdb/$iport/PM_UPGRADE_DONE_FLAG"
 		if [ "$iport" = "$port_ver" ]; then
 			if [ -n "$PM_FORCE" ]; then
@@ -1254,11 +1285,6 @@ check_for_updates () {
 		else
 			check_pkg_version $iport $port_ver $udf || do_update=do_update_check
 		fi
-	elif [ -z "$do_update" -a -z "$PM_INDEX_ONLY" ]; then
-		find_moved_port $origin $iport $nf
-
-		# If the port has moved, we have to update it, otherwise ignore
-		[ -n "$moved_npd" ] && do_update=do_update6
 	fi
 
 	[ -z "$do_update" ] && {
@@ -1269,7 +1295,7 @@ check_for_updates () {
 			echo "	===>>> New version available: $port_ver"
 			[ -e "$pdb/$iport/+IGNOREME" ] &&
 				echo "	===>>> +IGNOREME file is present for $1"
-			[ -z "$PM_INDEX_ONLY" ] && check_state
+			[ -z "$PM_INDEX_ONLY" ] && { pm_cd_pd $origin ;  check_state; }
 			num_updates=$(( $num_updates + 1 ))
 		else
 			unset moved_npd

From owner-svn-src-user@FreeBSD.ORG  Sat May  1 02:53:44 2010
Return-Path: 
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 231C01065672;
	Sat,  1 May 2010 02:53:44 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44])
	by mx1.freebsd.org (Postfix) with ESMTP id 13B428FC12;
	Sat,  1 May 2010 02:53:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o412rh7B056375;
	Sat, 1 May 2010 02:53:43 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o412rhE5056373;
	Sat, 1 May 2010 02:53:43 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201005010253.o412rhE5056373@svn.freebsd.org>
From: Doug Barton 
Date: Sat, 1 May 2010 02:53:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207459 - user/dougb/portmaster
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental " user"
	src tree" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 01 May 2010 02:53:44 -0000

Author: dougb
Date: Sat May  1 02:53:43 2010
New Revision: 207459
URL: http://svn.freebsd.org/changeset/base/207459

Log:
  Document the new working of the --index option, and the new --index-first

Modified:
  user/dougb/portmaster/portmaster.8

Modified: user/dougb/portmaster/portmaster.8
==============================================================================
--- user/dougb/portmaster/portmaster.8	Sat May  1 02:49:16 2010	(r207458)
+++ user/dougb/portmaster/portmaster.8	Sat May  1 02:53:43 2010	(r207459)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 9, 2010
+.Dd May 1, 2010
 .Dt PORTMASTER 8
 .Os
 .Sh NAME
@@ -41,7 +41,7 @@ Common Flags:
 .Op Fl -delete-packages
 .Op Fl -no-confirm
 .Op Fl -no-term-title
-.Op --index|--index-only
+.Op --index|--index-first|--index-only
 .Op Fl m Ar arguments for make
 .Op Fl x Ar glob pattern to exclude from building
 .Nm
@@ -433,7 +433,9 @@ be installed and/or updated before proce
 .It Fl -no-term-title
 do not update the xterm title bar
 .It Fl -index
-use INDEX-[6-9] to check if a port is out of date
+use INDEX-[6-9] exclusively to check if a port is up to date
+.It Fl -index-first
+use the INDEX for status, but double-check with the port
 .It Fl -index-only
 do not try to use
 .Pa /usr/ports .
@@ -658,9 +660,13 @@ along with their related options.
 # Do not update the xterm title bar (--no-term-title)
 # PM_NO_TERM_TITLE=pm_no_term_title
 #
-# Use the INDEX file to check if a port is out of date (--index)
+# Use only the INDEX file to check if a port is out of date (--index)
 # PM_INDEX=pm_index
 #
+# Use the INDEX file first, then check /usr/ports (--index-first)
+# PM_INDEX=pm_index
+# PM_INDEX_FIRST=pm_index_first
+#
 # Use the INDEX file instead of /usr/ports (--index-only)
 # PM_INDEX=pm_index
 # PM_INDEX_ONLY=pm_index_only