diff -urpN -x compile /usr/src/sys.orig/cam/cam_debug.h sys/cam/cam_debug.h --- /usr/src/sys.orig/cam/cam_debug.h Tue Dec 28 22:54:25 1999 +++ sys/cam/cam_debug.h Tue Jun 26 14:37:27 2001 @@ -55,6 +55,14 @@ extern struct cam_path *cam_dpath; extern u_int32_t cam_dflags; /* Printf delay value (to prevent scrolling */ extern u_int32_t cam_debug_delay; +extern unsigned long long cam_debug_lasttime; + +#define CAM_TIME_DIFF ({ unsigned long long now = rdtsc(); \ + u_int32_t diff, mhz = tsc_freq/1000/1000; \ + if (mhz == 0) mhz = 800; /* xxx */ \ + diff = (now - cam_debug_lasttime)/mhz; \ + cam_debug_lasttime = now; diff; }) +#define PRINT_TIME_DIFF printf("%5d | ", CAM_TIME_DIFF) /* Debugging macros. */ #define CAM_DEBUGGED(path, flag) \ @@ -67,13 +75,21 @@ extern u_int32_t cam_debug_delay; && (cam_dpath != NULL) \ && (xpt_path_comp(cam_dpath, path) >= 0) \ && (xpt_path_comp(cam_dpath, path) < 2)) { \ + PRINT_TIME_DIFF; \ xpt_print_path(path); \ printf printfargs; \ if (cam_debug_delay != 0) \ DELAY(cam_debug_delay); \ + } else if (cam_dflags & (flag)) { \ + PRINT_TIME_DIFF; \ + printf("cam_dpath: "); \ + printf printfargs; \ + if (cam_debug_delay != 0) \ + DELAY(cam_debug_delay); \ } #define CAM_DEBUG_PRINT(flag, printfargs) \ if (cam_dflags & (flag)) { \ + PRINT_TIME_DIFF; \ printf("cam_debug: "); \ printf printfargs; \ if (cam_debug_delay != 0) \ diff -urpN -x compile /usr/src/sys.orig/cam/cam_xpt.c sys/cam/cam_xpt.c --- /usr/src/sys.orig/cam/cam_xpt.c Fri Mar 16 23:24:51 2001 +++ sys/cam/cam_xpt.c Tue Jun 26 14:18:44 2001 @@ -614,6 +614,7 @@ static u_int bus_generation; struct cam_path *cam_dpath; u_int32_t cam_dflags; u_int32_t cam_debug_delay; +unsigned long long cam_debug_lasttime = 0; #endif #if defined(CAM_DEBUG_FLAGS) && !defined(CAMDEBUG) @@ -3422,6 +3423,16 @@ xpt_polled_action(union ccb *start_ccb) splx(s); } +extern void (*disk_doIO)(void *xxx); +extern int force_dequeue_now; +static struct cam_periph *last_periph; +static u_int32_t last_prio; +static void _disk_doIO(void *xxx /* will be void* for disk */) +{ + if (!last_periph) { printf("ERROR: last_periph NULL\n"); return; } + xpt_schedule(last_periph, last_prio); +} + /* * Schedule a peripheral driver to receive a ccb when it's * target device has space for more transactions. @@ -3432,6 +3443,10 @@ xpt_schedule(struct cam_periph *perph, u struct cam_ed *device; int s; int runq; + + last_periph = perph; + last_prio = new_priority; + disk_doIO = _disk_doIO; CAM_DEBUG(perph->path, CAM_DEBUG_TRACE, ("xpt_schedule\n")); device = perph->path->device; diff -urpN -x compile /usr/src/sys.orig/cam/scsi/scsi_da.c sys/cam/scsi/scsi_da.c --- /usr/src/sys.orig/cam/scsi/scsi_da.c Tue Apr 17 22:48:53 2001 +++ sys/cam/scsi/scsi_da.c Thu Jul 12 11:08:51 2001 @@ -873,8 +873,7 @@ daoninvalidate(struct cam_periph *periph * XXX Handle any transactions queued to the card * with XPT_ABORT_CCB. */ - while ((q_bp = bufq_first(&softc->buf_queue)) != NULL){ - bufq_remove(&softc->buf_queue, q_bp); + while ((q_bp = bufq_first_remove(&softc->buf_queue)) != NULL){ q_bp->b_resid = q_bp->b_bcount; q_bp->b_error = ENXIO; q_bp->b_flags |= B_ERROR; @@ -1088,14 +1087,15 @@ dastart(struct cam_periph *periph, union { /* Pull a buffer from the queue and get going on it */ struct buf *bp; + int hasany = 0; int s; /* * See if there is a buf with work for us to do.. */ s = splbio(); - bp = bufq_first(&softc->buf_queue); if (periph->immediate_priority <= periph->pinfo.priority) { + hasany = bufq_hasany(&softc->buf_queue); CAM_DEBUG_PRINT(CAM_DEBUG_SUBTRACE, ("queuing for immediate ccb\n")); start_ccb->ccb_h.ccb_state = DA_CCB_WAITING; @@ -1104,16 +1104,15 @@ dastart(struct cam_periph *periph, union periph->immediate_priority = CAM_PRIORITY_NONE; splx(s); wakeup(&periph->ccb_list); - } else if (bp == NULL) { + } else if ((bp = bufq_first_remove(&softc->buf_queue)) == 0) { splx(s); xpt_release_ccb(start_ccb); } else { int oldspl; u_int8_t tag_code; - bufq_remove(&softc->buf_queue, bp); - devstat_start_transaction(&softc->device_stats); + bp->b_t_iostart = ll_microtime(); if ((bp->b_flags & B_ORDERED) != 0 || (softc->flags & DA_FLAG_NEED_OTAG) != 0) { @@ -1154,13 +1153,13 @@ dastart(struct cam_periph *periph, union } start_ccb->ccb_h.ccb_bp = bp; - bp = bufq_first(&softc->buf_queue); + hasany = bufq_hasany(&softc->buf_queue); splx(s); xpt_action(start_ccb); } - if (bp != NULL) { + if (hasany) { /* Have more work to do, so ensure we stay scheduled */ xpt_schedule(periph, /* XXX priority */1); } @@ -1254,9 +1253,8 @@ dadone(struct cam_periph *periph, union * the client can retry these I/Os in the * proper order should it attempt to recover. */ - while ((q_bp = bufq_first(&softc->buf_queue)) + while ((q_bp = bufq_first_remove(&softc->buf_queue)) != NULL) { - bufq_remove(&softc->buf_queue, q_bp); q_bp->b_resid = q_bp->b_bcount; q_bp->b_error = EIO; q_bp->b_flags |= B_ERROR; diff -urpN -x compile /usr/src/sys.orig/conf/files sys/conf/files --- /usr/src/sys.orig/conf/files Sun Mar 4 23:33:20 2001 +++ sys/conf/files Sun May 6 14:01:27 2001 @@ -1223,3 +1223,4 @@ libkern/strtol.c standard libkern/strtoq.c standard libkern/strtoul.c standard libkern/strtouq.c standard +libkern/krap.c standard diff -urpN -x compile /usr/src/sys.orig/dev/ata/ata-all.c sys/dev/ata/ata-all.c --- /usr/src/sys.orig/dev/ata/ata-all.c Wed Apr 18 02:06:47 2001 +++ sys/dev/ata/ata-all.c Fri Jun 22 23:41:25 2001 @@ -1190,6 +1190,20 @@ out: return; } +extern void (*disk_doIO)(void *xxx); +extern int force_dequeue_now; +static struct ata_softc *last_scp = 0; /* HACK */ +static void _disk_doIO(void *xxx /* will be void* for disk */) +{ + struct ata_softc *scp = last_scp; + last_scp = NULL; + disk_doIO = NULL; + if (!scp) { printf("ERROR: last_scp NULL\n"); return; } + scp->active = ATA_IDLE; + scp->running = NULL; + ata_start(scp); +} + void ata_start(struct ata_softc *scp) { @@ -1204,6 +1218,9 @@ ata_start(struct ata_softc *scp) return; scp->active = ATA_ACTIVE; + last_scp = scp; + disk_doIO = _disk_doIO; + force_dequeue_now = 0; #if NATADISK > 0 /* find & call the responsible driver if anything on the ATA queue */ diff -urpN -x compile /usr/src/sys.orig/dev/ata/ata-disk.c sys/dev/ata/ata-disk.c --- /usr/src/sys.orig/dev/ata/ata-disk.c Thu Apr 5 12:21:54 2001 +++ sys/dev/ata/ata-disk.c Fri Jun 22 23:46:13 2001 @@ -32,6 +32,7 @@ #include "opt_ata.h" #include #include +#include #include #include #include @@ -291,7 +292,7 @@ adstrategy(struct buf *bp) return; } - s = splbio(); + s = splhigh(); bufqdisksort(&adp->queue, bp); ata_start(adp->controller); splx(s); @@ -375,7 +376,7 @@ addump(dev_t dev) void ad_start(struct ad_softc *adp) { - struct buf *bp = bufq_first(&adp->queue); + struct buf *bp = bufq_first_remove(&adp->queue); struct ad_request *request; int tag = 0; @@ -422,9 +423,6 @@ ad_start(struct ad_softc *adp) /* insert in tag array */ adp->tags[tag] = request; - /* remove from drive queue */ - bufq_remove(&adp->queue, bp); - /* link onto controller queue */ TAILQ_INSERT_TAIL(&adp->controller->ata_queue, request, chain); } @@ -475,6 +473,7 @@ ad_transfer(struct ad_request *request) request->currentsize = min(request->bytecount, adp->transfersize); devstat_start_transaction(&adp->stats); + request->bp->b_t_iostart = ll_microtime(); /* does this drive & transfer work with DMA ? */ request->flags &= ~ADR_F_DMA_USED; @@ -821,7 +820,7 @@ ad_service(struct ad_softc *adp, int cha static void ad_free(struct ad_request *request) { - int s = splbio(); + int s = splhigh(); if (request->dmatab) free(request->dmatab, M_DEVBUF); @@ -880,7 +879,7 @@ static void ad_timeout(struct ad_request *request) { struct ad_softc *adp = request->device; - int s = splbio(); + int s = splhigh(); adp->controller->running = NULL; printf("ad%d: %s command timeout tag=%d serv=%d - resetting\n", diff -urpN -x compile /usr/src/sys.orig/i386/conf/GENKERNEL sys/i386/conf/GENKERNEL --- /usr/src/sys.orig/i386/conf/GENKERNEL Wed Dec 31 18:00:00 1969 +++ sys/i386/conf/GENKERNEL Thu Aug 23 10:57:52 2001 @@ -0,0 +1,293 @@ +# +# GENERIC -- Generic kernel configuration file for FreeBSD/i386 +# +# For more information on this file, please read the handbook section on +# Kernel Configuration Files: +# +# http://www.FreeBSD.org/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ./LINT configuration file. If you are +# in doubt as to the purpose or necessity of a line, check first in LINT. +# +# $FreeBSD: src/sys/i386/conf/GENERIC,v 1.246.2.24 2001/04/05 17:23:10 sos Exp $ + +machine i386 +cpu I386_CPU +cpu I486_CPU +cpu I586_CPU +cpu I686_CPU +ident GENKERNEL +#ssiyer: 32->512. I like large numbers. +maxusers 512 + +#makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols + +options MATH_EMULATE #Support for x87 emulation +options INET #InterNETworking +options INET6 #IPv6 communications protocols +options FFS #Berkeley Fast Filesystem +options FFS_ROOT #FFS usable as root device [keep this!] +options SOFTUPDATES #Enable FFS soft updates support +options MFS #Memory Filesystem +options MD_ROOT #MD is a potential root device +options NFS #Network Filesystem +options NFS_ROOT #NFS usable as root device, NFS required +options MSDOSFS #MSDOS Filesystem +options CD9660 #ISO 9660 Filesystem +options CD9660_ROOT #CD-ROM usable as root, CD9660 required +options PROCFS #Process filesystem +options COMPAT_43 #Compatible with BSD 4.3 [KEEP THIS!] +options SCSI_DELAY=15000 #Delay (in ms) before probing SCSI +options UCONSOLE #Allow users to grab the console +options USERCONFIG #boot -c editor +options VISUAL_USERCONFIG #visual boot -c editor +options KTRACE #ktrace(1) support +options SYSVSHM #SYSV-style shared memory +options SYSVMSG #SYSV-style message queues +options SYSVSEM #SYSV-style semaphores +options P1003_1B #Posix P1003_1B real-time extensions +options _KPOSIX_PRIORITY_SCHEDULING +options ICMP_BANDLIM #Rate limit bad replies +options KBD_INSTALL_CDEV # install a CDEV entry in /dev + +#ssiyer: always comes in handy: +options EXT2FS #EXT2 filesystem + +#ssiyer: likewise: (all four) +options DDB +options DDB_UNATTENDED +options PERFMON +options INCLUDE_CONFIG_FILE # Include this file in the kernel + +#ssiyer: I live in a diagnostic world +options INVARIANTS +options INVARIANT_SUPPORT +options DIAGNOSTIC +options AHC_ALLOW_MEMIO +#options CAMDEBUG +# strictly debugging only. hogs up a MEGABYTE of memory for kernel messages. +options MSGBUF_SIZE=1048576 + +#ssiyer: these should be large. bloody large. +options NMBCLUSTERS=17408 + +# To make an SMP kernel, the next two are needed +#options SMP # Symmetric MultiProcessor Kernel +#options APIC_IO # Symmetric (APIC) I/O + +device isa +device eisa +device pci + +# Floppy drives +device fdc0 at isa? port IO_FD1 irq 6 drq 2 +device fd0 at fdc0 drive 0 +device fd1 at fdc0 drive 1 + +# ATA and ATAPI devices +device ata0 at isa? port IO_WD1 irq 14 +device ata1 at isa? port IO_WD2 irq 15 +device ata +device atadisk # ATA disk drives +device atapicd # ATAPI CDROM drives +device atapifd # ATAPI floppy drives +device atapist # ATAPI tape drives +options ATA_STATIC_ID #Static device numbering + +# SCSI Controllers +device ahb # EISA AHA1742 family +device ahc # AHA2940 and onboard AIC7xxx devices +device amd # AMD 53C974 (Tekram DC-390(T)) +device isp # Qlogic family +device ncr # NCR/Symbios Logic +device sym # NCR/Symbios Logic (newer chipsets) +options SYM_SETUP_LP_PROBE_MAP=0x40 + # Allow ncr to attach legacy NCR devices when + # both sym and ncr are configured + +device adv0 at isa? +device adw +device bt0 at isa? +device aha0 at isa? +device aic0 at isa? + +device ncv # NCR 53C500 +device nsp # Workbit Ninja SCSI-3 +device stg # TMC 18C30/18C50 + +# SCSI peripherals +device scbus # SCSI bus (required) +device da # Direct Access (disks) +device sa # Sequential Access (tape etc) +device cd # CD +device pass # Passthrough device (direct SCSI access) + +# RAID controllers interfaced to the SCSI subsystem +device asr # DPT SmartRAID V, VI and Adaptec SCSI RAID +device dpt # DPT Smartcache - See LINT for options! +device mly # Mylex AcceleRAID/eXtremeRAID + +# RAID controllers +device aac # Adaptec FSA RAID, Dell PERC2/PERC3 +device ida # Compaq Smart RAID +device amr # AMI MegaRAID +device mlx # Mylex DAC960 family +device twe # 3ware Escalade + +# atkbdc0 controls both the keyboard and the PS/2 mouse +device atkbdc0 at isa? port IO_KBD +device atkbd0 at atkbdc? irq 1 flags 0x1 +device psm0 at atkbdc? irq 12 + +device vga0 at isa? + +# splash screen/screen saver +pseudo-device splash + +# syscons is the default console driver, resembling an SCO console +device sc0 at isa? flags 0x100 + +#ssiyer: pretty screen yay. +options SC_ALT_MOUSE_IMAGE +options SC_HISTORY_SIZE=1000 +options SC_KERNEL_CONS_ATTR="(FG_YELLOW|BG_BLACK)" + + +# Enable this and PCVT_FREEBSD for pcvt vt220 compatible console driver +#device vt0 at isa? +#options XSERVER # support for X server on a vt console +#options FAT_CURSOR # start with block cursor +# If you have a ThinkPAD, uncomment this along with the rest of the PCVT lines +#options PCVT_SCANSET=2 # IBM keyboards are non-std + +# Floating point support - do not disable. +device npx0 at nexus? port IO_NPX irq 13 + +# Power management support (see LINT for more options) +device apm0 at nexus? disable flags 0x20 # Advanced Power Management + +# PCCARD (PCMCIA) support +device card +device pcic0 at isa? irq 0 port 0x3e0 iomem 0xd0000 +device pcic1 at isa? irq 0 port 0x3e2 iomem 0xd4000 disable + +# Serial (COM) ports +device sio0 at isa? port IO_COM1 flags 0x10 irq 4 +#ssiyer: serial console (commented out) +#device sio0 at isa? port IO_COM1 flags 0x30 irq 4 +device sio1 at isa? port IO_COM2 irq 3 +device sio2 at isa? disable port IO_COM3 irq 5 +device sio3 at isa? disable port IO_COM4 irq 9 +options BREAK_TO_DEBUGGER +options CONSPEED=115200 + +# Parallel port +device ppc0 at isa? irq 7 +device ppbus # Parallel port bus (required) +device lpt # Printer +device plip # TCP/IP over parallel +device ppi # Parallel port interface device +#device vpo # Requires scbus and da + + +# PCI Ethernet NICs. +device de # DEC/Intel DC21x4x (``Tulip'') +device fxp # Intel EtherExpress PRO/100B (82557, 82558) +#ssiyer: added ti +device ti +device tx # SMC 9432TX (83c170 ``EPIC'') +device vx # 3Com 3c590, 3c595 (``Vortex'') +device wx # Intel Gigabit Ethernet Card (``Wiseman'') + +# PCI Ethernet NICs that use the common MII bus controller code. +# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! +device miibus # MII bus support +device dc # DEC/Intel 21143 and various workalikes +device pcn # AMD Am79C79x PCI 10/100 NICs +device rl # RealTek 8129/8139 +device sf # Adaptec AIC-6915 (``Starfire'') +device sis # Silicon Integrated Systems SiS 900/SiS 7016 +device ste # Sundance ST201 (D-Link DFE-550TX) +device tl # Texas Instruments ThunderLAN +device vr # VIA Rhine, Rhine II +device wb # Winbond W89C840F +device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') + +# ISA Ethernet NICs. +device ed0 at isa? port 0x280 irq 10 iomem 0xd8000 +device ex +device ep +device fe0 at isa? port 0x300 +# Xircom Ethernet +device xe +# PRISM I IEEE 802.11b wireless NIC. +device awi +# WaveLAN/IEEE 802.11 wireless NICs. Note: the WaveLAN/IEEE really +# exists only as a PCMCIA device, so there is no ISA attachment needed +# and resources will always be dynamically assigned by the pccard code. +device wi +# Aironet 4500/4800 802.11 wireless NICs. Note: the declaration below will +# work for PCMCIA and PCI cards, as well as ISA cards set to ISA PnP +# mode (the factory default). If you set the switches on your ISA +# card for a manually chosen I/O address and IRQ, you must specify +# those parameters here. +device an +# The probe order of these is presently determined by i386/isa/isa_compat.c. +device ie0 at isa? port 0x300 irq 10 iomem 0xd0000 +#device le0 at isa? port 0x300 irq 5 iomem 0xd0000 +device lnc0 at isa? port 0x280 irq 10 drq 0 +device cs0 at isa? port 0x300 +device sn0 at isa? port 0x300 irq 10 + +# Pseudo devices - the number indicates how many units to allocate. +pseudo-device loop # Network loopback +pseudo-device ether # Ethernet support +pseudo-device sl 1 # Kernel SLIP +pseudo-device ppp 1 # Kernel PPP +pseudo-device tun # Packet tunnel. +pseudo-device pty # Pseudo-ttys (telnet etc) +pseudo-device md # Memory "disks" +pseudo-device gif 4 # IPv6 and IPv4 tunneling +pseudo-device faith 1 # IPv6-to-IPv4 relaying (translation) + +# The `bpf' pseudo-device enables the Berkeley Packet Filter. +# Be aware of the administrative consequences of enabling this! +pseudo-device bpf #Berkeley packet filter + +#ssiyer: nice things to have around (but commented out) +#pseudo-device vn # Vnode driver +#pseudo-device snp 3 # Snoop device + +#ssiyer: IP firewall (commented out) +#options IPFIREWALL #firewall +#options IPFIREWALL_VERBOSE #print information about +# # dropped packets +#options IPFIREWALL_FORWARD #enable transparent proxy support +#options IPFIREWALL_VERBOSE_LIMIT=100 #limit verbosity +#options IPFIREWALL_DEFAULT_TO_ACCEPT #allow everything by default +#options IPDIVERT #divert sockets +#options IPFILTER #ipfilter support +#options IPSTEALTH #support for stealth forwarding +#options TCPDEBUG + +# USB support +device uhci # UHCI PCI->USB interface +device ohci # OHCI PCI->USB interface +device usb # USB Bus (required) +device ugen # Generic +device uhid # "Human Interface Devices" +device ukbd # Keyboard +device ulpt # Printer +device umass # Disks/Mass storage - Requires scbus and da +device ums # Mouse +device uscanner # Scanners +# USB Ethernet, requires mii +device aue # ADMtek USB ethernet +device cue # CATC USB ethernet +device kue # Kawasaki LSI USB ethernet diff -urpN -x compile /usr/src/sys.orig/i386/conf/KERNEL sys/i386/conf/KERNEL --- /usr/src/sys.orig/i386/conf/KERNEL Wed Dec 31 18:00:00 1969 +++ sys/i386/conf/KERNEL Thu Aug 23 10:57:44 2001 @@ -0,0 +1,144 @@ +machine i386 +cpu I586_CPU +cpu I686_CPU +ident KERNEL +maxusers 512 + +options INET #InterNETworking +#options INET6 #IPv6 communications protocols + +options FFS #Berkeley Fast Filesystem +options FFS_ROOT #FFS usable as root device [keep this!] +options SOFTUPDATES +options MFS #Memory Filesystem +options NFS #Network Filesystem +options CD9660 #Network Filesystem +options PROCFS #Process filesystem +options EXT2FS #EXT2 filesystem +#options VFS_AIO + +options COMPAT_43 #Compatible with BSD 4.3 [KEEP THIS!] + +options UCONSOLE #Allow users to grab the console + +options USERCONFIG #boot -c editor +#options VISUAL_USERCONFIG #visual boot -c editor + +options INCLUDE_CONFIG_FILE # Include this file in the kernel + +options KTRACE #ktrace(1) support +options DDB +options DDB_UNATTENDED +options PERFMON + +options SYSVSHM #SYSV-style shared memory +options SYSVMSG #SYSV-style message queues +options SYSVSEM #SYSV-style semaphores + +options P1003_1B #Posix P1003_1B real-time extentions +options _KPOSIX_PRIORITY_SCHEDULING + +options ICMP_BANDLIM #Rate limit bad replies + +options INVARIANTS +options INVARIANT_SUPPORT +options DIAGNOSTIC + +options NMBCLUSTERS=17408 + +# strictly debugging only. hogs up a MEGABYTE of memory for kernel messages. +options MSGBUF_SIZE=1048576 + +device isa +device eisa +device pci + +device fdc0 at isa? port IO_FD1 irq 6 drq 2 +device fd0 at fdc0 drive 0 + +device ata +device atadisk # ATA disk drives +device atapicd # ATAPI CDROM drives +#options ATA_ENABLE_ATAPI_DMA + +# for bubbette +#options SMP # Symmetric MultiProcessor Kernel +#options APIC_IO # Symmetric (APIC) I/O +#options NCPU=1 # number of CPUs +#options NBUS=1 # number of busses +#options NAPIC=1 # number of IO APICs +#options NINTR=24 # number of INTs + +# for idli +#options SMP # Symmetric MultiProcessor Kernel +#options APIC_IO # Symmetric (APIC) I/O +#options NCPU=4 # number of CPUs +#options NBUS=4 # number of busses +#options NAPIC=4 # number of IO APICs +#options NINTR=24 # number of INTs +options SCSI_DELAY=5000 +device bt0 # Buslogic Multi-Master +device scbus # SCSI bus (required) +device da # Direct Access (disks) +device cd # CD +device pass # Passthrough device (direct SCSI access) +device sym # NCR/Symbios Logic (newer chipsets) +device ahc +options AHC_ALLOW_MEMIO +#options CAMDEBUG + +device atkbdc0 at isa? port IO_KBD +device atkbd0 at atkbdc? irq 1 +device psm0 at atkbdc? irq 12 + +device vga0 at isa? +#options VESA +#options SC_PIXEL_MODE + +pseudo-device splash + +device sc0 at isa? +options SC_ALT_MOUSE_IMAGE +options SC_HISTORY_SIZE=1000 +options SC_KERNEL_CONS_ATTR="(FG_YELLOW|BG_BLACK)" + +device npx0 at nexus? port IO_NPX irq 13 + +#device sio0 at isa? port IO_COM1 flags 0x10 irq 4 +device sio0 at isa? port IO_COM1 flags 0x30 irq 4 +options BREAK_TO_DEBUGGER +device sio1 at isa? port IO_COM2 irq 3 +options CONSPEED=115200 + +device ppc0 at isa? irq 7 +device ppbus # Parallel port bus (required) +device lpt # Printer + +device fxp # Intel EtherExpress PRO/100B (82557, 82558) +device ti + +device pcm0 + +pseudo-device loop # Network loopback +pseudo-device ether # Ethernet support +pseudo-device bpf # Berkeley packet filter +pseudo-device disc # Discard device + +pseudo-device pty # Pseudo-ttys (telnet etc) + +pseudo-device vn # Vnode driver +pseudo-device snp 3 # Snoop device +pseudo-device md # Memory "disks" +pseudo-device gif 4 # IPv6 and IPv4 tunneling +pseudo-device faith 1 # IPv6-to-IPv4 relaying (translation) + +options IPFIREWALL #firewall +options IPFIREWALL_VERBOSE #print information about + # dropped packets +options IPFIREWALL_FORWARD #enable transparent proxy support +options IPFIREWALL_VERBOSE_LIMIT=100 #limit verbosity +options IPFIREWALL_DEFAULT_TO_ACCEPT #allow everything by default +options IPDIVERT #divert sockets +options IPFILTER #ipfilter support +options IPSTEALTH #support for stealth forwarding +options TCPDEBUG diff -urpN -x compile /usr/src/sys.orig/i386/isa/wd.c sys/i386/isa/wd.c --- /usr/src/sys.orig/i386/isa/wd.c Fri Aug 4 17:31:07 2000 +++ sys/i386/isa/wd.c Fri Jun 22 23:41:26 2001 @@ -621,7 +621,7 @@ wdustart(register struct disk *du) return; - bp = bufq_first(&drive_queue[du->dk_lunit]); + bp = bufq_first_remove(&drive_queue[du->dk_lunit]); if (bp == NULL) { /* yes, an assign */ return; } @@ -629,8 +629,6 @@ wdustart(register struct disk *du) * store away which device we came from. */ bp->b_driver1 = du; - - bufq_remove(&drive_queue[du->dk_lunit], bp); /* link onto controller queue */ bufq_insert_tail(&wdtab[ctrlr].controller_queue, bp); diff -urpN -x compile /usr/src/sys.orig/kern/kern_descrip.c sys/kern/kern_descrip.c --- /usr/src/sys.orig/kern/kern_descrip.c Sun Feb 25 22:23:15 2001 +++ sys/kern/kern_descrip.c Sun May 6 14:04:11 2001 @@ -197,6 +197,7 @@ dup(p, uap) return (do_dup(fdp, (int)old, new, p->p_retval, p)); } +void vm_object_terminate __P((vm_object_t)); /* * The file control system call. */ @@ -365,6 +366,15 @@ fcntl(p, uap) (caddr_t)(intptr_t)uap->arg, sizeof(fl)); } return(error); + + case 42: /* purge file from cache -- ssiyer */ + if (fp->f_type != DTYPE_VNODE) + return (EBADF); + vp = (struct vnode *)fp->f_data; + cache_purge(vp); + if (vp->v_object) vm_object_terminate(vp->v_object); + return 0; + default: return (EINVAL); } diff -urpN -x compile /usr/src/sys.orig/kern/subr_diskslice.c sys/kern/subr_diskslice.c --- /usr/src/sys.orig/kern/subr_diskslice.c Mon Mar 5 07:09:01 2001 +++ sys/kern/subr_diskslice.c Fri Jun 22 23:41:26 2001 @@ -569,6 +569,7 @@ dsiodone(bp) char *msg; ic = bp->b_iodone_chain; + if ((ic->ic_prev_flags & B_DONE) != 0) IODONE(bp); bp->b_flags = (ic->ic_prev_flags & B_CALL) | (bp->b_flags & ~(B_CALL | B_DONE)); bp->b_iodone = ic->ic_prev_iodone; diff -urpN -x compile /usr/src/sys.orig/kern/uipc_socket2.c sys/kern/uipc_socket2.c --- /usr/src/sys.orig/kern/uipc_socket2.c Sun Feb 4 08:49:45 2001 +++ sys/kern/uipc_socket2.c Sun May 6 14:01:28 2001 @@ -1011,6 +1011,7 @@ SYSCTL_INT(_kern_ipc, KIPC_SOCKBUF_WASTE static void init_maxsockets(void *ignored) { TUNABLE_INT_FETCH("kern.ipc.maxsockets", 0, maxsockets); - maxsockets = imax(maxsockets, imax(maxfiles, nmbclusters)); + /* maxsockets = imax(maxsockets, imax(maxfiles, nmbclusters)); */ + maxsockets = 50000; } SYSINIT(param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_maxsockets, NULL); diff -urpN -x compile /usr/src/sys.orig/kern/vfs_aio.c sys/kern/vfs_aio.c --- /usr/src/sys.orig/kern/vfs_aio.c Wed Apr 18 20:38:34 2001 +++ sys/kern/vfs_aio.c Fri Jun 22 23:48:19 2001 @@ -2240,6 +2240,8 @@ aio_physwakeup(struct buf *bp) struct kaioinfo *ki; struct aio_liojob *lj; + IODONE(bp); + wakeup(bp); aiocbe = (struct aiocblist *)bp->b_spc; diff -urpN -x compile /usr/src/sys.orig/kern/vfs_bio.c sys/kern/vfs_bio.c --- /usr/src/sys.orig/kern/vfs_bio.c Fri Mar 2 10:45:12 2001 +++ sys/kern/vfs_bio.c Fri Jun 22 23:41:26 2001 @@ -861,6 +861,7 @@ bdirty(bp) bp->b_flags &= ~(B_READ|B_RELBUF); if ((bp->b_flags & B_DELWRI) == 0) { + IODONE(bp); bp->b_flags |= B_DONE | B_DELWRI; reassignbuf(bp, bp->b_vp); ++numdirtybuffers; @@ -2660,6 +2661,7 @@ biodone(register struct buf * bp) KASSERT(BUF_REFCNT(bp) > 0, ("biodone: bp %p not busy %d", bp, BUF_REFCNT(bp))); KASSERT(!(bp->b_flags & B_DONE), ("biodone: bp %p already done", bp)); + IODONE(bp); bp->b_flags |= B_DONE; runningbufwakeup(bp); diff -urpN -x compile /usr/src/sys.orig/libkern/krap.c sys/libkern/krap.c --- /usr/src/sys.orig/libkern/krap.c Wed Dec 31 18:00:00 1969 +++ sys/libkern/krap.c Sun May 6 14:01:28 2001 @@ -0,0 +1,125 @@ +/* + * Written by Sitaram Iyer + * Copyright (C) 1999 Rice University. + */ + +#if defined(_KERNEL) && !defined(KERNEL) /* 4.* kernels */ +#define KERNEL _KERNEL +#endif + +#if !defined(KERNEL) && !defined(MODULE) /* user program */ +# include +#elif defined(KERNEL) && !defined(MODULE) /* kernel */ +# include +#elif defined(KERNEL) && defined(MODULE) /* module */ +# include +#elif !defined(KERNEL) && defined(MODULE) +# error MODULE defined without defining KERNEL. bad. +#endif + +#ifdef KERNEL +#undef strrchr +#define strrchr rindex +#endif + +#undef __wrap_code__(x) +#define __wrap_code__(x) __wrap_voidfunc__() + +#ifdef KERNEL +#include +#include +#include +#else /* KERNEL */ +#include +#include +#include +#include +#include +#endif /* KERNEL */ + +#ifndef __wrap_maxN__ +#error must "gcc -include krap.h" for this file +#endif +int __wrap_line__[__wrap_maxN__] = {0,}; +const char *__wrap_file__[__wrap_maxN__] = {0,}; +const char *__wrap_func__[__wrap_maxN__] = {0,}; +const char *__wrap_kywd__[__wrap_maxN__] = {0,}; +int __wrap_I__ = -1; +int __wrap_ForI__; + +#if 1 +void __wrap_voidfunc__(void) {} + +void __wrap_codefunc__(int line, const char *file, + const char *func, const char *kywd) { + __wrap_I__ = (__wrap_I__ + 1) % __wrap_maxN__; + __wrap_line__[__wrap_I__] = line; + __wrap_file__[__wrap_I__] = file; + __wrap_func__[__wrap_I__] = func; + __wrap_kywd__[__wrap_I__] = kywd; +} +#endif + +void _wrap_(int n) +{ + int i, j; + if (n == 0) { + n = 20; + printf("wrap: defaulting to max %d trace entries\n", n); + } + if (n > __wrap_maxN__) { + printf("wrap: cutting down to max %d entries (instead of %d)\n", __wrap_maxN__, n); + n = __wrap_maxN__; + } + for (i = 0, j = __wrap_I__; i < n; + i++, j = (j - 1 + __wrap_maxN__) % __wrap_maxN__) { + const char *s = __wrap_file__[j], *p; + if (s != NULL) { + p = strrchr(s,'/'); + printf("wrap [%d] %s:%d: %s(): %s\n", i, + (p&&*p)?p+1:s, + __wrap_line__[j], + __wrap_func__[j], + __wrap_kywd__[j]); + } + } +} + +#ifndef KERNEL +#undef main +#include + +static void exitfn(void) +{ + _wrap_(20); +} +static char *signames[1024] = { 0, }; +#define mysignal(x,y) { signal(x,y); signames[x] = #x; } +static void handler(int sig) +{ + if (sig >= 0 && sig < 1024 && signames[sig]) + printf("wrap: aborting on signal %d (%s), execution trace:\n", sig, signames[sig]); + else + printf("wrap: aborting on signal %d\n, execution trace:", sig); + exitfn(); + signal(sig, SIG_DFL); + kill(getpid(), sig); + /* exit(1); */ +} +int main(int argc, char *argv[]) +{ + int main1(int, char**); + /* atexit(exitfn); */ + mysignal(SIGBUS,handler); + mysignal(SIGSEGV,handler); + mysignal(SIGILL,handler); + mysignal(SIGFPE,handler); + mysignal(SIGQUIT,handler); +#ifdef SIGSYS + mysignal(SIGSYS,handler); +#endif + return (main1(argc, argv)); +} + +#undef mysignal +#endif diff -urpN -x compile /usr/src/sys.orig/miscfs/devfs/devfs_vnops.c sys/miscfs/devfs/devfs_vnops.c --- /usr/src/sys.orig/miscfs/devfs/devfs_vnops.c Fri Dec 29 19:51:08 2000 +++ sys/miscfs/devfs/devfs_vnops.c Fri Jun 22 23:41:26 2001 @@ -1765,6 +1765,7 @@ static void devfs_getpages_iodone(struct buf *bp) { + IODONE(bp); bp->b_flags |= B_DONE; wakeup(bp); } diff -urpN -x compile /usr/src/sys.orig/miscfs/specfs/spec_vnops.c sys/miscfs/specfs/spec_vnops.c --- /usr/src/sys.orig/miscfs/specfs/spec_vnops.c Sun Feb 25 22:23:20 2001 +++ sys/miscfs/specfs/spec_vnops.c Fri Jun 22 23:41:26 2001 @@ -628,6 +628,7 @@ spec_getpages_iodone(bp) struct buf *bp; { + IODONE(bp); bp->b_flags |= B_DONE; wakeup(bp); } diff -urpN -x compile /usr/src/sys.orig/net/if.h sys/net/if.h --- /usr/src/sys.orig/net/if.h Fri May 5 08:37:04 2000 +++ sys/net/if.h Sun May 6 14:01:28 2001 @@ -100,7 +100,7 @@ struct if_data { (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\ IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI|IFF_SMART) -#define IFQ_MAXLEN 50 +#define IFQ_MAXLEN 1000 #define IFNET_SLOWHZ 1 /* granularity is 1 second */ /* diff -urpN -x compile /usr/src/sys.orig/netinet/if_ether.c sys/netinet/if_ether.c --- /usr/src/sys.orig/netinet/if_ether.c Thu Mar 29 03:51:16 2001 +++ sys/netinet/if_ether.c Sun May 6 14:03:11 2001 @@ -576,12 +576,14 @@ in_arpinput(m) if (la && (rt = la->la_rt) && (sdl = SDL(rt->rt_gateway))) { /* the following is not an error when doing bridging */ if (!BRIDGE_TEST && rt->rt_ifp != &ac->ac_if) { + /* if (log_arp_wrong_iface) log(LOG_ERR, "arp: %s is on %s%d but got reply from %6D on %s%d\n", inet_ntoa(isaddr), rt->rt_ifp->if_name, rt->rt_ifp->if_unit, ea->arp_sha, ":", ac->ac_if.if_name, ac->ac_if.if_unit); + */ goto reply; } if (sdl->sdl_alen && diff -urpN -x compile /usr/src/sys.orig/netinet/tcp_input.c sys/netinet/tcp_input.c --- /usr/src/sys.orig/netinet/tcp_input.c Wed Apr 18 12:55:23 2001 +++ sys/netinet/tcp_input.c Sun May 6 14:01:28 2001 @@ -2776,9 +2776,11 @@ tcp_mss(tp, offer) * number of mss units; if the mss is larger than * the socket buffer, decrease the mss. */ +#if 0 #ifdef RTV_SPIPE if ((bufsize = rt->rt_rmx.rmx_sendpipe) == 0) #endif +#endif bufsize = so->so_snd.sb_hiwat; if (bufsize < mss) mss = bufsize; @@ -2790,8 +2792,10 @@ tcp_mss(tp, offer) } tp->t_maxseg = mss; +#if 0 #ifdef RTV_RPIPE if ((bufsize = rt->rt_rmx.rmx_recvpipe) == 0) +#endif #endif bufsize = so->so_rcv.sb_hiwat; if (bufsize > mss) { diff -urpN -x compile /usr/src/sys.orig/netinet/tcp_subr.c sys/netinet/tcp_subr.c --- /usr/src/sys.orig/netinet/tcp_subr.c Wed Apr 18 12:55:23 2001 +++ sys/netinet/tcp_subr.c Sun May 6 14:01:28 2001 @@ -149,7 +149,7 @@ static void tcp_notify __P((struct inpcb * variable net.inet.tcp.tcbhashsize */ #ifndef TCBHASHSIZE -#define TCBHASHSIZE 512 +#define TCBHASHSIZE 8192 #endif /* diff -urpN -x compile /usr/src/sys.orig/sys/buf.h sys/sys/buf.h --- /usr/src/sys.orig/sys/buf.h Fri Dec 29 19:51:10 2000 +++ sys/sys/buf.h Tue Jun 26 15:57:28 2001 @@ -146,8 +146,24 @@ struct buf { struct buf *parent; int count; } b_chain; + + quad_t b_t_enqueue, b_t_dequeue, b_t_iostart, b_t_iodone; + int is_pageout_write; + int b_id; + struct proc *nwcs_bproc; + struct buf_queue_head *bufq; + int done_iodone; }; +extern void (*ext_iodone)(struct buf *); +#define IODONE(bp) do { \ + if (bp->done_iodone == 0) { \ + bp->done_iodone = 1; \ + bp->b_t_iodone = ll_microtime(); \ + if (ext_iodone) ext_iodone(bp); \ + } \ +} while (0) + #define b_spc b_pager.pg_spc /* @@ -381,6 +397,10 @@ static __inline void bufq_remove __P((st struct buf *bp)); static __inline struct buf *bufq_first __P((struct buf_queue_head *head)); + +struct buf *bufq_first_remove __P((struct buf_queue_head *head)); + +int bufq_hasany __P((struct buf_queue_head *head)); static __inline void bufq_init(struct buf_queue_head *head) diff -urpN -x compile /usr/src/sys.orig/sys/krap.h sys/sys/krap.h --- /usr/src/sys.orig/sys/krap.h Wed Dec 31 18:00:00 1969 +++ sys/sys/krap.h Sun May 6 14:01:28 2001 @@ -0,0 +1,151 @@ +/* + * Written by Sitaram Iyer + * Copyright (C) 1999 Rice University. + */ + +#ifndef __wrap_maxN__ +#define __wrap_maxN__ 50 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + extern int __wrap_line__[__wrap_maxN__]; + extern const char *__wrap_file__[__wrap_maxN__]; + extern const char *__wrap_func__[__wrap_maxN__]; + extern const char *__wrap_kywd__[__wrap_maxN__]; + extern int __wrap_I__; + extern int __wrap_ForI__; + void _wrap_(int); + void __wrap_voidfunc__(void); + void __wrap_codefunc__(int, const char *, const char *, const char *); +#ifdef __cplusplus +} +#endif + +/* #ifndef KERNEL */ +#ifdef __cplusplus + extern "C" int main1(int, char**); /* no prototype if C */ +#endif +#define main(x...) main1(x) +/* #endif */ + +#if (0) +#define __wrap_code__(kywd) \ + __wrap_I__ = (__wrap_I__ + 1) % __wrap_maxN__,\ + __wrap_line__[__wrap_I__] = __LINE__,\ + __wrap_file__[__wrap_I__] = __FILE__,\ + __wrap_func__[__wrap_I__] = __FUNCTION__,\ + __wrap_kywd__[__wrap_I__] = #kywd,\ + __wrap_voidfunc__() +#else +#define __wrap_code__(kywd) \ + __wrap_codefunc__(__LINE__,__FILE__,__FUNCTION__,#kywd),__wrap_voidfunc__() +#endif + +#if (0) +/* one implementation, doesn't work right now */ +#define __onetime_for__(x) for __wrap_forargs__(x) +#define __wrap_forargs__(x) \ + (__wrap_code__(x), __wrap_ForI__ = 0; __wrap_ForI__ == 0; __wrap_ForI__ = 1) +#else +/* a different implementation, non-ansiC */ +#define __wrap_semicolonsemicolon__ (;;) +#define __wrap_forargs__(x) (__wrap_code__(x) ; ; ({break;1;})) +#define __onetime_for__(x) for __wrap_semicolonsemicolon__ \ + for __wrap_forargs__(x) +#endif + +#ifdef KRAP +#if (!defined(KERNEL) && !defined(_KERNEL)) || defined(MODULE) +/* all such things have to take a fixed number of arguments, preferably 1 */ +/* break case continue default do else sizeof */ +#define _asm_ asm +#define asm __onetime_for__(asm) asm +#if !defined(KERNEL) && !defined(_KERNEL) && !defined(__cplusplus) +#define _for_ for +#define for(x...) for(__wrap_code__(for),x) +#endif + /* (;;). FIXED. */ +#define _goto_ goto +#define goto __onetime_for__(goto) goto +#define _sizeof_ sizeof +#define sizeof sizeof +#define _switch_ switch +#define switch(x...) switch(__wrap_code__(switch),(x)) +#define _while_ while +#define while(x...) while(__wrap_code__(while),(x)) +#endif +/* also for the kernel: */ +#define _if_(x...) if(__wrap_code__(if),(x)) +#define if(x...) _if_(x) +#define _return_ return +#define return __onetime_for__(return) return +#endif + +#define _trace_ __wrap_code__(trace) + +/* to avoid problems like (1,2,NULL) = (1,2,0) = an integer! */ +#undef NULL +#define NULL ((void*)0) + + +/* + * NEAT TRICKS (other than those that spring up to jump at the eye) + * + * __wrap_code__ is macro'ed to x = 1, y = 2, f() where f() returns void. + * this makes it possible to say return code; in place of return;, + * otherwise it'd generate a value-returned-in-void-function error. + * + * (oh, btw. the whole thing after application of these macros is still + * ansi C, generates no warnings, and is completely reentrant - you can + * apply it again without the compiler crapping on you) + * + * problems faced included + * for(;;) which was translating to for(__wrap_code__,;;) - and we have + * a c-post-preprocessor to fix this: it removes the offending commas + * out of "__wrap_voidfunc__(),\s*;" and ";\s*,__wrap_voidfunc__()" + * + * while still won't execute the extra stuff on each iteration - the + * optimizer would hopefully pull such loop invariants out of the loop. + * + * in for(), we can toss __wrap_code__ either before or after - in the + * latter case it'll be executed for each iteration. + * + * there's a _trace_ that manually inserts these things explicitly. + * + * if its not KERNEL, it redefines main to throw in an atexit() or + * whatever else one might prefer doing. perhaps segfault handlers and + * stuff. think of java's exception reporting. + * + * NULL is redefined because you might have a char* returning function, + * and this returns NULL, and NULL is usually #defined to 0, and we happen + * to change it to "line = __LINE__, 0" which translates to *integer* 0 (C + * weirdness w.r.t. comma expressions when the last thing is a 0). Hence + * we explicitly redefine NULL to be (void*)0 and hope noone redefines it + * after that. actually, *seriously* hope - since this gets included + * before anything else. + * + * the neat thing about all this is that *all* you have to change in + * anything is CFLAGS, to add a "-include /usr/local/include/krap.h" + * and everything else is automatic. At the debugger prompt you'd say + * "call _wrap_" to actually display the stack or whatever. + * + * think about whether an inline function like _wrap_ can be call'ed. + * + * various ways of incrementing/decrementing I: settle for all-wraparound + * ways to do I++ : + * 1. do it in each of these macros, and wraparound - so you get the + * last hundred macros "hit" or something. might be much more + * preferable if while() is done only once - in which case, what do + * you do to the if/for/.. inside the while loop? inconsistent policy. + * 2. bundle all functions inside other generated functions. + * 3. note the first time a macro of this sort gets done inside a + * function, and increment it then. + * + * onetime_for and the whole genre, and how only to looping constructs + * + * forargs!! + * + * TODO: implement synchronization + */ diff -urpN -x compile /usr/src/sys.orig/sys/proc.h sys/sys/proc.h --- /usr/src/sys.orig/sys/proc.h Thu Sep 7 14:13:54 2000 +++ sys/sys/proc.h Fri Jun 22 23:45:04 2001 @@ -244,6 +244,8 @@ struct proc { struct proc *p_leader; struct pasleep p_asleep; /* Used by asleep()/await(). */ void *p_emuldata; /* process-specific emulator state data */ + + void *ext_data; /* for various purposes */ }; #define p_session p_pgrp->pg_session diff -urpN -x compile /usr/src/sys.orig/sys/socket.h sys/sys/socket.h --- /usr/src/sys.orig/sys/socket.h Mon Feb 26 01:24:22 2001 +++ sys/sys/socket.h Sun May 6 14:01:28 2001 @@ -301,7 +301,7 @@ struct sockaddr_storage { /* * Maximum queue length specifiable by listen. */ -#define SOMAXCONN 128 +#define SOMAXCONN 1024 /* * Message header for recvmsg and sendmsg calls. diff -urpN -x compile /usr/src/sys.orig/sys/socketvar.h sys/sys/socketvar.h --- /usr/src/sys.orig/sys/socketvar.h Sun Feb 25 22:23:21 2001 +++ sys/sys/socketvar.h Sun May 6 14:01:29 2001 @@ -97,7 +97,7 @@ struct socket { short sb_flags; /* flags, see below */ short sb_timeo; /* timeout for read/write */ } so_rcv, so_snd; -#define SB_MAX (256*1024) /* default for max chars in sockbuf */ +#define SB_MAX (512*1024) /* default for max chars in sockbuf */ #define SB_LOCK 0x01 /* lock on data queue */ #define SB_WANT 0x02 /* someone is waiting to lock */ #define SB_WAIT 0x04 /* someone is waiting for data/space */ diff -urpN -x compile /usr/src/sys.orig/sys/time.h sys/sys/time.h --- /usr/src/sys.orig/sys/time.h Tue Dec 28 22:24:48 1999 +++ sys/sys/time.h Fri Jun 22 23:41:26 2001 @@ -285,6 +285,14 @@ void timevaladd __P((struct timeval *, s void timevalsub __P((struct timeval *, struct timeval *)); int tvtohz __P((struct timeval *)); void update_timecounter __P((struct timecounter *tc)); + +static __inline quad_t ll_microtime(void) +{ + struct timeval tv; + microtime(&tv); + return ((quad_t) tv.tv_sec) * 1000000LL + ((quad_t) tv.tv_usec); +} + #else /* !_KERNEL */ #include diff -urpN -x compile /usr/src/sys.orig/ufs/ffs/ffs_alloc.c sys/ufs/ffs/ffs_alloc.c --- /usr/src/sys.orig/ufs/ffs/ffs_alloc.c Thu Mar 16 02:15:53 2000 +++ sys/ufs/ffs/ffs_alloc.c Fri Jun 22 23:41:26 2001 @@ -237,6 +237,7 @@ ffs_realloccg(ip, lbprev, bpref, osize, ip->i_blocks += btodb(nsize - osize); ip->i_flag |= IN_CHANGE | IN_UPDATE; allocbuf(bp, nsize); + IODONE(bp); bp->b_flags |= B_DONE; bzero((char *)bp->b_data + osize, (u_int)nsize - osize); *bpp = bp; @@ -302,6 +303,7 @@ ffs_realloccg(ip, lbprev, bpref, osize, ip->i_blocks += btodb(nsize - osize); ip->i_flag |= IN_CHANGE | IN_UPDATE; allocbuf(bp, nsize); + IODONE(bp); bp->b_flags |= B_DONE; bzero((char *)bp->b_data + osize, (u_int)nsize - osize); *bpp = bp; diff -urpN -x compile /usr/src/sys.orig/ufs/ufs/ufs_disksubr.c sys/ufs/ufs/ufs_disksubr.c --- /usr/src/sys.orig/ufs/ufs/ufs_disksubr.c Sun Mar 4 23:42:19 2001 +++ sys/ufs/ufs/ufs_disksubr.c Tue Jun 26 15:57:53 2001 @@ -62,8 +62,53 @@ * allocated. */ +int force_dequeue_now = 0; +void (*ext_enqueue)(struct buf_queue_head *, struct buf *) = 0; +struct buf *(*ext_dequeue)(struct buf_queue_head *) = 0; +int (*ext_hasany)(struct buf_queue_head *) = 0; +void (*ext_iodone)(struct buf *) = 0; +void (*disk_doIO)(void *xxx /* will be void* for disk */) = 0; +void _bufqdisksort(struct buf_queue_head *, struct buf *); +LIST_HEAD(, buf) res_bound_bufs_list; +daddr_t last_blkno = 0; + +int bufq_hasany(struct buf_queue_head *bufq) +{ + if (bufq_first(bufq)) return 1; + if (ext_hasany) return ext_hasany(bufq); + return 0; +} + +struct buf *bufq_first_remove(struct buf_queue_head *bufq) +{ + struct buf *bp; + + bp = bufq_first(bufq); /* first slurp this queue as far as it goes */ + if (bp) bufq_remove(bufq, bp); + else if (ext_dequeue) bp = ext_dequeue(bufq); + + if (bp) { + bp->b_t_dequeue = ll_microtime(); + last_blkno = bp->b_pblkno; + bp->done_iodone = 0; + } + return bp; +} + void bufqdisksort(bufq, bp) + struct buf_queue_head *bufq; + struct buf *bp; +{ + bp->b_t_enqueue = ll_microtime(); + if (ext_enqueue) + ext_enqueue(bufq, bp); + else + _bufqdisksort(bufq, bp); +} + +void +_bufqdisksort(bufq, bp) struct buf_queue_head *bufq; struct buf *bp; { diff -urpN -x compile /usr/src/sys.orig/vm/swap_pager.c sys/vm/swap_pager.c --- /usr/src/sys.orig/vm/swap_pager.c Sat Mar 24 14:28:24 2001 +++ sys/vm/swap_pager.c Fri Jun 22 23:41:26 2001 @@ -1443,6 +1443,7 @@ static void swp_pager_sync_iodone(bp) struct buf *bp; { + IODONE(bp); bp->b_flags |= B_DONE; bp->b_flags &= ~B_ASYNC; wakeup(bp); @@ -1475,6 +1476,7 @@ swp_pager_async_iodone(bp) int i; vm_object_t object = NULL; + IODONE(bp); bp->b_flags |= B_DONE; /* diff -urpN -x compile /usr/src/sys.orig/vm/vm_pageout.h sys/vm/vm_pageout.h --- /usr/src/sys.orig/vm/vm_pageout.h Tue Dec 28 22:55:11 1999 +++ sys/vm/vm_pageout.h Sun May 6 14:01:29 2001 @@ -99,8 +99,12 @@ extern int vm_pageout_deficit; */ extern void pagedaemon_wakeup __P((void)); -#define VM_WAIT vm_wait() -#define VM_AWAIT vm_await() +#define VM_WAIT ({ struct timeval tv1, tv2; microuptime(&tv1); vm_wait(); \ + microuptime(&tv2); \ + if (tv2.tv_sec - tv1.tv_sec) \ + printf("VM_WAIT: %s:%d, %ld sec, %ld us, %c<%d> [%d]\n", __FILE__, __LINE__, tv1.tv_sec, (tv2.tv_usec - tv1.tv_usec) + 1000000 * (tv2.tv_sec - tv1.tv_sec), curproc ? curproc == pageproc ? 'p' : 'o' : '!', curproc ? curproc->p_pid : -1, curproc ? curproc->p_pptr ? curproc->p_pptr->p_pid : -1 : -2); \ + }) +#define VM_AWAIT ({ printf("await\n"); vm_await(); }) extern void vm_wait __P((void)); extern void vm_await __P((void)); diff -urpN -x compile /usr/src/sys.orig/vm/vm_pager.c sys/vm/vm_pager.c --- /usr/src/sys.orig/vm/vm_pager.c Fri Aug 4 17:31:11 2000 +++ sys/vm/vm_pager.c Fri Jun 22 23:41:27 2001 @@ -521,6 +521,7 @@ vm_pager_chain_iodone(struct buf *nbp) biodone(bp); } } + IODONE(nbp); nbp->b_flags |= B_DONE; nbp->b_flags &= ~B_ASYNC; relpbuf(nbp, NULL); diff -urpN -x compile /usr/src/sys.orig/vm/vnode_pager.c sys/vm/vnode_pager.c --- /usr/src/sys.orig/vm/vnode_pager.c Fri Dec 29 19:51:12 2000 +++ sys/vm/vnode_pager.c Fri Jun 22 23:41:27 2001 @@ -386,6 +386,7 @@ static void vnode_pager_iodone(bp) struct buf *bp; { + IODONE(bp); bp->b_flags |= B_DONE; wakeup(bp); }