Date: Thu, 16 Oct 2003 14:14:39 -0700 (PDT) From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 39808 for review Message-ID: <200310162114.h9GLEdf6026163@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=39808 Change 39808 by sam@sam_ebb on 2003/10/16 14:14:18 IFC Affected files ... .. //depot/projects/netperf/sys/dev/ciss/ciss.c#5 integrate .. //depot/projects/netperf/sys/dev/ed/if_ed.c#3 integrate .. //depot/projects/netperf/sys/dev/ed/if_ed_cbus.c#3 integrate .. //depot/projects/netperf/sys/dev/ed/if_ed_isa.c#3 integrate .. //depot/projects/netperf/sys/dev/ed/if_edreg.h#2 integrate .. //depot/projects/netperf/sys/dev/ed/if_edvar.h#2 integrate .. //depot/projects/netperf/sys/fs/specfs/spec_vnops.c#6 integrate .. //depot/projects/netperf/sys/i386/isa/apic_vector.s#2 integrate .. //depot/projects/netperf/sys/i386/isa/isa_compat.c#3 integrate .. //depot/projects/netperf/sys/kern/kern_clock.c#2 integrate .. //depot/projects/netperf/sys/kern/kern_proc.c#6 integrate .. //depot/projects/netperf/sys/kern/kern_switch.c#2 integrate .. //depot/projects/netperf/sys/kern/kern_synch.c#7 integrate .. //depot/projects/netperf/sys/kern/sched_4bsd.c#5 integrate .. //depot/projects/netperf/sys/kern/sched_ule.c#9 integrate .. //depot/projects/netperf/sys/kern/subr_bus.c#5 integrate .. //depot/projects/netperf/sys/kern/subr_kobj.c#3 integrate .. //depot/projects/netperf/sys/net/if.c#6 integrate .. //depot/projects/netperf/sys/netinet/ip_fw2.c#10 integrate .. //depot/projects/netperf/sys/netinet/ip_input.c#12 integrate .. //depot/projects/netperf/sys/sys/bus.h#3 integrate .. //depot/projects/netperf/sys/sys/conf.h#3 integrate .. //depot/projects/netperf/sys/sys/endian.h#2 integrate .. //depot/projects/netperf/sys/sys/kobj.h#3 integrate .. //depot/projects/netperf/sys/sys/mutex.h#4 integrate .. //depot/projects/netperf/sys/sys/param.h#9 integrate .. //depot/projects/netperf/sys/sys/sched.h#2 integrate .. //depot/projects/netperf/sys/tools/makeobjops.awk#2 integrate Differences ... ==== //depot/projects/netperf/sys/dev/ciss/ciss.c#5 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/ciss/ciss.c,v 1.29 2003/09/08 16:45:33 ps Exp $ + * $FreeBSD: src/sys/dev/ciss/ciss.c,v 1.30 2003/10/15 18:52:44 ps Exp $ */ /* @@ -1152,7 +1152,8 @@ */ if (bootverbose) { ciss_printf(sc, "logical drive %d: %s, %dMB ", - cbc->log_drive, ciss_name_ldrive_org(ld->cl_ldrive->fault_tolerance), + ld->cl_address.logical.lun, + ciss_name_ldrive_org(ld->cl_ldrive->fault_tolerance), ((ld->cl_ldrive->blocks_available / (1024 * 1024)) * ld->cl_ldrive->block_size)); ==== //depot/projects/netperf/sys/dev/ed/if_ed.c#3 (text+ko) ==== @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/ed/if_ed.c,v 1.218 2003/08/07 15:04:24 jhb Exp $ + * $FreeBSD: src/sys/dev/ed/if_ed.c,v 1.219 2003/10/15 17:22:15 shiba Exp $ */ /* @@ -911,6 +911,120 @@ } /* + * Probe and vendor-specific initialization routine for SIC boards + */ +int +ed_probe_SIC(dev, port_rid, flags) + device_t dev; + int port_rid; + int flags; +{ + struct ed_softc *sc = device_get_softc(dev); + int error; + int i; + u_int memsize; + u_long conf_maddr, conf_msize; + u_char sum; + + error = ed_alloc_port(dev, 0, ED_SIC_IO_PORTS); + if (error) + return (error); + + sc->asic_offset = ED_SIC_ASIC_OFFSET; + sc->nic_offset = ED_SIC_NIC_OFFSET; + + error = bus_get_resource(dev, SYS_RES_MEMORY, 0, + &conf_maddr, &conf_msize); + if (error) + return (error); + + memsize = 16384; + if (conf_msize > 1) + memsize = conf_msize; + + error = ed_alloc_memory(dev, 0, memsize); + if (error) + return (error); + + sc->mem_start = (caddr_t) rman_get_virtual(sc->mem_res); + sc->mem_size = memsize; + + /* Reset card to force it into a known state. */ + ed_asic_outb(sc, 0, 0x00); + DELAY(100); + + /* + * Here we check the card ROM, if the checksum passes, and the + * type code and ethernet address check out, then we know we have + * an SIC card. + */ + ed_asic_outb(sc, 0, 0x81); + DELAY(100); + + sum = sc->mem_start[6]; + for (i = 0; i < ETHER_ADDR_LEN; i++) { + sum ^= (sc->arpcom.ac_enaddr[i] = sc->mem_start[i]); + } +#ifdef ED_DEBUG + device_printf(dev, "ed_probe_sic: got address %6D\n", + sc->arpcom.ac_enaddr, ":"); +#endif + if (sum != 0) { + return (ENXIO); + } + if ((sc->arpcom.ac_enaddr[0] | sc->arpcom.ac_enaddr[1] | + sc->arpcom.ac_enaddr[2]) == 0) { + return (ENXIO); + } + + sc->vendor = ED_VENDOR_SIC; + sc->type_str = "SIC"; + sc->isa16bit = 0; + sc->cr_proto = 0; + + /* + * SIC RAM page 0x0000-0x3fff(or 0x7fff) + */ + ed_asic_outb(sc, 0, 0x80); + DELAY(100); + + /* + * Now zero memory and verify that it is clear + */ + bzero(sc->mem_start, sc->mem_size); + + for (i = 0; i < sc->mem_size; i++) { + if (sc->mem_start[i]) { + device_printf(dev, "failed to clear shared memory " + "at %jx - check configuration\n", + (uintmax_t)kvtop(sc->mem_start + i)); + + return (ENXIO); + } + } + + sc->mem_shared = 1; + sc->mem_end = sc->mem_start + sc->mem_size; + + /* + * allocate one xmit buffer if < 16k, two buffers otherwise + */ + if ((sc->mem_size < 16384) || (flags & ED_FLAGS_NO_MULTI_BUFFERING)) { + sc->txb_cnt = 1; + } else { + sc->txb_cnt = 2; + } + sc->tx_page_start = 0; + + sc->rec_page_start = sc->tx_page_start + ED_TXBUF_SIZE * sc->txb_cnt; + sc->rec_page_stop = sc->tx_page_start + sc->mem_size / ED_PAGE_SIZE; + + sc->mem_ring = sc->mem_start + sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE; + + return (0); +} + +/* * Probe and vendor-specific initialization routine for NE1000/2000 boards */ int ==== //depot/projects/netperf/sys/dev/ed/if_ed_cbus.c#3 (text+ko) ==== @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/ed/if_ed_cbus.c,v 1.10 2003/08/06 18:06:30 bde Exp $ + * $FreeBSD: src/sys/dev/ed/if_ed_cbus.c,v 1.11 2003/10/15 17:22:15 shiba Exp $ */ #include <sys/param.h> @@ -869,8 +869,8 @@ return (error); } - sc->asic_offset = ED_NOVELL_ASIC_OFFSET; - sc->nic_offset = ED_NOVELL_NIC_OFFSET; + sc->asic_offset = ED_SIC_ASIC_OFFSET; + sc->nic_offset = ED_SIC_NIC_OFFSET; error = ed98_alloc_memory(dev, 0); if (error) { @@ -916,7 +916,7 @@ return (ENXIO); } - sc->vendor = ED_VENDOR_MISC; + sc->vendor = ED_VENDOR_SIC; sc->type_str = "SIC98"; sc->isa16bit = 1; sc->cr_proto = 0; ==== //depot/projects/netperf/sys/dev/ed/if_ed_isa.c#3 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ed/if_ed_isa.c,v 1.13 2003/08/24 17:46:04 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ed/if_ed_isa.c,v 1.14 2003/10/15 17:22:15 shiba Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -97,6 +97,11 @@ goto end; ed_release_resources(dev); + error = ed_probe_SIC(dev, 0, flags); + if (error == 0) + goto end; + ed_release_resources(dev); + error = ed_probe_Novell(dev, 0, flags); if (error == 0) goto end; ==== //depot/projects/netperf/sys/dev/ed/if_edreg.h#2 (text+ko) ==== @@ -6,7 +6,7 @@ * of this software, nor does the author assume any responsibility * for damages incurred with its use. * - * $FreeBSD: src/sys/dev/ed/if_edreg.h,v 1.31 2001/07/22 18:58:44 iedowse Exp $ + * $FreeBSD: src/sys/dev/ed/if_edreg.h,v 1.32 2003/10/15 17:22:15 shiba Exp $ */ /* * National Semiconductor DS8390 NIC register definitions @@ -578,6 +578,7 @@ #define ED_VENDOR_PCCARD 0x03 /* PCMCIA/PCCARD */ #define ED_VENDOR_HP 0x04 /* Hewlett Packard */ #define ED_VENDOR_LINKSYS 0x05 /* Linksys (Dlink) */ +#define ED_VENDOR_SIC 0x06 /* Allied-Telesis SIC */ /* * Compile-time config flags @@ -1101,6 +1102,14 @@ #define ED_TYPE_HP_PCLANPLUS 0x00 /* + * Definitions for Allied-Telesis SIC + */ +#define ED_SIC_NIC_OFFSET 0 +#define ED_SIC_ASIC_OFFSET 0x10 /* offset to nic i/o regs */ + +#define ED_SIC_IO_PORTS 17 /* # of i/o addresses used */ + +/* * Chip types. */ ==== //depot/projects/netperf/sys/dev/ed/if_edvar.h#2 (text+ko) ==== @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/ed/if_edvar.h,v 1.14 2002/03/20 02:07:18 alfred Exp $ + * $FreeBSD: src/sys/dev/ed/if_edvar.h,v 1.15 2003/10/15 17:22:15 shiba Exp $ */ #ifndef SYS_DEV_ED_IF_EDVAR_H @@ -199,6 +199,7 @@ int ed_probe_WD80x3 (device_t, int, int); int ed_probe_WD80x3_generic (device_t, int, unsigned short *[]); int ed_probe_3Com (device_t, int, int); +int ed_probe_SIC (device_t, int, int); int ed_probe_Novell (device_t, int, int); int ed_probe_Novell_generic (device_t, int); int ed_probe_HP_pclanp (device_t, int, int); ==== //depot/projects/netperf/sys/fs/specfs/spec_vnops.c#6 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95 - * $FreeBSD: src/sys/fs/specfs/spec_vnops.c,v 1.210 2003/10/04 09:20:00 alc Exp $ + * $FreeBSD: src/sys/fs/specfs/spec_vnops.c,v 1.211 2003/10/15 20:00:59 phk Exp $ */ #include <sys/param.h> @@ -196,9 +196,14 @@ VOP_UNLOCK(vp, 0, td); if(dsw->d_flags & D_NOGIANT) { DROP_GIANT(); - error = dsw->d_open(dev, ap->a_mode, S_IFCHR, td); + if (dsw->d_fdopen != NULL) + error = dsw->d_fdopen(dev, ap->a_mode, td, ap->a_fdidx); + else + error = dsw->d_open(dev, ap->a_mode, S_IFCHR, td); PICKUP_GIANT(); - } else + } else if (dsw->d_fdopen != NULL) + error = dsw->d_fdopen(dev, ap->a_mode, td, ap->a_fdidx); + else error = dsw->d_open(dev, ap->a_mode, S_IFCHR, td); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); ==== //depot/projects/netperf/sys/i386/isa/apic_vector.s#2 (text+ko) ==== @@ -1,6 +1,6 @@ /* * from: vector.s, 386BSD 0.1 unknown origin - * $FreeBSD: src/sys/i386/isa/apic_vector.s,v 1.89 2003/07/10 01:02:59 peter Exp $ + * $FreeBSD: src/sys/i386/isa/apic_vector.s,v 1.90 2003/10/16 10:44:24 bde Exp $ */ #include <machine/apic.h> @@ -467,10 +467,12 @@ pushl %ecx pushl %edx pushl %ds /* save current data segment */ + pushl %es pushl %fs movl $KDSEL, %eax mov %ax, %ds /* use KERNEL data segment */ + mov %ax, %es movl $KPSEL, %eax mov %ax, %fs @@ -507,6 +509,7 @@ call *%eax 2: popl %fs + popl %es popl %ds /* restore previous data segment */ popl %edx popl %ecx ==== //depot/projects/netperf/sys/i386/isa/isa_compat.c#3 (text+ko) ==== @@ -27,7 +27,7 @@ #ifndef BURN_BRIDGES #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/i386/isa/isa_compat.c,v 1.28 2003/09/05 14:55:11 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/isa/isa_compat.c,v 1.29 2003/10/16 09:18:35 dfr Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -48,6 +48,17 @@ #include <isa/isavar.h> #include <i386/isa/isa_device.h> +/* + * The 'priv' field has been removed from 'struct driver' since the + * only remaining user of that field was this compatibility layer. We + * use this field to map from the newbus driver stub to the underlying + * old-style isa driver. + */ +struct isa_compat_driver { + KOBJ_CLASS_FIELDS; + void *priv; +}; + struct isa_compat_resources { struct resource *ports; struct resource *memory; @@ -137,6 +148,7 @@ static int isa_compat_probe(device_t dev) { + struct isa_compat_driver *drv; struct isa_device *dvp = device_get_softc(dev); struct isa_compat_resources res; u_long start, count; @@ -149,7 +161,8 @@ /* * Fill in the isa_device fields. */ - dvp->id_driver = device_get_driver(dev)->priv; + drv = (struct isa_compat_driver *) device_get_driver(dev); + dvp->id_driver = drv->priv; if (bus_get_resource(dev, SYS_RES_IOPORT, 0, &start, &count) == 0) dvp->id_iobase = start; @@ -267,12 +280,13 @@ compat_isa_handler(module_t mod, int type, void *data) { struct isa_driver *id = (struct isa_driver *)data; - driver_t *driver; + struct isa_compat_driver *driver; devclass_t isa_devclass = devclass_find("isa"); switch (type) { case MOD_LOAD: - driver = malloc(sizeof(driver_t), M_DEVBUF, M_NOWAIT | M_ZERO); + driver = malloc(sizeof(struct isa_compat_driver), + M_DEVBUF, M_NOWAIT | M_ZERO); if (!driver) return ENOMEM; driver->name = id->name; @@ -287,7 +301,7 @@ driver->name); #endif } - devclass_add_driver(isa_devclass, driver); + devclass_add_driver(isa_devclass, (kobj_class_t) driver); break; case MOD_UNLOAD: printf("%s: module unload not supported!\n", id->name); ==== //depot/projects/netperf/sys/kern/kern_clock.c#2 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_clock.c,v 1.162 2003/06/27 08:35:05 smkelly Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_clock.c,v 1.163 2003/10/16 08:39:15 jeff Exp $"); #include "opt_ntp.h" #include "opt_ddb.h" @@ -385,7 +385,6 @@ struct rusage *ru; struct vmspace *vm; struct thread *td; - struct kse *ke; struct proc *p; long rss; @@ -393,7 +392,6 @@ p = td->td_proc; mtx_lock_spin_flags(&sched_lock, MTX_QUIET); - ke = td->td_kse; if (CLKF_USERMODE(frame)) { /* * Charge the time as appropriate. @@ -401,7 +399,7 @@ if (p->p_flag & P_SA) thread_statclock(1); p->p_uticks++; - if (ke->ke_ksegrp->kg_nice > NZERO) + if (td->td_ksegrp->kg_nice > NZERO) cp_time[CP_NICE]++; else cp_time[CP_USER]++; @@ -433,7 +431,7 @@ } } - sched_clock(ke); + sched_clock(td); /* Update resource usage integrals and maximums. */ if ((pstats = p->p_stats) != NULL && ==== //depot/projects/netperf/sys/kern/kern_proc.c#6 (text+ko) ==== @@ -31,11 +31,11 @@ * SUCH DAMAGE. * * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95 - * $FreeBSD: src/sys/kern/kern_proc.c,v 1.196 2003/10/15 03:11:46 peter Exp $ + * $FreeBSD: src/sys/kern/kern_proc.c,v 1.197 2003/10/16 08:39:15 jeff Exp $ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_proc.c,v 1.196 2003/10/15 03:11:46 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_proc.c,v 1.197 2003/10/16 08:39:15 jeff Exp $"); #include "opt_ktrace.h" #include "opt_kstack_pages.h" @@ -763,16 +763,13 @@ kp->ki_tdflags = td->td_flags; kp->ki_pcb = td->td_pcb; kp->ki_kstack = (void *)td->td_kstack; + kp->ki_pctcpu = sched_pctcpu(td); /* Things in the kse */ - - if (ke) { + if (ke) kp->ki_rqindex = ke->ke_rqindex; - kp->ki_pctcpu = sched_pctcpu(ke); - } else { + else kp->ki_rqindex = 0; - kp->ki_pctcpu = 0; - } } else { kp->ki_stat = SZOMB; ==== //depot/projects/netperf/sys/kern/kern_switch.c#2 (text+ko) ==== @@ -86,7 +86,7 @@ ***/ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_switch.c,v 1.60 2003/06/15 00:31:24 davidxu Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_switch.c,v 1.61 2003/10/16 08:39:15 jeff Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -210,7 +210,7 @@ kg->kg_last_assigned = td; td->td_kse = ke; ke->ke_thread = td; - sched_add(ke); + sched_add(td); CTR2(KTR_RUNQ, "kse_reassign: ke%p -> td%p", ke, td); return; } @@ -249,7 +249,7 @@ */ if ((td->td_proc->p_flag & P_SA) == 0) { /* Bring its kse with it, leave the thread attached */ - sched_rem(ke); + sched_rem(td); ke->ke_state = KES_THREAD; return; } @@ -262,7 +262,7 @@ * KSE to the next available thread. Then, we should * see if we need to move the KSE in the run queues. */ - sched_rem(ke); + sched_rem(td); ke->ke_state = KES_THREAD; td2 = kg->kg_last_assigned; KASSERT((td2 != NULL), ("last assigned has wrong value")); @@ -294,8 +294,8 @@ /* We only care about the kse in the run queue. */ td->td_priority = newpri; if (ke->ke_rqindex != (newpri / RQ_PPQ)) { - sched_rem(ke); - sched_add(ke); + sched_rem(td); + sched_add(td); } return; } @@ -309,7 +309,7 @@ kg->kg_last_assigned = TAILQ_PREV(td, threadqueue, td_runq); } - sched_rem(ke); + sched_rem(td); } TAILQ_REMOVE(&kg->kg_runq, td, td_runq); td->td_priority = newpri; @@ -337,7 +337,7 @@ * and the KSE is always already attached. * Totally ignore the ksegrp run queue. */ - sched_add(td->td_kse); + sched_add(td); return; } @@ -360,7 +360,7 @@ ke->ke_thread = NULL; tda = kg->kg_last_assigned = TAILQ_PREV(tda, threadqueue, td_runq); - sched_rem(ke); + sched_rem(td); } } else { /* @@ -419,7 +419,7 @@ td2->td_kse = ke; ke->ke_thread = td2; } - sched_add(ke); + sched_add(ke->ke_thread); } } ==== //depot/projects/netperf/sys/kern/kern_synch.c#7 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_synch.c,v 1.235 2003/10/05 09:35:08 bms Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_synch.c,v 1.236 2003/10/16 08:53:46 jeff Exp $"); #include "opt_ddb.h" #include "opt_ktrace.h" @@ -457,9 +457,7 @@ { struct bintime new_switchtime; struct thread *td; - struct thread *newtd; struct proc *p; - u_int sched_nest; mtx_assert(&sched_lock, MA_OWNED | MA_NOTRECURSED); td = curthread; /* XXX */ @@ -510,18 +508,9 @@ PCPU_SET(switchtime, new_switchtime); CTR3(KTR_PROC, "mi_switch: old thread %p (pid %d, %s)", td, p->p_pid, p->p_comm); - sched_nest = sched_lock.mtx_recurse; if (td->td_proc->p_flag & P_SA) thread_switchout(td); - sched_switchout(td); - - newtd = choosethread(); - if (td != newtd) - cpu_switch(td, newtd); /* SHAZAM!! */ - - sched_lock.mtx_recurse = sched_nest; - sched_lock.mtx_lock = (uintptr_t)td; - sched_switchin(td); + sched_switch(td); /* * Start setting up stats etc. for the incoming thread. ==== //depot/projects/netperf/sys/kern/sched_4bsd.c#5 (text+ko) ==== @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.22 2003/08/19 17:51:09 sam Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.24 2003/10/16 08:53:46 jeff Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -441,14 +441,14 @@ * run much recently, and to round-robin among other processes. */ void -sched_clock(struct kse *ke) +sched_clock(struct thread *td) { struct ksegrp *kg; - struct thread *td; + struct kse *ke; mtx_assert(&sched_lock, MA_OWNED); - kg = ke->ke_ksegrp; - td = ke->ke_thread; + kg = td->td_ksegrp; + ke = td->td_kse; ke->ke_sched->ske_cpticks++; kg->kg_estcpu = ESTCPULIM(kg->kg_estcpu + 1); @@ -564,16 +564,10 @@ } void -sched_switchin(struct thread *td) +sched_switch(struct thread *td) { - - mtx_assert(&sched_lock, MA_OWNED); - td->td_oncpu = PCPU_GET(cpuid); -} - -void -sched_switchout(struct thread *td) -{ + struct thread *newtd; + u_long sched_nest; struct kse *ke; struct proc *p; @@ -603,6 +597,13 @@ */ kse_reassign(ke); } + sched_nest = sched_lock.mtx_recurse; + newtd = choosethread(); + if (td != newtd) + cpu_switch(td, newtd); + sched_lock.mtx_recurse = sched_nest; + sched_lock.mtx_lock = (uintptr_t)td; + td->td_oncpu = PCPU_GET(cpuid); } void @@ -620,8 +621,11 @@ } void -sched_add(struct kse *ke) +sched_add(struct thread *td) { + struct kse *ke; + + ke = td->td_kse; mtx_assert(&sched_lock, MA_OWNED); KASSERT((ke->ke_thread != NULL), ("runq_add: No thread on KSE")); KASSERT((ke->ke_thread->td_kse != NULL), @@ -638,8 +642,11 @@ } void -sched_rem(struct kse *ke) +sched_rem(struct thread *td) { + struct kse *ke; + + ke = td->td_kse; KASSERT(ke->ke_proc->p_sflag & PS_INMEM, ("runq_remove: process swapped out")); KASSERT((ke->ke_state == KES_ONRUNQ), ("KSE not on run queue")); @@ -714,7 +721,7 @@ } fixpt_t -sched_pctcpu(struct kse *ke) +sched_pctcpu(struct thread *td) { - return (ke->ke_pctcpu); + return (td->td_kse->ke_pctcpu); } ==== //depot/projects/netperf/sys/kern/sched_ule.c#9 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.59 2003/10/15 07:47:06 jeff Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.63 2003/10/16 10:04:54 jeff Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -150,11 +150,11 @@ * INTERACT_MAX: Maximum interactivity value. Smaller is better. * INTERACT_THRESH: Threshhold for placement on the current runq. */ -#define SCHED_SLP_RUN_MAX ((hz * 2) << 10) +#define SCHED_SLP_RUN_MAX ((hz * 5) << 10) #define SCHED_SLP_RUN_THROTTLE (100) #define SCHED_INTERACT_MAX (100) #define SCHED_INTERACT_HALF (SCHED_INTERACT_MAX / 2) -#define SCHED_INTERACT_THRESH (20) +#define SCHED_INTERACT_THRESH (30) /* * These parameters and macros determine the size of the time slice that is @@ -674,12 +674,10 @@ static void sched_interact_update(struct ksegrp *kg) { - int ratio; - if ((kg->kg_runtime + kg->kg_slptime) > SCHED_SLP_RUN_MAX) { - ratio = (SCHED_SLP_RUN_MAX / - (kg->kg_runtime + kg->kg_slptime)) * 4; - kg->kg_runtime = (kg->kg_runtime * ratio) / 5; - kg->kg_slptime = (kg->kg_slptime * ratio) / 5; + /* XXX Fixme, use a linear algorithm and not a while loop. */ + while ((kg->kg_runtime + kg->kg_slptime) > SCHED_SLP_RUN_MAX) { + kg->kg_runtime = (kg->kg_runtime / 5) * 4; + kg->kg_slptime = (kg->kg_slptime / 5) * 4; } } @@ -787,8 +785,10 @@ } void -sched_switchout(struct thread *td) +sched_switch(struct thread *td) { + struct thread *newtd; + u_int sched_nest; struct kse *ke; mtx_assert(&sched_lock, MA_OWNED); @@ -815,9 +815,7 @@ runq_add(ke->ke_runq, ke); /* setrunqueue(td); */ } - return; - } - if (ke->ke_runq) + } else if (ke->ke_runq) kseq_rem(KSEQ_CPU(ke->ke_cpu), ke); /* * We will not be on the run queue. So we must be @@ -825,13 +823,12 @@ */ if (td->td_proc->p_flag & P_SA) kse_reassign(ke); -} - -void -sched_switchin(struct thread *td) -{ - /* struct kse *ke = td->td_kse; */ - mtx_assert(&sched_lock, MA_OWNED); + sched_nest = sched_lock.mtx_recurse; + newtd = choosethread(); + if (td != newtd) + cpu_switch(td, newtd); + sched_lock.mtx_recurse = sched_nest; + sched_lock.mtx_lock = (uintptr_t)td; td->td_oncpu = PCPU_GET(cpuid); } @@ -1013,11 +1010,11 @@ } void -sched_clock(struct kse *ke) +sched_clock(struct thread *td) { struct kseq *kseq; struct ksegrp *kg; - struct thread *td; + struct kse *ke; #if 0 struct kse *nke; #endif @@ -1038,7 +1035,7 @@ tickincr = 1; } - td = ke->ke_thread; + ke = td->td_kse; kg = ke->ke_ksegrp; mtx_assert(&sched_lock, MA_OWNED); @@ -1227,11 +1224,14 @@ } void -sched_add(struct kse *ke) +sched_add(struct thread *td) { struct kseq *kseq; struct ksegrp *kg; + struct kse *ke; + ke = td->td_kse; + kg = td->td_ksegrp; mtx_assert(&sched_lock, MA_OWNED); KASSERT((ke->ke_thread != NULL), ("sched_add: No thread on KSE")); KASSERT((ke->ke_thread->td_kse != NULL), @@ -1244,7 +1244,6 @@ KASSERT(ke->ke_runq == NULL, ("sched_add: KSE %p is still assigned to a run queue", ke)); - kg = ke->ke_ksegrp; switch (PRI_BASE(kg->kg_pri_class)) { case PRI_ITHD: @@ -1285,9 +1284,12 @@ } void -sched_rem(struct kse *ke) +sched_rem(struct thread *td) { struct kseq *kseq; + struct kse *ke; + + ke = td->td_kse; mtx_assert(&sched_lock, MA_OWNED); KASSERT((ke->ke_state == KES_ONRUNQ), ("KSE not on run queue")); @@ -1300,11 +1302,13 @@ } fixpt_t -sched_pctcpu(struct kse *ke) +sched_pctcpu(struct thread *td) { fixpt_t pctcpu; + struct kse *ke; pctcpu = 0; + ke = td->td_kse; mtx_lock_spin(&sched_lock); if (ke->ke_ticks) { ==== //depot/projects/netperf/sys/kern/subr_bus.c#5 (text+ko) ==== @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1997,1998 Doug Rabson + * Copyright (c) 1997,1998,2003 Doug Rabson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/subr_bus.c,v 1.132 2003/10/14 06:22:07 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/subr_bus.c,v 1.133 2003/10/16 09:16:28 dfr Exp $"); #include "opt_bus.h" @@ -62,8 +62,8 @@ */ typedef struct driverlink *driverlink_t; struct driverlink { - driver_t *driver; - TAILQ_ENTRY(driverlink) link; /* list of drivers in devclass */ + kobj_class_t driver; + TAILQ_ENTRY(driverlink) link; /* list of drivers in devclass */ }; /* @@ -75,6 +75,7 @@ struct devclass { TAILQ_ENTRY(devclass) link; + devclass_t parent; /* parent in devclass hierarchy */ driver_list_t drivers; /* bus devclasses store drivers for bus */ char *name; device_t *devices; /* array of devices indexed by unit */ @@ -509,7 +510,8 @@ static devclass_list_t devclasses = TAILQ_HEAD_INITIALIZER(devclasses); static devclass_t -devclass_find_internal(const char *classname, int create) +devclass_find_internal(const char *classname, const char *parentname, + int create) { devclass_t dc; @@ -519,15 +521,16 @@ TAILQ_FOREACH(dc, &devclasses, link) { if (!strcmp(dc->name, classname)) - return (dc); + break; } - PDEBUG(("%s not found%s", classname, (create? ", creating": ""))); - if (create) { + if (create && !dc) { + PDEBUG(("creating %s", classname)); dc = malloc(sizeof(struct devclass) + strlen(classname) + 1, M_BUS, M_NOWAIT|M_ZERO); if (!dc) return (NULL); + dc->parent = NULL; dc->name = (char*) (dc + 1); strcpy(dc->name, classname); TAILQ_INIT(&dc->drivers); @@ -535,6 +538,9 @@ bus_data_generation_update(); } + if (parentname && dc && !dc->parent) { + dc->parent = devclass_find_internal(parentname, 0, FALSE); + } return (dc); } @@ -542,13 +548,13 @@ devclass_t devclass_create(const char *classname) { - return (devclass_find_internal(classname, TRUE)); + return (devclass_find_internal(classname, 0, TRUE)); } devclass_t devclass_find(const char *classname) { - return (devclass_find_internal(classname, FALSE)); >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200310162114.h9GLEdf6026163>