From owner-p4-projects@FreeBSD.ORG Mon Sep 13 22:54:44 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9F9B816A4D0; Mon, 13 Sep 2004 22:54:43 +0000 (GMT) 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 794B816A4CE for ; Mon, 13 Sep 2004 22:54:43 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4EF4B43D39 for ; Mon, 13 Sep 2004 22:54:43 +0000 (GMT) (envelope-from julian@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i8DMshd7091698 for ; Mon, 13 Sep 2004 22:54:43 GMT (envelope-from julian@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i8DMsgc5091695 for perforce@freebsd.org; Mon, 13 Sep 2004 22:54:42 GMT (envelope-from julian@freebsd.org) Date: Mon, 13 Sep 2004 22:54:42 GMT Message-Id: <200409132254.i8DMsgc5091695@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to julian@freebsd.org using -f From: Julian Elischer To: Perforce Change Reviews Subject: PERFORCE change 61461 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, 13 Sep 2004 22:54:44 -0000 http://perforce.freebsd.org/chv.cgi?CH=61461 Change 61461 by julian@julian_ref on 2004/09/13 22:54:19 IFC@61457 Affected files ... .. //depot/projects/nsched/sys/amd64/amd64/pmap.c#20 integrate .. //depot/projects/nsched/sys/conf/NOTES#19 integrate .. //depot/projects/nsched/sys/dev/esp/esp_sbus.c#6 integrate .. //depot/projects/nsched/sys/dev/sound/isa/sb16.c#6 integrate .. //depot/projects/nsched/sys/fs/specfs/spec_vnops.c#7 integrate .. //depot/projects/nsched/sys/geom/geom_kern.c#2 integrate .. //depot/projects/nsched/sys/geom/vinum/geom_vinum.c#7 integrate .. //depot/projects/nsched/sys/geom/vinum/geom_vinum.h#4 integrate .. //depot/projects/nsched/sys/geom/vinum/geom_vinum_drive.c#6 integrate .. //depot/projects/nsched/sys/geom/vinum/geom_vinum_plex.c#5 integrate .. //depot/projects/nsched/sys/geom/vinum/geom_vinum_rm.c#3 integrate .. //depot/projects/nsched/sys/geom/vinum/geom_vinum_state.c#3 integrate .. //depot/projects/nsched/sys/geom/vinum/geom_vinum_subr.c#5 integrate .. //depot/projects/nsched/sys/geom/vinum/geom_vinum_var.h#2 integrate .. //depot/projects/nsched/sys/i386/i386/pmap.c#22 integrate .. //depot/projects/nsched/sys/ia64/conf/GENERIC#8 integrate .. //depot/projects/nsched/sys/ia64/conf/SKI#6 integrate .. //depot/projects/nsched/sys/kern/kern_conf.c#9 integrate .. //depot/projects/nsched/sys/kern/kern_fork.c#14 integrate .. //depot/projects/nsched/sys/kern/vfs_bio.c#8 integrate .. //depot/projects/nsched/sys/kern/vnode_if.src#3 integrate .. //depot/projects/nsched/sys/netinet/ip_fastfwd.c#6 integrate .. //depot/projects/nsched/sys/netinet/ip_fw2.c#11 integrate .. //depot/projects/nsched/sys/netinet/ip_fw_pfil.c#3 integrate .. //depot/projects/nsched/sys/netinet/ip_output.c#11 integrate .. //depot/projects/nsched/sys/powerpc/powerpc/pmap.c#11 integrate .. //depot/projects/nsched/sys/sys/conf.h#9 integrate .. //depot/projects/nsched/sys/sys/proc.h#32 integrate .. //depot/projects/nsched/sys/ufs/ffs/ffs_alloc.c#7 integrate .. //depot/projects/nsched/sys/ufs/ffs/ffs_snapshot.c#7 integrate Differences ... ==== //depot/projects/nsched/sys/amd64/amd64/pmap.c#20 (text+ko) ==== @@ -75,7 +75,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.497 2004/09/08 18:58:28 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.498 2004/09/12 20:20:40 alc Exp $"); /* * Manages physical address maps. @@ -1784,14 +1784,15 @@ va_next = eva; for (; sva != va_next; sva += PAGE_SIZE) { - pt_entry_t pbits; + pt_entry_t obits, pbits; pt_entry_t *pte; vm_page_t m; pte = pmap_pte(pmap, sva); if (pte == NULL) continue; - pbits = *pte; +retry: + obits = pbits = *pte; if (pbits & PG_MANAGED) { m = NULL; if (pbits & PG_A) { @@ -1805,14 +1806,14 @@ m = PHYS_TO_VM_PAGE(pbits & PG_FRAME); vm_page_dirty(m); - pbits &= ~PG_M; } } - pbits &= ~PG_RW; + pbits &= ~(PG_RW | PG_M); - if (pbits != *pte) { - pte_store(pte, pbits); + if (pbits != obits) { + if (!atomic_cmpset_long(pte, obits, pbits)) + goto retry; anychanged = 1; } } ==== //depot/projects/nsched/sys/conf/NOTES#19 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/NOTES,v 1.1276 2004/09/08 08:42:36 ru Exp $ +# $FreeBSD: src/sys/conf/NOTES,v 1.1277 2004/09/12 12:13:29 ceri Exp $ # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # @@ -201,7 +201,7 @@ # allows interrupt threads to run sooner rather than waiting. # WARNING! Only tested on alpha, amd64, and i386. # FULL_PREEMPTION instructs the kernel to preempt non-realtime kernel -# threads. It sole use is to expose race conditions and other +# threads. Its sole use is to expose race conditions and other # bugs during development. Enabling this option will reduce # performance and increase the frequency of kernel panics by # design. If you aren't sure that you need it then you don't. ==== //depot/projects/nsched/sys/dev/esp/esp_sbus.c#6 (text+ko) ==== @@ -65,7 +65,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/esp/esp_sbus.c,v 1.6 2004/08/12 17:41:29 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/esp/esp_sbus.c,v 1.7 2004/09/13 15:15:38 scottl Exp $"); #include #include @@ -193,8 +193,12 @@ node = ofw_bus_get_node(dev); if (OF_getprop(node, "initiator-id", &sc->sc_id, sizeof(sc->sc_id)) == -1) - sc->sc_id = 7;; - sc->sc_freq = sbus_get_clockfreq(dev); + sc->sc_id = 7; + if (OF_getprop(node, "clock-frequency", &sc->sc_freq, + sizeof(sc->sc_freq)) == -1) { + printf("failed to query OFW for clock-frequency\n"); + sc->sc_freq = sbus_get_clockfreq(dev); + } #ifdef ESP_SBUS_DEBUG device_printf(dev, "espattach_sbus: sc_id %d, freq %d\n", ==== //depot/projects/nsched/sys/dev/sound/isa/sb16.c#6 (text+ko) ==== @@ -38,7 +38,7 @@ #include "mixer_if.h" -SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/isa/sb16.c,v 1.87 2004/07/16 03:59:54 tanimura Exp $"); +SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/isa/sb16.c,v 1.88 2004/09/12 18:19:42 truckman Exp $"); #define SB16_BUFFSIZE 4096 #define PLAIN_SB16(x) ((((x)->bd_flags) & (BD_F_SB16|BD_F_SB16X)) == BD_F_SB16) @@ -209,7 +209,7 @@ #if 0 printf("sb_cmd2: %x, %x\n", cmd, val); #endif - sb_lock(sb); + sb_lockassert(sb); r = 0; if (sb_dspwr(sb, cmd)) { if (sb_dspwr(sb, val & 0xff)) { @@ -218,7 +218,6 @@ } } } - sb_unlock(sb); return r; } @@ -243,12 +242,11 @@ { int val; - sb_lock(sb); + sb_lockassert(sb); sb_wr(sb, SB_MIX_ADDR, (u_char) (port & 0xff)); /* Select register */ DELAY(10); val = sb_rd(sb, SB_MIX_DATA); DELAY(10); - sb_unlock(sb); return val; } ==== //depot/projects/nsched/sys/fs/specfs/spec_vnops.c#7 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95 - * $FreeBSD: src/sys/fs/specfs/spec_vnops.c,v 1.226 2004/08/08 13:23:05 phk Exp $ + * $FreeBSD: src/sys/fs/specfs/spec_vnops.c,v 1.227 2004/09/13 06:50:41 phk Exp $ */ #include @@ -54,7 +54,6 @@ static int spec_advlock(struct vop_advlock_args *); static int spec_close(struct vop_close_args *); -static int spec_freeblks(struct vop_freeblks_args *); static int spec_fsync(struct vop_fsync_args *); static int spec_getpages(struct vop_getpages_args *); static int spec_ioctl(struct vop_ioctl_args *); @@ -74,7 +73,6 @@ { &vop_bmap_desc, (vop_t *) vop_panic }, { &vop_close_desc, (vop_t *) spec_close }, { &vop_create_desc, (vop_t *) vop_panic }, - { &vop_freeblks_desc, (vop_t *) spec_freeblks }, { &vop_fsync_desc, (vop_t *) spec_fsync }, { &vop_getpages_desc, (vop_t *) spec_getpages }, { &vop_getwritemount_desc, (vop_t *) vop_stdgetwritemount }, @@ -462,10 +460,8 @@ struct cdevsw *dsw; struct thread *td = curthread; - KASSERT(bp->b_iocmd == BIO_READ || - bp->b_iocmd == BIO_WRITE || - bp->b_iocmd == BIO_DELETE, - ("Wrong b_iocmd buf=%p cmd=%d", bp, bp->b_iocmd)); + KASSERT(bp->b_iocmd == BIO_READ || bp->b_iocmd == BIO_WRITE, + ("Wrong b_iocmd buf=%p cmd=%d", bp, bp->b_iocmd)); /* * Slow down disk requests for niced processes. @@ -529,33 +525,6 @@ return spec_xstrategy(ap->a_vp, ap->a_bp); } -static int -spec_freeblks(ap) - struct vop_freeblks_args /* { - struct vnode *a_vp; - daddr_t a_addr; - daddr_t a_length; - } */ *ap; -{ - struct buf *bp; - - /* - * XXX: This assumes that strategy does the deed right away. - * XXX: this may not be TRTTD. - */ - if ((ap->a_vp->v_rdev->si_flags & SI_CANDELETE) == 0) - return (0); - bp = geteblk(ap->a_length); - bp->b_iocmd = BIO_DELETE; - bp->b_dev = ap->a_vp->v_rdev; - bp->b_blkno = ap->a_addr; - bp->b_offset = dbtob(ap->a_addr); - bp->b_iooffset = bp->b_offset; - bp->b_bcount = ap->a_length; - BUF_KERNPROC(bp); - DEV_STRATEGY(bp); - return (0); -} /* * Device close routine ==== //depot/projects/nsched/sys/geom/geom_kern.c#2 (text+ko) ==== @@ -34,7 +34,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/geom_kern.c,v 1.34 2004/02/10 10:54:19 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/geom_kern.c,v 1.35 2004/09/13 14:58:27 pjd Exp $"); #include #include @@ -220,6 +220,7 @@ 0, 0, sysctl_kern_geom_conftxt, "", "Dump the GEOM config in txt"); +TUNABLE_INT("kern.geom.debugflags", &g_debugflags); SYSCTL_INT(_kern_geom, OID_AUTO, debugflags, CTLFLAG_RW, &g_debugflags, 0, ""); ==== //depot/projects/nsched/sys/geom/vinum/geom_vinum.c#7 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum.c,v 1.10 2004/08/27 21:32:18 le Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum.c,v 1.11 2004/09/13 17:27:58 le Exp $"); #include #include @@ -186,7 +186,7 @@ g_topology_unlock(); /* Check if the provided slice is a valid vinum drive. */ - vhdr = g_read_data(cp, GV_HDR_OFFSET, GV_HDR_LEN, &error); + vhdr = g_read_data(cp, GV_HDR_OFFSET, pp->sectorsize, &error); if (vhdr == NULL || error != 0) { g_topology_lock(); g_access(cp, -1, 0, 0); ==== //depot/projects/nsched/sys/geom/vinum/geom_vinum.h#4 (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/geom/vinum/geom_vinum.h,v 1.3 2004/08/27 21:32:18 le Exp $ + * $FreeBSD: src/sys/geom/vinum/geom_vinum.h,v 1.5 2004/09/13 21:01:36 le Exp $ */ #ifndef _GEOM_VINUM_H_ @@ -68,7 +68,8 @@ void gv_format_config(struct gv_softc *, struct sbuf *, int, char *); int gv_is_striped(struct gv_plex *); int gv_is_open(struct g_geom *); -void gv_kill_thread(struct gv_plex *); +void gv_kill_drive_thread(struct gv_drive *); +void gv_kill_plex_thread(struct gv_plex *); int gv_object_type(struct gv_softc *, char *); void gv_parse_config(struct gv_softc *, u_char *, int); const char *gv_roughlength(off_t, int); ==== //depot/projects/nsched/sys/geom/vinum/geom_vinum_drive.c#6 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_drive.c,v 1.11 2004/08/27 21:32:18 le Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_drive.c,v 1.14 2004/09/13 21:01:36 le Exp $"); #include #include @@ -47,6 +47,7 @@ #include #include +static void gv_drive_worker(void *); void gv_drive_modify(struct gv_drive *); void @@ -75,6 +76,11 @@ fl->size = d->avail; LIST_INSERT_HEAD(&d->freelist, fl, freelist); d->freelist_entries = 1; + + TAILQ_INIT(&d->bqueue); + mtx_init(&d->bqueue_mtx, "gv_drive", NULL, MTX_DEF); + kthread_create(gv_drive_worker, d, NULL, 0, 0, "gv_d %s", d->name); + d->flags |= GV_DRIVE_THREAD_ACTIVE; } void @@ -181,7 +187,8 @@ gp = pp->geom; cp = LIST_FIRST(&gp->consumer); - KASSERT(cp != NULL, ("gv_drive_access: NULL cp")); + if (cp == NULL) + return (0); d = gp->softc; @@ -225,71 +232,170 @@ } static void +gv_drive_done(struct bio *bp) +{ + struct gv_drive *d; + struct gv_bioq *bq; + + /* Put the BIO on the worker queue again. */ + d = bp->bio_from->geom->softc; + bp->bio_cflags |= GV_BIO_DONE; + bq = g_malloc(sizeof(*bq), M_NOWAIT | M_ZERO); + bq->bp = bp; + mtx_lock(&d->bqueue_mtx); + TAILQ_INSERT_TAIL(&d->bqueue, bq, queue); + wakeup(d); + mtx_unlock(&d->bqueue_mtx); +} + + +static void gv_drive_start(struct bio *bp) { - struct bio *bp2; - struct g_geom *gp; - struct g_consumer *cp; - struct g_provider *pp; struct gv_drive *d; struct gv_sd *s; + struct gv_bioq *bq; - pp = bp->bio_to; - gp = pp->geom; - cp = LIST_FIRST(&gp->consumer); - d = gp->softc; - s = pp->private; + switch (bp->bio_cmd) { + case BIO_READ: + case BIO_WRITE: + case BIO_DELETE: + break; + case BIO_GETATTR: + default: + g_io_deliver(bp, EOPNOTSUPP); + return; + } + s = bp->bio_to->private; if ((s->state == GV_SD_DOWN) || (s->state == GV_SD_STALE)) { g_io_deliver(bp, ENXIO); return; } - switch(bp->bio_cmd) { - case BIO_READ: - case BIO_WRITE: - case BIO_DELETE: - if (bp->bio_offset > s->size) { - g_io_deliver(bp, EINVAL); /* XXX: EWHAT ? */ - return; - } - bp2 = g_clone_bio(bp); - if (bp2 == NULL) { - g_io_deliver(bp, ENOMEM); - return; - } - if (bp2->bio_offset + bp2->bio_length > s->size) - bp2->bio_length = s->size - bp2->bio_offset; - bp2->bio_done = g_std_done; - bp2->bio_offset += s->drive_offset; - g_io_request(bp2, cp); - return; + d = bp->bio_to->geom->softc; + + /* + * Put the BIO on the worker queue, where the worker thread will pick + * it up. + */ + bq = g_malloc(sizeof(*bq), M_NOWAIT | M_ZERO); + bq->bp = bp; + mtx_lock(&d->bqueue_mtx); + TAILQ_INSERT_TAIL(&d->bqueue, bq, queue); + wakeup(d); + mtx_unlock(&d->bqueue_mtx); + +} + +static void +gv_drive_worker(void *arg) +{ + struct bio *bp, *cbp; + struct g_geom *gp; + struct g_provider *pp; + struct g_consumer *cp; + struct gv_drive *d; + struct gv_sd *s; + struct gv_bioq *bq, *bq2; + int error; + + d = arg; + + mtx_lock(&d->bqueue_mtx); + for (;;) { + /* We were signaled to exit. */ + if (d->flags & GV_DRIVE_THREAD_DIE) + break; + + /* Take the first BIO from out queue. */ + bq = TAILQ_FIRST(&d->bqueue); + if (bq == NULL) { + msleep(d, &d->bqueue_mtx, PRIBIO, "-", hz/10); + continue; + } + TAILQ_REMOVE(&d->bqueue, bq, queue); + mtx_unlock(&d->bqueue_mtx); + + bp = bq->bp; + g_free(bq); + pp = bp->bio_to; + gp = pp->geom; + + /* Completed request. */ + if (bp->bio_cflags & GV_BIO_DONE) { + error = bp->bio_error; + + /* Deliver the original request. */ + g_std_done(bp); + + /* The request had an error, we need to clean up. */ + if (error != 0) { + g_topology_lock(); + cp = LIST_FIRST(&gp->consumer); + if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0) + g_access(cp, -cp->acr, -cp->acw, + -cp->ace); + gv_set_drive_state(d, GV_DRIVE_DOWN, + GV_SETSTATE_FORCE | GV_SETSTATE_CONFIG); + if (cp->nstart == cp->nend) { + g_detach(cp); + g_destroy_consumer(cp); + } + g_topology_unlock(); + } + + /* New request, needs to be sent downwards. */ + } else { + s = pp->private; - case BIO_GETATTR: - if (!strcmp("GEOM::kerneldump", bp->bio_attribute)) { - struct g_kerneldump *gkd; + if ((s->state == GV_SD_DOWN) || + (s->state == GV_SD_STALE)) { + g_io_deliver(bp, ENXIO); + mtx_lock(&d->bqueue_mtx); + continue; + } + if (bp->bio_offset > s->size) { + g_io_deliver(bp, EINVAL); + mtx_lock(&d->bqueue_mtx); + continue; + } - gkd = (struct g_kerneldump *)bp->bio_data; - gkd->offset += s->drive_offset; - if (gkd->length > s->size) - gkd->length = s->size; - /* now, pass it on downwards... */ + cbp = g_clone_bio(bp); + if (cbp == NULL) { + g_io_deliver(bp, ENOMEM); + mtx_lock(&d->bqueue_mtx); + continue; + } + if (cbp->bio_offset + cbp->bio_length > s->size) + cbp->bio_length = s->size - + cbp->bio_offset; + cbp->bio_done = gv_drive_done; + cbp->bio_offset += s->drive_offset; + g_io_request(cbp, LIST_FIRST(&gp->consumer)); } - bp2 = g_clone_bio(bp); - if (bp2 == NULL) { - g_io_deliver(bp, ENOMEM); - return; - } - bp2->bio_done = g_std_done; - g_io_request(bp2, cp); - return; + + mtx_lock(&d->bqueue_mtx); + } - default: - g_io_deliver(bp, EOPNOTSUPP); - return; + TAILQ_FOREACH_SAFE(bq, &d->bqueue, queue, bq2) { + TAILQ_REMOVE(&d->bqueue, bq, queue); + mtx_unlock(&d->bqueue_mtx); + bp = bq->bp; + g_free(bq); + if (bp->bio_cflags & GV_BIO_DONE) + g_std_done(bp); + else + g_io_deliver(bp, ENXIO); + mtx_lock(&d->bqueue_mtx); } + mtx_unlock(&d->bqueue_mtx); + d->flags |= GV_DRIVE_THREAD_DEAD; + + kthread_exit(ENXIO); } + static void gv_drive_orphan(struct g_consumer *cp) { @@ -318,7 +424,9 @@ s->provider = NULL; s->consumer = NULL; } - gv_set_drive_state(d, GV_DRIVE_DOWN, GV_SETSTATE_FORCE); + gv_kill_drive_thread(d); + gv_set_drive_state(d, GV_DRIVE_DOWN, + GV_SETSTATE_FORCE | GV_SETSTATE_CONFIG); } gp->softc = NULL; g_wither_geom(gp, error); @@ -372,7 +480,7 @@ /* Now check if the provided slice is a valid vinum drive. */ do { - vhdr = g_read_data(cp, GV_HDR_OFFSET, GV_HDR_LEN, &error); + vhdr = g_read_data(cp, GV_HDR_OFFSET, pp->sectorsize, &error); if (vhdr == NULL || error != 0) break; if (vhdr->magic != GV_MAGIC) { @@ -426,6 +534,12 @@ LIST_INSERT_HEAD(&d->freelist, fl, freelist); d->freelist_entries = 1; + TAILQ_INIT(&d->bqueue); + mtx_init(&d->bqueue_mtx, "gv_drive", NULL, MTX_DEF); + kthread_create(gv_drive_worker, d, NULL, 0, 0, + "gv_d %s", d->name); + d->flags |= GV_DRIVE_THREAD_ACTIVE; + /* Save it into the main configuration. */ LIST_INSERT_HEAD(&sc->drives, d, drive); } @@ -434,6 +548,7 @@ gp->softc = d; d->geom = gp; + d->vinumconf = sc; strncpy(d->device, pp->name, GV_MAXDRIVENAME); /* @@ -511,9 +626,14 @@ 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(); + d = gp->softc; + gv_kill_drive_thread(d); + g_wither_geom(gp, ENXIO); return (0); } ==== //depot/projects/nsched/sys/geom/vinum/geom_vinum_plex.c#5 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_plex.c,v 1.8 2004/08/10 20:51:48 le Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_plex.c,v 1.9 2004/09/13 17:44:47 le Exp $"); #include #include @@ -67,7 +67,7 @@ p = gp->softc; if (p != NULL) { - gv_kill_thread(p); + gv_kill_plex_thread(p); p->geom = NULL; p->provider = NULL; p->consumer = NULL; @@ -468,7 +468,7 @@ * If this is a RAID5 plex, check if its worker thread is still active * and signal it to self destruct. */ - gv_kill_thread(p); + gv_kill_plex_thread(p); /* g_free(sc); */ g_wither_geom(gp, ENXIO); return (0); ==== //depot/projects/nsched/sys/geom/vinum/geom_vinum_rm.c#3 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_rm.c,v 1.2 2004/08/22 17:07:55 le Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_rm.c,v 1.4 2004/09/13 21:01:36 le Exp $"); #include #include @@ -228,7 +228,7 @@ p->vol_sc = NULL; } - gv_kill_thread(p); + gv_kill_plex_thread(p); g_free(p); if (gp != NULL) { @@ -342,6 +342,7 @@ } LIST_REMOVE(d, drive); + gv_kill_drive_thread(d); gp = d->geom; d->geom = NULL; g_free(d->hdr); ==== //depot/projects/nsched/sys/geom/vinum/geom_vinum_state.c#3 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_state.c,v 1.3 2004/08/19 12:03:27 le Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_state.c,v 1.4 2004/09/13 17:33:52 le Exp $"); #include #include @@ -63,6 +63,10 @@ gv_update_sd_state(s); } + /* Save the config back to disk. */ + if (flags & GV_SETSTATE_CONFIG) + gv_save_config_all(d->vinumconf); + return (1); } ==== //depot/projects/nsched/sys/geom/vinum/geom_vinum_subr.c#5 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_subr.c,v 1.7 2004/08/22 13:34:24 le Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_subr.c,v 1.9 2004/09/13 21:01:36 le Exp $"); #include #include @@ -817,7 +817,20 @@ } void -gv_kill_thread(struct gv_plex *p) +gv_kill_drive_thread(struct gv_drive *d) +{ + if (d->flags & GV_DRIVE_THREAD_ACTIVE) { + d->flags |= GV_DRIVE_THREAD_DIE; + wakeup(d); + while (!(d->flags & GV_DRIVE_THREAD_DEAD)) + tsleep(d, PRIBIO, "gv_die", hz); + d->flags &= ~GV_DRIVE_THREAD_ACTIVE; + mtx_destroy(&d->bqueue_mtx); + } +} + +void +gv_kill_plex_thread(struct gv_plex *p) { if ((p->org == GV_PLEX_RAID5) && (p->flags & GV_PLEX_THREAD_ACTIVE)) { p->flags |= GV_PLEX_THREAD_DIE; ==== //depot/projects/nsched/sys/geom/vinum/geom_vinum_var.h#2 (text+ko) ==== @@ -35,7 +35,7 @@ * otherwise) arising in any way out of the use of this software, even if * advised of the possibility of such damage. * - * $FreeBSD: src/sys/geom/vinum/geom_vinum_var.h,v 1.1 2004/06/12 21:16:10 le Exp $ + * $FreeBSD: src/sys/geom/vinum/geom_vinum_var.h,v 1.2 2004/09/13 21:01:36 le Exp $ */ #ifndef _GEOM_VINUM_VAR_H_ @@ -107,6 +107,11 @@ #define GV_MAX_SYNCSIZE MAXPHYS #define GV_DFLT_SYNCSIZE 65536 +/* Flags for BIOs, as they are processed within vinum. */ +#define GV_BIO_DONE 0x01 +#define GV_BIO_MALLOC 0x02 +#define GV_BIO_ONHOLD 0x04 + /* * hostname is 256 bytes long, but we don't need to shlep multiple copies in * vinum. We use the host name just to identify this system, and 32 bytes @@ -139,6 +144,16 @@ LIST_ENTRY(gv_freelist) freelist; }; +/* + * Since we share structures between userland and kernel, we need this helper + * struct instead of struct bio_queue_head and friends. Maybe I find a proper + * solution some day. + */ +struct gv_bioq { + struct bio *bp; + TAILQ_ENTRY(gv_bioq) queue; +}; + /* This struct contains the main vinum config. */ struct gv_softc { /*struct mtx config_mtx; XXX not yet */ @@ -164,6 +179,11 @@ off_t avail; /* Available space. */ int sdcount; /* Number of subdisks. */ + int flags; +#define GV_DRIVE_THREAD_ACTIVE 0x01 /* Drive has an active worker thread. */ +#define GV_DRIVE_THREAD_DIE 0x02 /* Signal the worker thread to die. */ +#define GV_DRIVE_THREAD_DEAD 0x04 /* The worker thread has died. */ + struct gv_hdr *hdr; /* The drive header. */ int freelist_entries; /* Count of freelist entries. */ @@ -171,6 +191,9 @@ LIST_HEAD(,gv_sd) subdisks; /* Subdisks on this drive. */ LIST_ENTRY(gv_drive) drive; /* Entry in the vinum config. */ + TAILQ_HEAD(,gv_bioq) bqueue; /* BIO queue of this drive. */ + struct mtx bqueue_mtx; /* Mtx. to protect the queue. */ + struct g_geom *geom; /* The geom of this drive. */ struct gv_softc *vinumconf; /* Pointer to the vinum conf. */ }; ==== //depot/projects/nsched/sys/i386/i386/pmap.c#22 (text+ko) ==== @@ -73,7 +73,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/i386/i386/pmap.c,v 1.503 2004/09/11 10:07:21 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/i386/pmap.c,v 1.504 2004/09/12 20:20:40 alc Exp $"); /* * Manages physical address maps. @@ -1814,7 +1814,7 @@ sched_pin(); PMAP_LOCK(pmap); for (; sva < eva; sva = pdnxt) { - unsigned pdirindex; + unsigned obits, pbits, pdirindex; pdnxt = (sva + NBPDR) & ~PDRMASK; @@ -1842,13 +1842,18 @@ pdnxt = eva; for (; sva != pdnxt; sva += PAGE_SIZE) { - pt_entry_t pbits; pt_entry_t *pte; vm_page_t m; if ((pte = pmap_pte_quick(pmap, sva)) == NULL) continue; - pbits = *pte; +retry: + /* + * Regardless of whether a pte is 32 or 64 bits in + * size, PG_RW, PG_A, and PG_M are among the least + * significant 32 bits. + */ + obits = pbits = *(u_int *)pte; if (pbits & PG_MANAGED) { m = NULL; if (pbits & PG_A) { @@ -1861,14 +1866,15 @@ if (m == NULL) m = PHYS_TO_VM_PAGE(pbits); vm_page_dirty(m); - pbits &= ~PG_M; } } - pbits &= ~PG_RW; + pbits &= ~(PG_RW | PG_M); - if (pbits != *pte) { - pte_store(pte, pbits); + if (pbits != obits) { + if (!atomic_cmpset_int((u_int *)pte, obits, + pbits)) + goto retry; anychanged = 1; } } ==== //depot/projects/nsched/sys/ia64/conf/GENERIC#8 (text+ko) ==== @@ -18,7 +18,7 @@ # # For hardware specific information check HARDWARE.TXT # -# $FreeBSD: src/sys/ia64/conf/GENERIC,v 1.69 2004/09/02 18:05:26 marcel Exp $ +# $FreeBSD: src/sys/ia64/conf/GENERIC,v 1.70 2004/09/12 05:50:32 marcel Exp $ machine ia64 cpu ITANIUM @@ -42,7 +42,8 @@ options NFS_ROOT # NFS usable as root device options PROCFS # Process filesystem (/proc) options PSEUDOFS # Pseudo-filesystem framework -options SCHED_ULE # ULE scheduler +options SCHED_4BSD # 4BSD scheduler +#options SCHED_ULE # ULE scheduler options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI #options SMP # SMP support options SOFTUPDATES # Enable FFS soft updates support ==== //depot/projects/nsched/sys/ia64/conf/SKI#6 (text+ko) ==== @@ -17,7 +17,7 @@ # If you are in doubt as to the purpose or necessity of a line, check # first in NOTES. # -# $FreeBSD: src/sys/ia64/conf/SKI,v 1.20 2004/08/27 15:16:22 andre Exp $ +# $FreeBSD: src/sys/ia64/conf/SKI,v 1.21 2004/09/12 05:50:32 marcel Exp $ machine ia64 cpu ITANIUM @@ -37,7 +37,8 @@ options MD_ROOT # MD usable as root device options PROCFS # Process filesystem (/proc) options PSEUDOFS # Pseudo-filesystem framework -options SCHED_ULE # ULE scheduler +options SCHED_4BSD # 4BSD scheduler +#options SCHED_ULE # ULE scheduler options SKI # Include SKI support code options SOFTUPDATES # Enable FFS soft updates support options SYSVMSG # SYSV-style message queues ==== //depot/projects/nsched/sys/kern/kern_conf.c#9 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/kern_conf.c,v 1.156 2004/08/30 01:10:20 pjd Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_conf.c,v 1.157 2004/09/13 07:29:44 phk Exp $"); #include #include @@ -293,7 +293,6 @@ si->__si_namebuf[0] = '\0'; si->si_name = si->__si_namebuf; LIST_INIT(&si->si_children); - TAILQ_INIT(&si->si_snapshots); return (si); } ==== //depot/projects/nsched/sys/kern/kern_fork.c#14 (text+ko) ==== @@ -35,7 +35,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/kern_fork.c,v 1.238 2004/09/05 02:09:53 julian Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_fork.c,v 1.239 2004/09/13 22:10:04 julian Exp $"); #include "opt_ktrace.h" #include "opt_mac.h" ==== //depot/projects/nsched/sys/kern/vfs_bio.c#8 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/vfs_bio.c,v 1.444 2004/07/25 21:24:21 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/vfs_bio.c,v 1.445 2004/09/13 06:50:41 phk Exp $"); #include #include @@ -1234,8 +1234,7 @@ bp->b_ioflags &= ~BIO_ERROR; bdirty(bp); } else if ((bp->b_flags & (B_NOCACHE | B_INVAL)) || - (bp->b_ioflags & BIO_ERROR) || - bp->b_iocmd == BIO_DELETE || (bp->b_bufsize <= 0)) { + (bp->b_ioflags & BIO_ERROR) || (bp->b_bufsize <= 0)) { /* * Either a failed I/O or we were asked to free or not * cache the buffer. @@ -3130,12 +3129,6 @@ bp->b_flags |= B_DONE; runningbufwakeup(bp); - if (bp->b_iocmd == BIO_DELETE) { - brelse(bp); - splx(s); - return; - } - if (bp->b_iocmd == BIO_WRITE) { vwakeup(bp); } ==== //depot/projects/nsched/sys/kern/vnode_if.src#3 (text+ko) ==== @@ -27,7 +27,7 @@ # SUCH DAMAGE. # # @(#)vnode_if.src 8.12 (Berkeley) 5/14/95 -# $FreeBSD: src/sys/kern/vnode_if.src,v 1.67 2004/04/05 21:03:37 imp Exp $ +# $FreeBSD: src/sys/kern/vnode_if.src,v 1.68 2004/09/13 06:50:42 phk Exp $ # # @@ -478,20 +478,6 @@ }; # -#% freeblks vp - - - -# -# This call is used by the filesystem to release blocks back to >>> TRUNCATED FOR MAIL (1000 lines) <<<