@@ -184,10 +184,12 @@ static inline int hv_cpu_number_to_vp_number(int cpu_number)
184
184
return hv_vp_index [cpu_number ];
185
185
}
186
186
187
- static inline int cpumask_to_vpset (struct hv_vpset * vpset ,
188
- const struct cpumask * cpus )
187
+ static inline int __cpumask_to_vpset (struct hv_vpset * vpset ,
188
+ const struct cpumask * cpus ,
189
+ bool exclude_self )
189
190
{
190
191
int cpu , vcpu , vcpu_bank , vcpu_offset , nr_bank = 1 ;
192
+ int this_cpu = smp_processor_id ();
191
193
192
194
/* valid_bank_mask can represent up to 64 banks */
193
195
if (hv_max_vp_index / 64 >= 64 )
@@ -205,6 +207,8 @@ static inline int cpumask_to_vpset(struct hv_vpset *vpset,
205
207
* Some banks may end up being empty but this is acceptable.
206
208
*/
207
209
for_each_cpu (cpu , cpus ) {
210
+ if (exclude_self && cpu == this_cpu )
211
+ continue ;
208
212
vcpu = hv_cpu_number_to_vp_number (cpu );
209
213
if (vcpu == VP_INVAL )
210
214
return -1 ;
@@ -219,6 +223,19 @@ static inline int cpumask_to_vpset(struct hv_vpset *vpset,
219
223
return nr_bank ;
220
224
}
221
225
226
+ static inline int cpumask_to_vpset (struct hv_vpset * vpset ,
227
+ const struct cpumask * cpus )
228
+ {
229
+ return __cpumask_to_vpset (vpset , cpus , false);
230
+ }
231
+
232
+ static inline int cpumask_to_vpset_noself (struct hv_vpset * vpset ,
233
+ const struct cpumask * cpus )
234
+ {
235
+ WARN_ON_ONCE (preemptible ());
236
+ return __cpumask_to_vpset (vpset , cpus , true);
237
+ }
238
+
222
239
void hyperv_report_panic (struct pt_regs * regs , long err , bool in_die );
223
240
bool hv_is_hyperv_initialized (void );
224
241
bool hv_is_hibernation_supported (void );
0 commit comments