subr_smp.c (189313) | subr_smp.c (189903) |
---|---|
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 189313 2009-03-03 17:34:09Z dchagin $"); | 36__FBSDID("$FreeBSD: head/sys/kern/subr_smp.c 189903 2009-03-17 00:48:11Z jkim $"); |
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> --- 212 unchanged lines hidden (view full) --- 257 break; 258 } 259#endif 260 } 261 262 return 1; 263} 264 | 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> --- 212 unchanged lines hidden (view full) --- 257 break; 258 } 259#endif 260 } 261 262 return 1; 263} 264 |
265#if defined(__amd64__) |
|
265/* | 266/* |
267 * When called the executing CPU will send an IPI to all other CPUs 268 * requesting that they halt execution. 269 * 270 * Usually (but not necessarily) called with 'other_cpus' as its arg. 271 * 272 * - Signals all CPUs in map to suspend. 273 * - Waits for each to suspend. 274 * 275 * Returns: 276 * -1: error 277 * 0: NA 278 * 1: ok 279 * 280 * XXX FIXME: this is not MP-safe, needs a lock to prevent multiple CPUs 281 * from executing at same time. 282 */ 283int 284suspend_cpus(cpumask_t map) 285{ 286 int i; 287 288 if (!smp_started) 289 return (0); 290 291 CTR1(KTR_SMP, "suspend_cpus(%x)", map); 292 293 /* send the suspend IPI to all CPUs in map */ 294 ipi_selected(map, IPI_SUSPEND); 295 296 i = 0; 297 while ((stopped_cpus & map) != map) { 298 /* spin */ 299 cpu_spinwait(); 300 i++; 301#ifdef DIAGNOSTIC 302 if (i == 100000) { 303 printf("timeout suspending cpus\n"); 304 break; 305 } 306#endif 307 } 308 309 return (1); 310} 311#endif 312 313/* |
|
266 * Called by a CPU to restart stopped CPUs. 267 * 268 * Usually (but not necessarily) called with 'stopped_cpus' as its arg. 269 * 270 * - Signals all CPUs in map to restart. 271 * - Waits for each to restart. 272 * 273 * Returns: --- 362 unchanged lines hidden --- | 314 * Called by a CPU to restart stopped CPUs. 315 * 316 * Usually (but not necessarily) called with 'stopped_cpus' as its arg. 317 * 318 * - Signals all CPUs in map to restart. 319 * - Waits for each to restart. 320 * 321 * Returns: --- 362 unchanged lines hidden --- |