[PATCH v3] powerpc/pseries/vas: Migration suspend waits for no in-progress open windows
Nathan Lynch
nathanl at linux.ibm.com
Thu Oct 26 01:04:59 AEDT 2023
Haren Myneni <haren at linux.ibm.com> writes:
> The hypervisor returns migration failure if all VAS windows are not
> closed. During pre-migration stage, vas_migration_handler() sets
> migration_in_progress flag and closes all windows from the list.
> The allocate VAS window routine checks the migration flag, setup
> the window and then add it to the list. So there is possibility of
> the migration handler missing the window that is still in the
> process of setup.
>
> t1: Allocate and open VAS t2: Migration event
> window
>
> lock vas_pseries_mutex
> If migration_in_progress set
> unlock vas_pseries_mutex
> return
> open window HCALL
> unlock vas_pseries_mutex
> Modify window HCALL lock vas_pseries_mutex
> setup window migration_in_progress=true
> Closes all windows from
> the list
> unlock vas_pseries_mutex
> lock vas_pseries_mutex return
> if nr_closed_windows == 0
> // No DLPAR CPU or migration
> add to the list
> unlock vas_pseries_mutex
> return
> unlock vas_pseries_mutex
> Close VAS window
> // due to DLPAR CPU or migration
> return -EBUSY
>
> This patch resolves the issue with the following steps:
> - Set the migration_in_progress flag without holding mutex.
> - Introduce nr_open_wins_progress counter in VAS capabilities
> struct
> - This counter tracks the number of open windows are still in
> progress
> - The allocate setup window thread closes windows if the migration
> is set and decrements nr_open_window_progress counter
> - The migration handler waits for no in-progress open windows.
>
> Fixes: 37e6764895ef ("powerpc/pseries/vas: Add VAS migration handler")
> Signed-off-by: Haren Myneni <haren at linux.ibm.com>
Thanks for bearing with me Haren. While I still think this code would
benefit from reevaluating the overall locking model, that can be taken
up later. I can't identify any bugs in this version.
Reviewed-by: Nathan Lynch <nathanl at linux.ibm.com>
More information about the Linuxppc-dev
mailing list