Date: Mon, 19 Jul 2004 08:43:00 GMT From: Doug Rabson <dfr@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 57686 for review Message-ID: <200407190843.i6J8h0UH034399@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=57686 Change 57686 by dfr@dfr_home on 2004/07/19 08:42:50 IFC Affected files ... .. //depot/projects/kse/lib/libc/amd64/gen/Makefile.inc#3 integrate .. //depot/projects/kse/lib/libc/amd64/gen/flt_rounds.c#1 branch .. //depot/projects/kse/lib/libc/gen/Makefile.inc#8 integrate .. //depot/projects/kse/lib/libc/gen/signbit.3#2 delete .. //depot/projects/kse/lib/libc/gen/signbit.c#2 delete .. //depot/projects/kse/lib/libc/i386/gen/Makefile.inc#6 integrate .. //depot/projects/kse/lib/libc/i386/gen/flt_rounds.c#1 branch .. //depot/projects/kse/lib/libc/ia64/gen/Makefile.inc#4 integrate .. //depot/projects/kse/lib/libc/ia64/gen/flt_rounds.c#1 branch .. //depot/projects/kse/lib/libc/regex/grot/debug.c#2 integrate .. //depot/projects/kse/lib/libc/regex/grot/limits.h#2 delete .. //depot/projects/kse/lib/libc/regex/grot/stdlib.h#2 delete .. //depot/projects/kse/sys/amd64/include/float.h#5 integrate .. //depot/projects/kse/sys/arm/include/float.h#2 integrate .. //depot/projects/kse/sys/geom/nop/g_nop.c#3 integrate .. //depot/projects/kse/sys/geom/nop/g_nop.h#2 integrate .. //depot/projects/kse/sys/i386/i386/machdep.c#65 integrate .. //depot/projects/kse/sys/i386/include/float.h#6 integrate .. //depot/projects/kse/sys/ia64/ia64/pmap.c#37 integrate .. //depot/projects/kse/sys/ia64/include/float.h#6 integrate .. //depot/projects/kse/sys/ia64/include/pmap.h#11 integrate .. //depot/projects/kse/sys/kern/kern_malloc.c#18 integrate .. //depot/projects/kse/sys/powerpc/conf/GENERIC.hints#1 branch .. //depot/projects/kse/sys/powerpc/include/float.h#5 integrate .. //depot/projects/kse/sys/powerpc/include/ucontext.h#3 integrate .. //depot/projects/kse/sys/sys/malloc.h#12 integrate .. //depot/projects/kse/sys/vm/vm_contig.c#13 integrate .. //depot/projects/kse/sys/vm/vm_page.h#17 integrate .. //depot/projects/kse/tools/regression/lib/msun/test-fenv.c#2 integrate Differences ... ==== //depot/projects/kse/lib/libc/amd64/gen/Makefile.inc#3 (text+ko) ==== @@ -1,8 +1,8 @@ # @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 -# $FreeBSD: src/lib/libc/amd64/gen/Makefile.inc,v 1.26 2004/07/18 21:23:38 das Exp $ +# $FreeBSD: src/lib/libc/amd64/gen/Makefile.inc,v 1.27 2004/07/19 08:17:24 das Exp $ SRCS+= _setjmp.S rfork_thread.S setjmp.S sigsetjmp.S \ fabs.S modf.S \ infinity.c ldexp.c makecontext.c signalcontext.c \ - fpgetmask.c fpsetmask.c fpgetprec.c fpsetprec.c \ + flt_rounds.c fpgetmask.c fpsetmask.c fpgetprec.c fpsetprec.c \ fpgetround.c fpsetround.c fpgetsticky.c fpsetsticky.c ==== //depot/projects/kse/lib/libc/gen/Makefile.inc#8 (text+ko) ==== @@ -1,5 +1,5 @@ # @(#)Makefile.inc 8.6 (Berkeley) 5/4/95 -# $FreeBSD: src/lib/libc/gen/Makefile.inc,v 1.113 2004/07/18 21:23:39 das Exp $ +# $FreeBSD: src/lib/libc/gen/Makefile.inc,v 1.114 2004/07/19 08:16:10 das Exp $ # machine-independent gen sources .PATH: ${.CURDIR}/${MACHINE_ARCH}/gen ${.CURDIR}/gen @@ -25,8 +25,7 @@ raise.c readdir.c readpassphrase.c rewinddir.c \ scandir.c seed48.c seekdir.c sem.c semctl.c \ setdomainname.c sethostname.c setjmperr.c setmode.c \ - setproctitle.c setprogname.c \ - siginterrupt.c siglist.c signal.c signbit.c \ + setproctitle.c setprogname.c siginterrupt.c siglist.c signal.c \ sigsetops.c sleep.c srand48.c statvfs.c stringlist.c strtofflags.c \ sysconf.c sysctl.c sysctlbyname.c sysctlnametomib.c \ syslog.c telldir.c termios.c time.c times.c timezone.c tls.c \ @@ -58,7 +57,7 @@ scandir.3 sem_destroy.3 sem_getvalue.3 sem_init.3 \ sem_open.3 sem_post.3 sem_wait.3 \ setjmp.3 setmode.3 setproctitle.3 shm_open.3 \ - siginterrupt.3 signal.3 signbit.3 sigsetops.3 sleep.3 \ + siginterrupt.3 signal.3 sigsetops.3 sleep.3 \ statvfs.3 stringlist.3 \ strtofflags.3 sysconf.3 sysctl.3 syslog.3 tcgetpgrp.3 \ tcsendbreak.3 tcsetattr.3 tcsetpgrp.3 time.3 times.3 timezone.3 \ ==== //depot/projects/kse/lib/libc/i386/gen/Makefile.inc#6 (text+ko) ==== @@ -1,6 +1,6 @@ # @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 -# $FreeBSD: src/lib/libc/i386/gen/Makefile.inc,v 1.20 2004/07/18 21:23:39 das Exp $ +# $FreeBSD: src/lib/libc/i386/gen/Makefile.inc,v 1.21 2004/07/19 08:17:24 das Exp $ SRCS+= _ctx_start.S _setjmp.S alloca.S fabs.S \ - infinity.c ldexp.c makecontext.c modf.S \ + flt_rounds.c infinity.c ldexp.c makecontext.c modf.S \ rfork_thread.S setjmp.S signalcontext.c sigsetjmp.S ==== //depot/projects/kse/lib/libc/ia64/gen/Makefile.inc#4 (text+ko) ==== @@ -1,8 +1,9 @@ -# $FreeBSD: src/lib/libc/ia64/gen/Makefile.inc,v 1.10 2004/07/18 21:23:39 das Exp $ +# $FreeBSD: src/lib/libc/ia64/gen/Makefile.inc,v 1.11 2004/07/19 08:17:24 das Exp $ SRCS+= __divdf3.S __divdi3.S __divsf3.S __divsi3.S __moddi3.S __modsi3.S \ __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S _setjmp.S fabs.S \ - fpgetmask.c fpgetround.c fpsetmask.c fpsetround.c infinity.c \ + flt_rounds.c fpgetmask.c fpgetround.c fpsetmask.c \ + fpsetround.c infinity.c \ ldexp.c makecontext.c modf.c setjmp.S signalcontext.c sigsetjmp.S # The following may go away if function _Unwind_FindTableEntry() ==== //depot/projects/kse/lib/libc/regex/grot/debug.c#2 (text+ko) ==== @@ -1,5 +1,5 @@ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libc/regex/grot/debug.c,v 1.3 2002/03/22 21:52:48 obrien Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/regex/grot/debug.c,v 1.4 2004/07/19 08:28:53 tjr Exp $"); #include <stdio.h> #include <string.h> @@ -8,6 +8,8 @@ #include <stdlib.h> #include <sys/types.h> #include <regex.h> +#include <wchar.h> +#include <wctype.h> #include "utils.h" #include "regex2.h" @@ -26,10 +28,8 @@ int i; int c; int last; - int nincat[NC]; - fprintf(d, "%ld states, %d categories", (long)g->nstates, - g->ncategories); + fprintf(d, "%ld states", (long)g->nstates); fprintf(d, ", first %ld last %ld", (long)g->firststate, (long)g->laststate); if (g->iflags&USEBOL) @@ -49,41 +49,6 @@ fprintf(d, ", nplus %ld", (long)g->nplus); fprintf(d, "\n"); s_print(g, d); - for (i = 0; i < g->ncategories; i++) { - nincat[i] = 0; - for (c = CHAR_MIN; c <= CHAR_MAX; c++) - if (g->categories[c] == i) - nincat[i]++; - } - fprintf(d, "cc0#%d", nincat[0]); - for (i = 1; i < g->ncategories; i++) - if (nincat[i] == 1) { - for (c = CHAR_MIN; c <= CHAR_MAX; c++) - if (g->categories[c] == i) - break; - fprintf(d, ", %d=%s", i, regchar(c)); - } - fprintf(d, "\n"); - for (i = 1; i < g->ncategories; i++) - if (nincat[i] != 1) { - fprintf(d, "cc%d\t", i); - last = -1; - for (c = CHAR_MIN; c <= CHAR_MAX+1; c++) /* +1 does flush */ - if (c <= CHAR_MAX && g->categories[c] == i) { - if (last < 0) { - fprintf(d, "%s", regchar(c)); - last = c; - } - } else { - if (last >= 0) { - if (last != c-1) - fprintf(d, "-%s", - regchar(c-1)); - last = -1; - } - } - fprintf(d, "\n"); - } } /* @@ -148,6 +113,7 @@ break; case OANYOF: fprintf(d, "[(%ld)", (long)opnd); +#if 0 cs = &g->sets[opnd]; last = -1; for (i = 0; i < g->csetsize+1; i++) /* +1 flushes */ @@ -164,6 +130,7 @@ last = -1; } } +#endif fprintf(d, "]"); break; case OBACK_: ==== //depot/projects/kse/sys/amd64/include/float.h#5 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * from: @(#)float.h 7.1 (Berkeley) 5/8/90 - * $FreeBSD: src/sys/amd64/include/float.h,v 1.13 2004/07/08 01:32:25 peter Exp $ + * $FreeBSD: src/sys/amd64/include/float.h,v 1.14 2004/07/19 08:17:24 das Exp $ */ #ifndef _MACHINE_FLOAT_H_ @@ -35,8 +35,12 @@ #include <sys/cdefs.h> +__BEGIN_DECLS +extern int __flt_rounds(void); +__END_DECLS + #define FLT_RADIX 2 /* b */ -#define FLT_ROUNDS 1 /* FP addition rounds to nearest */ +#define FLT_ROUNDS __flt_rounds() #if __ISO_C_VISIBLE >= 1999 #define FLT_EVAL_METHOD (-1) /* i387 semantics are...interesting */ #define DECIMAL_DIG 21 /* max precision in decimal digits */ ==== //depot/projects/kse/sys/arm/include/float.h#2 (text+ko) ==== @@ -31,15 +31,15 @@ * SUCH DAMAGE. * * from: @(#)float.h 7.1 (Berkeley) 5/8/90 - * $FreeBSD: src/sys/arm/include/float.h,v 1.1 2004/05/14 11:46:44 cognet Exp $ + * $FreeBSD: src/sys/arm/include/float.h,v 1.3 2004/07/19 08:24:04 das Exp $ */ #ifndef _MACHINE_FLOAT_H_ #define _MACHINE_FLOAT_H_ 1 #define FLT_RADIX 2 /* b */ -#define FLT_ROUNDS 1 /* FP addition rounds to nearest */ -#define FLT_EVAL_METHOD (-1) /* i387 semantics are...interesting */ +#define FLT_ROUNDS (-1) /* indeterminate */ +#define FLT_EVAL_METHOD (-1) /* XXX */ #define DECIMAL_DIG 21 /* max precision in decimal digits */ #define FLT_MANT_DIG 24 /* p */ ==== //depot/projects/kse/sys/geom/nop/g_nop.c#3 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/geom/nop/g_nop.c,v 1.4 2004/06/07 13:40:40 pjd Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/nop/g_nop.c,v 1.5 2004/07/19 07:52:56 pjd Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -72,11 +72,13 @@ static void g_nop_start(struct bio *bp) { + struct g_nop_softc *sc; struct g_geom *gp; struct g_provider *pp; struct bio *cbp; gp = bp->bio_to->geom; + sc = gp->softc; G_NOP_LOGREQ(bp, "Request received."); cbp = g_clone_bio(bp); if (cbp == NULL) { @@ -85,17 +87,17 @@ } pp = LIST_FIRST(&gp->provider); KASSERT(pp != NULL, ("NULL pp")); - if (pp->index > 0) { + if (sc->sc_failprob > 0) { u_int rval; rval = arc4random() % 100; - if (rval < pp->index) { + if (rval < sc->sc_failprob) { g_io_deliver(bp, EIO); return; } } cbp->bio_done = g_std_done; - cbp->bio_offset = bp->bio_offset; + cbp->bio_offset = bp->bio_offset + sc->sc_offset; cbp->bio_data = bp->bio_data; cbp->bio_length = bp->bio_length; cbp->bio_to = LIST_FIRST(&gp->provider); @@ -119,8 +121,9 @@ static int g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp, - u_int failprob) + u_int failprob, off_t offset, off_t size) { + struct g_nop_softc *sc; struct g_geom *gp; struct g_provider *newpp; struct g_consumer *cp; @@ -133,6 +136,24 @@ newpp = NULL; cp = NULL; + if ((offset % pp->sectorsize) != 0) { + gctl_error(req, "Invalid offset for provider %s.", pp->name); + return (EINVAL); + } + if ((size % pp->sectorsize) != 0) { + gctl_error(req, "Invalid size for provider %s.", pp->name); + return (EINVAL); + } + if (offset >= pp->mediasize) { + gctl_error(req, "Invalid offset for provider %s.", pp->name); + return (EINVAL); + } + if (size == 0) + size = pp->mediasize - offset; + if (offset + size > pp->mediasize) { + gctl_error(req, "Invalid size for provider %s.", pp->name); + return (EINVAL); + } snprintf(name, sizeof(name), "%s%s", pp->name, G_NOP_SUFFIX); LIST_FOREACH(gp, &mp->geom, geom) { if (strcmp(gp->name, name) == 0) { @@ -145,7 +166,10 @@ gctl_error(req, "Cannot create geom %s.", name); return (ENOMEM); } - gp->softc = NULL; + sc = g_malloc(sizeof(*sc), M_WAITOK); + sc->sc_offset = offset; + sc->sc_failprob = failprob; + gp->softc = sc; gp->start = g_nop_start; gp->spoiled = g_nop_orphan; gp->orphan = g_nop_orphan; @@ -158,9 +182,8 @@ error = ENOMEM; goto fail; } - newpp->mediasize = pp->mediasize; + newpp->mediasize = size; newpp->sectorsize = pp->sectorsize; - newpp->index = failprob; cp = g_new_consumer(gp); if (cp == NULL) { @@ -185,8 +208,11 @@ } if (newpp != NULL) g_destroy_provider(pp); - if (gp != NULL) + if (gp != NULL) { + if (gp->softc != NULL) + g_free(gp->softc); g_destroy_geom(gp); + } return (error); } @@ -209,6 +235,8 @@ } else { G_NOP_DEBUG(0, "Device %s removed.", gp->name); } + g_free(gp->softc); + gp->softc = NULL; g_wither_geom(gp, ENXIO); return (0); @@ -225,7 +253,7 @@ g_nop_ctl_create(struct gctl_req *req, struct g_class *mp) { struct g_provider *pp; - intmax_t *failprob; + intmax_t *failprob, *offset, *size; const char *name; char param[16]; int i, *nargs; @@ -250,6 +278,24 @@ gctl_error(req, "Invalid '%s' argument", "failprob"); return; } + offset = gctl_get_paraml(req, "offset", sizeof(*offset)); + if (offset == NULL) { + gctl_error(req, "No '%s' argument", "offset"); + return; + } + if (*offset < 0) { + gctl_error(req, "Invalid '%s' argument", "offset"); + return; + } + size = gctl_get_paraml(req, "size", sizeof(*size)); + if (size == NULL) { + gctl_error(req, "No '%s' argument", "size"); + return; + } + if (*size < 0) { + gctl_error(req, "Invalid '%s' argument", "size"); + return; + } for (i = 0; i < *nargs; i++) { snprintf(param, sizeof(param), "arg%d", i); @@ -266,14 +312,17 @@ gctl_error(req, "Provider %s is invalid.", name); return; } - if (g_nop_create(req, mp, pp, (u_int)*failprob) != 0) + if (g_nop_create(req, mp, pp, (u_int)*failprob, (off_t)*offset, + (off_t)*size) != 0) { return; + } } } static void g_nop_ctl_configure(struct gctl_req *req, struct g_class *mp) { + struct g_nop_softc *sc; struct g_provider *pp; intmax_t *failprob; const char *name; @@ -316,7 +365,8 @@ gctl_error(req, "Provider %s is invalid.", name); return; } - pp->index = (u_int)*failprob; + sc = pp->geom->softc; + sc->sc_failprob = (u_int)*failprob; } } @@ -416,11 +466,14 @@ g_nop_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g_consumer *cp, struct g_provider *pp) { + struct g_nop_softc *sc; - if (pp != NULL) { - sbuf_printf(sb, "%s<failprob>%u</failprob>\n", indent, - pp->index); - } + if (pp == NULL) + return; + sc = gp->softc; + sbuf_printf(sb, "%s<offset>%jd</offset>\n", indent, + (intmax_t)sc->sc_offset); + sbuf_printf(sb, "%s<failprob>%u</failprob>\n", indent, sc->sc_failprob); } DECLARE_GEOM_CLASS(g_nop_class, g_nop); ==== //depot/projects/kse/sys/geom/nop/g_nop.h#2 (text+ko) ==== @@ -23,14 +23,14 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/geom/nop/g_nop.h,v 1.2 2004/05/21 15:23:48 pjd Exp $ + * $FreeBSD: src/sys/geom/nop/g_nop.h,v 1.3 2004/07/19 07:52:56 pjd Exp $ */ #ifndef _G_NOP_H_ #define _G_NOP_H_ #define G_NOP_CLASS_NAME "NOP" -#define G_NOP_VERSION 1 +#define G_NOP_VERSION 2 #define G_NOP_SUFFIX ".nop" #ifdef _KERNEL @@ -53,6 +53,11 @@ printf("\n"); \ } \ } while (0) + +struct g_nop_softc { + off_t sc_offset; + u_int sc_failprob; +}; #endif /* _KERNEL */ #endif /* _G_NOP_H_ */ ==== //depot/projects/kse/sys/i386/i386/machdep.c#65 (text+ko) ==== @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/i386/i386/machdep.c,v 1.595 2004/07/13 07:22:54 davidxu Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/i386/machdep.c,v 1.596 2004/07/19 02:46:34 silby Exp $"); #include "opt_apic.h" #include "opt_atalk.h" @@ -95,6 +95,9 @@ #include <sys/cons.h> #ifdef DDB +#ifndef KDB +#error KDB must be enabled in order for DDB to work! +#endif #include <ddb/ddb.h> #include <ddb/db_sym.h> #endif ==== //depot/projects/kse/sys/i386/include/float.h#6 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * from: @(#)float.h 7.1 (Berkeley) 5/8/90 - * $FreeBSD: src/sys/i386/include/float.h,v 1.13 2004/06/28 03:08:17 imp Exp $ + * $FreeBSD: src/sys/i386/include/float.h,v 1.14 2004/07/19 08:17:25 das Exp $ */ #ifndef _MACHINE_FLOAT_H_ @@ -35,8 +35,12 @@ #include <sys/cdefs.h> +__BEGIN_DECLS +extern int __flt_rounds(void); +__END_DECLS + #define FLT_RADIX 2 /* b */ -#define FLT_ROUNDS 1 /* FP addition rounds to nearest */ +#define FLT_ROUNDS __flt_rounds() #if __ISO_C_VISIBLE >= 1999 #define FLT_EVAL_METHOD (-1) /* i387 semantics are...interesting */ #define DECIMAL_DIG 21 /* max precision in decimal digits */ ==== //depot/projects/kse/sys/ia64/ia64/pmap.c#37 (text+ko) ==== @@ -46,7 +46,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/ia64/ia64/pmap.c,v 1.141 2004/07/16 03:42:45 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/ia64/ia64/pmap.c,v 1.142 2004/07/19 05:39:49 alc Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -445,6 +445,7 @@ /* * Initialize the kernel pmap (which is statically allocated). */ + PMAP_LOCK_INIT(kernel_pmap); for (i = 0; i < 5; i++) kernel_pmap->pm_rid[i] = 0; kernel_pmap->pm_active = 1; @@ -698,6 +699,7 @@ { int i; + PMAP_LOCK_INIT(pmap); for (i = 0; i < 5; i++) pmap->pm_rid[i] = pmap_allocate_rid(); pmap->pm_active = 0; @@ -722,6 +724,7 @@ for (i = 0; i < 5; i++) if (pmap->pm_rid[i]) pmap_free_rid(pmap->pm_rid[i]); + PMAP_LOCK_DESTROY(pmap); } /* @@ -1339,6 +1342,7 @@ return; vm_page_lock_queues(); + PMAP_LOCK(pmap); oldpmap = pmap_install(pmap); /* @@ -1374,6 +1378,7 @@ out: pmap_install(oldpmap); + PMAP_UNLOCK(pmap); vm_page_unlock_queues(); } @@ -1414,6 +1419,7 @@ pmap_t pmap = pv->pv_pmap; vm_offset_t va = pv->pv_va; + PMAP_LOCK(pmap); oldpmap = pmap_install(pmap); pte = pmap_find_vhpt(va); KASSERT(pte != NULL, ("pte")); @@ -1422,6 +1428,7 @@ pmap_remove_pte(pmap, pte, va, pv, 1); pmap_invalidate_page(pmap, va); pmap_install(oldpmap); + PMAP_UNLOCK(pmap); } vm_page_flag_clear(m, PG_WRITEABLE); @@ -1458,6 +1465,7 @@ panic("pmap_protect: unaligned addresses"); vm_page_lock_queues(); + PMAP_LOCK(pmap); oldpmap = pmap_install(pmap); while (sva < eva) { /* @@ -1491,6 +1499,7 @@ sva += PAGE_SIZE; } pmap_install(oldpmap); + PMAP_UNLOCK(pmap); vm_page_unlock_queues(); } @@ -1704,6 +1713,7 @@ if (pmap == NULL) return; + PMAP_LOCK(pmap); oldpmap = pmap_install(pmap); pte = pmap_find_vhpt(va); @@ -1720,6 +1730,7 @@ pmap_pte_set_w(pte, wired); pmap_install(oldpmap); + PMAP_UNLOCK(pmap); } @@ -1854,6 +1865,7 @@ #endif vm_page_lock_queues(); + PMAP_LOCK(pmap); for (pv = TAILQ_FIRST(&pmap->pm_pvlist); pv; pv = npv) { @@ -1874,6 +1886,7 @@ } pmap_invalidate_all(pmap); + PMAP_UNLOCK(pmap); vm_page_unlock_queues(); } ==== //depot/projects/kse/sys/ia64/include/float.h#6 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/ia64/include/float.h,v 1.6 2004/04/25 02:36:29 das Exp $ */ +/* $FreeBSD: src/sys/ia64/include/float.h,v 1.7 2004/07/19 08:17:25 das Exp $ */ /* From: NetBSD: float.h,v 1.6 1997/07/17 21:36:03 thorpej Exp */ /* @@ -35,8 +35,12 @@ #include <sys/cdefs.h> +__BEGIN_DECLS +extern int __flt_rounds(void); +__END_DECLS + #define FLT_RADIX 2 /* b */ -#define FLT_ROUNDS 1 /* FP addition rounds to nearest */ +#define FLT_ROUNDS __flt_rounds() #if __ISO_C_VISIBLE >= 1999 #define FLT_EVAL_METHOD 0 /* no promotions */ #define DECIMAL_DIG 35 /* max precision in decimal digits */ ==== //depot/projects/kse/sys/ia64/include/pmap.h#11 (text+ko) ==== @@ -39,13 +39,15 @@ * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 * from: i386 pmap.h,v 1.54 1997/11/20 19:30:35 bde Exp - * $FreeBSD: src/sys/ia64/include/pmap.h,v 1.21 2004/07/16 03:42:45 alc Exp $ + * $FreeBSD: src/sys/ia64/include/pmap.h,v 1.22 2004/07/19 05:39:49 alc Exp $ */ #ifndef _MACHINE_PMAP_H_ #define _MACHINE_PMAP_H_ #include <sys/queue.h> +#include <sys/_lock.h> +#include <sys/_mutex.h> #include <machine/pte.h> #ifdef _KERNEL @@ -70,6 +72,7 @@ }; struct pmap { + struct mtx pm_mtx; TAILQ_HEAD(,pv_entry) pm_pvlist; /* list of mappings in pmap */ u_int32_t pm_rid[5]; /* base RID for pmap */ int pm_active; /* active flag */ @@ -81,6 +84,17 @@ #ifdef _KERNEL extern struct pmap kernel_pmap_store; #define kernel_pmap (&kernel_pmap_store) + +#define PMAP_LOCK(pmap) mtx_lock(&(pmap)->pm_mtx) +#define PMAP_LOCK_ASSERT(pmap, type) \ + mtx_assert(&(pmap)->pm_mtx, (type)) +#define PMAP_LOCK_DESTROY(pmap) mtx_destroy(&(pmap)->pm_mtx) +#define PMAP_LOCK_INIT(pmap) mtx_init(&(pmap)->pm_mtx, "pmap", \ + NULL, MTX_DEF) +#define PMAP_LOCKED(pmap) mtx_owned(&(pmap)->pm_mtx) +#define PMAP_MTX(pmap) (&(pmap)->pm_mtx) +#define PMAP_TRYLOCK(pmap) mtx_trylock(&(pmap)->pm_mtx) +#define PMAP_UNLOCK(pmap) mtx_unlock(&(pmap)->pm_mtx) #endif /* ==== //depot/projects/kse/sys/kern/kern_malloc.c#18 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_malloc.c,v 1.134 2004/07/10 21:36:01 marcel Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_malloc.c,v 1.135 2004/07/19 06:21:26 green Exp $"); #include "opt_vm.h" @@ -176,6 +176,47 @@ } /* + * Add this to the informational malloc_type bucket. + */ +static void +malloc_type_zone_allocated(struct malloc_type *ksp, unsigned long size, + int zindx) +{ + mtx_lock(&ksp->ks_mtx); + ksp->ks_calls++; + if (zindx != -1) + ksp->ks_size |= 1 << zindx; + if (size != 0) { + ksp->ks_memuse += size; + ksp->ks_inuse++; + if (ksp->ks_memuse > ksp->ks_maxused) + ksp->ks_maxused = ksp->ks_memuse; + } + mtx_unlock(&ksp->ks_mtx); +} + +void +malloc_type_allocated(struct malloc_type *ksp, unsigned long size) +{ + malloc_type_zone_allocated(ksp, size, -1); +} + +/* + * Remove this allocation from the informational malloc_type bucket. + */ +void +malloc_type_freed(struct malloc_type *ksp, unsigned long size) +{ + mtx_lock(&ksp->ks_mtx); + KASSERT(size <= ksp->ks_memuse, + ("malloc(9)/free(9) confusion.\n%s", + "Probably freeing with wrong type, but maybe not here.")); + ksp->ks_memuse -= size; + ksp->ks_inuse--; + mtx_unlock(&ksp->ks_mtx); +} + +/* * malloc: * * Allocate a block of memory. @@ -196,7 +237,6 @@ #ifdef DIAGNOSTIC unsigned long osize = size; #endif - register struct malloc_type *ksp = type; #ifdef INVARIANTS /* @@ -242,29 +282,16 @@ krequests[size >> KMEM_ZSHIFT]++; #endif va = uma_zalloc(zone, flags); - mtx_lock(&ksp->ks_mtx); - if (va == NULL) - goto out; - - ksp->ks_size |= 1 << indx; - size = keg->uk_size; + if (va != NULL) + size = keg->uk_size; + malloc_type_zone_allocated(type, va == NULL ? 0 : size, indx); } else { size = roundup(size, PAGE_SIZE); zone = NULL; keg = NULL; va = uma_large_malloc(size, flags); - mtx_lock(&ksp->ks_mtx); - if (va == NULL) - goto out; + malloc_type_allocated(type, va == NULL ? 0 : size); } - ksp->ks_memuse += size; - ksp->ks_inuse++; -out: - ksp->ks_calls++; - if (ksp->ks_memuse > ksp->ks_maxused) - ksp->ks_maxused = ksp->ks_memuse; - - mtx_unlock(&ksp->ks_mtx); if (flags & M_WAITOK) KASSERT(va != NULL, ("malloc(M_WAITOK) returned NULL")); else if (va == NULL) @@ -289,7 +316,6 @@ void *addr; struct malloc_type *type; { - register struct malloc_type *ksp = type; uma_slab_t slab; u_long size; @@ -297,7 +323,7 @@ if (addr == NULL) return; - KASSERT(ksp->ks_memuse > 0, + KASSERT(type->ks_memuse > 0, ("malloc(9)/free(9) confusion.\n%s", "Probably freeing with wrong type, but maybe not here.")); size = 0; @@ -334,13 +360,7 @@ size = slab->us_size; uma_large_free(slab); } - mtx_lock(&ksp->ks_mtx); - KASSERT(size <= ksp->ks_memuse, - ("malloc(9)/free(9) confusion.\n%s", - "Probably freeing with wrong type, but maybe not here.")); - ksp->ks_memuse -= size; - ksp->ks_inuse--; - mtx_unlock(&ksp->ks_mtx); + malloc_type_freed(type, size); } /* ==== //depot/projects/kse/sys/powerpc/include/float.h#5 (text+ko) ==== @@ -28,7 +28,7 @@ * * from: @(#)float.h 7.1 (Berkeley) 5/8/90 * from: FreeBSD: src/sys/i386/include/float.h,v 1.8 1999/08/28 00:44:11 - * $FreeBSD: src/sys/powerpc/include/float.h,v 1.5 2004/04/25 02:36:29 das Exp $ + * $FreeBSD: src/sys/powerpc/include/float.h,v 1.6 2004/07/19 08:17:25 das Exp $ */ #ifndef _MACHINE_FLOAT_H_ @@ -36,8 +36,12 @@ #include <sys/cdefs.h> +__BEGIN_DECLS +extern int __flt_rounds(void); +__END_DECLS + #define FLT_RADIX 2 /* b */ -#define FLT_ROUNDS 1 /* FP addition rounds to nearest */ +#define FLT_ROUNDS __flt_rounds() #if __ISO_C_VISIBLE >= 1999 #define FLT_EVAL_METHOD 1 /* operands promoted to double */ #define DECIMAL_DIG 35 /* max precision in decimal digits */ ==== //depot/projects/kse/sys/powerpc/include/ucontext.h#3 (text+ko) ==== @@ -29,7 +29,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $NetBSD: signal.h,v 1.4 1998/09/14 02:48:34 thorpej Exp $ - * $FreeBSD: src/sys/powerpc/include/ucontext.h,v 1.3 2004/03/02 06:13:08 grehan Exp $ + * $FreeBSD: src/sys/powerpc/include/ucontext.h,v 1.4 2004/07/19 07:21:46 grehan Exp $ */ #ifndef _MACHINE_UCONTEXT_H_ @@ -68,5 +68,6 @@ #define mc_vrsave mc_av[1] #define _MC_VERSION 0x1 +#define _MC_VERSION_KSE 0xee /* partial ucontext for libpthread */ #endif /* !_MACHINE_UCONTEXT_H_ */ ==== //depot/projects/kse/sys/sys/malloc.h#12 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)malloc.h 8.5 (Berkeley) 5/3/95 - * $FreeBSD: src/sys/sys/malloc.h,v 1.76 2004/04/07 04:19:49 imp Exp $ + * $FreeBSD: src/sys/sys/malloc.h,v 1.77 2004/07/19 06:21:26 green Exp $ */ #ifndef _SYS_MALLOC_H_ @@ -105,6 +105,8 @@ void *malloc(unsigned long size, struct malloc_type *type, int flags); void malloc_init(void *); int malloc_last_fail(void); +void malloc_type_allocated(struct malloc_type *type, unsigned long size); +void malloc_type_freed(struct malloc_type *type, unsigned long size); void malloc_uninit(void *); void *realloc(void *addr, unsigned long size, struct malloc_type *type, int flags); ==== //depot/projects/kse/sys/vm/vm_contig.c#13 (text+ko) ==== @@ -60,7 +60,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/vm/vm_contig.c,v 1.35 2004/06/15 01:02:00 green Exp $"); +__FBSDID("$FreeBSD: src/sys/vm/vm_contig.c,v 1.36 2004/07/19 06:21:27 green Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -68,6 +68,9 @@ #include <sys/malloc.h> #include <sys/mutex.h> #include <sys/proc.h> +#include <sys/kernel.h> +#include <sys/linker_set.h> +#include <sys/sysctl.h> #include <sys/vmmeter.h> #include <sys/vnode.h> @@ -83,49 +86,62 @@ #include <vm/vm_extern.h> static int -vm_contig_launder(int queue) +vm_contig_launder_page(vm_page_t m) { vm_object_t object; - vm_page_t m, m_tmp, next; + vm_page_t m_tmp; struct vnode *vp; + if (vm_page_sleep_if_busy(m, TRUE, "vpctw0")) { + vm_page_lock_queues(); + return (EBUSY); + } + if (!VM_OBJECT_TRYLOCK(m->object)) + return (EAGAIN); + vm_page_test_dirty(m); + if (m->dirty == 0 && m->hold_count == 0) + pmap_remove_all(m); + if (m->dirty) { + object = m->object; + if (object->type == OBJT_VNODE) { + vm_page_unlock_queues(); + vp = object->handle; + VM_OBJECT_UNLOCK(object); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread); + VM_OBJECT_LOCK(object); + vm_object_page_clean(object, 0, 0, OBJPC_SYNC); + VM_OBJECT_UNLOCK(object); + VOP_UNLOCK(vp, 0, curthread); + vm_page_lock_queues(); + return (0); + } else if (object->type == OBJT_SWAP || + object->type == OBJT_DEFAULT) { + m_tmp = m; + vm_pageout_flush(&m_tmp, 1, VM_PAGER_PUT_SYNC); + VM_OBJECT_UNLOCK(object); + return (0); + } + } else if (m->hold_count == 0) + vm_page_cache(m); + VM_OBJECT_UNLOCK(m->object); + return (0); +} + +static int +vm_contig_launder(int queue) +{ + vm_page_t m, next; + int error; + for (m = TAILQ_FIRST(&vm_page_queues[queue].pl); m != NULL; m = next) { next = TAILQ_NEXT(m, pageq); KASSERT(m->queue == queue, ("vm_contig_launder: page %p's queue is not %d", m, queue)); - if (!VM_OBJECT_TRYLOCK(m->object)) - continue; >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200407190843.i6J8h0UH034399>