Date: Mon, 1 May 2006 21:09:03 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 96514 for review Message-ID: <200605012109.k41L93qH052879@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=96514 Change 96514 by jhb@jhb_slimer on 2006/05/01 21:08:07 IFC @96512. Affected files ... .. //depot/projects/smpng/sys/alpha/conf/DEFAULTS#3 integrate .. //depot/projects/smpng/sys/amd64/amd64/pmap.c#56 integrate .. //depot/projects/smpng/sys/amd64/conf/DEFAULTS#4 integrate .. //depot/projects/smpng/sys/amd64/conf/GENERIC#44 integrate .. //depot/projects/smpng/sys/amd64/conf/NOTES#29 integrate .. //depot/projects/smpng/sys/conf/NOTES#118 integrate .. //depot/projects/smpng/sys/conf/files#174 integrate .. //depot/projects/smpng/sys/conf/files.amd64#42 integrate .. //depot/projects/smpng/sys/conf/files.i386#96 integrate .. //depot/projects/smpng/sys/conf/kmod.mk#57 integrate .. //depot/projects/smpng/sys/conf/options#119 integrate .. //depot/projects/smpng/sys/ddb/db_ps.c#31 integrate .. //depot/projects/smpng/sys/ddb/db_thread.c#6 integrate .. //depot/projects/smpng/sys/ddb/ddb.h#21 integrate .. //depot/projects/smpng/sys/dev/advansys/advansys.c#11 integrate .. //depot/projects/smpng/sys/dev/ath/if_ath.c#39 integrate .. //depot/projects/smpng/sys/dev/atkbdc/atkbd.c#2 integrate .. //depot/projects/smpng/sys/dev/atkbdc/atkbdc.c#3 integrate .. //depot/projects/smpng/sys/dev/atkbdc/atkbdc_isa.c#2 integrate .. //depot/projects/smpng/sys/dev/bce/if_bcereg.h#2 integrate .. //depot/projects/smpng/sys/dev/bfe/if_bfe.c#23 integrate .. //depot/projects/smpng/sys/dev/hptmv/osbsd.h#5 integrate .. //depot/projects/smpng/sys/dev/iwi/if_iwi.c#16 integrate .. //depot/projects/smpng/sys/dev/iwi/if_iwireg.h#8 integrate .. //depot/projects/smpng/sys/dev/iwi/if_iwivar.h#7 integrate .. //depot/projects/smpng/sys/dev/nve/if_nve.c#12 integrate .. //depot/projects/smpng/sys/dev/pccard/pccard.c#42 integrate .. //depot/projects/smpng/sys/dev/pci/pci.c#69 integrate .. //depot/projects/smpng/sys/dev/ppc/ppc_puc.c#4 integrate .. //depot/projects/smpng/sys/dev/puc/puc.c#28 integrate .. //depot/projects/smpng/sys/dev/puc/puc_bfe.h#1 branch .. //depot/projects/smpng/sys/dev/puc/puc_bus.h#1 branch .. //depot/projects/smpng/sys/dev/puc/puc_cfg.c#1 branch .. //depot/projects/smpng/sys/dev/puc/puc_cfg.h#1 branch .. //depot/projects/smpng/sys/dev/puc/puc_ebus.c#9 delete .. //depot/projects/smpng/sys/dev/puc/puc_pccard.c#7 integrate .. //depot/projects/smpng/sys/dev/puc/puc_pci.c#11 integrate .. //depot/projects/smpng/sys/dev/puc/puc_sbus.c#11 delete .. //depot/projects/smpng/sys/dev/puc/pucdata.c#35 integrate .. //depot/projects/smpng/sys/dev/puc/pucvar.h#14 delete .. //depot/projects/smpng/sys/dev/rr232x/LICENSE#1 branch .. //depot/projects/smpng/sys/dev/rr232x/README#1 branch .. //depot/projects/smpng/sys/dev/rr232x/amd64-elf.rr232x_lib.o.uu#1 branch .. //depot/projects/smpng/sys/dev/rr232x/array.h#1 branch .. //depot/projects/smpng/sys/dev/rr232x/him.h#1 branch .. //depot/projects/smpng/sys/dev/rr232x/himfuncs.h#1 branch .. //depot/projects/smpng/sys/dev/rr232x/hptintf.h#1 branch .. //depot/projects/smpng/sys/dev/rr232x/i386-elf.rr232x_lib.o.uu#1 branch .. //depot/projects/smpng/sys/dev/rr232x/ldm.h#1 branch .. //depot/projects/smpng/sys/dev/rr232x/list.h#1 branch .. //depot/projects/smpng/sys/dev/rr232x/os_bsd.c#1 branch .. //depot/projects/smpng/sys/dev/rr232x/os_bsd.h#1 branch .. //depot/projects/smpng/sys/dev/rr232x/osm.h#1 branch .. //depot/projects/smpng/sys/dev/rr232x/osm_bsd.c#1 branch .. //depot/projects/smpng/sys/dev/rr232x/rr232x_config.c#1 branch .. //depot/projects/smpng/sys/dev/rr232x/rr232x_config.h#1 branch .. //depot/projects/smpng/sys/dev/sio/sio_puc.c#9 integrate .. //depot/projects/smpng/sys/dev/sk/if_sk.c#1 branch .. //depot/projects/smpng/sys/dev/sk/if_skreg.h#1 branch .. //depot/projects/smpng/sys/dev/sk/xmaciireg.h#1 branch .. //depot/projects/smpng/sys/dev/sk/yukonreg.h#1 branch .. //depot/projects/smpng/sys/dev/sound/pci/ich.c#43 integrate .. //depot/projects/smpng/sys/dev/twa/tw_osl_cam.c#6 integrate .. //depot/projects/smpng/sys/dev/uart/uart_bus.h#10 integrate .. //depot/projects/smpng/sys/dev/uart/uart_bus_pci.c#7 integrate .. //depot/projects/smpng/sys/dev/uart/uart_bus_puc.c#3 integrate .. //depot/projects/smpng/sys/dev/uart/uart_core.c#13 integrate .. //depot/projects/smpng/sys/dev/uart/uart_dev_ns8250.c#13 integrate .. //depot/projects/smpng/sys/dev/usb/usbdevs#89 integrate .. //depot/projects/smpng/sys/geom/mirror/g_mirror.c#29 integrate .. //depot/projects/smpng/sys/geom/raid3/g_raid3.c#28 integrate .. //depot/projects/smpng/sys/i386/conf/DEFAULTS#4 integrate .. //depot/projects/smpng/sys/i386/conf/GENERIC#74 integrate .. //depot/projects/smpng/sys/i386/conf/NOTES#118 integrate .. //depot/projects/smpng/sys/i386/i386/pmap.c#95 integrate .. //depot/projects/smpng/sys/i386/i386/vm_machdep.c#78 integrate .. //depot/projects/smpng/sys/i386/include/pmap.h#29 integrate .. //depot/projects/smpng/sys/ia64/conf/DEFAULTS#3 integrate .. //depot/projects/smpng/sys/kern/sched_4bsd.c#55 integrate .. //depot/projects/smpng/sys/kern/subr_rman.c#27 integrate .. //depot/projects/smpng/sys/kern/subr_turnstile.c#28 integrate .. //depot/projects/smpng/sys/kern/subr_witness.c#153 integrate .. //depot/projects/smpng/sys/kern/tty_pts.c#3 integrate .. //depot/projects/smpng/sys/kern/vfs_lookup.c#36 integrate .. //depot/projects/smpng/sys/kern/vfs_subr.c#127 integrate .. //depot/projects/smpng/sys/kern/vfs_vnops.c#72 integrate .. //depot/projects/smpng/sys/modules/Makefile#121 integrate .. //depot/projects/smpng/sys/modules/puc/Makefile#2 integrate .. //depot/projects/smpng/sys/modules/rr232x/Makefile#1 branch .. //depot/projects/smpng/sys/modules/sio/Makefile#7 integrate .. //depot/projects/smpng/sys/modules/sk/Makefile#3 integrate .. //depot/projects/smpng/sys/net/if_bridge.c#27 integrate .. //depot/projects/smpng/sys/net80211/ieee80211.c#21 integrate .. //depot/projects/smpng/sys/net80211/ieee80211_node.c#26 integrate .. //depot/projects/smpng/sys/netgraph/netflow/netflow.c#12 integrate .. //depot/projects/smpng/sys/netgraph/netflow/netflow.h#3 integrate .. //depot/projects/smpng/sys/netinet/in_pcb.c#62 integrate .. //depot/projects/smpng/sys/pc98/conf/DEFAULTS#4 integrate .. //depot/projects/smpng/sys/pci/if_sk.c#56 delete .. //depot/projects/smpng/sys/pci/if_skreg.h#15 delete .. //depot/projects/smpng/sys/pci/xmaciireg.h#3 delete .. //depot/projects/smpng/sys/pci/yukonreg.h#3 delete .. //depot/projects/smpng/sys/sparc64/conf/GENERIC#67 integrate .. //depot/projects/smpng/sys/sys/bufobj.h#6 integrate .. //depot/projects/smpng/sys/sys/mac_policy.h#36 integrate .. //depot/projects/smpng/sys/sys/rman.h#16 integrate .. //depot/projects/smpng/sys/ufs/ffs/ffs_vfsops.c#85 integrate Differences ... ==== //depot/projects/smpng/sys/alpha/conf/DEFAULTS#3 (text+ko) ==== @@ -1,11 +1,9 @@ # # DEFAULTS -- Default kernel configuration file for FreeBSD/alpha # -# $FreeBSD: src/sys/alpha/conf/DEFAULTS,v 1.3 2005/11/27 23:16:58 ru Exp $ +# $FreeBSD: src/sys/alpha/conf/DEFAULTS,v 1.4 2006/04/28 21:21:50 marcel Exp $ machine alpha # Pseudo devices. device mem # Memory and kernel memory devices - -options PUC_FASTINTR ==== //depot/projects/smpng/sys/amd64/amd64/pmap.c#56 (text+ko) ==== @@ -77,7 +77,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.549 2006/04/21 04:50:18 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.552 2006/04/29 00:59:15 alc Exp $"); /* * Manages physical address maps. @@ -1449,6 +1449,9 @@ static uint64_t pc_freemask[3] = { PC_FREE0, PC_FREE1, PC_FREE2 }; +SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_count, CTLFLAG_RD, &pv_entry_count, 0, + "Current number of pv entries"); + #ifdef PV_STATS static int pc_chunk_count, pc_chunk_allocs, pc_chunk_frees, pc_chunk_tryfail; @@ -1464,8 +1467,6 @@ static long pv_entry_frees, pv_entry_allocs; static int pv_entry_spare; -SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_count, CTLFLAG_RD, &pv_entry_count, 0, - "Current number of pv entries"); SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_frees, CTLFLAG_RD, &pv_entry_frees, 0, "Current number of pv entry frees"); SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_allocs, CTLFLAG_RD, &pv_entry_allocs, 0, @@ -1545,6 +1546,7 @@ struct pv_chunk *pc; int idx, field, bit; + mtx_assert(&vm_page_queue_mtx, MA_OWNED); PV_STAT(pv_entry_frees++); PV_STAT(pv_entry_spare++); pv_entry_count--; @@ -1566,9 +1568,7 @@ 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_lock_queues(); vm_page_free(m); - vm_page_unlock_queues(); } /* @@ -2060,6 +2060,7 @@ boolean_t wired) { vm_paddr_t pa; + pd_entry_t *pde; register pt_entry_t *pte; vm_paddr_t opa; pt_entry_t origpte, newpte; @@ -2097,7 +2098,13 @@ } #endif - pte = pmap_pte(pmap, va); + pde = pmap_pde(pmap, va); + if (pde != NULL) { + if ((*pde & PG_PS) != 0) + panic("pmap_enter: attempted pmap_enter on 2MB page"); + pte = pmap_pde_to_pte(pde, va); + } else + pte = NULL; /* * Page Directory table entry not valid, we need a new PT page @@ -2110,9 +2117,6 @@ origpte = *pte; opa = origpte & PG_FRAME; - if (origpte & PG_PS) - panic("pmap_enter: attempted pmap_enter on 2MB page"); - /* * Mapping has not changed, must be protection or wiring change. */ @@ -2797,14 +2801,12 @@ 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_lock_queues(); vm_page_free(m); - vm_page_unlock_queues(); } } + vm_page_unlock_queues(); pmap_invalidate_all(pmap); PMAP_UNLOCK(pmap); - vm_page_unlock_queues(); } /* ==== //depot/projects/smpng/sys/amd64/conf/DEFAULTS#4 (text+ko) ==== @@ -1,7 +1,7 @@ # # DEFAULTS -- Default kernel configuration file for FreeBSD/amd64 # -# $FreeBSD: src/sys/amd64/conf/DEFAULTS,v 1.4 2005/11/27 23:16:58 ru Exp $ +# $FreeBSD: src/sys/amd64/conf/DEFAULTS,v 1.5 2006/04/28 21:21:51 marcel Exp $ machine amd64 @@ -11,5 +11,3 @@ # Pseudo devices. device mem # Memory and kernel memory devices device io # I/O device - -options PUC_FASTINTR ==== //depot/projects/smpng/sys/amd64/conf/GENERIC#44 (text+ko) ==== @@ -16,7 +16,7 @@ # If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # -# $FreeBSD: src/sys/amd64/conf/GENERIC,v 1.453 2006/04/24 08:44:33 delphij Exp $ +# $FreeBSD: src/sys/amd64/conf/GENERIC,v 1.454 2006/04/28 05:23:10 scottl Exp $ cpu HAMMER ident GENERIC @@ -128,6 +128,7 @@ device ciss # Compaq Smart RAID 5* device dpt # DPT Smartcache III, IV - See NOTES for options device hptmv # Highpoint RocketRAID 182x +device rr232x # Highpoint RocketRAID 232x device iir # Intel Integrated RAID device ips # IBM (Adaptec) ServeRAID device mly # Mylex AcceleRAID/eXtremeRAID ==== //depot/projects/smpng/sys/amd64/conf/NOTES#29 (text+ko) ==== @@ -4,7 +4,7 @@ # This file contains machine dependent kernel configuration notes. For # machine independent notes, look in /sys/conf/NOTES. # -# $FreeBSD: src/sys/amd64/conf/NOTES,v 1.52 2006/03/06 15:29:28 yar Exp $ +# $FreeBSD: src/sys/amd64/conf/NOTES,v 1.53 2006/04/28 05:23:10 scottl Exp $ # # @@ -281,6 +281,11 @@ device hptmv # +# Highpoint RocketRAID 232x. This is software RAID but with hardware +# acceleration assistance for RAID_5. +device rr232x + +# # IBM (now Adaptec) ServeRAID controllers device ips ==== //depot/projects/smpng/sys/conf/NOTES#118 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/NOTES,v 1.1358 2006/04/18 22:43:46 mjacob Exp $ +# $FreeBSD: src/sys/conf/NOTES,v 1.1359 2006/04/28 21:21:51 marcel Exp $ # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # @@ -1689,15 +1689,8 @@ device scc # PCI Universal Communications driver -# Supports various single and multi port PCI serial cards. Maybe later -# also the parallel ports on combination serial/parallel cards. New cards -# can be added in src/sys/dev/puc/pucdata.c. -# -# If the PUC_FASTINTR option is used the driver will try to use fast -# interrupts. The card must then be the only user of that interrupt. -# Interrupts cannot be shared when using PUC_FASTINTR. +# Supports various multi port PCI I/O cards. device puc -options PUC_FASTINTR # # Network interfaces: ==== //depot/projects/smpng/sys/conf/files#174 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/files,v 1.1111 2006/04/24 23:31:49 marcel Exp $ +# $FreeBSD: src/sys/conf/files,v 1.1113 2006/04/28 21:21:51 marcel Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -805,10 +805,9 @@ dev/pst/pst-pci.c optional pst pci dev/pst/pst-raid.c optional pst dev/puc/puc.c optional puc -dev/puc/puc_ebus.c optional puc ebus +dev/puc/puc_cfg.c optional puc dev/puc/puc_pccard.c optional puc pccard dev/puc/puc_pci.c optional puc pci -dev/puc/puc_sbus.c optional puc fhc | puc sbus dev/puc/pucdata.c optional puc pci dev/ral/rt2560.c optional ral dev/ral/rt2661.c optional ral @@ -845,7 +844,8 @@ dev/si/si_pci.c optional si pci dev/sio/sio_pccard.c optional sio pccard dev/sio/sio_pci.c optional sio pci -dev/sio/sio_puc.c optional sio puc pci +dev/sio/sio_puc.c optional sio puc +dev/sk/if_sk.c optional sk pci dev/smbus/smb.c optional smb dev/smbus/smbconf.c optional smbus dev/smbus/smbus.c optional smbus @@ -1320,7 +1320,7 @@ kern/md5c.c standard kern/sched_4bsd.c optional sched_4bsd kern/sched_ule.c optional sched_ule -kern/serdev_if.m optional scc +kern/serdev_if.m optional puc | scc kern/subr_autoconf.c standard kern/subr_blist.c standard kern/subr_bus.c standard @@ -1838,7 +1838,6 @@ pci/if_rl.c optional rl pci pci/if_sf.c optional sf pci pci/if_sis.c optional sis pci -pci/if_sk.c optional sk pci pci/if_ste.c optional ste pci pci/if_tl.c optional tl pci pci/if_vr.c optional vr pci ==== //depot/projects/smpng/sys/conf/files.amd64#42 (text+ko) ==== @@ -1,7 +1,7 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $FreeBSD: src/sys/conf/files.amd64,v 1.85 2006/04/24 23:31:50 marcel Exp $ +# $FreeBSD: src/sys/conf/files.amd64,v 1.86 2006/04/28 05:23:09 scottl Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -72,6 +72,10 @@ dependency "$S/dev/hptmv/amd64-elf.raid.o.uu" \ compile-with "uudecode < $S/dev/hptmv/amd64-elf.raid.o.uu" \ no-implicit-rule +rr232x_lib.o optional rr232x \ + dependency "$S/dev/rr232x/amd64-elf.rr232x_lib.o.uu" \ + compile-with "uudecode < $S/dev/rr232x/amd64-elf.rr232x_lib.o.uu" \ + no-implicit-rule # amd64/acpica/OsdEnvironment.c optional acpi amd64/acpica/acpi_machdep.c optional acpi @@ -174,6 +178,9 @@ dev/kbd/kbd.c optional atkbd | sc | ukbd dev/mem/memutil.c optional mem dev/nve/if_nve.c optional nve pci +dev/rr232x/os_bsd.c optional rr232x +dev/rr232x/osm_bsd.c optional rr232x +dev/rr232x/rr232x_config.c optional rr232x dev/sio/sio.c optional sio dev/sio/sio_isa.c optional sio isa dev/speaker/spkr.c optional speaker ==== //depot/projects/smpng/sys/conf/files.i386#96 (text+ko) ==== @@ -1,7 +1,7 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $FreeBSD: src/sys/conf/files.i386,v 1.555 2006/04/24 23:31:50 marcel Exp $ +# $FreeBSD: src/sys/conf/files.i386,v 1.556 2006/04/27 20:22:44 scottl Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -77,6 +77,11 @@ compile-with "uudecode < $S/dev/hptmv/i386-elf.raid.o.uu" \ no-implicit-rule # +rr232x_lib.o optional rr232x \ + dependency "$S/dev/rr232x/i386-elf.rr232x_lib.o.uu" \ + compile-with "uudecode < $S/dev/rr232x/i386-elf.rr232x_lib.o.uu" \ + no-implicit-rule +# # compat/linux/linux_file.c optional compat_linux compat/linux/linux_getcwd.c optional compat_linux @@ -194,6 +199,9 @@ dev/nve/if_nve.c optional nve pci dev/pcf/pcf_isa.c optional pcf dev/random/nehemiah.c optional random +dev/rr232x/os_bsd.c optional rr232x +dev/rr232x/osm_bsd.c optional rr232x +dev/rr232x/rr232x_config.c optional rr232x dev/sbni/if_sbni.c optional sbni dev/sbni/if_sbni_isa.c optional sbni isa dev/sbni/if_sbni_pci.c optional sbni pci ==== //depot/projects/smpng/sys/conf/kmod.mk#57 (text+ko) ==== @@ -1,5 +1,5 @@ # From: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 -# $FreeBSD: src/sys/conf/kmod.mk,v 1.206 2006/02/24 01:49:36 marcel Exp $ +# $FreeBSD: src/sys/conf/kmod.mk,v 1.207 2006/04/28 21:21:51 marcel Exp $ # # The include file <bsd.kmod.mk> handles building and installing loadable # kernel modules. @@ -321,8 +321,8 @@ dev/pci/pcib_if.m dev/ppbus/ppbus_if.m dev/smbus/smbus_if.m \ dev/sound/pcm/ac97_if.m dev/sound/pcm/channel_if.m \ dev/sound/pcm/feeder_if.m dev/sound/pcm/mixer_if.m \ - dev/usb/usb_if.m isa/isa_if.m \ - kern/bus_if.m kern/cpufreq_if.m kern/device_if.m \ + dev/usb/usb_if.m isa/isa_if.m kern/bus_if.m kern/cpufreq_if.m \ + kern/device_if.m kern/serdev_if.m \ libkern/iconv_converter_if.m opencrypto/crypto_if.m \ pc98/pc98/canbus_if.m pci/agp_if.m ==== //depot/projects/smpng/sys/conf/options#119 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/options,v 1.537 2006/04/25 15:56:52 mr Exp $ +# $FreeBSD: src/sys/conf/options,v 1.538 2006/04/28 21:21:51 marcel Exp $ # # On the handling of kernel options # @@ -125,7 +125,6 @@ PPC_PROBE_CHIPSET opt_ppc.h PPS_SYNC opt_ntp.h PREEMPTION opt_sched.h -PUC_FASTINTR opt_puc.h QUOTA SCHED_4BSD opt_sched.h SCHED_ULE opt_sched.h ==== //depot/projects/smpng/sys/ddb/db_ps.c#31 (text+ko) ==== @@ -28,143 +28,401 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/ddb/db_ps.c,v 1.55 2004/11/20 02:32:42 das Exp $"); +__FBSDID("$FreeBSD: src/sys/ddb/db_ps.c,v 1.59 2006/04/27 22:09:18 jhb Exp $"); #include <sys/param.h> +#include <sys/cons.h> +#include <sys/jail.h> +#include <sys/kdb.h> +#include <sys/linker_set.h> +#include <sys/proc.h> +#include <sys/sysent.h> #include <sys/systm.h> -#include <sys/lock.h> -#include <sys/mutex.h> -#include <sys/proc.h> -#include <sys/cons.h> #include <vm/vm.h> #include <vm/vm_param.h> #include <vm/pmap.h> #include <ddb/ddb.h> -static void dumpthread(volatile struct proc *p, volatile struct thread *td); +/* XXX I'd prefer a better way. */ +#if defined(__alpha__) || defined(__amd64__) || defined(__ia64__) || defined(__sparc64__) +#define PTR64 +#endif + +#ifdef PTR64 +CTASSERT(sizeof(uintptr_t) == sizeof(uint64_t)); +#else +CTASSERT(sizeof(uintptr_t) == sizeof(uint32_t)); +#endif + +static void dumpthread(volatile struct proc *p, volatile struct thread *td, + int all); +/* + * Layout: + * - column counts + * - header + * - single-threaded process + * - multi-threaded process + * - thread in a MT process + * + * 1 2 3 4 5 6 7 + * 1234567890123456789012345678901234567890123456789012345678901234567890 + * pid uid ppid pgrp state wmesg wchan cmd + * <pid> <ui> <ppi> <pgi> <stat> < wmesg > < wchan > <name> + * <pid> <ui> <ppi> <pgi> <stat> (threaded) <command> + * <tid > <stat> < wmesg > < wchan > <name> + * + * For machines with 64-bit pointers, we expand the wchan field 8 more + * characters. + */ void -db_ps(dummy1, dummy2, dummy3, dummy4) - db_expr_t dummy1; - boolean_t dummy2; - db_expr_t dummy3; - char * dummy4; +db_ps(db_expr_t addr, boolean_t hasaddr, db_expr_t count, char *modif) { volatile struct proc *p, *pp; volatile struct thread *td; - char *state; - int np, quit; + struct ucred *cred; + struct pgrp *pgrp; + char state[9]; + int np, quit, rflag, sflag, dflag, lflag, wflag; np = nprocs; quit = 0; - /* sx_slock(&allproc_lock); */ if (!LIST_EMPTY(&allproc)) p = LIST_FIRST(&allproc); else p = &proc0; db_setup_paging(db_simple_pager, &quit, db_lines_per_page); - db_printf(" pid proc uid ppid pgrp flag stat wmesg wchan cmd\n"); +#ifdef PTR64 + db_printf(" pid uid ppid pgrp state wmesg wchan cmd\n"); +#else + db_printf(" pid uid ppid pgrp state wmesg wchan cmd\n"); +#endif while (--np >= 0 && !quit) { if (p == NULL) { - printf("oops, ran out of processes early!\n"); + db_printf("oops, ran out of processes early!\n"); break; } - /* PROC_LOCK(p); */ pp = p->p_pptr; if (pp == NULL) pp = p; + cred = p->p_ucred; + pgrp = p->p_pgrp; + db_printf("%5d %4d %5d %5d ", p->p_pid, + cred != NULL ? cred->cr_ruid : 0, pp->p_pid, + pgrp != NULL ? pgrp->pg_id : 0); - switch(p->p_state) { + /* Determine our primary process state. */ + switch (p->p_state) { case PRS_NORMAL: if (P_SHOULDSTOP(p)) - state = "stop"; - else - state = ""; + state[0] = 'T'; + else { + /* + * One of D, L, R, S, W. For a + * multithreaded process we will use + * the state of the thread with the + * highest precedence. The + * precendence order from high to low + * is R, L, D, S, W. If no thread is + * in a sane state we use '?' for our + * primary state. + */ + rflag = sflag = dflag = lflag = wflag = 0; + FOREACH_THREAD_IN_PROC(p, td) { + if (td->td_state == TDS_RUNNING || + td->td_state == TDS_RUNQ || + td->td_state == TDS_CAN_RUN) + rflag++; + if (TD_ON_LOCK(td)) + lflag++; + if (TD_IS_SLEEPING(td)) { + if (!td->td_flags & TDF_SINTR) + dflag++; + else + sflag++; + } + if (TD_AWAITING_INTR(td)) + wflag++; + } + if (rflag) + state[0] = 'R'; + else if (lflag) + state[0] = 'L'; + else if (dflag) + state[0] = 'D'; + else if (sflag) + state[0] = 'S'; + else if (wflag) + state[0] = 'W'; + else + state[0] = '?'; + } break; case PRS_NEW: - state = "new "; + state[0] = 'N'; break; case PRS_ZOMBIE: - state = "zomb"; + state[0] = 'Z'; break; default: - state = "Unkn"; + state[0] = 'U'; break; } - db_printf("%5d %8p %4d %5d %5d %07x %s", - p->p_pid, (volatile void *)p, - p->p_ucred != NULL ? p->p_ucred->cr_ruid : 0, pp->p_pid, - p->p_pgrp != NULL ? p->p_pgrp->pg_id : 0, p->p_flag, - state); + state[1] = '\0'; + + /* Additional process state flags. */ + if (!p->p_sflag & PS_INMEM) + strlcat(state, "W", sizeof(state)); + if (p->p_flag & P_TRACED) + strlcat(state, "X", sizeof(state)); + if (p->p_flag & P_WEXIT && p->p_state != PRS_ZOMBIE) + strlcat(state, "E", sizeof(state)); + if (p->p_flag & P_PPWAIT) + strlcat(state, "V", sizeof(state)); + if (p->p_flag & P_SYSTEM || p->p_lock > 0) + strlcat(state, "L", sizeof(state)); + if (p->p_session != NULL && SESS_LEADER(p)) + strlcat(state, "s", sizeof(state)); + /* Cheated here and didn't compare pgid's. */ + if (p->p_flag & P_CONTROLT) + strlcat(state, "+", sizeof(state)); + if (cred != NULL && jailed(cred)) + strlcat(state, "J", sizeof(state)); + db_printf(" %-6.6s ", state); if (p->p_flag & P_HADTHREADS) - db_printf("(threaded) %s\n", p->p_comm); +#ifdef PTR64 + db_printf(" (threaded) %s\n", + p->p_comm); +#else + db_printf(" (threaded) %s\n", p->p_comm); +#endif FOREACH_THREAD_IN_PROC(p, td) { - dumpthread(p, td); + dumpthread(p, td, p->p_flag & P_HADTHREADS); if (quit) break; } - /* PROC_UNLOCK(p); */ p = LIST_NEXT(p, p_list); if (p == NULL && np > 0) p = LIST_FIRST(&zombproc); } - /* sx_sunlock(&allproc_lock); */ } static void -dumpthread(volatile struct proc *p, volatile struct thread *td) +dumpthread(volatile struct proc *p, volatile struct thread *td, int all) +{ + char state[9], wprefix; + const char *wmesg; + void *wchan; + + if (all) { + db_printf(" %9d ", td->td_tid); + switch (td->td_state) { + case TDS_RUNNING: + snprintf(state, sizeof(state), "Run"); + break; + case TDS_RUNQ: + snprintf(state, sizeof(state), "RunQ"); + break; + case TDS_CAN_RUN: + snprintf(state, sizeof(state), "CanRun"); + break; + case TDS_INACTIVE: + snprintf(state, sizeof(state), "Inactv"); + break; + case TDS_INHIBITED: + state[0] = '\0'; + if (TD_ON_LOCK(td)) + strlcat(state, "L", sizeof(state)); + if (TD_IS_SLEEPING(td)) { + if (td->td_flags & TDF_SINTR) + strlcat(state, "S", sizeof(state)); + else + strlcat(state, "D", sizeof(state)); + } + if (TD_IS_SWAPPED(td)) + strlcat(state, "W", sizeof(state)); + if (TD_AWAITING_INTR(td)) + strlcat(state, "I", sizeof(state)); + if (TD_IS_SUSPENDED(td)) + strlcat(state, "s", sizeof(state)); + if (state[0] != '\0') + break; + default: + snprintf(state, sizeof(state), "???"); + } + db_printf(" %-6.6s ", state); + } + wprefix = ' '; + if (TD_ON_LOCK(td)) { + wprefix = '*'; + wmesg = td->td_lockname; + wchan = td->td_blocked; + } else if (TD_ON_SLEEPQ(td)) { + wmesg = td->td_wmesg; + wchan = td->td_wchan; + } else if (TD_IS_RUNNING(td)) { + snprintf(state, sizeof(state), "CPU %d", td->td_oncpu); + wmesg = state; + wchan = NULL; + } else { + wmesg = ""; + wchan = NULL; + } + db_printf("%c%-8.8s ", wprefix, wmesg); + if (wchan == NULL) +#ifdef PTR64 + db_printf("%18s ", ""); +#else + db_printf("%10s ", ""); +#endif + else + db_printf("%p ", wchan); + if (p->p_flag & P_SYSTEM) + db_printf("["); + if (td->td_name[0] != '\0') + db_printf("%s", td->td_name); + else + db_printf("%s", td->td_proc->p_comm); + if (p->p_flag & P_SYSTEM) + db_printf("]"); + db_printf("\n"); +} + +DB_SHOW_COMMAND(thread, db_show_thread) { + struct thread *td; + boolean_t comma; + + /* Determine which thread to examine. */ + if (have_addr) + td = db_lookup_thread(addr, FALSE); + else + td = kdb_thread; - if (p->p_flag & P_HADTHREADS) - db_printf( " thread %p ksegrp %p ", td, td->td_ksegrp); - if (TD_ON_SLEEPQ(td)) - db_printf("[SLPQ %s %p]", td->td_wmesg, (void *)td->td_wchan); + db_printf("Thread %d at %p:\n", td->td_tid, td); + db_printf(" proc (pid %d): %p ", td->td_proc->p_pid, td->td_proc); + db_printf(" ksegrp: %p\n", td->td_ksegrp); + if (td->td_name[0] != '\0') + db_printf(" name: %s\n", td->td_name); + db_printf(" flags: %#x ", td->td_flags); + db_printf(" pflags: %#x\n", td->td_pflags); + db_printf(" state: "); switch (td->td_state) { + case TDS_INACTIVE: + db_printf("INACTIVE\n"); + break; + case TDS_CAN_RUN: + db_printf("CAN RUN\n"); + break; + case TDS_RUNQ: + db_printf("RUNQ\n"); + break; + case TDS_RUNNING: + db_printf("RUNNING (CPU %d)\n", td->td_oncpu); + break; case TDS_INHIBITED: - if (TD_ON_LOCK(td)) { - db_printf("[LOCK %6s %8p]", - td->td_lockname, - (void *)td->td_blocked); + db_printf("INHIBITED: {"); + comma = FALSE; + if (TD_IS_SLEEPING(td)) { + db_printf("SLEEPING"); + comma = TRUE; + } + if (TD_IS_SUSPENDED(td)) { + if (comma) + db_printf(", "); + db_printf("SUSPENDED"); + comma = TRUE; } - if (TD_IS_SLEEPING(td)) { - db_printf("[SLP]"); - } if (TD_IS_SWAPPED(td)) { - db_printf("[SWAP]"); + if (comma) + db_printf(", "); + db_printf("SWAPPED"); + comma = TRUE; } - if (TD_IS_SUSPENDED(td)) { - db_printf("[SUSP]"); + if (TD_ON_LOCK(td)) { + if (comma) + db_printf(", "); + db_printf("LOCK"); + comma = TRUE; } if (TD_AWAITING_INTR(td)) { - db_printf("[IWAIT]"); + if (comma) + db_printf(", "); + db_printf("IWAIT"); } + db_printf("}\n"); break; - case TDS_CAN_RUN: - db_printf("[Can run]"); + default: + db_printf("??? (%#x)\n", td->td_state); break; - case TDS_RUNQ: - db_printf("[RUNQ]"); + } + if (TD_ON_LOCK(td)) + db_printf(" lock: %s turnstile: %p\n", td->td_lockname, + td->td_blocked); + if (TD_ON_SLEEPQ(td)) + db_printf(" wmesg: %s wchan: %p\n", td->td_wmesg, + td->td_wchan); + db_printf(" priority: %d\n", td->td_priority); +} + +DB_SHOW_COMMAND(proc, db_show_proc) +{ + struct thread *td; + struct proc *p; + int i, quit; + + /* Determine which process to examine. */ + if (have_addr) + p = db_lookup_proc(addr); + else + p = kdb_thread->td_proc; + + quit = 0; + db_setup_paging(db_simple_pager, &quit, db_lines_per_page); + db_printf("Process %d (%s) at %p:\n", p->p_pid, p->p_comm, p); + db_printf(" state: "); + switch (p->p_state) { + case PRS_NEW: + db_printf("NEW\n"); break; - case TDS_RUNNING: - db_printf("[CPU %d]", td->td_oncpu); + case PRS_NORMAL: + db_printf("NORMAL\n"); break; - case TDS_INACTIVE: - db_printf("[INACTIVE]"); + case PRS_ZOMBIE: + db_printf("ZOMBIE\n"); break; default: - db_printf("[UNK: %#x]", td->td_state); + db_printf("??? (%#x)\n", p->p_state); } - if (p->p_flag & P_HADTHREADS) { -#ifdef KEF_DIDRUN - if (td->td_kse) - db_printf("[kse %p]", td->td_kse); -#endif + if (p->p_ucred != NULL) { + db_printf(" uid: %d gids: ", p->p_ucred->cr_uid); + for (i = 0; i < p->p_ucred->cr_ngroups; i++) { + db_printf("%d", p->p_ucred->cr_groups[i]); + if (i < (p->p_ucred->cr_ngroups - 1)) + db_printf(", "); + } db_printf("\n"); - } else - db_printf(" %s\n", p->p_comm); + } + if (p->p_pptr != NULL) + db_printf(" parent: pid %d at %p\n", p->p_pptr->p_pid, + p->p_pptr); + if (p->p_leader != NULL && p->p_leader != p) + db_printf(" leader: pid %d at %p\n", p->p_leader->p_pid, + p->p_leader); + if (p->p_sysent != NULL) + db_printf(" ABI: %s\n", p->p_sysent->sv_name); + if (p->p_args != NULL) + db_printf(" arguments: %.*s\n", (int)p->p_args->ar_length, + p->p_args->ar_args); + db_printf(" threads: %d\n", p->p_numthreads); + FOREACH_THREAD_IN_PROC(p, td) { + dumpthread(p, td, 1); + if (quit) + break; + } } ==== //depot/projects/smpng/sys/ddb/db_thread.c#6 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/ddb/db_thread.c,v 1.4 2005/01/06 01:34:41 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/ddb/db_thread.c,v 1.5 2006/04/25 20:22:48 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -38,6 +38,8 @@ #include <ddb/db_command.h> #include <ddb/db_sym.h> +static db_expr_t hex2dec(db_expr_t expr); + void db_print_thread(void) { @@ -108,3 +110,93 @@ thr = kdb_thr_next(thr); } } + +/* + * Take the parsed expression value from the command line that was parsed + * as a hexadecimal value and convert it as if the expression was parsed + * as a decimal value. Returns -1 if the expression was not a valid + * decimal value. + */ +static db_expr_t +hex2dec(db_expr_t expr) +{ + uintptr_t x, y; + db_expr_t val; + + y = 1; + val = 0; + x = expr; + while (x != 0) { + if (x % 16 > 9) + return (-1); + val += (x % 16) * (y); + x >>= 4; + y *= 10; + } + return (val); +} + +/* + * Lookup a thread based on a db expression address. We assume that the + * address was parsed in hexadecimal. We reparse the address in decimal + * first and try to treat it as a thread ID to find an associated thread. + * If that fails and check_pid is true, we terat the decimal value as a + * PID. If that matches a process, we return the first thread in that + * process. Otherwise, we treat the addr as a pointer to a thread. + */ +struct thread * >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605012109.k41L93qH052879>