mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
migration/multifd: Make MultiFDSendData a struct
The newly introduced device state buffer can be used for either storing VFIO's read() raw data, but already also possible to store generic device states. After noticing that device states may not easily provide a max buffer size (also the fact that RAM MultiFDPages_t after all also want to have flexibility on managing offset[] array), it may not be a good idea to stick with union on MultiFDSendData.. as it won't play well with such flexibility. Switch MultiFDSendData to a struct. It won't consume a lot more space in reality, after all the real buffers were already dynamically allocated, so it's so far only about the two structs (pages, device_state) that will be duplicated, but they're small. With this, we can remove the pretty hard to understand alloc size logic. Because now we can allocate offset[] together with the SendData, and properly free it when the SendData is freed. [MSS: Make sure to clear possible device state payload before freeing MultiFDSendData, remove placeholders for other patches not included] Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com> Acked-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/qemu-devel/7b02baba8e6ddb23ef7c349d312b9b631db09d7e.1741124640.git.maciej.szmigiero@oracle.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
0525b91a0b
commit
99fab22350
4 changed files with 22 additions and 36 deletions
|
@ -20,11 +20,6 @@ static struct {
|
|||
MultiFDSendData *send_data;
|
||||
} *multifd_send_device_state;
|
||||
|
||||
size_t multifd_device_state_payload_size(void)
|
||||
{
|
||||
return sizeof(MultiFDDeviceState_t);
|
||||
}
|
||||
|
||||
void multifd_device_state_send_setup(void)
|
||||
{
|
||||
assert(!multifd_send_device_state);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue