From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 16:14:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA911106575E; Tue, 10 Aug 2010 16:14:11 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C96D48FC15; Tue, 10 Aug 2010 16:14:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7AGEBUh069343; Tue, 10 Aug 2010 16:14:11 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7AGEBSJ069341; Tue, 10 Aug 2010 16:14:11 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008101614.o7AGEBSJ069341@svn.freebsd.org> From: Attilio Rao Date: Tue, 10 Aug 2010 16:14:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211149 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Aug 2010 16:14:11 -0000 Author: attilio Date: Tue Aug 10 16:14:10 2010 New Revision: 211149 URL: http://svn.freebsd.org/changeset/base/211149 Log: Fix some places that may use cpumask_t while they still use 'int' types. While there, also fix some places assuming cpu type is 'int' while u_int is really meant. Note: this will also fix some possible races in per-cpu data accessings to be addressed in further commits. In collabouration with: Yahoo! Incorporated (via sbruno and peter) Tested by: gianni MFC after: 1 month Modified: head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/pmap.c head/sys/i386/i386/mp_machdep.c head/sys/i386/i386/pmap.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Tue Aug 10 15:22:48 2010 (r211148) +++ head/sys/amd64/amd64/mp_machdep.c Tue Aug 10 16:14:10 2010 (r211149) @@ -127,7 +127,7 @@ extern inthand_t IDTVEC(fast_syscall), I * Local data and functions. */ -static u_int logical_cpus; +static cpumask_t logical_cpus; static volatile cpumask_t ipi_nmi_pending; /* used to hold the AP's until we are ready to release them */ @@ -162,8 +162,8 @@ static int start_all_aps(void); static int start_ap(int apic_id); static void release_aps(void *dummy); -static int hlt_logical_cpus; -static u_int hyperthreading_cpus; +static cpumask_t hlt_logical_cpus; +static cpumask_t hyperthreading_cpus; static cpumask_t hyperthreading_cpus_mask; static int hyperthreading_allowed = 1; static struct sysctl_ctx_list logical_cpu_clist; @@ -1321,8 +1321,11 @@ ipi_nmi_handler() void cpustop_handler(void) { - int cpu = PCPU_GET(cpuid); - int cpumask = PCPU_GET(cpumask); + cpumask_t cpumask; + u_int cpu; + + cpu = PCPU_GET(cpuid); + cpumask = PCPU_GET(cpumask); savectx(&stoppcbs[cpu]); @@ -1349,9 +1352,12 @@ cpustop_handler(void) void cpususpend_handler(void) { + cpumask_t cpumask; register_t cr3, rf; - int cpu = PCPU_GET(cpuid); - int cpumask = PCPU_GET(cpumask); + u_int cpu; + + cpu = PCPU_GET(cpuid); + cpumask = PCPU_GET(cpumask); rf = intr_disable(); cr3 = rcr3(); @@ -1523,13 +1529,15 @@ SYSINIT(cpu_hlt, SI_SUB_SMP, SI_ORDER_AN int mp_grab_cpu_hlt(void) { - u_int mask = PCPU_GET(cpumask); + cpuset_t mask; #ifdef MP_WATCHDOG - u_int cpuid = PCPU_GET(cpuid); + u_int cpuid; #endif int retval; + mask = PCPU_GET(cpumask); #ifdef MP_WATCHDOG + cpuid = PCPU_GET(cpuid); ap_watchdog(cpuid); #endif Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Aug 10 15:22:48 2010 (r211148) +++ head/sys/amd64/amd64/pmap.c Tue Aug 10 16:14:10 2010 (r211149) @@ -926,8 +926,7 @@ pmap_update_pde_invalidate(vm_offset_t v void pmap_invalidate_page(pmap_t pmap, vm_offset_t va) { - u_int cpumask; - u_int other_cpus; + cpumask_t cpumask, other_cpus; sched_pin(); if (pmap == kernel_pmap || pmap->pm_active == all_cpus) { @@ -947,8 +946,7 @@ pmap_invalidate_page(pmap_t pmap, vm_off void pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { - u_int cpumask; - u_int other_cpus; + cpumask_t cpumask, other_cpus; vm_offset_t addr; sched_pin(); @@ -972,8 +970,7 @@ pmap_invalidate_range(pmap_t pmap, vm_of void pmap_invalidate_all(pmap_t pmap) { - u_int cpumask; - u_int other_cpus; + cpumask_t cpumask, other_cpus; sched_pin(); if (pmap == kernel_pmap || pmap->pm_active == all_cpus) { Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Tue Aug 10 15:22:48 2010 (r211148) +++ head/sys/i386/i386/mp_machdep.c Tue Aug 10 16:14:10 2010 (r211149) @@ -174,7 +174,7 @@ static u_long *ipi_statclock_counts[MAXC * Local data and functions. */ -static u_int logical_cpus; +static cpumask_t logical_cpus; static volatile cpumask_t ipi_nmi_pending; /* used to hold the AP's until we are ready to release them */ @@ -210,8 +210,8 @@ static int start_all_aps(void); static int start_ap(int apic_id); static void release_aps(void *dummy); -static int hlt_logical_cpus; -static u_int hyperthreading_cpus; +static cpumask_t hlt_logical_cpus; +static cpumask_t hyperthreading_cpus; static cpumask_t hyperthreading_cpus_mask; static int hyperthreading_allowed = 1; static struct sysctl_ctx_list logical_cpu_clist; @@ -1408,8 +1408,11 @@ ipi_nmi_handler() void cpustop_handler(void) { - int cpu = PCPU_GET(cpuid); - int cpumask = PCPU_GET(cpumask); + cpumask_t cpumask; + u_int cpu; + + cpu = PCPU_GET(cpuid); + cpumask = PCPU_GET(cpumask); savectx(&stoppcbs[cpu]); @@ -1577,13 +1580,15 @@ SYSINIT(cpu_hlt, SI_SUB_SMP, SI_ORDER_AN int mp_grab_cpu_hlt(void) { - u_int mask = PCPU_GET(cpumask); + cpuset_t mask; #ifdef MP_WATCHDOG - u_int cpuid = PCPU_GET(cpuid); + u_int cpuid; #endif int retval; + mask = PCPU_GET(cpumask); #ifdef MP_WATCHDOG + cpuid = PCPU_GET(cpuid); ap_watchdog(cpuid); #endif Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Tue Aug 10 15:22:48 2010 (r211148) +++ head/sys/i386/i386/pmap.c Tue Aug 10 16:14:10 2010 (r211149) @@ -949,8 +949,7 @@ pmap_update_pde_invalidate(vm_offset_t v void pmap_invalidate_page(pmap_t pmap, vm_offset_t va) { - u_int cpumask; - u_int other_cpus; + cpumask_t cpumask, other_cpus; sched_pin(); if (pmap == kernel_pmap || pmap->pm_active == all_cpus) { @@ -970,8 +969,7 @@ pmap_invalidate_page(pmap_t pmap, vm_off void pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { - u_int cpumask; - u_int other_cpus; + cpumask_t cpumask, other_cpus; vm_offset_t addr; sched_pin(); @@ -995,8 +993,7 @@ pmap_invalidate_range(pmap_t pmap, vm_of void pmap_invalidate_all(pmap_t pmap) { - u_int cpumask; - u_int other_cpus; + cpumask_t cpumask, other_cpus; sched_pin(); if (pmap == kernel_pmap || pmap->pm_active == all_cpus) {