subr_pcpu.c (261725) | subr_pcpu.c (302372) |
---|---|
1/*- 2 * Copyright (c) 2001 Wind River Systems, Inc. 3 * All rights reserved. 4 * Written by: John Baldwin <jhb@FreeBSD.org> 5 * 6 * Copyright (c) 2009 Jeffrey Roberson <jeff@freebsd.org> 7 * All rights reserved. 8 * --- 32 unchanged lines hidden (view full) --- 41 * gaps in the mappings. 42 * - The platform sets the value of MAXCPU in <machine/param.h>. 43 * - It is suggested, but not required, that in the non-SMP case, the 44 * platform define MAXCPU to be 1 and define the logical ID of the 45 * sole CPU as 0. 46 */ 47 48#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001 Wind River Systems, Inc. 3 * All rights reserved. 4 * Written by: John Baldwin <jhb@FreeBSD.org> 5 * 6 * Copyright (c) 2009 Jeffrey Roberson <jeff@freebsd.org> 7 * All rights reserved. 8 * --- 32 unchanged lines hidden (view full) --- 41 * gaps in the mappings. 42 * - The platform sets the value of MAXCPU in <machine/param.h>. 43 * - It is suggested, but not required, that in the non-SMP case, the 44 * platform define MAXCPU to be 1 and define the logical ID of the 45 * sole CPU as 0. 46 */ 47 48#include <sys/cdefs.h> |
49__FBSDID("$FreeBSD: head/sys/kern/subr_pcpu.c 261725 2014-02-10 19:59:46Z glebius $"); | 49__FBSDID("$FreeBSD: head/sys/kern/subr_pcpu.c 302372 2016-07-06 14:09:49Z nwhitehorn $"); |
50 51#include "opt_ddb.h" 52 53#include <sys/param.h> 54#include <sys/systm.h> 55#include <sys/sysctl.h> 56#include <sys/lock.h> 57#include <sys/malloc.h> --- 185 unchanged lines hidden (view full) --- 243 */ 244void 245dpcpu_copy(void *s, int size) 246{ 247#ifdef SMP 248 uintptr_t dpcpu; 249 int i; 250 | 50 51#include "opt_ddb.h" 52 53#include <sys/param.h> 54#include <sys/systm.h> 55#include <sys/sysctl.h> 56#include <sys/lock.h> 57#include <sys/malloc.h> --- 185 unchanged lines hidden (view full) --- 243 */ 244void 245dpcpu_copy(void *s, int size) 246{ 247#ifdef SMP 248 uintptr_t dpcpu; 249 int i; 250 |
251 for (i = 0; i < mp_ncpus; ++i) { | 251 CPU_FOREACH(i) { |
252 dpcpu = dpcpu_off[i]; 253 if (dpcpu == 0) 254 continue; 255 memcpy((void *)(dpcpu + (uintptr_t)s), s, size); 256 } 257#else 258 memcpy((void *)(dpcpu_off[0] + (uintptr_t)s), s, size); 259#endif --- 24 unchanged lines hidden (view full) --- 284int 285sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS) 286{ 287 uintptr_t dpcpu; 288 int64_t count; 289 int i; 290 291 count = 0; | 252 dpcpu = dpcpu_off[i]; 253 if (dpcpu == 0) 254 continue; 255 memcpy((void *)(dpcpu + (uintptr_t)s), s, size); 256 } 257#else 258 memcpy((void *)(dpcpu_off[0] + (uintptr_t)s), s, size); 259#endif --- 24 unchanged lines hidden (view full) --- 284int 285sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS) 286{ 287 uintptr_t dpcpu; 288 int64_t count; 289 int i; 290 291 count = 0; |
292 for (i = 0; i < mp_ncpus; ++i) { | 292 CPU_FOREACH(i) { |
293 dpcpu = dpcpu_off[i]; 294 if (dpcpu == 0) 295 continue; 296 count += *(int64_t *)(dpcpu + (uintptr_t)arg1); 297 } 298 return (SYSCTL_OUT(req, &count, sizeof(count))); 299} 300 301int 302sysctl_dpcpu_long(SYSCTL_HANDLER_ARGS) 303{ 304 uintptr_t dpcpu; 305 long count; 306 int i; 307 308 count = 0; | 293 dpcpu = dpcpu_off[i]; 294 if (dpcpu == 0) 295 continue; 296 count += *(int64_t *)(dpcpu + (uintptr_t)arg1); 297 } 298 return (SYSCTL_OUT(req, &count, sizeof(count))); 299} 300 301int 302sysctl_dpcpu_long(SYSCTL_HANDLER_ARGS) 303{ 304 uintptr_t dpcpu; 305 long count; 306 int i; 307 308 count = 0; |
309 for (i = 0; i < mp_ncpus; ++i) { | 309 CPU_FOREACH(i) { |
310 dpcpu = dpcpu_off[i]; 311 if (dpcpu == 0) 312 continue; 313 count += *(long *)(dpcpu + (uintptr_t)arg1); 314 } 315 return (SYSCTL_OUT(req, &count, sizeof(count))); 316} 317 318int 319sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS) 320{ 321 uintptr_t dpcpu; 322 int count; 323 int i; 324 325 count = 0; | 310 dpcpu = dpcpu_off[i]; 311 if (dpcpu == 0) 312 continue; 313 count += *(long *)(dpcpu + (uintptr_t)arg1); 314 } 315 return (SYSCTL_OUT(req, &count, sizeof(count))); 316} 317 318int 319sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS) 320{ 321 uintptr_t dpcpu; 322 int count; 323 int i; 324 325 count = 0; |
326 for (i = 0; i < mp_ncpus; ++i) { | 326 CPU_FOREACH(i) { |
327 dpcpu = dpcpu_off[i]; 328 if (dpcpu == 0) 329 continue; 330 count += *(int *)(dpcpu + (uintptr_t)arg1); 331 } 332 return (SYSCTL_OUT(req, &count, sizeof(count))); 333} 334 --- 85 unchanged lines hidden --- | 327 dpcpu = dpcpu_off[i]; 328 if (dpcpu == 0) 329 continue; 330 count += *(int *)(dpcpu + (uintptr_t)arg1); 331 } 332 return (SYSCTL_OUT(req, &count, sizeof(count))); 333} 334 --- 85 unchanged lines hidden --- |