Date: Sat, 19 Jun 2004 04:24:42 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 55287 for review Message-ID: <200406190424.i5J4Og2f054265@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=55287 Change 55287 by rwatson@rwatson_paprika on 2004/06/19 04:24:38 Integrate netperf_socket to loop-back initial sosend/soreceive, sbwait/sblock locking. Affected files ... .. //depot/projects/netperf_socket/sys/amd64/amd64/fpu.c#5 integrate .. //depot/projects/netperf_socket/sys/compat/linux/linux_ioctl.c#4 integrate .. //depot/projects/netperf_socket/sys/compat/linux/linux_ioctl.h#4 integrate .. //depot/projects/netperf_socket/sys/contrib/dev/ath/freebsd/ah_osdep.c#2 integrate .. //depot/projects/netperf_socket/sys/dev/acpica/Osd/OsdHardware.c#4 integrate .. //depot/projects/netperf_socket/sys/dev/acpica/Osd/OsdSynch.c#4 integrate .. //depot/projects/netperf_socket/sys/dev/acpica/acpi_cpu.c#10 integrate .. //depot/projects/netperf_socket/sys/dev/firewire/sbp.c#5 integrate .. //depot/projects/netperf_socket/sys/fs/devfs/devfs_devs.c#4 integrate .. //depot/projects/netperf_socket/sys/geom/vinum/geom_vinum.c#2 integrate .. //depot/projects/netperf_socket/sys/geom/vinum/geom_vinum_drive.c#4 integrate .. //depot/projects/netperf_socket/sys/geom/vinum/geom_vinum_plex.c#3 integrate .. //depot/projects/netperf_socket/sys/geom/vinum/geom_vinum_volume.c#3 integrate .. //depot/projects/netperf_socket/sys/kern/kern_exit.c#12 integrate .. //depot/projects/netperf_socket/sys/kern/kern_thread.c#13 integrate .. //depot/projects/netperf_socket/sys/kern/subr_prf.c#4 integrate .. //depot/projects/netperf_socket/sys/kern/uipc_socket.c#20 edit .. //depot/projects/netperf_socket/sys/kern/uipc_socket2.c#17 edit .. //depot/projects/netperf_socket/sys/kern/uipc_syscalls.c#19 integrate .. //depot/projects/netperf_socket/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c#9 integrate .. //depot/projects/netperf_socket/sys/netinet/ip_input.c#14 integrate .. //depot/projects/netperf_socket/sys/netinet/tcp_output.c#6 integrate .. //depot/projects/netperf_socket/sys/netinet/tcp_usrreq.c#9 integrate .. //depot/projects/netperf_socket/sys/sys/kernel.h#5 integrate .. //depot/projects/netperf_socket/sys/ufs/ffs/ffs_snapshot.c#5 integrate Differences ... ==== //depot/projects/netperf_socket/sys/amd64/amd64/fpu.c#5 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/fpu.c,v 1.153 2004/06/08 01:35:48 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/fpu.c,v 1.154 2004/06/18 04:01:54 peter Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -125,6 +125,8 @@ ldmxcsr(mxcsr); fxsave(&fpu_cleanstate); start_emulating(); + bzero(fpu_cleanstate.sv_fp, sizeof(fpu_cleanstate.sv_fp)); + bzero(fpu_cleanstate.sv_xmm, sizeof(fpu_cleanstate.sv_xmm)); fpu_cleanstate_ready = 1; intr_restore(savecrit); } @@ -384,7 +386,6 @@ { struct pcb *pcb; register_t s; - u_short control; if (PCPU_GET(fpcurthread) == curthread) { printf("fpudna: fpcurthread == curthread %d times\n", @@ -409,13 +410,10 @@ if ((pcb->pcb_flags & PCB_FPUINITDONE) == 0) { /* - * This is the first time this thread has used the FPU or - * the PCB doesn't contain a clean FPU state. Explicitly - * initialize the FPU and load the default control word. + * This is the first time this thread has used the FPU, + * explicitly load sanitized registers. */ - fninit(); - control = __INITIAL_FPUCW__; - fldcw(&control); + fxrstor(&fpu_cleanstate); pcb->pcb_flags |= PCB_FPUINITDONE; } else fxrstor(&pcb->pcb_save); ==== //depot/projects/netperf_socket/sys/compat/linux/linux_ioctl.c#4 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_ioctl.c,v 1.114 2004/06/14 07:26:23 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_ioctl.c,v 1.119 2004/06/18 14:36:24 bms Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1443,20 +1443,22 @@ } case LINUX_CDROMREADTOCENTRY: { - struct linux_cdrom_tocentry lte, *ltep = - (struct linux_cdrom_tocentry *)args->arg; + struct linux_cdrom_tocentry lte; struct ioc_read_toc_single_entry irtse; - irtse.address_format = ltep->cdte_format; - irtse.track = ltep->cdte_track; + + error = copyin((void *)args->arg, <e, sizeof(lte)); + if (error) + break; + irtse.address_format = lte.cdte_format; + irtse.track = lte.cdte_track; error = fo_ioctl(fp, CDIOREADTOCENTRY, (caddr_t)&irtse, td->td_ucred, td); if (!error) { - lte = *ltep; lte.cdte_ctrl = irtse.entry.control; lte.cdte_adr = irtse.entry.addr_type; bsd_to_linux_msf_lba(irtse.address_format, &irtse.entry.addr, <e.cdte_addr); - copyout(<e, (void *)args->arg, sizeof(lte)); + error = copyout(<e, (void *)args->arg, sizeof(lte)); } break; } @@ -1696,6 +1698,10 @@ args->cmd = SETDIR(SOUND_MIXER_WRITE_LINE3); return (ioctl(td, (struct ioctl_args *)args)); + case LINUX_SOUND_MIXER_INFO: + args->cmd = SETDIR(SOUND_MIXER_INFO); + return (ioctl(td, (struct ioctl_args *)args)); + case LINUX_OSS_GETVERSION: { int version = linux_get_oss_version(td); return (copyout(&version, (void *)args->arg, sizeof(int))); @@ -1705,6 +1711,10 @@ args->cmd = SOUND_MIXER_READ_STEREODEVS; return (ioctl(td, (struct ioctl_args *)args)); + case LINUX_SOUND_MIXER_READ_RECMASK: + args->cmd = SOUND_MIXER_READ_RECMASK; + return (ioctl(td, (struct ioctl_args *)args)); + case LINUX_SOUND_MIXER_READ_DEVMASK: args->cmd = SOUND_MIXER_READ_DEVMASK; return (ioctl(td, (struct ioctl_args *)args)); @@ -1941,11 +1951,14 @@ break; case LINUX_VT_SETMODE: { - struct vt_mode *mode; + struct vt_mode mode; + if ((error = copyin((void *)args->arg, &mode, sizeof(mode)))) + break; + if (!ISSIGVALID(mode.frsig) && ISSIGVALID(mode.acqsig)) + mode.frsig = mode.acqsig; + if ((error = copyout(&mode, (void *)args->arg, sizeof(mode)))) + break; args->cmd = VT_SETMODE; - mode = (struct vt_mode *)args->arg; - if (!ISSIGVALID(mode->frsig) && ISSIGVALID(mode->acqsig)) - mode->frsig = mode->acqsig; error = (ioctl(td, (struct ioctl_args *)args)); break; } @@ -2076,6 +2089,20 @@ if (error != 0) return (error); + /* handle the 'request buffer size' case */ + if (ifc.ifc_buf == NULL) { + ifc.ifc_len = 0; + TAILQ_FOREACH(ifp, &ifnet, if_link) { + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + struct sockaddr *sa = ifa->ifa_addr; + if (sa->sa_family == AF_INET) + ifc.ifc_len += sizeof(ifr); + } + } + error = copyout(&ifc, uifc, sizeof(ifc)); + return (error); + } + /* much easier to use uiomove than keep track ourselves */ iov.iov_base = ifc.ifc_buf; iov.iov_len = ifc.ifc_len; ==== //depot/projects/netperf_socket/sys/compat/linux/linux_ioctl.h#4 (text+ko) ==== @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/compat/linux/linux_ioctl.h,v 1.18 2004/06/14 07:26:23 phk Exp $ + * $FreeBSD: src/sys/compat/linux/linux_ioctl.h,v 1.20 2004/06/18 14:36:24 bms Exp $ */ #ifndef _LINUX_IOCTL_H_ @@ -227,8 +227,10 @@ #define LINUX_SOUND_MIXER_WRITE_LINE1 0x4d0E #define LINUX_SOUND_MIXER_WRITE_LINE2 0x4d0F #define LINUX_SOUND_MIXER_WRITE_LINE3 0x4d10 +#define LINUX_SOUND_MIXER_INFO 0x4d65 #define LINUX_OSS_GETVERSION 0x4d76 #define LINUX_SOUND_MIXER_READ_STEREODEVS 0x4dfb +#define LINUX_SOUND_MIXER_READ_RECMASK 0x4dfd #define LINUX_SOUND_MIXER_READ_DEVMASK 0x4dfe #define LINUX_SOUND_MIXER_WRITE_RECSRC 0x4dff #define LINUX_SNDCTL_DSP_RESET 0x5000 ==== //depot/projects/netperf_socket/sys/contrib/dev/ath/freebsd/ah_osdep.c#2 (text+ko) ==== @@ -40,6 +40,7 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/module.h> #include <sys/sysctl.h> #include <sys/bus.h> #include <sys/malloc.h> ==== //depot/projects/netperf_socket/sys/dev/acpica/Osd/OsdHardware.c#4 (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/acpica/Osd/OsdHardware.c,v 1.13 2004/04/14 03:39:08 njl Exp $ + * $FreeBSD: src/sys/dev/acpica/Osd/OsdHardware.c,v 1.14 2004/06/18 17:56:45 njl Exp $ */ /* @@ -36,11 +36,7 @@ #include <machine/bus_pio.h> #include <machine/bus.h> #include <machine/pci_cfgreg.h> -#if __FreeBSD_version >= 500000 #include <dev/pci/pcireg.h> -#else -#include <pci/pcireg.h> -#endif /* * ACPICA's rather gung-ho approach to hardware resource ownership is a little ==== //depot/projects/netperf_socket/sys/dev/acpica/Osd/OsdSynch.c#4 (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/acpica/Osd/OsdSynch.c,v 1.21 2004/05/05 20:07:52 njl Exp $ + * $FreeBSD: src/sys/dev/acpica/Osd/OsdSynch.c,v 1.22 2004/06/18 17:58:11 njl Exp $ */ /* @@ -37,35 +37,23 @@ #include <sys/kernel.h> #include <sys/malloc.h> #include <sys/sysctl.h> -#if __FreeBSD_version >= 500000 #include <sys/lock.h> #include <sys/mutex.h> -#endif #define _COMPONENT ACPI_OS_SERVICES ACPI_MODULE_NAME("SYNCH") MALLOC_DEFINE(M_ACPISEM, "acpisem", "ACPI semaphore"); -#if __FreeBSD_version < 500000 -# define AS_LOCK(as) s = splhigh() -# define AS_UNLOCK(as) splx(s) -# define AS_LOCK_DECL int s -# define msleep(a, b, c, d, e) tsleep(a, c, d, e) -#else -# define AS_LOCK(as) mtx_lock(&(as)->as_mtx) -# define AS_UNLOCK(as) mtx_unlock(&(as)->as_mtx) -# define AS_LOCK_DECL -#endif +#define AS_LOCK(as) mtx_lock(&(as)->as_mtx) +#define AS_UNLOCK(as) mtx_unlock(&(as)->as_mtx) /* * Simple counting semaphore implemented using a mutex. (Subsequently used * in the OSI code to implement a mutex. Go figure.) */ struct acpi_semaphore { -#if __FreeBSD_version >= 500000 struct mtx as_mtx; -#endif UINT32 as_units; UINT32 as_maxunits; UINT32 as_pendings; @@ -101,9 +89,7 @@ if ((as = malloc(sizeof(*as), M_ACPISEM, M_NOWAIT | M_ZERO)) == NULL) return_ACPI_STATUS (AE_NO_MEMORY); -#if __FreeBSD_version >= 500000 mtx_init(&as->as_mtx, "ACPI semaphore", NULL, MTX_DEF); -#endif as->as_units = InitialUnits; as->as_maxunits = MaxUnits; as->as_pendings = as->as_resetting = as->as_timeouts = 0; @@ -129,9 +115,7 @@ ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "destroyed semaphore %p\n", as)); -#if __FreeBSD_version >= 500000 mtx_destroy(&as->as_mtx); -#endif free(Handle, M_ACPISEM); #endif /* !ACPI_NO_SEMAPHORES */ @@ -151,7 +135,6 @@ struct acpi_semaphore *as = (struct acpi_semaphore *)Handle; int rv, tmo; struct timeval timeouttv, currenttv, timelefttv; - AS_LOCK_DECL; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -223,11 +206,9 @@ break; } -#if __FreeBSD_version >= 500000 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "semaphore blocked, calling msleep(%p, %p, %d, \"acsem\", %d)\n", as, &as->as_mtx, PCATCH, tmo)); -#endif as->as_pendings++; @@ -310,7 +291,6 @@ { #ifndef ACPI_NO_SEMAPHORES struct acpi_semaphore *as = (struct acpi_semaphore *)Handle; - AS_LOCK_DECL; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); ==== //depot/projects/netperf_socket/sys/dev/acpica/acpi_cpu.c#10 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_cpu.c,v 1.39 2004/06/05 07:02:17 njl Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_cpu.c,v 1.40 2004/06/19 02:27:23 njl Exp $"); #include "opt_acpi.h" #include <sys/param.h> @@ -1046,15 +1046,21 @@ struct sbuf sb; char buf[128]; int i; - u_int sum; + uint64_t fract, sum, whole; - /* Avoid divide by 0 potential error. */ - sum = 1; + sum = 0; for (i = 0; i < cpu_cx_count; i++) sum += cpu_cx_stats[i]; sbuf_new(&sb, buf, sizeof(buf), SBUF_FIXEDLEN); - for (i = 0; i < cpu_cx_count; i++) - sbuf_printf(&sb, "%u%% ", (cpu_cx_stats[i] * 100) / sum); + for (i = 0; i < cpu_cx_count; i++) { + if (sum > 0) { + whole = cpu_cx_stats[i] * 100; + fract = (whole % sum) * 100; + sbuf_printf(&sb, "%u.%02u%% ", (u_int)(whole / sum), + (u_int)(fract / sum)); + } else + sbuf_printf(&sb, "0%% "); + } sbuf_trim(&sb); sbuf_finish(&sb); sysctl_handle_string(oidp, sbuf_data(&sb), sbuf_len(&sb), req); ==== //depot/projects/netperf_socket/sys/dev/firewire/sbp.c#5 (text+ko) ==== @@ -31,7 +31,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/firewire/sbp.c,v 1.77 2004/06/15 16:03:49 dfr Exp $ + * $FreeBSD: src/sys/dev/firewire/sbp.c,v 1.78 2004/06/18 08:02:49 simokawa Exp $ * */ @@ -139,7 +139,7 @@ SYSCTL_INT(_hw_firewire_sbp, OID_AUTO, max_speed, CTLFLAG_RW, &max_speed, 0, "SBP transfer max speed"); SYSCTL_INT(_hw_firewire_sbp, OID_AUTO, exclusive_login, CTLFLAG_RW, - &ex_login, 0, "SBP transfer max speed"); + &ex_login, 0, "SBP enable exclusive login"); SYSCTL_INT(_hw_firewire_sbp, OID_AUTO, login_delay, CTLFLAG_RW, &login_delay, 0, "SBP login delay in msec"); SYSCTL_INT(_hw_firewire_sbp, OID_AUTO, scan_delay, CTLFLAG_RW, ==== //depot/projects/netperf_socket/sys/fs/devfs/devfs_devs.c#4 (text+ko) ==== @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000 + * Copyright (c) 2000,2004 * Poul-Henning Kamp. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ * * From: FreeBSD: src/sys/miscfs/kernfs/kernfs_vfsops.c 1.36 * - * $FreeBSD: src/sys/fs/devfs/devfs_devs.c,v 1.30 2004/06/16 09:47:03 phk Exp $ + * $FreeBSD: src/sys/fs/devfs/devfs_devs.c,v 1.31 2004/06/18 08:08:47 phk Exp $ */ #include "opt_devfs.h" @@ -58,7 +58,6 @@ static int devfs_noverflow; static unsigned devfs_generation; -static void devfs_attemptoverflow(int insist); static struct devfs_dirent *devfs_find (struct devfs_dirent *dd, const char *name, int namelen); SYSCTL_NODE(_vfs, OID_AUTO, devfs, CTLFLAG_RW, 0, "DEVFS filesystem"); @@ -137,43 +136,6 @@ return (NULL); } -static void -devfs_attemptoverflow(int insist) -{ - struct cdev ***ot; - int *or; - int n, nb; - - /* Check if somebody beat us to it */ - if (devfs_overflow != NULL) - return; - ot = NULL; - or = NULL; - n = devfs_noverflowwant; - nb = sizeof (struct cdev **) * n; - MALLOC(ot, struct cdev ***, nb, M_DEVFS, (insist ? M_WAITOK : M_NOWAIT) | M_ZERO); - if (ot == NULL) - goto bail; - nb = sizeof (int) * n; - MALLOC(or, int *, nb, M_DEVFS, (insist ? M_WAITOK : M_NOWAIT) | M_ZERO); - if (or == NULL) - goto bail; - if (!atomic_cmpset_ptr(&devfs_overflow, NULL, ot)) - goto bail; - devfs_refoverflow = or; - devfs_noverflow = n; - printf("DEVFS Overflow table with %d entries allocated when %d in use\n", n, devfs_numino); - return; - -bail: - /* Somebody beat us to it, or something went wrong. */ - if (ot != NULL) - FREE(ot, M_DEVFS); - if (or != NULL) - FREE(or, M_DEVFS); - return; -} - static struct devfs_dirent * devfs_find(struct devfs_dirent *dd, const char *name, int namelen) { @@ -367,20 +329,26 @@ de->de_dir = dd; devfs_rules_apply(dm, de); TAILQ_INSERT_TAIL(&dd->de_dlist, de, de_list); -#if 0 - printf("Add ino%d %s\n", i, dev->si_name); -#endif } } lockmgr(&dm->dm_lock, LK_DOWNGRADE, 0, curthread); return (0); } +/* + * devfs_create() and devfs_destroy() are called from kern_conf.c and + * in both cases the devlock() mutex is held, so no further locking + * is necesary and no sleeping allowed. + */ + void devfs_create(struct cdev *dev) { int ino, i, *ip; struct cdev **dp; + struct cdev **ot; + int *or; + int n; for (;;) { /* Grab the next inode number */ @@ -389,56 +357,70 @@ /* wrap around when we reach the end */ if (i >= NDEVFSINO + devfs_noverflow) i = 3; - if (!atomic_cmpset_int(&devfs_nextino, ino, i)) - continue; + devfs_nextino = i; /* see if it was occupied */ dp = devfs_itod(ino); - if (dp == NULL) - Debugger("dp == NULL\n"); + KASSERT(dp != NULL, ("DEVFS: No devptr inode %d", ino)); if (*dp != NULL) continue; ip = devfs_itor(ino); - if (ip == NULL) - Debugger("ip == NULL\n"); + KASSERT(ip != NULL, ("DEVFS: No iptr inode %d", ino)); if (*ip != 0) continue; + break; + } - if (!atomic_cmpset_ptr(dp, NULL, dev)) - continue; + *dp = dev; + dev->si_inode = ino; + if (i > devfs_topino) + devfs_topino = i; + + devfs_numino++; + devfs_generation++; + + if (devfs_overflow != NULL || devfs_numino + 100 < NDEVFSINO) + return; - dev->si_inode = ino; - for (;;) { - i = devfs_topino; - if (i >= ino) - break; - if (atomic_cmpset_int(&devfs_topino, i, ino)) - break; - printf("failed topino %d %d\n", i, ino); - } - break; + /* + * Try to allocate overflow table + * XXX: we can probably be less panicy these days and a linked + * XXX: list of PAGESIZE/PTRSIZE entries might be a better idea. + * + * XXX: we may be into witness unlove here. + */ + n = devfs_noverflowwant; + ot = malloc(sizeof(*ot) * n, M_DEVFS, M_NOWAIT | M_ZERO); + if (ot == NULL) + return; + or = malloc(sizeof(*or) * n, M_DEVFS, M_NOWAIT | M_ZERO); + if (or == NULL) { + free(ot, M_DEVFS); + return; } - - atomic_add_int(&devfs_numino, 1); - atomic_add_int(&devfs_generation, 1); - if (devfs_overflow == NULL && devfs_numino + 100 > NDEVFSINO) - devfs_attemptoverflow(0); + devfs_overflow = ot; + devfs_refoverflow = or; + devfs_noverflow = n; + printf("DEVFS Overflow table with %d entries allocated\n", n); + return; } void devfs_destroy(struct cdev *dev) { - int ino, i; + int ino; + struct cdev **dp; ino = dev->si_inode; dev->si_inode = 0; if (ino == 0) return; - if (atomic_cmpset_ptr(devfs_itod(ino), dev, NULL)) { - atomic_add_int(&devfs_generation, 1); - atomic_add_int(&devfs_numino, -1); - i = devfs_nextino; - if (ino < i) - atomic_cmpset_int(&devfs_nextino, i, ino); - } + dp = devfs_itod(ino); + KASSERT(*dp == dev, + ("DEVFS: destroying wrong cdev ino %d", ino)); + *dp = NULL; + devfs_numino--; + devfs_generation++; + if (ino < devfs_nextino) + devfs_nextino = ino; } ==== //depot/projects/netperf_socket/sys/geom/vinum/geom_vinum.c#2 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum.c,v 1.1 2004/06/12 21:16:10 le Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum.c,v 1.2 2004/06/18 19:53:33 le Exp $"); #include <sys/param.h> #include <sys/bio.h> @@ -520,6 +520,9 @@ struct g_geom *gp2; struct gv_softc *sc; struct gv_drive *d, *d2; + struct gv_plex *p, *p2; + struct gv_sd *s, *s2; + struct gv_volume *v, *v2; struct gv_freelist *fl, *fl2; g_trace(G_T_TOPOLOGY, "gv_destroy_geom: %s", gp->name); @@ -539,7 +542,9 @@ return (EBUSY); } + /* Clean up and deallocate what we allocated. */ LIST_FOREACH_SAFE(d, &sc->drives, drive, d2) { + LIST_REMOVE(d, drive); g_free(d->hdr); d->hdr = NULL; LIST_FOREACH_SAFE(fl, &d->freelist, freelist, fl2) { @@ -548,11 +553,40 @@ g_free(fl); fl = NULL; } - LIST_REMOVE(d, drive); + d->geom->softc = NULL; + g_free(d); + } + + LIST_FOREACH_SAFE(s, &sc->subdisks, sd, s2) { + LIST_REMOVE(s, sd); + s->drive_sc = NULL; + s->plex_sc = NULL; + s->provider = NULL; + s->consumer = NULL; + g_free(s); + } + + LIST_FOREACH_SAFE(p, &sc->plexes, plex, p2) { + LIST_REMOVE(p, plex); + gv_kill_thread(p); + p->vol_sc = NULL; + p->geom->softc = NULL; + p->provider = NULL; + p->consumer = NULL; + if (p->org == GV_PLEX_RAID5) { + mtx_destroy(&p->worklist_mtx); + } + g_free(p); + } + + LIST_FOREACH_SAFE(v, &sc->volumes, volume, v2) { + LIST_REMOVE(v, volume); + v->geom->softc = NULL; + g_free(v); } + gp->softc = NULL; g_free(sc); - sc = NULL; g_wither_geom(gp, ENXIO); return (0); } ==== //depot/projects/netperf_socket/sys/geom/vinum/geom_vinum_drive.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_drive.c,v 1.3 2004/06/16 14:41:04 le Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_drive.c,v 1.4 2004/06/18 19:53:33 le Exp $"); #include <sys/param.h> #include <sys/bio.h> @@ -281,13 +281,15 @@ if (!LIST_EMPTY(&gp->consumer)) return; d = gp->softc; - printf("gvinum: lost drive '%s'\n", d->name); - d->geom = NULL; - LIST_FOREACH(s, &d->subdisks, from_drive) { - s->provider = NULL; - s->consumer = NULL; + if (d != NULL) { + printf("gvinum: lost drive '%s'\n", d->name); + d->geom = NULL; + LIST_FOREACH(s, &d->subdisks, from_drive) { + s->provider = NULL; + s->consumer = NULL; + } + gv_set_drive_state(d, GV_DRIVE_DOWN, GV_SETSTATE_FORCE); } - gv_set_drive_state(d, GV_DRIVE_DOWN, GV_SETSTATE_FORCE); gp->softc = NULL; g_wither_geom(gp, error); } @@ -465,12 +467,9 @@ gv_drive_destroy_geom(struct gctl_req *req, struct g_class *mp, struct g_geom *gp) { - /*struct gv_drive *d;*/ - g_trace(G_T_TOPOLOGY, "gv_drive_destroy_geom: %s", gp->name); g_topology_assert(); - /* g_free(sc); */ g_wither_geom(gp, ENXIO); return (0); } ==== //depot/projects/netperf_socket/sys/geom/vinum/geom_vinum_plex.c#3 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_plex.c,v 1.2 2004/06/16 14:41:04 le Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_plex.c,v 1.3 2004/06/18 19:53:33 le Exp $"); #include <sys/param.h> #include <sys/bio.h> @@ -66,11 +66,13 @@ return; p = gp->softc; - gv_kill_thread(p); - p->geom = NULL; + if (p != NULL) { + gv_kill_thread(p); + p->geom = NULL; + p->provider = NULL; + p->consumer = NULL; + } gp->softc = NULL; - p->provider = NULL; - p->consumer = NULL; g_wither_geom(gp, error); } ==== //depot/projects/netperf_socket/sys/geom/vinum/geom_vinum_volume.c#3 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_volume.c,v 1.2 2004/06/16 14:41:04 le Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_volume.c,v 1.3 2004/06/18 19:53:33 le Exp $"); #include <sys/param.h> #include <sys/bio.h> @@ -62,7 +62,8 @@ if (!LIST_EMPTY(&gp->consumer)) return; v = gp->softc; - v->geom = NULL; + if (v != NULL) + v->geom = NULL; gp->softc = NULL; g_wither_geom(gp, error); } @@ -243,11 +244,7 @@ { g_trace(G_T_TOPOLOGY, "gv_volume_destroy_geom: %s", gp->name); g_topology_assert(); -/* - if (gp->softc != NULL) - g_free(gp->softc); - gp->softc = NULL; -*/ + g_wither_geom(gp, ENXIO); return (0); } ==== //depot/projects/netperf_socket/sys/kern/kern_exit.c#12 (text+ko) ==== @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_exit.c,v 1.234 2004/06/08 10:37:29 tjr Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_exit.c,v 1.236 2004/06/18 11:13:49 davidxu Exp $"); #include "opt_compat.h" #include "opt_ktrace.h" @@ -133,6 +133,7 @@ */ PROC_LOCK(p); if (p->p_flag & P_SA || p->p_numthreads > 1) { +retry: /* * First check if some other thread got here before us.. * if so, act apropriatly, (exit or suspend); @@ -152,9 +153,13 @@ * to return to userland will thread_exit() from userret(). * thread_exit() will unsuspend us when the last other * thread exits. + * If there is already a thread singler after resumption, + * calling thread_single will fail, in the case, we just + * re-check all suspension request, the thread should + * either be suspended there or exit. */ if (thread_single(SINGLE_EXIT)) - panic ("Exit: Single threading fouled up"); + goto retry; /* * All other activity in this process is now stopped. * Remove excess KSEs and KSEGRPS. XXXKSE (when we have them) ==== //depot/projects/netperf_socket/sys/kern/kern_thread.c#13 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_thread.c,v 1.181 2004/06/11 17:48:20 julian Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_thread.c,v 1.182 2004/06/18 06:15:21 davidxu Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -849,6 +849,7 @@ struct thread *td; struct thread *td2; struct proc *p; + int remaining; td = curthread; p = td->td_proc; @@ -870,7 +871,11 @@ p->p_flag |= P_STOPPED_SINGLE; mtx_lock_spin(&sched_lock); p->p_singlethread = td; - while ((p->p_numthreads - p->p_suspcount) != 1) { + if (force_exit == SINGLE_EXIT) + remaining = p->p_numthreads; + else + remaining = p->p_numthreads - p->p_suspcount; + while (remaining != 1) { FOREACH_THREAD_IN_PROC(p, td2) { if (td2 == td) continue; @@ -898,10 +903,15 @@ } } } + if (force_exit == SINGLE_EXIT) + remaining = p->p_numthreads; + else + remaining = p->p_numthreads - p->p_suspcount; + /* * Maybe we suspended some threads.. was it enough? */ - if ((p->p_numthreads - p->p_suspcount) == 1) + if (remaining == 1) break; /* @@ -914,6 +924,10 @@ mtx_unlock_spin(&sched_lock); PROC_LOCK(p); mtx_lock_spin(&sched_lock); + if (force_exit == SINGLE_EXIT) + remaining = p->p_numthreads; + else + remaining = p->p_numthreads - p->p_suspcount; } if (force_exit == SINGLE_EXIT) { if (td->td_upcall) ==== //depot/projects/netperf_socket/sys/kern/subr_prf.c#4 (text+ko) ==== @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/subr_prf.c,v 1.110 2004/04/05 21:03:35 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/subr_prf.c,v 1.111 2004/06/18 20:12:42 green Exp $"); #include "opt_ddb.h" @@ -97,7 +97,12 @@ static int log_console_output = 1; TUNABLE_INT("kern.log_console_output", &log_console_output); SYSCTL_INT(_kern, OID_AUTO, log_console_output, CTLFLAG_RW, - &log_console_output, 0, ""); + &log_console_output, 0, "Duplicate console output to the syslog."); + +static int always_console_output = 0; +TUNABLE_INT("kern.always_console_output", &always_console_output); +SYSCTL_INT(_kern, OID_AUTO, always_console_output, CTLFLAG_RW, + &always_console_output, 0, "Always output to console despite TIOCCONS."); /* * Warn that a system table is full. @@ -345,8 +350,12 @@ } else { if ((flags & TOTTY) && tp != NULL) tputchar(c, tp); - if ((flags & TOCONS) && constty != NULL) - msgbuf_addchar(&consmsgbuf, c); + if (flags & TOCONS) { + if (constty != NULL) + msgbuf_addchar(&consmsgbuf, c); + if (always_console_output && c != '\0') + cnputc(c); + } } if ((flags & TOLOG)) msglogchar(c, ap->pri); ==== //depot/projects/netperf_socket/sys/kern/uipc_socket.c#20 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/uipc_socket.c,v 1.180 2004/06/18 02:57:55 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/uipc_socket.c,v 1.182 2004/06/19 03:23:14 rwatson Exp $"); #include "opt_inet.h" #include "opt_mac.h" @@ -600,8 +600,9 @@ SOCKBUF_LOCK(&so->so_snd); error = sblock(&so->so_snd, SBLOCKWAIT(flags)); if (error) - goto out; + goto out_locked; do { + SOCKBUF_LOCK_ASSERT(&so->so_snd); if (so->so_snd.sb_state & SBS_CANTSENDMORE) snderr(EPIPE); if (so->so_error) { @@ -640,6 +641,7 @@ goto release; continue; } + SOCKBUF_UNLOCK(&so->so_snd); mp = ⊤ space -= clen; do { @@ -654,7 +656,6 @@ #ifdef ZERO_COPY_SOCKETS cow_send = 0; #endif /* ZERO_COPY_SOCKETS */ - SOCKBUF_UNLOCK(&so->so_snd); if (resid >= MINCLSIZE) { #ifdef ZERO_COPY_SOCKETS if (top == NULL) { @@ -735,13 +736,14 @@ else #endif /* ZERO_COPY_SOCKETS */ error = uiomove(mtod(m, void *), (int)len, uio); - SOCKBUF_LOCK(&so->so_snd); resid = uio->uio_resid; m->m_len = len; *mp = m; top->m_pkthdr.len += len; - if (error) + if (error) { + SOCKBUF_LOCK(&so->so_snd); goto release; + } mp = &m->m_next; if (resid <= 0) { if (flags & MSG_EOR) @@ -777,22 +779,30 @@ /* If there is more to send set PRUS_MORETOCOME */ (resid > 0 && space > 0) ? PRUS_MORETOCOME : 0, top, addr, control, td); - if (dontroute) + if (dontroute) { + SOCK_LOCK(so); so->so_options &= ~SO_DONTROUTE; + SOCK_UNLOCK(so); + } clen = 0; control = NULL; top = NULL; mp = ⊤ - if (error) + if (error) { + SOCKBUF_LOCK(&so->so_snd); goto release; >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406190424.i5J4Og2f054265>