From ece04c2557986041a9aaea9ac568c6b1f04bbde0 Mon Sep 17 00:00:00 2001 From: attilio Date: Tue, 10 Aug 2010 16:14:10 +0000 Subject: 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 --- sys/amd64/amd64/mp_machdep.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'sys/amd64/amd64/mp_machdep.c') diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index d39e252..6e8fb23 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -127,7 +127,7 @@ extern inthand_t IDTVEC(fast_syscall), IDTVEC(fast_syscall32); * 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_ANY, cpu_hlt_setup, NULL); 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 -- cgit v1.1