From owner-p4-projects@FreeBSD.ORG Wed Aug 15 13:07:47 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A786F16A419; Wed, 15 Aug 2007 13:07:47 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FB2E16A417 for ; Wed, 15 Aug 2007 13:07:47 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 2A06713C458 for ; Wed, 15 Aug 2007 13:07:47 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l7FD7kiS056241 for ; Wed, 15 Aug 2007 13:07:47 GMT (envelope-from lulf@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l7FD7k4R056232 for perforce@freebsd.org; Wed, 15 Aug 2007 13:07:46 GMT (envelope-from lulf@FreeBSD.org) Date: Wed, 15 Aug 2007 13:07:46 GMT Message-Id: <200708151307.l7FD7k4R056232@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to lulf@FreeBSD.org using -f From: Ulf Lilleengen To: Perforce Change Reviews Cc: Subject: PERFORCE change 125171 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Aug 2007 13:07:48 -0000 http://perforce.freebsd.org/chv.cgi?CH=125171 Change 125171 by lulf@lulf_carrot on 2007/08/15 13:07:39 IFC Affected files ... .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/NOTES#13 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/files#14 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/kern.pre.mk#5 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/options#11 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/options.ia64#2 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/i386/i386/local_apic.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/i386/i386/machdep.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/i386/i386/mp_machdep.c#5 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/i386/include/cpufunc.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_descrip.c#7 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_lockf.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_poll.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_switch.c#5 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/sched_ule.c#8 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/sys_socket.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/uipc_domain.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/uipc_syscalls.c#6 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/sys/mutex.h#5 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/vm/device_pager.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/vm/phys_pager.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/vm/swap_pager.c#6 integrate .. //depot/projects/soc2007/lulf/gvinum_fixup/sys/vm/vm_pager.c#2 integrate Differences ... ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/NOTES#13 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/NOTES,v 1.1447 2007/07/24 15:35:01 scottl Exp $ +# $FreeBSD: src/sys/conf/NOTES,v 1.1448 2007/08/05 16:16:15 bz Exp $ # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # @@ -501,15 +501,15 @@ options IPSEC #IP security (requires device crypto) #options IPSEC_DEBUG #debug for IP security # -# Set IPSEC_FILTERGIF to force packets coming through a gif tunnel -# to be processed by any configured packet filtering (ipfw, ipf). -# The default is that packets coming from a tunnel are _not_ processed; +# Set IPSEC_FILTERTUNNEL to force packets coming through a tunnel +# to be processed by any configured packet filtering twice. +# The default is that packets coming out of a tunnel are _not_ processed; # they are assumed trusted. # # IPSEC history is preserved for such packets, and can be filtered # using ipfw(8)'s 'ipsec' keyword, when this option is enabled. # -#options IPSEC_FILTERGIF #filter ipsec packets from a tunnel +#options IPSEC_FILTERTUNNEL #filter ipsec packets from a tunnel options IPX #IPX/SPX communications protocols ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/files#14 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/files,v 1.1241 2007/07/24 15:35:01 scottl Exp $ +# $FreeBSD: src/sys/conf/files,v 1.1242 2007/08/09 01:11:21 marcel Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -259,7 +259,7 @@ contrib/ipfilter/netinet/ip_state.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_lookup.c optional ipfilter inet \ - compile-with "${NORMAL_C} -I$S/contrib/ipfilter" + compile-with "${NORMAL_C} -Wno-error -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_pool.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_htable.c optional ipfilter inet \ ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/kern.pre.mk#5 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/kern.pre.mk,v 1.90 2007/07/12 00:01:53 jfv Exp $ +# $FreeBSD: src/sys/conf/kern.pre.mk,v 1.92 2007/08/08 19:12:06 marcel Exp $ # Part of a unified Makefile for building kernels. This part contains all # of the definitions that need to be before %BEFORE_DEPEND. @@ -88,7 +88,8 @@ CFLAGS+= --param inline-unit-growth=100 CFLAGS+= --param large-function-growth=1000 .if ${MACHINE_ARCH} == "amd64" || ${MACHINE} == "i386" || \ - ${MACHINE_ARCH} == "sparc64" + ${MACHINE_ARCH} == "ia64" || ${MACHINE_ARCH} == "powerpc" || \ + ${MACHINE_ARCH} == "ia64" || ${MACHINE_ARCH} == "sparc64" WERROR?= -Werror .endif .endif ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/options#11 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/options,v 1.603 2007/07/24 15:35:01 scottl Exp $ +# $FreeBSD: src/sys/conf/options,v 1.605 2007/08/06 14:25:59 rwatson Exp $ # # On the handling of kernel options # @@ -362,7 +362,7 @@ INET6 opt_inet6.h IPSEC opt_ipsec.h IPSEC_DEBUG opt_ipsec.h -IPSEC_FILTERGIF opt_ipsec.h +IPSEC_FILTERTUNNEL opt_ipsec.h IPDIVERT DUMMYNET opt_ipdn.h IPFILTER opt_ipfilter.h @@ -383,7 +383,6 @@ MBUF_STRESS_TEST NCP NETATALK opt_atalk.h -NET_WITH_GIANT opt_net.h PPP_BSDCOMP opt_ppp.h PPP_DEFLATE opt_ppp.h PPP_FILTER opt_ppp.h ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/conf/options.ia64#2 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/options.ia64,v 1.27 2006/04/24 23:31:50 marcel Exp $ +# $FreeBSD: src/sys/conf/options.ia64,v 1.28 2007/07/30 22:42:33 marcel Exp $ # Options specific to the ia64 platform kernels ITANIUM opt_global.h @@ -11,6 +11,8 @@ COMPAT_IA32 opt_compat.h +EXCEPTION_TRACING opt_xtrace.h + VGA_ALT_SEQACCESS opt_vga.h VGA_DEBUG opt_vga.h VGA_NO_FONT_LOADING opt_vga.h ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/i386/i386/local_apic.c#4 (text+ko) ==== @@ -32,7 +32,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/i386/i386/local_apic.c,v 1.42 2007/05/08 22:01:03 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/i386/local_apic.c,v 1.43 2007/08/02 21:17:57 peter Exp $"); #include "opt_hwpmc_hooks.h" @@ -1064,10 +1064,6 @@ if (retval != 0) printf("%s: Failed to setup the local APIC: returned %d\n", best_enum->apic_name, retval); -#ifdef SMP - /* Last, setup the cpu topology now that we have probed CPUs */ - mp_topology(); -#endif } SYSINIT(apic_init, SI_SUB_CPU, SI_ORDER_FIRST, apic_init, NULL) ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/i386/i386/machdep.c#4 (text+ko) ==== @@ -38,7 +38,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/i386/i386/machdep.c,v 1.657 2007/06/06 07:35:07 davidxu Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/i386/machdep.c,v 1.658 2007/08/09 20:14:34 njl Exp $"); #include "opt_apic.h" #include "opt_atalk.h" @@ -1587,6 +1587,25 @@ ip++; } } + +/* Show privileged registers. */ +DB_SHOW_COMMAND(sysregs, db_show_sysregs) +{ + uint64_t idtr, gdtr; + + idtr = ridt(); + db_printf("idtr\t0x%08x/%04x\n", + (u_int)(idtr >> 16), (u_int)idtr & 0xffff); + gdtr = rgdt(); + db_printf("gdtr\t0x%08x/%04x\n", + (u_int)(gdtr >> 16), (u_int)gdtr & 0xffff); + db_printf("ldtr\t0x%04x\n", rldt()); + db_printf("tr\t0x%04x\n", rtr()); + db_printf("cr0\t0x%08x\n", rcr0()); + db_printf("cr2\t0x%08x\n", rcr2()); + db_printf("cr3\t0x%08x\n", rcr3()); + db_printf("cr4\t0x%08x\n", rcr4()); +} #endif void ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/i386/i386/mp_machdep.c#5 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/i386/i386/mp_machdep.c,v 1.280 2007/06/04 23:56:07 jeff Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/i386/mp_machdep.c,v 1.281 2007/08/02 21:17:57 peter Exp $"); #include "opt_apic.h" #include "opt_cpu.h" @@ -241,26 +241,14 @@ mp_topology(void) { struct cpu_group *group; - u_int regs[4]; - int logical_cpus; int apic_id; int groups; int cpu; /* Build the smp_topology map. */ /* Nothing to do if there is no HTT support. */ - if ((cpu_feature & CPUID_HTT) == 0) + if (hyperthreading_cpus <= 1) return; - logical_cpus = (cpu_procinfo & CPUID_HTT_CORES) >> 16; - if (logical_cpus <= 1) - return; - /* Nothing to do if reported cores are physical cores. */ - if (strcmp(cpu_vendor, "GenuineIntel") == 0 && cpu_high >= 4) { - cpuid_count(4, 0, regs); - if ((regs[0] & 0x1f) != 0 && - logical_cpus <= ((regs[0] >> 26) & 0x3f) + 1) - return; - } group = &mp_groups[0]; groups = 1; for (cpu = 0, apic_id = 0; apic_id <= MAX_APIC_ID; apic_id++) { @@ -270,7 +258,8 @@ * If the current group has members and we're not a logical * cpu, create a new group. */ - if (group->cg_count != 0 && (apic_id % logical_cpus) == 0) { + if (group->cg_count != 0 && + (apic_id % hyperthreading_cpus) == 0) { group++; groups++; } @@ -469,6 +458,9 @@ } set_interrupt_apic_ids(); + + /* Last, setup the cpu topology now that we have probed CPUs */ + mp_topology(); } ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/i386/include/cpufunc.h#2 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/i386/include/cpufunc.h,v 1.144 2005/05/13 00:05:56 nectar Exp $ + * $FreeBSD: src/sys/i386/include/cpufunc.h,v 1.145 2007/08/09 20:14:35 njl Exp $ */ /* @@ -326,28 +326,28 @@ return (ef); } -static __inline u_int64_t +static __inline uint64_t rdmsr(u_int msr) { - u_int64_t rv; + uint64_t rv; __asm __volatile("rdmsr" : "=A" (rv) : "c" (msr)); return (rv); } -static __inline u_int64_t +static __inline uint64_t rdpmc(u_int pmc) { - u_int64_t rv; + uint64_t rv; __asm __volatile("rdpmc" : "=A" (rv) : "c" (pmc)); return (rv); } -static __inline u_int64_t +static __inline uint64_t rdtsc(void) { - u_int64_t rv; + uint64_t rv; __asm __volatile("rdtsc" : "=A" (rv)); return (rv); @@ -366,7 +366,7 @@ } static __inline void -wrmsr(u_int msr, u_int64_t newval) +wrmsr(u_int msr, uint64_t newval) { __asm __volatile("wrmsr" : : "A" (newval), "c" (msr)); } @@ -456,6 +456,14 @@ return (sel); } +static __inline uint64_t +rgdt(void) +{ + uint64_t gdtr; + __asm __volatile("sgdt %0" : "=m" (gdtr)); + return (gdtr); +} + static __inline u_int rgs(void) { @@ -464,6 +472,22 @@ return (sel); } +static __inline uint64_t +ridt(void) +{ + uint64_t idtr; + __asm __volatile("sidt %0" : "=m" (idtr)); + return (idtr); +} + +static __inline u_short +rldt(void) +{ + u_short ldtr; + __asm __volatile("sldt %0" : "=g" (ldtr)); + return (ldtr); +} + static __inline u_int rss(void) { @@ -472,6 +496,14 @@ return (sel); } +static __inline u_short +rtr(void) +{ + u_short tr; + __asm __volatile("str %0" : "=g" (tr)); + return (tr); +} + static __inline void load_fs(u_int sel) { @@ -677,8 +709,8 @@ u_int rcr2(void); u_int rcr3(void); u_int rcr4(void); -u_int64_t rdmsr(u_int msr); -u_int64_t rdpmc(u_int pmc); +uint64_t rdmsr(u_int msr); +uint64_t rdpmc(u_int pmc); u_int rdr0(void); u_int rdr1(void); u_int rdr2(void); @@ -687,13 +719,17 @@ u_int rdr5(void); u_int rdr6(void); u_int rdr7(void); -u_int64_t rdtsc(void); +uint64_t rdtsc(void); u_int read_eflags(void); u_int rfs(void); +uint64_t rgdt(void); u_int rgs(void); +uint64_t ridt(void); +u_short rldt(void); +u_short rtr(void); void wbinvd(void); void write_eflags(u_int ef); -void wrmsr(u_int msr, u_int64_t newval); +void wrmsr(u_int msr, uint64_t newval); #endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE */ ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_descrip.c#7 (text+ko) ==== @@ -35,7 +35,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/kern_descrip.c,v 1.312 2007/07/03 21:26:06 jeff Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_descrip.c,v 1.313 2007/08/06 14:26:00 rwatson Exp $"); #include "opt_compat.h" #include "opt_ddb.h" @@ -2098,8 +2098,6 @@ struct file *fp; int error; - NET_ASSERT_GIANT(); - *spp = NULL; if (fflagp != NULL) *fflagp = 0; @@ -2129,7 +2127,6 @@ fputsock(struct socket *so) { - NET_ASSERT_GIANT(); ACCEPT_LOCK(); SOCK_LOCK(so); sorele(so); ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_lockf.c#4 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/kern_lockf.c,v 1.56 2007/07/03 21:22:58 jeff Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_lockf.c,v 1.57 2007/08/07 09:04:50 kib Exp $"); #include "opt_debug_lockf.h" @@ -106,7 +106,7 @@ struct lockf *lock; struct vnode *vp = ap->a_vp; off_t start, end, oadd; - struct lockf *split; + struct lockf *clean, *n; int error; /* @@ -162,9 +162,11 @@ /* * Allocate a spare structure in case we have to split. */ - split = NULL; - if (ap->a_op == F_SETLK || ap->a_op == F_UNLCK) - MALLOC(split, struct lockf *, sizeof *lock, M_LOCKF, M_WAITOK); + clean = NULL; + if (ap->a_op == F_SETLK || ap->a_op == F_UNLCK) { + MALLOC(clean, struct lockf *, sizeof *lock, M_LOCKF, M_WAITOK); + clean->lf_next = NULL; + } /* * Create the lockf structure */ @@ -190,27 +192,33 @@ VI_LOCK(vp); switch(ap->a_op) { case F_SETLK: - error = lf_setlock(lock, vp, &split); + error = lf_setlock(lock, vp, &clean); break; case F_UNLCK: - error = lf_clearlock(lock, &split); - FREE(lock, M_LOCKF); + error = lf_clearlock(lock, &clean); + lock->lf_next = clean; + clean = lock; break; case F_GETLK: error = lf_getlock(lock, fl); - FREE(lock, M_LOCKF); + lock->lf_next = clean; + clean = lock; break; default: - free(lock, M_LOCKF); + lock->lf_next = clean; + clean = lock; error = EINVAL; break; } VI_UNLOCK(vp); - if (split) - FREE(split, M_LOCKF); + for (lock = clean; lock != NULL; ) { + n = lock->lf_next; + free(lock, M_LOCKF); + lock = n; + } return (error); } @@ -218,10 +226,10 @@ * Set a byte-range lock. */ static int -lf_setlock(lock, vp, split) +lf_setlock(lock, vp, clean) struct lockf *lock; struct vnode *vp; - struct lockf **split; + struct lockf **clean; { struct lockf *block; struct lockf **head = lock->lf_head; @@ -249,7 +257,8 @@ * Free the structure and return if nonblocking. */ if ((lock->lf_flags & F_WAIT) == 0) { - FREE(lock, M_LOCKF); + lock->lf_next = *clean; + *clean = lock; return (EAGAIN); } /* @@ -289,7 +298,8 @@ if (nproc == (struct proc *)lock->lf_id) { PROC_SUNLOCK(wproc); thread_unlock(td); - free(lock, M_LOCKF); + lock->lf_next = *clean; + *clean = lock; return (EDEADLK); } } @@ -308,7 +318,7 @@ if ((lock->lf_flags & F_FLOCK) && lock->lf_type == F_WRLCK) { lock->lf_type = F_UNLCK; - (void) lf_clearlock(lock, split); + (void) lf_clearlock(lock, clean); lock->lf_type = F_WRLCK; } /* @@ -337,7 +347,8 @@ lock->lf_next = NOLOCKF; } if (error) { - free(lock, M_LOCKF); + lock->lf_next = *clean; + *clean = lock; return (error); } } @@ -382,7 +393,8 @@ overlap->lf_type == F_WRLCK) lf_wakelock(overlap); overlap->lf_type = lock->lf_type; - FREE(lock, M_LOCKF); + lock->lf_next = *clean; + *clean = lock; lock = overlap; /* for debug output below */ break; @@ -391,7 +403,8 @@ * Check for common starting point and different types. */ if (overlap->lf_type == lock->lf_type) { - free(lock, M_LOCKF); + lock->lf_next = *clean; + *clean = lock; lock = overlap; /* for debug output below */ break; } @@ -400,7 +413,7 @@ lock->lf_next = overlap; overlap->lf_start = lock->lf_end + 1; } else - lf_split(overlap, lock, split); + lf_split(overlap, lock, clean); lf_wakelock(overlap); break; @@ -432,7 +445,8 @@ needtolink = 0; } else *prev = overlap->lf_next; - free(overlap, M_LOCKF); + overlap->lf_next = *clean; + *clean = overlap; continue; case 4: /* overlap starts before lock */ @@ -477,9 +491,9 @@ * and remove it (or shrink it), then wakeup anyone we can. */ static int -lf_clearlock(unlock, split) +lf_clearlock(unlock, clean) struct lockf *unlock; - struct lockf **split; + struct lockf **clean; { struct lockf **head = unlock->lf_head; register struct lockf *lf = *head; @@ -505,7 +519,8 @@ case 1: /* overlap == lock */ *prev = overlap->lf_next; - FREE(overlap, M_LOCKF); + overlap->lf_next = *clean; + *clean = overlap; break; case 2: /* overlap contains lock: split it */ @@ -513,14 +528,15 @@ overlap->lf_start = unlock->lf_end + 1; break; } - lf_split(overlap, unlock, split); + lf_split(overlap, unlock, clean); overlap->lf_next = unlock->lf_next; break; case 3: /* lock contains overlap */ *prev = overlap->lf_next; lf = overlap->lf_next; - free(overlap, M_LOCKF); + overlap->lf_next = *clean; + *clean = overlap; continue; case 4: /* overlap starts before lock */ @@ -754,7 +770,8 @@ * splitlock so we don't have to block. */ splitlock = *split; - *split = NULL; + KASSERT(splitlock != NULL, ("no split")); + *split = splitlock->lf_next; bcopy(lock1, splitlock, sizeof *splitlock); splitlock->lf_start = lock2->lf_end + 1; TAILQ_INIT(&splitlock->lf_blkhd); ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_poll.c#3 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/kern_poll.c,v 1.30 2007/06/05 00:00:54 jeff Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_poll.c,v 1.31 2007/08/06 14:26:00 rwatson Exp $"); #include "opt_device_polling.h" @@ -329,7 +329,6 @@ { int i; - NET_LOCK_GIANT(); mtx_lock(&poll_mtx); if (count > poll_each_burst) @@ -339,7 +338,6 @@ pr[i].handler(pr[i].ifp, POLL_ONLY, count); mtx_unlock(&poll_mtx); - NET_UNLOCK_GIANT(); } /* @@ -366,8 +364,6 @@ struct timeval t; int kern_load; - NET_ASSERT_GIANT(); - mtx_lock(&poll_mtx); phase = 5; if (residual_burst > 0) { @@ -417,8 +413,6 @@ int i, cycles; enum poll_cmd arg = POLL_ONLY; - NET_ASSERT_GIANT(); - mtx_lock(&poll_mtx); phase = 3; if (residual_burst == 0) { /* first call in this tick */ @@ -456,8 +450,6 @@ KASSERT(h != NULL, ("%s: handler is NULL", __func__)); KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); - NET_ASSERT_GIANT(); - mtx_lock(&poll_mtx); if (poll_handlers >= POLL_LIST_LEN) { /* @@ -504,7 +496,6 @@ KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); - NET_ASSERT_GIANT(); mtx_lock(&poll_mtx); for (i = 0 ; i < poll_handlers ; i++) @@ -547,7 +538,6 @@ polling = val; - NET_LOCK_GIANT(); IFNET_RLOCK(); TAILQ_FOREACH(ifp, &ifnet, if_link) { if (ifp->if_capabilities & IFCAP_POLLING) { @@ -565,7 +555,6 @@ } } IFNET_RUNLOCK(); - NET_UNLOCK_GIANT(); log(LOG_ERR, "kern.polling.enable is deprecated. Use ifconfig(8)"); ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/kern_switch.c#5 (text+ko) ==== @@ -26,7 +26,7 @@ #include -__FBSDID("$FreeBSD: src/sys/kern/kern_switch.c,v 1.132 2007/07/19 08:58:40 jeff Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_switch.c,v 1.133 2007/08/03 23:35:35 jeff Exp $"); #include "opt_sched.h" @@ -192,7 +192,7 @@ thread_lock(td); td->td_critnest--; SCHED_STAT_INC(switch_owepreempt); - mi_switch(SW_INVOL, NULL); + mi_switch(SW_INVOL|SW_PREEMPT, NULL); thread_unlock(td); } } else ==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/kern/sched_ule.c#8 (text+ko) ==== @@ -36,7 +36,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.202 2007/07/19 20:03:15 jeff Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.204 2007/08/04 01:21:28 jeff Exp $"); #include "opt_hwpmc_hooks.h" #include "opt_sched.h" @@ -183,7 +183,7 @@ * locking in sched_pickcpu(); */ struct tdq { - struct mtx tdq_lock; /* Protects all fields below. */ + struct mtx *tdq_lock; /* Pointer to group lock. */ struct runq tdq_realtime; /* real-time run queue. */ struct runq tdq_timeshare; /* timeshare run queue. */ struct runq tdq_idle; /* Queue of IDLE threads. */ @@ -198,7 +198,6 @@ #else int tdq_sysload; /* For loadavg, !ITHD load. */ #endif - char tdq_name[16]; /* lock name. */ } __aligned(64); @@ -212,13 +211,15 @@ * load balancer. */ struct tdq_group { - int tdg_cpus; /* Count of CPUs in this tdq group. */ - cpumask_t tdg_cpumask; /* Mask of cpus in this group. */ - cpumask_t tdg_idlemask; /* Idle cpus in this group. */ - cpumask_t tdg_mask; /* Bit mask for first cpu. */ - int tdg_load; /* Total load of this group. */ + struct mtx tdg_lock; /* Protects all fields below. */ + int tdg_cpus; /* Count of CPUs in this tdq group. */ + cpumask_t tdg_cpumask; /* Mask of cpus in this group. */ + cpumask_t tdg_idlemask; /* Idle cpus in this group. */ + cpumask_t tdg_mask; /* Bit mask for first cpu. */ + int tdg_load; /* Total load of this group. */ int tdg_transferable; /* Transferable load of this group. */ LIST_HEAD(, tdq) tdg_members; /* Linked list of all members. */ + char tdg_name[16]; /* lock name. */ } __aligned(64); #define SCHED_AFFINITY_DEFAULT (max(1, hz / 300)) @@ -249,10 +250,12 @@ #define TDQ_SELF() (&tdq_cpu[PCPU_GET(cpuid)]) #define TDQ_CPU(x) (&tdq_cpu[(x)]) -#define TDQ_ID(x) ((x) - tdq_cpu) +#define TDQ_ID(x) ((int)((x) - tdq_cpu)) #define TDQ_GROUP(x) (&tdq_groups[(x)]) +#define TDG_ID(x) ((int)((x) - tdq_groups)) #else /* !SMP */ static struct tdq tdq_cpu; +static struct mtx tdq_lock; #define TDQ_ID(x) (0) #define TDQ_SELF() (&tdq_cpu) @@ -263,7 +266,7 @@ #define TDQ_LOCK(t) mtx_lock_spin(TDQ_LOCKPTR((t))) #define TDQ_LOCK_FLAGS(t, f) mtx_lock_spin_flags(TDQ_LOCKPTR((t)), (f)) #define TDQ_UNLOCK(t) mtx_unlock_spin(TDQ_LOCKPTR((t))) -#define TDQ_LOCKPTR(t) (&(t)->tdq_lock) +#define TDQ_LOCKPTR(t) ((t)->tdq_lock) static void sched_priority(struct thread *); static void sched_thread_priority(struct thread *, u_char); @@ -296,6 +299,7 @@ static inline struct tdq *sched_setcpu(struct td_sched *, int, int); static inline struct mtx *thread_block_switch(struct thread *); static inline void thread_unblock_switch(struct thread *, struct mtx *); +static struct mtx *sched_switch_migrate(struct tdq *, struct thread *, int); #define THREAD_CAN_MIGRATE(td) ((td)->td_pinned == 0) #endif @@ -343,9 +347,8 @@ tdq = TDQ_CPU(cpu); - printf("tdq:\n"); + printf("tdq %d:\n", TDQ_ID(tdq)); printf("\tlockptr %p\n", TDQ_LOCKPTR(tdq)); - printf("\tlock name %s\n", tdq->tdq_name); printf("\tload: %d\n", tdq->tdq_load); printf("\ttimeshare idx: %d\n", tdq->tdq_idx); printf("\ttimeshare ridx: %d\n", tdq->tdq_ridx); @@ -357,7 +360,9 @@ runq_print(&tdq->tdq_idle); #ifdef SMP printf("\tload transferable: %d\n", tdq->tdq_transferable); - printf("\tlowest priority: %d\n", tdq->tdq_lowpri); + printf("\tlowest priority: %d\n", tdq->tdq_lowpri); + printf("\tgroup: %d\n", TDG_ID(tdq->tdq_group)); + printf("\tLock name: %s\n", tdq->tdq_group->tdg_name); #endif } @@ -389,7 +394,7 @@ * This queue contains only priorities between MIN and MAX * realtime. Use the whole queue to represent these values. */ - if ((flags & SRQ_BORROWING) == 0) { + if ((flags & (SRQ_BORROWING|SRQ_PREEMPTED)) == 0) { pri = (pri - PRI_MIN_TIMESHARE) / TS_RQ_PPQ; pri = (pri + tdq->tdq_idx) % RQ_NQS; /* @@ -454,7 +459,7 @@ THREAD_LOCK_ASSERT(ts->ts_thread, MA_OWNED); class = PRI_BASE(ts->ts_thread->td_pri_class); tdq->tdq_load++; - CTR2(KTR_SCHED, "cpu %jd load: %d", TDQ_ID(tdq), tdq->tdq_load); + CTR2(KTR_SCHED, "cpu %d load: %d", TDQ_ID(tdq), tdq->tdq_load); if (class != PRI_ITHD && (ts->ts_thread->td_proc->p_flag & P_NOLOAD) == 0) #ifdef SMP @@ -484,7 +489,7 @@ tdq->tdq_sysload--; #endif KASSERT(tdq->tdq_load != 0, - ("tdq_load_rem: Removing with 0 load on queue %d", (int)TDQ_ID(tdq))); + ("tdq_load_rem: Removing with 0 load on queue %d", TDQ_ID(tdq))); tdq->tdq_load--; CTR1(KTR_SCHED, "load: %d", tdq->tdq_load); ts->ts_runq = NULL; @@ -916,6 +921,8 @@ tdq = TDQ_CPU(cpu); td = ts->ts_thread; ts->ts_cpu = cpu; + + /* If the lock matches just return the queue. */ if (td->td_lock == TDQ_LOCKPTR(tdq)) return (tdq); #ifdef notyet @@ -936,9 +943,7 @@ */ thread_lock_block(td); TDQ_LOCK(tdq); - /* Return to sched_switch() with the lock still blocked */ - if ((flags & SRQ_OURSELF) == 0) - thread_lock_unblock(td, TDQ_LOCKPTR(tdq)); + thread_lock_unblock(td, TDQ_LOCKPTR(tdq)); return (tdq); } @@ -1129,107 +1134,159 @@ tdq_setup(struct tdq *tdq) { - snprintf(tdq->tdq_name, sizeof(tdq->tdq_name), - "sched lock %d", (int)TDQ_ID(tdq)); - mtx_init(&tdq->tdq_lock, tdq->tdq_name, "sched lock", - MTX_SPIN | MTX_RECURSE); + if (bootverbose) + printf("ULE: setup cpu %d\n", TDQ_ID(tdq)); runq_init(&tdq->tdq_realtime); runq_init(&tdq->tdq_timeshare); runq_init(&tdq->tdq_idle); tdq->tdq_load = 0; } -/* - * Setup the thread queues and initialize the topology based on MD - * information. - */ +#ifdef SMP +static void +tdg_setup(struct tdq_group *tdg) +{ + if (bootverbose) + printf("ULE: setup cpu group %d\n", TDG_ID(tdg)); + snprintf(tdg->tdg_name, sizeof(tdg->tdg_name), + "sched lock %d", (int)TDG_ID(tdg)); + mtx_init(&tdg->tdg_lock, tdg->tdg_name, "sched lock", + MTX_SPIN | MTX_RECURSE); + LIST_INIT(&tdg->tdg_members); + tdg->tdg_load = 0; + tdg->tdg_transferable = 0; + tdg->tdg_cpus = 0; + tdg->tdg_mask = 0; + tdg->tdg_cpumask = 0; + tdg->tdg_idlemask = 0; +} + +static void +tdg_add(struct tdq_group *tdg, struct tdq *tdq) +{ + if (tdg->tdg_mask == 0) + tdg->tdg_mask |= 1 << TDQ_ID(tdq); + tdg->tdg_cpumask |= 1 << TDQ_ID(tdq); + tdg->tdg_cpus++; + tdq->tdq_group = tdg; + tdq->tdq_lock = &tdg->tdg_lock; + LIST_INSERT_HEAD(&tdg->tdg_members, tdq, tdq_siblings); + if (bootverbose) + printf("ULE: adding cpu %d to group %d: cpus %d mask 0x%X\n", + TDQ_ID(tdq), TDG_ID(tdg), tdg->tdg_cpus, tdg->tdg_cpumask); +} + static void -sched_setup(void *dummy) +sched_setup_topology(void) { + struct tdq_group *tdg; + struct cpu_group *cg; + int balance_groups; struct tdq *tdq; -#ifdef SMP - int balance_groups; int i; + int j; + topology = 1; balance_groups = 0; - /* - * Initialize the tdqs. - */ - for (i = 0; i < MAXCPU; i++) { + for (i = 0; i < smp_topology->ct_count; i++) { + cg = &smp_topology->ct_group[i]; + tdg = &tdq_groups[i]; + /* + * Initialize the group. + */ + tdg_setup(tdg); + /* + * Find all of the group members and add them. + */ + for (j = 0; j < MAXCPU; j++) { + if ((cg->cg_mask & (1 << j)) != 0) { + tdq = TDQ_CPU(j); + tdq_setup(tdq); + tdg_add(tdg, tdq); + } + } + if (tdg->tdg_cpus > 1) + balance_groups = 1; + } + tdg_maxid = smp_topology->ct_count - 1; + if (balance_groups) + sched_balance_groups(NULL); +} + +static void +sched_setup_smp(void) +{ + struct tdq_group *tdg; >>> TRUNCATED FOR MAIL (1000 lines) <<<