Date: Sat, 12 Jun 2004 16:58:18 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 54725 for review Message-ID: <200406121658.i5CGwI0e039898@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=54725 Change 54725 by rwatson@rwatson_tislabs on 2004/06/12 16:57:36 Integrate netperf_socket; loop back: - Socket mutexes - Socket mutex init/destroy Also: - Altq - Ipfw ucred caching optimization Affected files ... .. //depot/projects/netperf_socket/sys/alpha/alpha/pmap.c#8 integrate .. //depot/projects/netperf_socket/sys/alpha/alpha/uma_machdep.c#1 branch .. //depot/projects/netperf_socket/sys/conf/files.alpha#4 integrate .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq.h#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_cbq.c#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_cbq.h#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_cdnr.c#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_cdnr.h#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_classq.h#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_hfsc.c#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_hfsc.h#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_priq.c#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_priq.h#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_red.c#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_red.h#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_rio.c#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_rio.h#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_rmclass.c#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_rmclass.h#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_rmclass_debug.h#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_subr.c#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altq_var.h#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/altqconf.h#1 branch .. //depot/projects/netperf_socket/sys/contrib/altq/altq/if_altq.h#1 branch .. //depot/projects/netperf_socket/sys/dev/bktr/bktr_mem.c#3 integrate .. //depot/projects/netperf_socket/sys/dev/esp/esp_sbus.c#2 integrate .. //depot/projects/netperf_socket/sys/dev/esp/ncr53c9x.c#2 integrate .. //depot/projects/netperf_socket/sys/dev/esp/ncr53c9xvar.h#2 integrate .. //depot/projects/netperf_socket/sys/dev/hme/if_hme.c#8 integrate .. //depot/projects/netperf_socket/sys/dev/twe/twe.c#5 integrate .. //depot/projects/netperf_socket/sys/dev/twe/twe_freebsd.c#5 integrate .. //depot/projects/netperf_socket/sys/dev/twe/twevar.h#5 integrate .. //depot/projects/netperf_socket/sys/ia64/ia64/pmap.c#8 integrate .. //depot/projects/netperf_socket/sys/kern/kern_kse.c#2 integrate .. //depot/projects/netperf_socket/sys/kern/kern_thread.c#12 integrate .. //depot/projects/netperf_socket/sys/kern/tty_conf.c#4 integrate .. //depot/projects/netperf_socket/sys/kern/uipc_mbuf.c#7 integrate .. //depot/projects/netperf_socket/sys/kern/uipc_socket.c#15 integrate .. //depot/projects/netperf_socket/sys/netinet/ip_fw2.c#7 integrate .. //depot/projects/netperf_socket/sys/sys/socketvar.h#9 integrate Differences ... ==== //depot/projects/netperf_socket/sys/alpha/alpha/pmap.c#8 (text+ko) ==== @@ -148,7 +148,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/alpha/pmap.c,v 1.147 2004/06/10 04:30:59 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/alpha/pmap.c,v 1.149 2004/06/12 06:03:27 alc Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -172,7 +172,6 @@ #include <vm/vm_pageout.h> #include <vm/vm_pager.h> #include <vm/uma.h> -#include <vm/uma_int.h> #include <sys/user.h> @@ -555,52 +554,6 @@ return 0; } -void * -uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) -{ - static vm_pindex_t color; - vm_page_t m; - int pflags; - void *va; - - *flags = UMA_SLAB_PRIV; - - if ((wait & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT) - pflags = VM_ALLOC_INTERRUPT; - else - pflags = VM_ALLOC_SYSTEM; - - if (wait & M_ZERO) - pflags |= VM_ALLOC_ZERO; - - for (;;) { - m = vm_page_alloc(NULL, color++, pflags | VM_ALLOC_NOOBJ); - if (m == NULL) { - if (wait & M_NOWAIT) - return (NULL); - else - VM_WAIT; - } else - break; - } - - va = (void *)ALPHA_PHYS_TO_K0SEG(m->phys_addr); - if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - bzero(va, PAGE_SIZE); - return (va); -} - -void -uma_small_free(void *mem, int size, u_int8_t flags) -{ - vm_page_t m; - - m = PHYS_TO_VM_PAGE(ALPHA_K0SEG_TO_PHYS((vm_offset_t)mem)); - vm_page_lock_queues(); - vm_page_free(m); - vm_page_unlock_queues(); -} - /* * Initialize the pmap module. * Called by vm_init, to initialize any structures that the pmap ==== //depot/projects/netperf_socket/sys/conf/files.alpha#4 (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.alpha,v 1.110 2004/05/17 05:46:15 imp Exp $ +# $FreeBSD: src/sys/conf/files.alpha,v 1.111 2004/06/11 19:55:56 alc Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -83,6 +83,7 @@ alpha/alpha/sys_machdep.c standard alpha/alpha/trap.c standard alpha/alpha/uio_machdep.c standard +alpha/alpha/uma_machdep.c standard alpha/alpha/vm_machdep.c standard alpha/isa/isa.c optional isa alpha/isa/isa_dma.c optional isa ==== //depot/projects/netperf_socket/sys/dev/bktr/bktr_mem.c#3 (text+ko) ==== @@ -1,9 +1,5 @@ - - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/bktr/bktr_mem.c,v 1.8 2004/05/30 20:08:27 phk Exp $"); /* - * This is prt of the Driver for Video Capture Cards (Frame grabbers) + * This is part of the Driver for Video Capture Cards (Frame grabbers) * and TV Tuner cards using the Brooktree Bt848, Bt848A, Bt849A, Bt878, Bt879 * chipset. * Copyright Roger Hardiman. @@ -47,6 +43,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/dev/bktr/bktr_mem.c,v 1.10 2004/06/11 18:47:44 schweikh Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -55,12 +53,12 @@ #include <dev/bktr/bktr_mem.h> struct memory_pointers { - int addresses_stored; - vm_offset_t dma_prog; - vm_offset_t odd_dma_prog; - vm_offset_t vbidata; - vm_offset_t vbibuffer; - vm_offset_t buf; + int addresses_stored; + vm_offset_t dma_prog; + vm_offset_t odd_dma_prog; + vm_offset_t vbidata; + vm_offset_t vbibuffer; + vm_offset_t buf; } memory_pointers; static struct memory_pointers memory_list[BKTR_MEM_MAX_DEVICES]; @@ -72,39 +70,37 @@ switch (type) { case MOD_LOAD: + printf("bktr_mem: memory holder loaded\n"); + /* + * bzero((caddr_t)memory_list, sizeof(memory_list)); + * causes a panic. So use a simple for loop for now. + */ { - printf("bktr_mem: memory holder loaded\n"); -/* - * bzero causes a panic. - bzero((caddr_t)memory_list, sizeof(memory_list)); - * So use a simple for loop for now. -*/ - {int x; - unsigned char *d = (unsigned char *)memory_list; - for (x=0; x< sizeof(memory_list); x++) { - d[x]=0; - } + int x; + unsigned char *d; + + d = (unsigned char *)memory_list; + for (x = 0; x < sizeof(memory_list); x++) + d[x] = 0; } return 0; - } case MOD_UNLOAD: - { printf("bktr_mem: memory holder cannot be unloaded\n"); return EBUSY; - } default: break; } - return 0; -}; + return (0); +} /*************************************************************/ int -bktr_has_stored_addresses(int unit) { +bktr_has_stored_addresses(int unit) +{ - if ((unit < 0) || (unit >= BKTR_MEM_MAX_DEVICES)) { - printf("bktr_mem: Unit number %d invalid\n",unit); + if (unit < 0 || unit >= BKTR_MEM_MAX_DEVICES) { + printf("bktr_mem: Unit number %d invalid\n", unit); return 0; } @@ -114,64 +110,83 @@ /*************************************************************/ void -bktr_store_address(int unit, int type, vm_offset_t addr) { +bktr_store_address(int unit, int type, vm_offset_t addr) +{ - if ((unit < 0) || (unit >= BKTR_MEM_MAX_DEVICES)) { - printf("bktr_mem: Unit number %d invalid for memory type %d, address 0x%x\n" - ,unit,type,addr); + if (unit < 0 || unit >= BKTR_MEM_MAX_DEVICES) { + printf("bktr_mem: Unit number %d invalid for memory type %d, address 0x%x\n", + unit, type, addr); return; } switch (type) { - case BKTR_MEM_DMA_PROG: memory_list[unit].dma_prog = addr; - memory_list[unit].addresses_stored = 1; - break; - case BKTR_MEM_ODD_DMA_PROG: memory_list[unit].odd_dma_prog = addr; - memory_list[unit].addresses_stored = 1; - break; - case BKTR_MEM_VBIDATA: memory_list[unit].vbidata = addr; - memory_list[unit].addresses_stored = 1; - break; - case BKTR_MEM_VBIBUFFER: memory_list[unit].vbibuffer = addr; - memory_list[unit].addresses_stored = 1; - break; - case BKTR_MEM_BUF: memory_list[unit].buf = addr; - memory_list[unit].addresses_stored = 1; - break; - default: printf("bktr_mem: Invalid memory type %d for bktr%d, address 0x%xn", - type,unit,addr); - break; + case BKTR_MEM_DMA_PROG: + memory_list[unit].dma_prog = addr; + memory_list[unit].addresses_stored = 1; + break; + case BKTR_MEM_ODD_DMA_PROG: + memory_list[unit].odd_dma_prog = addr; + memory_list[unit].addresses_stored = 1; + break; + case BKTR_MEM_VBIDATA: + memory_list[unit].vbidata = addr; + memory_list[unit].addresses_stored = 1; + break; + case BKTR_MEM_VBIBUFFER: + memory_list[unit].vbibuffer = addr; + memory_list[unit].addresses_stored = 1; + break; + case BKTR_MEM_BUF: + memory_list[unit].buf = addr; + memory_list[unit].addresses_stored = 1; + break; + default: + printf("bktr_mem: Invalid memory type %d for bktr%d, address 0x%xn", + type, unit, addr); + break; } } /*************************************************************/ vm_offset_t -bktr_retrieve_address(int unit, int type) { +bktr_retrieve_address(int unit, int type) +{ - if ((unit < 0) || (unit >= BKTR_MEM_MAX_DEVICES)) { - printf("bktr_mem: Unit number %d too large for memory type %d\n",unit,type); - return NULL; + if (unit < 0 || unit >= BKTR_MEM_MAX_DEVICES) { + printf("bktr_mem: Unit number %d too large for memory type %d\n", + unit, type); + return (0); } switch (type) { - case BKTR_MEM_DMA_PROG: return memory_list[unit].dma_prog; - case BKTR_MEM_ODD_DMA_PROG: return memory_list[unit].odd_dma_prog; - case BKTR_MEM_VBIDATA: return memory_list[unit].vbidata; - case BKTR_MEM_VBIBUFFER: return memory_list[unit].vbibuffer; - case BKTR_MEM_BUF: return memory_list[unit].buf; - default: printf("bktr_mem: Invalid memory type %d for bktr%d",type,unit); - return NULL; + case BKTR_MEM_DMA_PROG: + return memory_list[unit].dma_prog; + case BKTR_MEM_ODD_DMA_PROG: + return memory_list[unit].odd_dma_prog; + case BKTR_MEM_VBIDATA: + return memory_list[unit].vbidata; + case BKTR_MEM_VBIBUFFER: + return memory_list[unit].vbibuffer; + case BKTR_MEM_BUF: + return memory_list[unit].buf; + default: + printf("bktr_mem: Invalid memory type %d for bktr%d", + type, unit); + return (0); } } /*************************************************************/ static moduledata_t bktr_mem_mod = { - "bktr_mem", - bktr_mem_modevent, - 0 + "bktr_mem", + bktr_mem_modevent, + 0 }; -/* The load order is First and module type is Driver to make sure bktr_mem - loads (and initialises) before bktr when both are loaded together */ + +/* + * The load order is First and module type is Driver to make sure bktr_mem + * loads (and initialises) before bktr when both are loaded together. + */ DECLARE_MODULE(bktr_mem, bktr_mem_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(bktr_mem, 1); ==== //depot/projects/netperf_socket/sys/dev/esp/esp_sbus.c#2 (text+ko) ==== @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/esp/esp_sbus.c,v 1.1 2004/06/10 05:11:39 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/esp/esp_sbus.c,v 1.3 2004/06/12 03:23:37 scottl Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -391,6 +391,8 @@ sc->sc_maxsync = sc->sc_minsync; sc->sc_maxoffset = 15; + sc->sc_extended_geom = 1; + /* * Alas, we must now modify the value a bit, because it's * only valid when can switch on FASTCLK and FASTSCSI bits ==== //depot/projects/netperf_socket/sys/dev/esp/ncr53c9x.c#2 (text+ko) ==== @@ -104,7 +104,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/esp/ncr53c9x.c,v 1.1 2004/06/10 05:11:39 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/esp/ncr53c9x.c,v 1.3 2004/06/12 05:19:17 scottl Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -839,7 +839,7 @@ return; case XPT_CALC_GEOMETRY: mtx_unlock(&sc->sc_lock); - cam_calc_geometry(&ccb->ccg, 0); /* XXX Extended? */ + cam_calc_geometry(&ccb->ccg, sc->sc_extended_geom); xpt_done(ccb); return; case XPT_PATH_INQ: @@ -944,7 +944,7 @@ ecb->ccb = ccb; ecb->timeout = ccb->ccb_h.timeout; - if (ccb->ccb_h.func_code == XPT_RESET_BUS) { + if (ccb->ccb_h.func_code == XPT_RESET_DEV) { ecb->flags |= ECB_RESET; ecb->clen = 0; ecb->dleft = 0; @@ -1219,6 +1219,7 @@ if ((ecb->flags & ECB_ABORT) != 0) { ccb->ccb_h.status = CAM_CMD_TIMEOUT; } else if ((ecb->flags & ECB_SENSE) != 0) { + ccb->ccb_h.status = CAM_AUTOSNS_VALID; } else if (ecb->stat == SCSI_STATUS_CHECK_COND) { if ((ecb->flags & ECB_SENSE) != 0) ccb->ccb_h.status = CAM_AUTOSENSE_FAIL; ==== //depot/projects/netperf_socket/sys/dev/esp/ncr53c9xvar.h#2 (text+ko) ==== @@ -66,7 +66,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $FreeBSD: src/sys/dev/esp/ncr53c9xvar.h,v 1.1 2004/06/10 05:11:39 scottl Exp $ */ +/* $FreeBSD: src/sys/dev/esp/ncr53c9xvar.h,v 1.2 2004/06/11 15:33:20 scottl Exp $ */ #ifndef _DEV_IC_NCR53C9XVAR_H_ #define _DEV_IC_NCR53C9XVAR_H_ @@ -345,6 +345,7 @@ int sc_maxsync; /* Maximum sync period */ int sc_maxoffset; /* Maximum offset */ int sc_maxwidth; /* Maximum width */ + int sc_extended_geom; /* Should we return extended geometry */ struct mtx sc_lock; /* driver mutex */ }; ==== //depot/projects/netperf_socket/sys/dev/hme/if_hme.c#8 (text+ko) ==== @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/hme/if_hme.c,v 1.26 2004/06/10 00:06:04 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/hme/if_hme.c,v 1.27 2004/06/12 02:23:06 marius Exp $"); /* * HME Ethernet module driver. @@ -819,7 +819,7 @@ #endif /* Set the current media. */ - mii_mediachg(sc->sc_mii); + /* mii_mediachg(sc->sc_mii); */ /* Start the one second timer. */ callout_reset(&sc->sc_tick_ch, hz, hme_tick, sc); ==== //depot/projects/netperf_socket/sys/dev/twe/twe.c#5 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/twe/twe.c,v 1.21 2004/05/12 04:10:37 vkashyap Exp $ + * $FreeBSD: src/sys/dev/twe/twe.c,v 1.22 2004/06/11 18:42:44 vkashyap Exp $ */ /* @@ -384,7 +384,7 @@ debug_called(4); - if (sc->twe_state & TWE_STATE_FRZN) + if (sc->twe_state & (TWE_STATE_CTLR_BUSY | TWE_STATE_FRZN)) return; /* spin until something prevents us from doing any work */ @@ -435,6 +435,8 @@ error = twe_map_request(tr); if (error != 0) { + if (error == EBUSY) + break; tr->tr_status = TWE_CMD_ERROR; if (tr->tr_private != NULL) { bp = (twe_bio *)(tr->tr_private); @@ -762,7 +764,7 @@ } else { tr->tr_complete = func; error = twe_map_request(tr); - if (error == 0) + if ((error == 0) || (error == EBUSY)) return(func); } @@ -931,7 +933,8 @@ tr->tr_flags |= TWE_CMD_IMMEDIATE; tr->tr_status = TWE_CMD_BUSY; if ((error = twe_map_request(tr)) != 0) - return(error); + if (error != EBUSY) + return(error); while (tr->tr_status == TWE_CMD_BUSY){ twe_done(tr->tr_sc); } @@ -1131,6 +1134,7 @@ /* move to completed queue */ twe_remove_busy(tr); twe_enqueue_complete(tr); + sc->twe_state &= ~TWE_STATE_CTLR_BUSY; } else { break; /* no response ready */ } ==== //depot/projects/netperf_socket/sys/dev/twe/twe_freebsd.c#5 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/twe/twe_freebsd.c,v 1.37 2004/03/25 19:30:35 vkashyap Exp $ + * $FreeBSD: src/sys/dev/twe/twe_freebsd.c,v 1.38 2004/06/11 18:42:44 vkashyap Exp $ */ /* @@ -1014,8 +1014,10 @@ } } - if (twe_start(tr) == EBUSY) + if (twe_start(tr) == EBUSY) { + tr->tr_sc->twe_state |= TWE_STATE_CTLR_BUSY; twe_requeue_ready(tr); + } } static void @@ -1037,8 +1039,10 @@ debug_called(4); - if (sc->twe_state & TWE_STATE_FRZN) + if (sc->twe_state & (TWE_STATE_CTLR_BUSY | TWE_STATE_FRZN)) { + twe_requeue_ready(tr); return (EBUSY); + } bus_dmamap_sync(sc->twe_cmd_dmat, sc->twe_cmdmap, BUS_DMASYNC_PREWRITE); @@ -1079,8 +1083,8 @@ } } else if ((error = twe_start(tr)) == EBUSY) { + sc->twe_state |= TWE_STATE_CTLR_BUSY; twe_requeue_ready(tr); - error = 0; } return(error); ==== //depot/projects/netperf_socket/sys/dev/twe/twevar.h#5 (text+ko) ==== @@ -24,10 +24,10 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/twe/twevar.h,v 1.12 2004/05/12 04:10:37 vkashyap Exp $ + * $FreeBSD: src/sys/dev/twe/twevar.h,v 1.13 2004/06/11 18:42:44 vkashyap Exp $ */ -#define TWE_DRIVER_VERSION_STRING "1.50.01.001" +#define TWE_DRIVER_VERSION_STRING "1.50.01.002" #ifdef TWE_DEBUG #define debug(level, fmt, args...) \ @@ -131,7 +131,8 @@ #define TWE_STATE_SHUTDOWN (1<<1) /* controller is shut down */ #define TWE_STATE_OPEN (1<<2) /* control device is open */ #define TWE_STATE_SUSPEND (1<<3) /* controller is suspended */ -#define TWE_STATE_FRZN (1<<4) +#define TWE_STATE_FRZN (1<<4) /* got EINPROGRESS */ +#define TWE_STATE_CTLR_BUSY (1<<5) /* controller cmd queue full */ int twe_host_id; struct twe_qstat twe_qstat[TWEQ_COUNT]; /* queue statistics */ ==== //depot/projects/netperf_socket/sys/ia64/ia64/pmap.c#8 (text+ko) ==== @@ -46,7 +46,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/ia64/ia64/pmap.c,v 1.133 2004/06/11 04:24:35 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/ia64/ia64/pmap.c,v 1.134 2004/06/11 20:11:41 alc Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -1606,7 +1606,8 @@ /* * Enter on the PV list if part of our managed memory. */ - if (pmap_initialized && (m->flags & PG_FICTITIOUS) == 0) { + if (pmap_initialized && + (m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { pmap_insert_entry(pmap, va, m); managed |= PTE_IG_MANAGED; } @@ -1653,17 +1654,23 @@ { struct ia64_lpte *pte; pmap_t oldpmap; + int managed; oldpmap = pmap_install(pmap); pte = pmap_find_pte(va); if (pte->pte_p) goto reinstall; + managed = 0; /* * Enter on the PV list since its part of our managed memory. */ - pmap_insert_entry(pmap, va, m); + if (pmap_initialized && + (m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { + pmap_insert_entry(pmap, va, m); + managed |= PTE_IG_MANAGED; + } /* * Increment counters @@ -1673,8 +1680,7 @@ /* * Initialise PTE with read-only protection and enter into VHPT. */ - pmap_set_pte(pte, va, VM_PAGE_TO_PHYS(m), - PTE_IG_MANAGED, + pmap_set_pte(pte, va, VM_PAGE_TO_PHYS(m), managed, PTE_PL_USER, PTE_AR_R); reinstall: pmap_install(oldpmap); ==== //depot/projects/netperf_socket/sys/kern/kern_kse.c#2 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_kse.c,v 1.180 2004/06/07 07:26:53 julian Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_kse.c,v 1.181 2004/06/11 17:48:20 julian Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -36,7 +36,6 @@ #include <sys/mutex.h> #include <sys/proc.h> #include <sys/smp.h> -#include <sys/sysctl.h> #include <sys/sysproto.h> #include <sys/sched.h> #include <sys/signalvar.h> @@ -53,6 +52,7 @@ /* DEBUG ONLY */ extern int virtual_cpu; extern int thread_debug; + extern int max_threads_per_proc; extern int max_groups_per_proc; extern int max_threads_hits; @@ -73,39 +73,6 @@ void kseinit(void); void kse_GC(void); -static int virtual_cpu; -SYSCTL_DECL(_kern_threads); - -static int -sysctl_kse_virtual_cpu(SYSCTL_HANDLER_ARGS) -{ - int error, new_val; - int def_val; - -#ifdef SMP - def_val = mp_ncpus; -#else - def_val = 1; -#endif - if (virtual_cpu == 0) - new_val = def_val; - else - new_val = virtual_cpu; - error = sysctl_handle_int(oidp, &new_val, 0, req); - if (error != 0 || req->newptr == NULL) - return (error); - if (new_val < 0) - return (EINVAL); - virtual_cpu = new_val; - return (0); -} - -/* DEBUG ONLY */ -SYSCTL_PROC(_kern_threads, OID_AUTO, virtual_cpu, CTLTYPE_INT|CTLFLAG_RW, - 0, sizeof(virtual_cpu), sysctl_kse_virtual_cpu, "I", - "debug virtual cpus"); - - struct kse_upcall * upcall_alloc(void) { @@ -265,10 +232,24 @@ int error, count; p = td->td_proc; + /* + * Ensure that this is only called from the UTS + */ if ((ku = td->td_upcall) == NULL || TD_CAN_UNBIND(td)) return (EINVAL); + kg = td->td_ksegrp; count = 0; + + /* + * Calculate the existing non-exiting upcalls in this ksegroup. + * If we are the last upcall but there are still other threads, + * then do not exit. We need the other threads to be able to + * complete whatever they are doing. + * XXX This relies on the userland knowing what to do if we return. + * It may be a better choice to convert ourselves into a kse_release + * ( or similar) and wait in the kernel to be needed. + */ PROC_LOCK(p); mtx_lock_spin(&sched_lock); FOREACH_UPCALL_IN_GROUP(kg, ku2) { @@ -284,6 +265,12 @@ ku->ku_flags |= KUF_EXITING; mtx_unlock_spin(&sched_lock); PROC_UNLOCK(p); + + /* + * Mark the UTS mailbox as having been finished with. + * If that fails then just go for a segfault. + * XXX need to check it that can be deliverred without a mailbox. + */ error = suword(&ku->ku_mailbox->km_flags, ku->ku_mflags|KMF_DONE); PROC_LOCK(p); if (error) @@ -467,12 +454,7 @@ if ((err = copyin(uap->mbx, &mbx, sizeof(mbx)))) return (err); - /* Too bad, why hasn't kernel always a cpu counter !? */ -#ifdef SMP ncpus = mp_ncpus; -#else - ncpus = 1; -#endif if (virtual_cpu != 0) ncpus = virtual_cpu; if (!(mbx.km_flags & KMF_BOUND)) @@ -635,7 +617,7 @@ } /* - * Initialize global kse related resources. + * Initialize global thread allocation resources. */ void kseinit(void) @@ -669,7 +651,7 @@ * Don't even bother to lock if none at this instant, * we really don't care about the next instant.. */ - if ((!TAILQ_EMPTY(&zombie_upcalls))) { + if (!TAILQ_EMPTY(&zombie_upcalls)) { mtx_lock_spin(&kse_zombie_lock); ku_first = TAILQ_FIRST(&zombie_upcalls); if (ku_first) @@ -929,7 +911,7 @@ bcopy(&td->td_startcopy, &td2->td_startcopy, (unsigned) RANGEOF(struct thread, td_startcopy, td_endcopy)); thread_link(td2, ku->ku_ksegrp); - /* inherit blocked thread's context */ + /* inherit parts of blocked thread's context as a good template */ cpu_set_upcall(td2, td); /* Let the new thread become owner of the upcall */ ku->ku_owner = td2; @@ -1285,3 +1267,4 @@ else return (0); } + ==== //depot/projects/netperf_socket/sys/kern/kern_thread.c#12 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_thread.c,v 1.180 2004/06/09 14:06:44 jmallett Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_thread.c,v 1.181 2004/06/11 17:48:20 julian Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -35,6 +35,7 @@ #include <sys/lock.h> #include <sys/mutex.h> #include <sys/proc.h> +#include <sys/smp.h> #include <sys/sysctl.h> #include <sys/sched.h> #include <sys/sleepqueue.h> @@ -70,6 +71,9 @@ SYSCTL_INT(_kern_threads, OID_AUTO, max_threads_hits, CTLFLAG_RD, &max_threads_hits, 0, ""); +int virtual_cpu; + +#define RANGEOF(type, start, end) (offsetof(type, end) - offsetof(type, start)) TAILQ_HEAD(, thread) zombie_threads = TAILQ_HEAD_INITIALIZER(zombie_threads); TAILQ_HEAD(, kse) zombie_kses = TAILQ_HEAD_INITIALIZER(zombie_kses); @@ -85,7 +89,31 @@ extern void kse_GC(void); +static int +sysctl_kse_virtual_cpu(SYSCTL_HANDLER_ARGS) +{ + int error, new_val; + int def_val; + def_val = mp_ncpus; + if (virtual_cpu == 0) + new_val = def_val; + else + new_val = virtual_cpu; + error = sysctl_handle_int(oidp, &new_val, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (new_val < 0) + return (EINVAL); + virtual_cpu = new_val; + return (0); +} + +/* DEBUG ONLY */ +SYSCTL_PROC(_kern_threads, OID_AUTO, virtual_cpu, CTLTYPE_INT|CTLFLAG_RW, + 0, sizeof(virtual_cpu), sysctl_kse_virtual_cpu, "I", + "debug virtual cpus"); + /* * Thread ID allocator. The allocator keeps track of assigned IDs by * using a bitmap. The bitmap is created in parts. The parts are linked @@ -556,11 +584,24 @@ /* * Discard the current thread and exit from its context. + * Always called with scheduler locked. * * Because we can't free a thread while we're operating under its context, * push the current thread into our CPU's deadthread holder. This means * we needn't worry about someone else grabbing our context before we - * do a cpu_throw(). + * do a cpu_throw(). This may not be needed now as we are under schedlock. + * Maybe we can just do a thread_stash() as thr_exit1 does. + */ +/* XXX + * libthr expects its thread exit to return for the last + * thread, meaning that the program is back to non-threaded + * mode I guess. Because we do this (cpu_throw) unconditionally + * here, they have their own version of it. (thr_exit1()) + * that doesn't do it all if this was the last thread. + * It is also called from thread_suspend_check(). + * Of course in the end, they end up coming here through exit1 + * anyhow.. After fixing 'thr' to play by the rules we should be able + * to merge these two functions together. */ void thread_exit(void) ==== //depot/projects/netperf_socket/sys/kern/tty_conf.c#4 (text+ko) ==== @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/tty_conf.c,v 1.21 2004/06/07 20:45:45 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/tty_conf.c,v 1.22 2004/06/12 12:31:42 phk Exp $"); #include "opt_compat.h" @@ -122,8 +122,9 @@ if (discipline == LDISC_LOAD) { int i; for (i = LOADABLE_LDISC; i < MAXLDISC; i++) - if (bcmp(linesw + i, &nodisc, sizeof(nodisc)) == 0) { + if (linesw[i] == &nodisc) { slot = i; + break; } } else if (discipline >= 0 && discipline < MAXLDISC) { slot = discipline; ==== //depot/projects/netperf_socket/sys/kern/uipc_mbuf.c#7 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/uipc_mbuf.c,v 1.132 2004/06/10 00:04:27 bmilekic Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/uipc_mbuf.c,v 1.133 2004/06/11 18:17:25 bmilekic Exp $"); #include "opt_mac.h" #include "opt_param.h" @@ -237,7 +237,7 @@ */ if (m->m_ext.ext_type == EXT_PACKET) { uma_zfree(zone_pack, m); - break; + return; } else if (m->m_ext.ext_type == EXT_CLUSTER) { uma_zfree(zone_clust, m->m_ext.ext_buf); m->m_ext.ext_buf = NULL; @@ -246,13 +246,14 @@ m->m_ext.ext_args); if (m->m_ext.ext_type != EXT_EXTREF) free(m->m_ext.ref_cnt, M_MBUF); + m->m_ext.ext_buf = NULL; } - uma_zfree(zone_mbuf, m); } /* Decrement (and potentially free) done, safely. */ break; } } while (1); + uma_zfree(zone_mbuf, m); } /* ==== //depot/projects/netperf_socket/sys/kern/uipc_socket.c#15 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/uipc_socket.c,v 1.175 2004/06/08 13:08:17 stefanf Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/uipc_socket.c,v 1.176 2004/06/12 16:08:41 rwatson Exp $"); #include "opt_inet.h" #include "opt_mac.h" ==== //depot/projects/netperf_socket/sys/netinet/ip_fw2.c#7 (text+ko) ==== @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/netinet/ip_fw2.c,v 1.61 2004/06/10 20:20:37 ru Exp $ + * $FreeBSD: src/sys/netinet/ip_fw2.c,v 1.62 2004/06/11 22:17:14 csjp Exp $ */ #define DEB(x) @@ -113,6 +113,18 @@ static struct callout ipfw_timeout; #define IPFW_DEFAULT_RULE 65535 +/* + * Data structure to cache our ucred related + * information. This structure only gets used if + * the user specified UID/GID based constraints in + * a firewall rule. + */ +struct ip_fw_ugid { + gid_t fw_groups[NGROUPS]; + int fw_ngroups; + uid_t fw_uid; +}; + struct ip_fw_chain { struct ip_fw *rules; /* list of rules */ struct ip_fw *reap; /* list of rules to reap */ @@ -1530,13 +1542,23 @@ ipfw_insn_u32 *insn, >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406121658.i5CGwI0e039898>