@@ -353,8 +353,11 @@ impl Vmm {
353353 #[ cfg( target_arch = "x86_64" ) ]
354354 vcpu. kvm_vcpu . set_pio_bus ( self . vm . pio_bus . clone ( ) ) ;
355355
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+ ) ?) ;
358361 }
359362 self . instance_info . state = VmState :: Paused ;
360363 // Wait for vCPUs to initialize their TLS before moving forward.
@@ -369,7 +372,7 @@ impl Vmm {
369372
370373 // Send the events.
371374 self . vcpus_handles
372- . iter ( )
375+ . iter_mut ( )
373376 . try_for_each ( |handle| handle. send_event ( VcpuEvent :: Resume ) )
374377 . map_err ( |_| VmmError :: VcpuMessage ) ?;
375378
@@ -391,7 +394,7 @@ impl Vmm {
391394 pub fn pause_vm ( & mut self ) -> Result < ( ) , VmmError > {
392395 // Send the events.
393396 self . vcpus_handles
394- . iter ( )
397+ . iter_mut ( )
395398 . try_for_each ( |handle| handle. send_event ( VcpuEvent :: Pause ) )
396399 . map_err ( |_| VmmError :: VcpuMessage ) ?;
397400
@@ -450,7 +453,7 @@ impl Vmm {
450453 }
451454
452455 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 ( ) {
454457 handle
455458 . send_event ( VcpuEvent :: SaveState )
456459 . map_err ( MicrovmStateError :: SignalVcpu ) ?;
@@ -479,7 +482,7 @@ impl Vmm {
479482
480483 /// Dumps CPU configuration.
481484 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 ( ) {
483486 handle
484487 . send_event ( VcpuEvent :: DumpCpuConfig )
485488 . map_err ( DumpCpuConfigError :: SendEvent ) ?;
@@ -615,7 +618,7 @@ impl Vmm {
615618 // We send a "Finish" event. If a VCPU has already exited, this is the only
616619 // message it will accept... but running and paused will take it as well.
617620 // 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 ( ) {
619622 if let Err ( err) = handle. send_event ( VcpuEvent :: Finish ) {
620623 error ! ( "Failed to send VcpuEvent::Finish to vCPU {}: {}" , idx, err) ;
621624 }
0 commit comments