From owner-p4-projects@FreeBSD.ORG Mon May 31 13:50:22 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7C75416A4D0; Mon, 31 May 2004 13:50:22 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1878716A4CE for ; Mon, 31 May 2004 13:50:22 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1F75743D5C for ; Mon, 31 May 2004 13:50:14 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i4VKnu2Y036927 for ; Mon, 31 May 2004 13:49:56 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i4VKnuHX036924 for perforce@freebsd.org; Mon, 31 May 2004 13:49:56 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Mon, 31 May 2004 13:49:56 -0700 (PDT) Message-Id: <200405312049.i4VKnuHX036924@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Subject: PERFORCE change 53894 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2004 20:50:23 -0000 http://perforce.freebsd.org/chv.cgi?CH=53894 Change 53894 by rwatson@rwatson_tislabs on 2004/05/31 13:49:45 Integrate netperf_socket from FreeBSD CVS HEAD: pcf device driver printf output toned down, other resource allocation tweaks. Loops back of GIANT_REQUIRED for vrele(). Bosko's addition of conditional Giant release when returning EBUSY from loading NFS server as a module. Loop back of Giant assertions in NFS server system call code. Affected files ... .. //depot/projects/netperf_socket/sys/dev/pcf/pcf.c#3 integrate .. //depot/projects/netperf_socket/sys/dev/pcf/pcf_isa.c#2 integrate .. //depot/projects/netperf_socket/sys/dev/sound/usb/uaudio_pcm.c#2 integrate .. //depot/projects/netperf_socket/sys/kern/vfs_subr.c#8 integrate .. //depot/projects/netperf_socket/sys/nfsserver/nfs_serv.c#7 integrate .. //depot/projects/netperf_socket/sys/nfsserver/nfs_srvsubs.c#7 integrate .. //depot/projects/netperf_socket/sys/nfsserver/nfs_syscalls.c#8 integrate .. //depot/projects/netperf_socket/sys/ufs/ffs/fs.h#4 integrate Differences ... ==== //depot/projects/netperf_socket/sys/dev/pcf/pcf.c#3 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/pcf/pcf.c,v 1.24 2004/05/25 07:42:45 joerg Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/pcf/pcf.c,v 1.25 2004/05/31 14:24:21 nsouch Exp $"); #include #include @@ -64,6 +64,10 @@ return (0); } +#ifdef PCFDEBUG + printf("pcf: timeout!\n"); +#endif + return (IIC_ETIMEOUT); } @@ -132,6 +136,9 @@ /* check for ack */ if (pcf_noack(sc, timeout)) { error = IIC_ENOACK; +#ifdef PCFDEBUG + printf("pcf: no ack on repeated_start!\n"); +#endif goto error; } @@ -151,8 +158,12 @@ #ifdef PCFDEBUG device_printf(dev, " >> start for slave %#x\n", (unsigned)slave); #endif - if ((pcf_get_S1(sc) & nBB) == 0) + if ((pcf_get_S1(sc) & nBB) == 0) { +#ifdef PCFDEBUG + printf("pcf: busy!\n"); +#endif return (IIC_EBUSBSY); + } /* set slave address to PCF. Last bit (LSB) must be set correctly * according to transfer direction */ @@ -170,6 +181,9 @@ /* check for ACK */ if (pcf_noack(sc, timeout)) { error = IIC_ENOACK; +#ifdef PCFDEBUG + printf("pcf: no ack on start!\n"); +#endif goto error; } @@ -183,23 +197,21 @@ void pcf_intr(void *arg) { - device_t dev = (device_t)arg; - struct pcf_softc *sc = DEVTOSOFTC(dev); - + struct pcf_softc *sc = arg; char data, status, addr; char error = 0; status = pcf_get_S1(sc); if (status & PIN) { - device_printf(dev, "spurious interrupt, status=0x%x\n", - status & 0xff); + printf("pcf: spurious interrupt, status=0x%x\n", + status & 0xff); goto error; } if (status & LAB) - device_printf(dev, "bus arbitration lost!\n"); + printf("pcf: bus arbitration lost!\n"); if (status & BER) { error = IIC_EBUSERR; ==== //depot/projects/netperf_socket/sys/dev/pcf/pcf_isa.c#2 (text+ko) ==== @@ -28,7 +28,7 @@ * SUCH DAMAGE. */ #include -__FBSDID("$FreeBSD: src/sys/dev/pcf/pcf_isa.c,v 1.1 2004/05/25 07:42:45 joerg Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/pcf/pcf_isa.c,v 1.2 2004/05/31 14:24:21 nsouch Exp $"); /* * Hardware driver for a Philips PCF8584 I2C bus controller sitting @@ -53,12 +53,16 @@ #include #include "iicbus_if.h" +#define PCF_NAME "pcf" + +static void pcf_identify(driver_t *, device_t); static int pcf_probe(device_t); static int pcf_attach(device_t); static int pcf_detach(device_t); static device_method_t pcf_methods[] = { /* device interface */ + DEVMETHOD(device_identify, pcf_identify), DEVMETHOD(device_probe, pcf_probe), DEVMETHOD(device_attach, pcf_attach), DEVMETHOD(device_detach, pcf_detach), @@ -77,16 +81,37 @@ static devclass_t pcf_devclass; static driver_t pcf_driver = { - "pcf", + PCF_NAME, pcf_methods, sizeof(struct pcf_softc), }; +static void +pcf_identify(driver_t *driver, device_t parent) +{ + BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, PCF_NAME, 0); + + return; +} + static int pcf_probe(device_t dev) { + u_long start, count; + u_int rid = 0, port, error; + + bus_get_resource(dev, SYS_RES_IOPORT, rid, &start, &count); + + /* The port address must be explicitly specified */ + if ((error = resource_int_value(PCF_NAME, 0, "port", &port) != 0)) + return (error); + + /* Probe is only successfull for the specified base io */ + if (port != (u_int)start) + return (ENXIO); device_set_desc(dev, "PCF8584 I2C bus controller"); + return (0); } @@ -121,14 +146,16 @@ /* reset the chip */ pcf_rst_card(dev, IIC_FASTEST, PCF_DEFAULT_ADDR, NULL); - rv = BUS_SETUP_INTR(device_get_parent(dev), dev, sc->res_irq, - INTR_TYPE_NET /* | INTR_ENTROPY */, - pcf_intr, sc, &sc->intr_cookie); - if (rv) { - device_printf(dev, "could not setup IRQ\n"); - goto error; + if (sc->res_irq) { + rv = BUS_SETUP_INTR(device_get_parent(dev), dev, sc->res_irq, + INTR_TYPE_NET /* | INTR_ENTROPY */, + pcf_intr, sc, &sc->intr_cookie); + if (rv) { + device_printf(dev, "could not setup IRQ\n"); + goto error; + } } - + if ((sc->iicbus = device_add_child(dev, "iicbus", -1)) == NULL) device_printf(dev, "could not allocate iicbus instance\n"); @@ -181,5 +208,6 @@ } DRIVER_MODULE(pcf, ebus, pcf_driver, pcf_devclass, 0, 0); +DRIVER_MODULE(pcf, isa, pcf_driver, pcf_devclass, 0, 0); MODULE_DEPEND(pcf, iicbus, PCF_MINVER, PCF_PREFVER, PCF_MAXVER); MODULE_VERSION(pcf, PCF_MODVER); ==== //depot/projects/netperf_socket/sys/dev/sound/usb/uaudio_pcm.c#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/sound/usb/uaudio_pcm.c,v 1.3 2003/07/01 15:52:02 scottl Exp $ */ +/* $FreeBSD: src/sys/dev/sound/usb/uaudio_pcm.c,v 1.4 2004/05/31 11:38:46 takawata Exp $ */ /* * Copyright (c) 2000-2002 Hiroyuki Aizu @@ -373,7 +373,6 @@ PCM_SOFTC_SIZE, }; -static devclass_t pcm_devclass; DRIVER_MODULE(ua_pcm, uaudio, ua_pcm_driver, pcm_devclass, 0, 0); MODULE_DEPEND(ua_pcm, uaudio, 1, 1, 1); ==== //depot/projects/netperf_socket/sys/kern/vfs_subr.c#8 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/vfs_subr.c,v 1.490 2004/04/11 21:09:22 mux Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/vfs_subr.c,v 1.491 2004/05/31 19:06:01 rwatson Exp $"); #include "opt_ddb.h" #include "opt_mac.h" @@ -1963,6 +1963,8 @@ { struct thread *td = curthread; /* XXX */ + GIANT_REQUIRED; + KASSERT(vp != NULL, ("vrele: null vp")); VI_LOCK(vp); ==== //depot/projects/netperf_socket/sys/nfsserver/nfs_serv.c#7 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/nfsserver/nfs_serv.c,v 1.145 2004/05/30 22:59:54 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/nfsserver/nfs_serv.c,v 1.146 2004/05/31 19:08:22 rwatson Exp $"); /* * nfs version 2 and 3 server calls to vnode ops @@ -2349,7 +2349,11 @@ error = ESTALE; goto out1; } + NFSD_UNLOCK(); + mtx_lock(&Giant); (void) vn_start_write(NULL, &mp, V_WAIT); + mtx_unlock(&Giant); + NFSD_LOCK(); nfsm_srvnamesiz(len); /* * Remember our original uid so that we can reset cr_uid before ==== //depot/projects/netperf_socket/sys/nfsserver/nfs_srvsubs.c#7 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/nfsserver/nfs_srvsubs.c,v 1.128 2004/05/31 00:59:10 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/nfsserver/nfs_srvsubs.c,v 1.129 2004/05/31 20:21:06 bmilekic Exp $"); /* * These functions support the macros and help fiddle mbuf chains for @@ -557,8 +557,10 @@ break; case MOD_UNLOAD: - if (nfsrv_numnfsd != 0) + if (nfsrv_numnfsd != 0) { + NET_UNLOCK_GIANT(); return EBUSY; + } callout_stop(&nfsrv_callout); sysent[SYS_nfssvc].sy_narg = nfs_prev_nfssvc_sy_narg; ==== //depot/projects/netperf_socket/sys/nfsserver/nfs_syscalls.c#8 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/nfsserver/nfs_syscalls.c,v 1.99 2004/05/29 15:21:25 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/nfsserver/nfs_syscalls.c,v 1.100 2004/05/31 16:32:49 rwatson Exp $"); #include "opt_inet6.h" #include "opt_mac.h" @@ -134,6 +134,8 @@ struct nfsd_args nfsdarg; int error; + KASSERT(!mtx_owned(&Giant), ("nfssvc(): called with Giant")); + #ifdef MAC error = mac_check_system_nfsd(td->td_ucred); if (error) @@ -550,8 +552,16 @@ nfsd->nfsd_slp = NULL; nfsrv_slpderef(slp); } + KASSERT(!(debug_mpsafenet == 0 && !mtx_owned(&Giant)), + ("nfssvc_nfsd(): debug.mpsafenet=0 && !Giant")); + KASSERT(!(debug_mpsafenet == 1 && mtx_owned(&Giant)), + ("nfssvc_nfsd(): debug.mpsafenet=1 && Giant")); } done: + KASSERT(!(debug_mpsafenet == 0 && !mtx_owned(&Giant)), + ("nfssvc_nfsd(): debug.mpsafenet=0 && !Giant")); + KASSERT(!(debug_mpsafenet == 1 && mtx_owned(&Giant)), + ("nfssvc_nfsd(): debug.mpsafenet=1 && Giant")); TAILQ_REMOVE(&nfsd_head, nfsd, nfsd_chain); splx(s); free((caddr_t)nfsd, M_NFSD); ==== //depot/projects/netperf_socket/sys/ufs/ffs/fs.h#4 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)fs.h 8.13 (Berkeley) 3/21/95 - * $FreeBSD: src/sys/ufs/ffs/fs.h,v 1.42 2004/04/07 03:47:20 imp Exp $ + * $FreeBSD: src/sys/ufs/ffs/fs.h,v 1.43 2004/05/31 16:53:46 krion Exp $ */ #ifndef _UFS_FFS_FS_H_ @@ -168,7 +168,7 @@ * which tell the system the average file size and the average number * of files per directory. These defaults are well selected for typical * filesystems, but may need to be tuned for odd cases like filesystems - * being used for sqiud caches or news spools. + * being used for squid caches or news spools. */ #define AVFILESIZ 16384 /* expected average file size */ #define AFPDIR 64 /* expected number of files per directory */