On Tue, Dec 10, 2024 at 10:51:56AM +0800, Binbin Wu wrote: > > > >On 12/9/2024 8:45 PM, Chao Gao wrote: >> > +/* >> > + * Split into chunks and check interrupt pending between chunks. This allows >> > + * for timely injection of interrupts to prevent issues with guest lockup >> > + * detection. >> Would it cause any problems if an (intra-host or inter-host) migration happens >> between chunks? >> >> My understanding is that KVM would lose track of the progress if >> map_gpa_next/end are not migrated. I'm not sure if KVM should expose the >> state or prevent migration in the middle. Or, we can let the userspace VMM >> cut the range into chunks, making it the userspace VMM's responsibility to >> ensure necessary state is migrated. >> >> I am not asking to fix this issue right now. I just want to ensure this issue >> can be solved in a clean way when we start to support migration. >How about: >Before exiting to userspace, KVM always sets the start GPA to r11 and set >return code to TDVMCALL_STATUS_RETRY. >- If userspace finishes the part, the complete_userspace_io() callback will > be called and the return code will be set to TDVMCALL_STATUS_SUCCESS. >- If the live migration interrupts the MapGAP in the userspace, and > complete_userspace_io() is not called, when the vCPU resumes from migration, > TDX guest will see the return code is TDVMCALL_STATUS_RETRY with the failed > GPA, and it can retry the MapGAP with the failed GAP. Sounds good