subr_smp.c (255726) | subr_smp.c (255744) |
---|---|
1/*- 2 * Copyright (c) 2001, John Baldwin <jhb@FreeBSD.org>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 19 unchanged lines hidden (view full) --- 28 */ 29 30/* 31 * This module holds the global variables and machine independent functions 32 * used for the kernel SMP support. 33 */ 34 35#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001, John Baldwin <jhb@FreeBSD.org>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 19 unchanged lines hidden (view full) --- 28 */ 29 30/* 31 * This module holds the global variables and machine independent functions 32 * used for the kernel SMP support. 33 */ 34 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sys/kern/subr_smp.c 255726 2013-09-20 05:06:03Z gibbs $"); | 36__FBSDID("$FreeBSD: head/sys/kern/subr_smp.c 255744 2013-09-20 22:59:22Z gibbs $"); |
37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/kernel.h> 41#include <sys/ktr.h> 42#include <sys/proc.h> 43#include <sys/bus.h> 44#include <sys/lock.h> --- 175 unchanged lines hidden (view full) --- 220 ("%s: invalid stop type", __func__)); 221 222 if (!smp_started) 223 return (0); 224 225 CTR2(KTR_SMP, "stop_cpus(%s) with %u type", 226 cpusetobj_strprint(cpusetbuf, &map), type); 227 | 37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/kernel.h> 41#include <sys/ktr.h> 42#include <sys/proc.h> 43#include <sys/bus.h> 44#include <sys/lock.h> --- 175 unchanged lines hidden (view full) --- 220 ("%s: invalid stop type", __func__)); 221 222 if (!smp_started) 223 return (0); 224 225 CTR2(KTR_SMP, "stop_cpus(%s) with %u type", 226 cpusetobj_strprint(cpusetbuf, &map), type); 227 |
228#ifdef XENHVM | |
229 /* | 228 /* |
230 * When migrating a PVHVM domain we need to make sure there are 231 * no IPIs in progress. IPIs that have been issued, but not 232 * yet delivered (not pending on a vCPU) will be lost in the 233 * IPI rebinding process, violating FreeBSD's assumption of 234 * reliable IPI delivery. | 229 * When suspending, ensure there are are no IPIs in progress. 230 * IPIs that have been issued, but not yet delivered (e.g. 231 * not pending on a vCPU when running under virtualization) 232 * will be lost, violating FreeBSD's assumption of reliable 233 * IPI delivery. |
235 */ 236 if (type == IPI_SUSPEND) 237 mtx_lock_spin(&smp_ipi_mtx); | 234 */ 235 if (type == IPI_SUSPEND) 236 mtx_lock_spin(&smp_ipi_mtx); |
238#endif | |
239 240 if (stopping_cpu != PCPU_GET(cpuid)) 241 while (atomic_cmpset_int(&stopping_cpu, NOCPU, 242 PCPU_GET(cpuid)) == 0) 243 while (stopping_cpu != NOCPU) 244 cpu_spinwait(); /* spin */ 245 246 /* send the stop IPI to all CPUs in map */ --- 12 unchanged lines hidden (view full) --- 259 cpu_spinwait(); 260 i++; 261 if (i == 100000000) { 262 printf("timeout stopping cpus\n"); 263 break; 264 } 265 } 266 | 237 238 if (stopping_cpu != PCPU_GET(cpuid)) 239 while (atomic_cmpset_int(&stopping_cpu, NOCPU, 240 PCPU_GET(cpuid)) == 0) 241 while (stopping_cpu != NOCPU) 242 cpu_spinwait(); /* spin */ 243 244 /* send the stop IPI to all CPUs in map */ --- 12 unchanged lines hidden (view full) --- 257 cpu_spinwait(); 258 i++; 259 if (i == 100000000) { 260 printf("timeout stopping cpus\n"); 261 break; 262 } 263 } 264 |
267#ifdef XENHVM | |
268 if (type == IPI_SUSPEND) 269 mtx_unlock_spin(&smp_ipi_mtx); | 265 if (type == IPI_SUSPEND) 266 mtx_unlock_spin(&smp_ipi_mtx); |
270#endif | |
271 272 stopping_cpu = NOCPU; 273 return (1); 274} 275 276int 277stop_cpus(cpuset_t map) 278{ --- 558 unchanged lines hidden --- | 267 268 stopping_cpu = NOCPU; 269 return (1); 270} 271 272int 273stop_cpus(cpuset_t map) 274{ --- 558 unchanged lines hidden --- |