|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v3 33/39] xen/riscv: restore register state in the new IMSIC VS-file
On 11/3/26 5:45 PM, Baptiste Le Duc wrote: Complete the migration of a vCPU's guest interrupt file: move the state saved from the old IMSIC VS-file into the new one and make the vCPU use the new VS-file. The interrupt producers have already been retargeted to the new VS-file, so MSIs may land in it before the saved state is restored.Could we send an extempore MSI to the hart of the new file once the interrupt producers have been retargeted, and spin until it is received? That would guarantee that no more MSIs land once we have received it. I don't think it's needed. The barrier is there so that nothing gets lost from the old file: once the extempore MSI sent to the hart of the old file has arrived, every MSI the APLIC sent towards the old file before the retargeting has landed there, so what's read out of the old file is complete. MSIs sent after the retargeting go to the new file, and they can keep arriving at any time, including while the saved state is being restored, so an extempore MSI to the hart of the new file wouldn't stop them anyway: it would only tell that the MSIs sent before it have arrived. That's why the saved eip/eie bits are ORed into the new file rather than written to it, so that whatever lands there in the meantime is kept, and why eidelivery is restored last, so that the new file doesn't deliver anything until its state is complete.
Good point. I will apply that. + unsigned long new_hstatus, old_hstatus, old_vsiselect; + + /* We can only update if we have a HW IMSIC context */ + if ( !idata->hgei ) + return; + + /* + * No atomic accessors are needed to read the values out of the MRIF here, + * as this is always called with a pointer to a temporary MRIF on the + * stack. + */ + + /* + * The file is reached by retargeting hstatus.VGEIN, and the + * imsic_vs_csr_*() accessors alter vsiselect. Both belong to the vCPU + * running on this pCPU, so restore them before returning. + */Same comment as on the previous patch: you are not restoring the CSRs here but saving them, as imsic_vs_csr_*() will alter vsiselect. Please update the comment accordingly. Sure! As I mentioned in reply to prev. patch I think that it would be better to factor out the sequence of work with hstatus&vsiselect to separate helpers, put your comment suggestion above the helpers once.
Acked. Thanks for review. ~ Oleksii
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |