@@ -353,8 +353,11 @@ impl Vmm {
353
353
#[ cfg( target_arch = "x86_64" ) ]
354
354
vcpu. kvm_vcpu . set_pio_bus ( self . vm . pio_bus . clone ( ) ) ;
355
355
356
- self . vcpus_handles
357
- . push ( vcpu. start_threaded ( vcpu_seccomp_filter. clone ( ) , barrier. clone ( ) ) ?) ;
356
+ self . vcpus_handles . push ( vcpu. start_threaded (
357
+ & self . vm ,
358
+ vcpu_seccomp_filter. clone ( ) ,
359
+ barrier. clone ( ) ,
360
+ ) ?) ;
358
361
}
359
362
self . instance_info . state = VmState :: Paused ;
360
363
// Wait for vCPUs to initialize their TLS before moving forward.
@@ -369,7 +372,7 @@ impl Vmm {
369
372
370
373
// Send the events.
371
374
self . vcpus_handles
372
- . iter ( )
375
+ . iter_mut ( )
373
376
. try_for_each ( |handle| handle. send_event ( VcpuEvent :: Resume ) )
374
377
. map_err ( |_| VmmError :: VcpuMessage ) ?;
375
378
@@ -391,7 +394,7 @@ impl Vmm {
391
394
pub fn pause_vm ( & mut self ) -> Result < ( ) , VmmError > {
392
395
// Send the events.
393
396
self . vcpus_handles
394
- . iter ( )
397
+ . iter_mut ( )
395
398
. try_for_each ( |handle| handle. send_event ( VcpuEvent :: Pause ) )
396
399
. map_err ( |_| VmmError :: VcpuMessage ) ?;
397
400
@@ -450,7 +453,7 @@ impl Vmm {
450
453
}
451
454
452
455
fn save_vcpu_states ( & mut self ) -> Result < Vec < VcpuState > , MicrovmStateError > {
453
- for handle in self . vcpus_handles . iter ( ) {
456
+ for handle in self . vcpus_handles . iter_mut ( ) {
454
457
handle
455
458
. send_event ( VcpuEvent :: SaveState )
456
459
. map_err ( MicrovmStateError :: SignalVcpu ) ?;
@@ -479,7 +482,7 @@ impl Vmm {
479
482
480
483
/// Dumps CPU configuration.
481
484
pub fn dump_cpu_config ( & mut self ) -> Result < Vec < CpuConfiguration > , DumpCpuConfigError > {
482
- for handle in self . vcpus_handles . iter ( ) {
485
+ for handle in self . vcpus_handles . iter_mut ( ) {
483
486
handle
484
487
. send_event ( VcpuEvent :: DumpCpuConfig )
485
488
. map_err ( DumpCpuConfigError :: SendEvent ) ?;
@@ -615,7 +618,7 @@ impl Vmm {
615
618
// We send a "Finish" event. If a VCPU has already exited, this is the only
616
619
// message it will accept... but running and paused will take it as well.
617
620
// It breaks out of the state machine loop so that the thread can be joined.
618
- for ( idx, handle) in self . vcpus_handles . iter ( ) . enumerate ( ) {
621
+ for ( idx, handle) in self . vcpus_handles . iter_mut ( ) . enumerate ( ) {
619
622
if let Err ( err) = handle. send_event ( VcpuEvent :: Finish ) {
620
623
error ! ( "Failed to send VcpuEvent::Finish to vCPU {}: {}" , idx, err) ;
621
624
}
0 commit comments