aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-10-03 14:02:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-03 14:02:39 -0400
commitd7a0dab82fef61bebd34f2bbb9314b075153b646 (patch)
tree1ec0a1d31ed8231bcce7f20c6b289e57a8969ca9 /include
parent4b978934a440c1aafce986353001b03289eaa040 (diff)
parent8db549491c4a3ce9e1d509b75f78516e497f48ec (diff)
Merge branch 'core-smp-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull core SMP updates from Ingo Molnar: "Two main change is generic vCPU pinning and physical CPU SMP-call support, for Xen to be able to perform certain calls on specific physical CPUs - by Juergen Gross" * 'core-smp-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: smp: Allocate smp_call_on_cpu() workqueue on stack too hwmon: Use smp_call_on_cpu() for dell-smm i8k dcdbas: Make use of smp_call_on_cpu() xen: Add xen_pin_vcpu() to support calling functions on a dedicated pCPU smp: Add function to execute a function synchronously on a CPU virt, sched: Add generic vCPU pinning support xen: Sync xen header
Diffstat (limited to 'include')
-rw-r--r--include/linux/hypervisor.h17
-rw-r--r--include/linux/smp.h3
-rw-r--r--include/xen/interface/sched.h100
3 files changed, 102 insertions, 18 deletions
diff --git a/include/linux/hypervisor.h b/include/linux/hypervisor.h
new file mode 100644
index 000000000000..3fa5ef2b3759
--- /dev/null
+++ b/include/linux/hypervisor.h
@@ -0,0 +1,17 @@
1#ifndef __LINUX_HYPEVISOR_H
2#define __LINUX_HYPEVISOR_H
3
4/*
5 * Generic Hypervisor support
6 * Juergen Gross <jgross@suse.com>
7 */
8
9#ifdef CONFIG_HYPERVISOR_GUEST
10#include <asm/hypervisor.h>
11#else
12static inline void hypervisor_pin_vcpu(int cpu)
13{
14}
15#endif
16
17#endif /* __LINUX_HYPEVISOR_H */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index eccae4690f41..8e0cb7a0f836 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -196,6 +196,9 @@ extern void arch_enable_nonboot_cpus_end(void);
196 196
197void smp_setup_processor_id(void); 197void smp_setup_processor_id(void);
198 198
199int smp_call_on_cpu(unsigned int cpu, int (*func)(void *), void *par,
200 bool phys);
201
199/* SMP core functions */ 202/* SMP core functions */
200int smpcfd_prepare_cpu(unsigned int cpu); 203int smpcfd_prepare_cpu(unsigned int cpu);
201int smpcfd_dead_cpu(unsigned int cpu); 204int smpcfd_dead_cpu(unsigned int cpu);
diff --git a/include/xen/interface/sched.h b/include/xen/interface/sched.h
index f18490985fc8..a4c4d735d781 100644
--- a/include/xen/interface/sched.h
+++ b/include/xen/interface/sched.h
@@ -3,6 +3,24 @@
3 * 3 *
4 * Scheduler state interactions 4 * Scheduler state interactions
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
6 * Copyright (c) 2005, Keir Fraser <keir@xensource.com> 24 * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
7 */ 25 */
8 26
@@ -12,18 +30,30 @@
12#include <xen/interface/event_channel.h> 30#include <xen/interface/event_channel.h>
13 31
14/* 32/*
33 * Guest Scheduler Operations
34 *
35 * The SCHEDOP interface provides mechanisms for a guest to interact
36 * with the scheduler, including yield, blocking and shutting itself
37 * down.
38 */
39
40/*
15 * The prototype for this hypercall is: 41 * The prototype for this hypercall is:
16 * long sched_op_new(int cmd, void *arg) 42 * long HYPERVISOR_sched_op(enum sched_op cmd, void *arg, ...)
43 *
17 * @cmd == SCHEDOP_??? (scheduler operation). 44 * @cmd == SCHEDOP_??? (scheduler operation).
18 * @arg == Operation-specific extra argument(s), as described below. 45 * @arg == Operation-specific extra argument(s), as described below.
46 * ... == Additional Operation-specific extra arguments, described below.
19 * 47 *
20 * **NOTE**: 48 * Versions of Xen prior to 3.0.2 provided only the following legacy version
21 * Versions of Xen prior to 3.0.2 provide only the following legacy version
22 * of this hypercall, supporting only the commands yield, block and shutdown: 49 * of this hypercall, supporting only the commands yield, block and shutdown:
23 * long sched_op(int cmd, unsigned long arg) 50 * long sched_op(int cmd, unsigned long arg)
24 * @cmd == SCHEDOP_??? (scheduler operation). 51 * @cmd == SCHEDOP_??? (scheduler operation).
25 * @arg == 0 (SCHEDOP_yield and SCHEDOP_block) 52 * @arg == 0 (SCHEDOP_yield and SCHEDOP_block)
26 * == SHUTDOWN_* code (SCHEDOP_shutdown) 53 * == SHUTDOWN_* code (SCHEDOP_shutdown)
54 *
55 * This legacy version is available to new guests as:
56 * long HYPERVISOR_sched_op_compat(enum sched_op cmd, unsigned long arg)
27 */ 57 */
28 58
29/* 59/*
@@ -44,12 +74,17 @@
44/* 74/*
45 * Halt execution of this domain (all VCPUs) and notify the system controller. 75 * Halt execution of this domain (all VCPUs) and notify the system controller.
46 * @arg == pointer to sched_shutdown structure. 76 * @arg == pointer to sched_shutdown structure.
77 *
78 * If the sched_shutdown_t reason is SHUTDOWN_suspend then
79 * x86 PV guests must also set RDX (EDX for 32-bit guests) to the MFN
80 * of the guest's start info page. RDX/EDX is the third hypercall
81 * argument.
82 *
83 * In addition, which reason is SHUTDOWN_suspend this hypercall
84 * returns 1 if suspend was cancelled or the domain was merely
85 * checkpointed, and 0 if it is resuming in a new domain.
47 */ 86 */
48#define SCHEDOP_shutdown 2 87#define SCHEDOP_shutdown 2
49struct sched_shutdown {
50 unsigned int reason; /* SHUTDOWN_* */
51};
52DEFINE_GUEST_HANDLE_STRUCT(sched_shutdown);
53 88
54/* 89/*
55 * Poll a set of event-channel ports. Return when one or more are pending. An 90 * Poll a set of event-channel ports. Return when one or more are pending. An
@@ -57,12 +92,6 @@ DEFINE_GUEST_HANDLE_STRUCT(sched_shutdown);
57 * @arg == pointer to sched_poll structure. 92 * @arg == pointer to sched_poll structure.
58 */ 93 */
59#define SCHEDOP_poll 3 94#define SCHEDOP_poll 3
60struct sched_poll {
61 GUEST_HANDLE(evtchn_port_t) ports;
62 unsigned int nr_ports;
63 uint64_t timeout;
64};
65DEFINE_GUEST_HANDLE_STRUCT(sched_poll);
66 95
67/* 96/*
68 * Declare a shutdown for another domain. The main use of this function is 97 * Declare a shutdown for another domain. The main use of this function is
@@ -71,15 +100,11 @@ DEFINE_GUEST_HANDLE_STRUCT(sched_poll);
71 * @arg == pointer to sched_remote_shutdown structure. 100 * @arg == pointer to sched_remote_shutdown structure.
72 */ 101 */
73#define SCHEDOP_remote_shutdown 4 102#define SCHEDOP_remote_shutdown 4
74struct sched_remote_shutdown {
75 domid_t domain_id; /* Remote domain ID */
76 unsigned int reason; /* SHUTDOWN_xxx reason */
77};
78 103
79/* 104/*
80 * Latch a shutdown code, so that when the domain later shuts down it 105 * Latch a shutdown code, so that when the domain later shuts down it
81 * reports this code to the control tools. 106 * reports this code to the control tools.
82 * @arg == as for SCHEDOP_shutdown. 107 * @arg == sched_shutdown, as for SCHEDOP_shutdown.
83 */ 108 */
84#define SCHEDOP_shutdown_code 5 109#define SCHEDOP_shutdown_code 5
85 110
@@ -92,10 +117,47 @@ struct sched_remote_shutdown {
92 * With id != 0 and timeout != 0, poke watchdog timer and set new timeout. 117 * With id != 0 and timeout != 0, poke watchdog timer and set new timeout.
93 */ 118 */
94#define SCHEDOP_watchdog 6 119#define SCHEDOP_watchdog 6
120
121/*
122 * Override the current vcpu affinity by pinning it to one physical cpu or
123 * undo this override restoring the previous affinity.
124 * @arg == pointer to sched_pin_override structure.
125 *
126 * A negative pcpu value will undo a previous pin override and restore the
127 * previous cpu affinity.
128 * This call is allowed for the hardware domain only and requires the cpu
129 * to be part of the domain's cpupool.
130 */
131#define SCHEDOP_pin_override 7
132
133struct sched_shutdown {
134 unsigned int reason; /* SHUTDOWN_* => shutdown reason */
135};
136DEFINE_GUEST_HANDLE_STRUCT(sched_shutdown);
137
138struct sched_poll {
139 GUEST_HANDLE(evtchn_port_t) ports;
140 unsigned int nr_ports;
141 uint64_t timeout;
142};
143DEFINE_GUEST_HANDLE_STRUCT(sched_poll);
144
145struct sched_remote_shutdown {
146 domid_t domain_id; /* Remote domain ID */
147 unsigned int reason; /* SHUTDOWN_* => shutdown reason */
148};
149DEFINE_GUEST_HANDLE_STRUCT(sched_remote_shutdown);
150
95struct sched_watchdog { 151struct sched_watchdog {
96 uint32_t id; /* watchdog ID */ 152 uint32_t id; /* watchdog ID */
97