Deleted Added
full compact
subr_smp.c (261520) subr_smp.c (264984)
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

--- 16 unchanged lines hidden (view full) ---

25 */
26
27/*
28 * This module holds the global variables and machine independent functions
29 * used for the kernel SMP support.
30 */
31
32#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

--- 16 unchanged lines hidden (view full) ---

25 */
26
27/*
28 * This module holds the global variables and machine independent functions
29 * used for the kernel SMP support.
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/kern/subr_smp.c 261520 2014-02-05 18:13:27Z jhb $");
33__FBSDID("$FreeBSD: head/sys/kern/subr_smp.c 264984 2014-04-26 20:27:54Z scottl $");
34
35#include <sys/param.h>
36#include <sys/systm.h>
37#include <sys/kernel.h>
38#include <sys/ktr.h>
39#include <sys/proc.h>
40#include <sys/bus.h>
41#include <sys/lock.h>

--- 12 unchanged lines hidden (view full) ---

54volatile cpuset_t stopped_cpus;
55volatile cpuset_t started_cpus;
56volatile cpuset_t suspended_cpus;
57cpuset_t hlt_cpus_mask;
58cpuset_t logical_cpus_mask;
59
60void (*cpustop_restartfunc)(void);
61#endif
34
35#include <sys/param.h>
36#include <sys/systm.h>
37#include <sys/kernel.h>
38#include <sys/ktr.h>
39#include <sys/proc.h>
40#include <sys/bus.h>
41#include <sys/lock.h>

--- 12 unchanged lines hidden (view full) ---

54volatile cpuset_t stopped_cpus;
55volatile cpuset_t started_cpus;
56volatile cpuset_t suspended_cpus;
57cpuset_t hlt_cpus_mask;
58cpuset_t logical_cpus_mask;
59
60void (*cpustop_restartfunc)(void);
61#endif
62
63static int sysctl_kern_smp_active(SYSCTL_HANDLER_ARGS);
64
62/* This is used in modules that need to work in both SMP and UP. */
63cpuset_t all_cpus;
64
65int mp_ncpus;
66/* export this for libkvm consumers. */
67int mp_maxcpus = MAXCPU;
68
69volatile int smp_started;
70u_int mp_maxid;
71
72static SYSCTL_NODE(_kern, OID_AUTO, smp, CTLFLAG_RD|CTLFLAG_CAPRD, NULL,
73 "Kernel SMP");
74
75SYSCTL_INT(_kern_smp, OID_AUTO, maxid, CTLFLAG_RD|CTLFLAG_CAPRD, &mp_maxid, 0,
76 "Max CPU ID.");
77
78SYSCTL_INT(_kern_smp, OID_AUTO, maxcpus, CTLFLAG_RD|CTLFLAG_CAPRD, &mp_maxcpus,
79 0, "Max number of CPUs that the system was compiled for.");
80
65/* This is used in modules that need to work in both SMP and UP. */
66cpuset_t all_cpus;
67
68int mp_ncpus;
69/* export this for libkvm consumers. */
70int mp_maxcpus = MAXCPU;
71
72volatile int smp_started;
73u_int mp_maxid;
74
75static SYSCTL_NODE(_kern, OID_AUTO, smp, CTLFLAG_RD|CTLFLAG_CAPRD, NULL,
76 "Kernel SMP");
77
78SYSCTL_INT(_kern_smp, OID_AUTO, maxid, CTLFLAG_RD|CTLFLAG_CAPRD, &mp_maxid, 0,
79 "Max CPU ID.");
80
81SYSCTL_INT(_kern_smp, OID_AUTO, maxcpus, CTLFLAG_RD|CTLFLAG_CAPRD, &mp_maxcpus,
82 0, "Max number of CPUs that the system was compiled for.");
83
81int smp_active = 0; /* are the APs allowed to run? */
82SYSCTL_INT(_kern_smp, OID_AUTO, active, CTLFLAG_RW, &smp_active, 0,
83 "Number of Auxillary Processors (APs) that were successfully started");
84SYSCTL_PROC(_kern_smp, OID_AUTO, active, CTLFLAG_RD | CTLTYPE_INT, NULL, 0,
85 sysctl_kern_smp_active, "I", "Indicates system is running in SMP mode");
84
85int smp_disabled = 0; /* has smp been disabled? */
86SYSCTL_INT(_kern_smp, OID_AUTO, disabled, CTLFLAG_RDTUN|CTLFLAG_CAPRD,
87 &smp_disabled, 0, "SMP has been disabled from the loader");
88TUNABLE_INT("kern.smp.disabled", &smp_disabled);
89
90int smp_cpus = 1; /* how many cpu's running */
91SYSCTL_INT(_kern_smp, OID_AUTO, cpus, CTLFLAG_RD|CTLFLAG_CAPRD, &smp_cpus, 0,

--- 734 unchanged lines hidden (view full) ---

826}
827
828int
829quiesce_all_cpus(const char *wmesg, int prio)
830{
831
832 return quiesce_cpus(all_cpus, wmesg, prio);
833}
86
87int smp_disabled = 0; /* has smp been disabled? */
88SYSCTL_INT(_kern_smp, OID_AUTO, disabled, CTLFLAG_RDTUN|CTLFLAG_CAPRD,
89 &smp_disabled, 0, "SMP has been disabled from the loader");
90TUNABLE_INT("kern.smp.disabled", &smp_disabled);
91
92int smp_cpus = 1; /* how many cpu's running */
93SYSCTL_INT(_kern_smp, OID_AUTO, cpus, CTLFLAG_RD|CTLFLAG_CAPRD, &smp_cpus, 0,

--- 734 unchanged lines hidden (view full) ---

828}
829
830int
831quiesce_all_cpus(const char *wmesg, int prio)
832{
833
834 return quiesce_cpus(all_cpus, wmesg, prio);
835}
836
837/* Extra care is taken with this sysctl because the data type is volatile */
838static int
839sysctl_kern_smp_active(SYSCTL_HANDLER_ARGS)
840{
841 int error, active;
842
843 active = smp_started;
844 error = SYSCTL_OUT(req, &active, sizeof(active));
845 return (error);
846}
847