@@ -84,21 +84,6 @@ EXPORT_SYMBOL(xen_start_flags);
84
84
*/
85
85
struct shared_info * HYPERVISOR_shared_info = & xen_dummy_shared_info ;
86
86
87
- /*
88
- * Flag to determine whether vcpu info placement is available on all
89
- * VCPUs. We assume it is to start with, and then set it to zero on
90
- * the first failure. This is because it can succeed on some VCPUs
91
- * and not others, since it can involve hypervisor memory allocation,
92
- * or because the guest failed to guarantee all the appropriate
93
- * constraints on all VCPUs (ie buffer can't cross a page boundary).
94
- *
95
- * Note that any particular CPU may be using a placed vcpu structure,
96
- * but we can only optimise if the all are.
97
- *
98
- * 0: not available, 1: available
99
- */
100
- int xen_have_vcpu_info_placement = 1 ;
101
-
102
87
static int xen_cpu_up_online (unsigned int cpu )
103
88
{
104
89
xen_init_lock_cpu (cpu );
@@ -124,10 +109,8 @@ int xen_cpuhp_setup(int (*cpu_up_prepare_cb)(unsigned int),
124
109
return rc >= 0 ? 0 : rc ;
125
110
}
126
111
127
- static int xen_vcpu_setup_restore (int cpu )
112
+ static void xen_vcpu_setup_restore (int cpu )
128
113
{
129
- int rc = 0 ;
130
-
131
114
/* Any per_cpu(xen_vcpu) is stale, so reset it */
132
115
xen_vcpu_info_reset (cpu );
133
116
@@ -136,11 +119,8 @@ static int xen_vcpu_setup_restore(int cpu)
136
119
* be handled by hotplug.
137
120
*/
138
121
if (xen_pv_domain () ||
139
- (xen_hvm_domain () && cpu_online (cpu ))) {
140
- rc = xen_vcpu_setup (cpu );
141
- }
142
-
143
- return rc ;
122
+ (xen_hvm_domain () && cpu_online (cpu )))
123
+ xen_vcpu_setup (cpu );
144
124
}
145
125
146
126
/*
@@ -150,7 +130,7 @@ static int xen_vcpu_setup_restore(int cpu)
150
130
*/
151
131
void xen_vcpu_restore (void )
152
132
{
153
- int cpu , rc ;
133
+ int cpu ;
154
134
155
135
for_each_possible_cpu (cpu ) {
156
136
bool other_cpu = (cpu != smp_processor_id ());
@@ -170,20 +150,9 @@ void xen_vcpu_restore(void)
170
150
if (xen_pv_domain () || xen_feature (XENFEAT_hvm_safe_pvclock ))
171
151
xen_setup_runstate_info (cpu );
172
152
173
- rc = xen_vcpu_setup_restore (cpu );
174
- if (rc )
175
- pr_emerg_once ("vcpu restore failed for cpu=%d err=%d. "
176
- "System will hang.\n" , cpu , rc );
177
- /*
178
- * In case xen_vcpu_setup_restore() fails, do not bring up the
179
- * VCPU. This helps us avoid the resulting OOPS when the VCPU
180
- * accesses pvclock_vcpu_time via xen_vcpu (which is NULL.)
181
- * Note that this does not improve the situation much -- now the
182
- * VM hangs instead of OOPSing -- with the VCPUs that did not
183
- * fail, spinning in stop_machine(), waiting for the failed
184
- * VCPUs to come up.
185
- */
186
- if (other_cpu && is_up && (rc == 0 ) &&
153
+ xen_vcpu_setup_restore (cpu );
154
+
155
+ if (other_cpu && is_up &&
187
156
HYPERVISOR_vcpu_op (VCPUOP_up , xen_vcpu_nr (cpu ), NULL ))
188
157
BUG ();
189
158
}
@@ -200,7 +169,7 @@ void xen_vcpu_info_reset(int cpu)
200
169
}
201
170
}
202
171
203
- int xen_vcpu_setup (int cpu )
172
+ void xen_vcpu_setup (int cpu )
204
173
{
205
174
struct vcpu_register_vcpu_info info ;
206
175
int err ;
@@ -221,44 +190,26 @@ int xen_vcpu_setup(int cpu)
221
190
*/
222
191
if (xen_hvm_domain ()) {
223
192
if (per_cpu (xen_vcpu , cpu ) == & per_cpu (xen_vcpu_info , cpu ))
224
- return 0 ;
193
+ return ;
225
194
}
226
195
227
- if (xen_have_vcpu_info_placement ) {
228
- vcpup = & per_cpu (xen_vcpu_info , cpu );
229
- info .mfn = arbitrary_virt_to_mfn (vcpup );
230
- info .offset = offset_in_page (vcpup );
196
+ vcpup = & per_cpu (xen_vcpu_info , cpu );
197
+ info .mfn = arbitrary_virt_to_mfn (vcpup );
198
+ info .offset = offset_in_page (vcpup );
231
199
232
- /*
233
- * Check to see if the hypervisor will put the vcpu_info
234
- * structure where we want it, which allows direct access via
235
- * a percpu-variable.
236
- * N.B. This hypercall can _only_ be called once per CPU.
237
- * Subsequent calls will error out with -EINVAL. This is due to
238
- * the fact that hypervisor has no unregister variant and this
239
- * hypercall does not allow to over-write info.mfn and
240
- * info.offset.
241
- */
242
- err = HYPERVISOR_vcpu_op (VCPUOP_register_vcpu_info ,
243
- xen_vcpu_nr (cpu ), & info );
244
-
245
- if (err ) {
246
- pr_warn_once ("register_vcpu_info failed: cpu=%d err=%d\n" ,
247
- cpu , err );
248
- xen_have_vcpu_info_placement = 0 ;
249
- } else {
250
- /*
251
- * This cpu is using the registered vcpu info, even if
252
- * later ones fail to.
253
- */
254
- per_cpu (xen_vcpu , cpu ) = vcpup ;
255
- }
256
- }
257
-
258
- if (!xen_have_vcpu_info_placement )
259
- xen_vcpu_info_reset (cpu );
200
+ /*
201
+ * N.B. This hypercall can _only_ be called once per CPU.
202
+ * Subsequent calls will error out with -EINVAL. This is due to
203
+ * the fact that hypervisor has no unregister variant and this
204
+ * hypercall does not allow to over-write info.mfn and
205
+ * info.offset.
206
+ */
207
+ err = HYPERVISOR_vcpu_op (VCPUOP_register_vcpu_info , xen_vcpu_nr (cpu ),
208
+ & info );
209
+ if (err )
210
+ panic ("register_vcpu_info failed: cpu=%d err=%d\n" , cpu , err );
260
211
261
- return (( per_cpu (xen_vcpu , cpu ) == NULL ) ? - ENODEV : 0 ) ;
212
+ per_cpu (xen_vcpu , cpu ) = vcpup ;
262
213
}
263
214
264
215
void __init xen_banner (void )
0 commit comments