Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Multifd common functions |
| 3 | * |
| 4 | * Copyright (c) 2019-2020 Red Hat Inc |
| 5 | * |
| 6 | * Authors: |
| 7 | * Juan Quintela <quintela@redhat.com> |
| 8 | * |
| 9 | * This work is licensed under the terms of the GNU GPL, version 2 or later. |
| 10 | * See the COPYING file in the top-level directory. |
| 11 | */ |
| 12 | |
| 13 | #ifndef QEMU_MIGRATION_MULTIFD_H |
| 14 | #define QEMU_MIGRATION_MULTIFD_H |
| 15 | |
Fabiano Rosas | 90fa121 | 2024-08-27 14:45:49 -0300 | [diff] [blame] | 16 | #include "exec/target_page.h" |
Fabiano Rosas | a49d15a | 2024-02-29 12:30:15 -0300 | [diff] [blame] | 17 | #include "ram.h" |
| 18 | |
Fabiano Rosas | d117ed0 | 2024-02-29 12:30:09 -0300 | [diff] [blame] | 19 | typedef struct MultiFDRecvData MultiFDRecvData; |
Fabiano Rosas | addd7d1 | 2024-08-27 14:45:52 -0300 | [diff] [blame] | 20 | typedef struct MultiFDSendData MultiFDSendData; |
Fabiano Rosas | d117ed0 | 2024-02-29 12:30:09 -0300 | [diff] [blame] | 21 | |
Fabiano Rosas | bd8b0a8 | 2024-02-06 18:51:15 -0300 | [diff] [blame] | 22 | bool multifd_send_setup(void); |
Peter Xu | cde85c3 | 2024-02-02 18:28:55 +0800 | [diff] [blame] | 23 | void multifd_send_shutdown(void); |
Fabiano Rosas | a8a3e71 | 2024-02-29 12:30:10 -0300 | [diff] [blame] | 24 | void multifd_send_channel_created(void); |
Peter Xu | cde85c3 | 2024-02-02 18:28:55 +0800 | [diff] [blame] | 25 | int multifd_recv_setup(Error **errp); |
| 26 | void multifd_recv_cleanup(void); |
| 27 | void multifd_recv_shutdown(void); |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 28 | bool multifd_recv_all_channels_created(void); |
manish.mishra | 6720c2b | 2022-12-20 18:44:18 +0000 | [diff] [blame] | 29 | void multifd_recv_new_channel(QIOChannel *ioc, Error **errp); |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 30 | void multifd_recv_sync_main(void); |
Fabiano Rosas | 9346fa1 | 2024-01-04 11:21:39 -0300 | [diff] [blame] | 31 | int multifd_send_sync_main(void); |
Peter Xu | d6556d1 | 2024-02-02 18:28:50 +0800 | [diff] [blame] | 32 | bool multifd_queue_page(RAMBlock *block, ram_addr_t offset); |
Fabiano Rosas | d117ed0 | 2024-02-29 12:30:09 -0300 | [diff] [blame] | 33 | bool multifd_recv(void); |
| 34 | MultiFDRecvData *multifd_get_recv_data(void); |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 35 | |
Juan Quintela | 7ec2c2b | 2019-01-04 15:30:06 +0100 | [diff] [blame] | 36 | /* Multifd Compression flags */ |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 37 | #define MULTIFD_FLAG_SYNC (1 << 0) |
| 38 | |
Bryan Zhang | 80484f9 | 2024-08-30 16:27:21 -0700 | [diff] [blame] | 39 | /* We reserve 5 bits for compression methods */ |
| 40 | #define MULTIFD_FLAG_COMPRESSION_MASK (0x1f << 1) |
Juan Quintela | ab7cbb0 | 2019-05-15 13:37:46 +0200 | [diff] [blame] | 41 | /* we need to be compatible. Before compression value was 0 */ |
| 42 | #define MULTIFD_FLAG_NOCOMP (0 << 1) |
Juan Quintela | 7ec2c2b | 2019-01-04 15:30:06 +0100 | [diff] [blame] | 43 | #define MULTIFD_FLAG_ZLIB (1 << 1) |
Juan Quintela | 87dc6f5 | 2019-12-13 13:47:14 +0100 | [diff] [blame] | 44 | #define MULTIFD_FLAG_ZSTD (2 << 1) |
Yuan Liu | 354cac2 | 2024-06-10 18:21:07 +0800 | [diff] [blame] | 45 | #define MULTIFD_FLAG_QPL (4 << 1) |
Shameer Kolothum | f3d8bb7 | 2024-06-07 14:53:06 +0100 | [diff] [blame] | 46 | #define MULTIFD_FLAG_UADK (8 << 1) |
Bryan Zhang | 80484f9 | 2024-08-30 16:27:21 -0700 | [diff] [blame] | 47 | #define MULTIFD_FLAG_QATZIP (16 << 1) |
Juan Quintela | ab7cbb0 | 2019-05-15 13:37:46 +0200 | [diff] [blame] | 48 | |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 49 | /* This value needs to be a multiple of qemu_target_page_size() */ |
| 50 | #define MULTIFD_PACKET_SIZE (512 * 1024) |
| 51 | |
| 52 | typedef struct { |
| 53 | uint32_t magic; |
| 54 | uint32_t version; |
| 55 | uint32_t flags; |
| 56 | /* maximum number of allocated pages */ |
| 57 | uint32_t pages_alloc; |
Juan Quintela | 8c0ec0b | 2021-11-22 14:13:51 +0100 | [diff] [blame] | 58 | /* non zero pages */ |
| 59 | uint32_t normal_pages; |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 60 | /* size of the next packet that contains pages */ |
| 61 | uint32_t next_packet_size; |
| 62 | uint64_t packet_num; |
Hao Xiang | 303e6f5 | 2024-03-11 18:00:12 +0000 | [diff] [blame] | 63 | /* zero pages */ |
| 64 | uint32_t zero_pages; |
| 65 | uint32_t unused32[1]; /* Reserved for future use */ |
| 66 | uint64_t unused64[3]; /* Reserved for future use */ |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 67 | char ramblock[256]; |
Hao Xiang | 303e6f5 | 2024-03-11 18:00:12 +0000 | [diff] [blame] | 68 | /* |
| 69 | * This array contains the pointers to: |
| 70 | * - normal pages (initial normal_pages entries) |
| 71 | * - zero pages (following zero_pages entries) |
| 72 | */ |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 73 | uint64_t offset[]; |
| 74 | } __attribute__((packed)) MultiFDPacket_t; |
| 75 | |
| 76 | typedef struct { |
| 77 | /* number of used pages */ |
Juan Quintela | 90a3d2f | 2021-11-22 11:51:40 +0100 | [diff] [blame] | 78 | uint32_t num; |
Hao Xiang | 303e6f5 | 2024-03-11 18:00:12 +0000 | [diff] [blame] | 79 | /* number of normal pages */ |
| 80 | uint32_t normal_num; |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 81 | RAMBlock *block; |
Fabiano Rosas | 0e427da | 2024-08-27 14:45:53 -0300 | [diff] [blame] | 82 | /* offset of each page */ |
| 83 | ram_addr_t offset[]; |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 84 | } MultiFDPages_t; |
| 85 | |
Fabiano Rosas | d117ed0 | 2024-02-29 12:30:09 -0300 | [diff] [blame] | 86 | struct MultiFDRecvData { |
| 87 | void *opaque; |
| 88 | size_t size; |
| 89 | /* for preadv */ |
| 90 | off_t file_offset; |
| 91 | }; |
| 92 | |
Fabiano Rosas | addd7d1 | 2024-08-27 14:45:52 -0300 | [diff] [blame] | 93 | typedef enum { |
| 94 | MULTIFD_PAYLOAD_NONE, |
| 95 | MULTIFD_PAYLOAD_RAM, |
| 96 | } MultiFDPayloadType; |
| 97 | |
| 98 | typedef union MultiFDPayload { |
| 99 | MultiFDPages_t ram; |
| 100 | } MultiFDPayload; |
| 101 | |
| 102 | struct MultiFDSendData { |
| 103 | MultiFDPayloadType type; |
| 104 | MultiFDPayload u; |
| 105 | }; |
| 106 | |
| 107 | static inline bool multifd_payload_empty(MultiFDSendData *data) |
| 108 | { |
| 109 | return data->type == MULTIFD_PAYLOAD_NONE; |
| 110 | } |
| 111 | |
| 112 | static inline void multifd_set_payload_type(MultiFDSendData *data, |
| 113 | MultiFDPayloadType type) |
| 114 | { |
| 115 | data->type = type; |
| 116 | } |
| 117 | |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 118 | typedef struct { |
Juan Quintela | 4a8f19c | 2022-05-31 12:43:06 +0200 | [diff] [blame] | 119 | /* Fields are only written at creating/deletion time */ |
| 120 | /* No lock required for them, they are read only */ |
| 121 | |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 122 | /* channel number */ |
| 123 | uint8_t id; |
| 124 | /* channel thread name */ |
| 125 | char *name; |
| 126 | /* channel thread id */ |
| 127 | QemuThread thread; |
Fabiano Rosas | a2a63c4 | 2024-02-06 18:51:14 -0300 | [diff] [blame] | 128 | bool thread_created; |
Fabiano Rosas | e1921f1 | 2024-02-06 18:51:13 -0300 | [diff] [blame] | 129 | QemuThread tls_thread; |
| 130 | bool tls_thread_created; |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 131 | /* communication channel */ |
| 132 | QIOChannel *c; |
Juan Quintela | 4a8f19c | 2022-05-31 12:43:06 +0200 | [diff] [blame] | 133 | /* packet allocated len */ |
| 134 | uint32_t packet_len; |
| 135 | /* multifd flags for sending ram */ |
| 136 | int write_flags; |
| 137 | |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 138 | /* sem where to wait for more work */ |
| 139 | QemuSemaphore sem; |
Juan Quintela | 4a8f19c | 2022-05-31 12:43:06 +0200 | [diff] [blame] | 140 | /* syncs main thread and channels */ |
| 141 | QemuSemaphore sem_sync; |
| 142 | |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 143 | /* multifd flags for each packet */ |
| 144 | uint32_t flags; |
Peter Xu | f5f48a7 | 2024-02-02 18:28:40 +0800 | [diff] [blame] | 145 | /* |
| 146 | * The sender thread has work to do if either of below boolean is set. |
| 147 | * |
| 148 | * @pending_job: a job is pending |
| 149 | * @pending_sync: a sync request is pending |
| 150 | * |
| 151 | * For both of these fields, they're only set by the requesters, and |
| 152 | * cleared by the multifd sender threads. |
| 153 | */ |
| 154 | bool pending_job; |
| 155 | bool pending_sync; |
Fabiano Rosas | 9f0e108 | 2024-08-27 14:45:54 -0300 | [diff] [blame] | 156 | MultiFDSendData *data; |
Juan Quintela | 4a8f19c | 2022-05-31 12:43:06 +0200 | [diff] [blame] | 157 | |
| 158 | /* thread local variables. No locking required */ |
| 159 | |
| 160 | /* pointer to the packet */ |
| 161 | MultiFDPacket_t *packet; |
| 162 | /* size of the next packet that contains pages */ |
| 163 | uint32_t next_packet_size; |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 164 | /* packets sent through this channel */ |
Peter Xu | 05b7ec1 | 2024-02-02 18:28:43 +0800 | [diff] [blame] | 165 | uint64_t packets_sent; |
Juan Quintela | 226468b | 2021-11-19 12:06:05 +0100 | [diff] [blame] | 166 | /* buffers to send */ |
| 167 | struct iovec *iov; |
| 168 | /* number of iovs used */ |
| 169 | uint32_t iovs_num; |
Juan Quintela | ab7cbb0 | 2019-05-15 13:37:46 +0200 | [diff] [blame] | 170 | /* used for compression methods */ |
Fabiano Rosas | 402dd7a | 2024-02-29 12:30:06 -0300 | [diff] [blame] | 171 | void *compress_data; |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 172 | } MultiFDSendParams; |
| 173 | |
| 174 | typedef struct { |
Juan Quintela | 4a8f19c | 2022-05-31 12:43:06 +0200 | [diff] [blame] | 175 | /* Fields are only written at creating/deletion time */ |
| 176 | /* No lock required for them, they are read only */ |
| 177 | |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 178 | /* channel number */ |
| 179 | uint8_t id; |
| 180 | /* channel thread name */ |
| 181 | char *name; |
| 182 | /* channel thread id */ |
| 183 | QemuThread thread; |
Fabiano Rosas | a2a63c4 | 2024-02-06 18:51:14 -0300 | [diff] [blame] | 184 | bool thread_created; |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 185 | /* communication channel */ |
| 186 | QIOChannel *c; |
Juan Quintela | 4a8f19c | 2022-05-31 12:43:06 +0200 | [diff] [blame] | 187 | /* packet allocated len */ |
| 188 | uint32_t packet_len; |
| 189 | |
| 190 | /* syncs main thread and channels */ |
| 191 | QemuSemaphore sem_sync; |
Fabiano Rosas | d117ed0 | 2024-02-29 12:30:09 -0300 | [diff] [blame] | 192 | /* sem where to wait for more work */ |
| 193 | QemuSemaphore sem; |
Juan Quintela | 4a8f19c | 2022-05-31 12:43:06 +0200 | [diff] [blame] | 194 | |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 195 | /* this mutex protects the following parameters */ |
| 196 | QemuMutex mutex; |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 197 | /* should this thread finish */ |
| 198 | bool quit; |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 199 | /* multifd flags for each packet */ |
| 200 | uint32_t flags; |
| 201 | /* global number of generated multifd packets */ |
| 202 | uint64_t packet_num; |
Fabiano Rosas | d117ed0 | 2024-02-29 12:30:09 -0300 | [diff] [blame] | 203 | int pending_job; |
| 204 | MultiFDRecvData *data; |
Juan Quintela | 4a8f19c | 2022-05-31 12:43:06 +0200 | [diff] [blame] | 205 | |
| 206 | /* thread local variables. No locking required */ |
| 207 | |
| 208 | /* pointer to the packet */ |
| 209 | MultiFDPacket_t *packet; |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 210 | /* size of the next packet that contains pages */ |
| 211 | uint32_t next_packet_size; |
Peter Xu | 05b7ec1 | 2024-02-02 18:28:43 +0800 | [diff] [blame] | 212 | /* packets received through this channel */ |
| 213 | uint64_t packets_recved; |
Lukas Straub | 5d1d1fc | 2023-05-08 21:11:07 +0200 | [diff] [blame] | 214 | /* ramblock */ |
| 215 | RAMBlock *block; |
Juan Quintela | 4a8f19c | 2022-05-31 12:43:06 +0200 | [diff] [blame] | 216 | /* ramblock host address */ |
| 217 | uint8_t *host; |
Juan Quintela | 226468b | 2021-11-19 12:06:05 +0100 | [diff] [blame] | 218 | /* buffers to recv */ |
| 219 | struct iovec *iov; |
Juan Quintela | cf2d4aa | 2021-11-22 13:41:06 +0100 | [diff] [blame] | 220 | /* Pages that are not zero */ |
| 221 | ram_addr_t *normal; |
| 222 | /* num of non zero pages */ |
| 223 | uint32_t normal_num; |
Hao Xiang | 303e6f5 | 2024-03-11 18:00:12 +0000 | [diff] [blame] | 224 | /* Pages that are zero */ |
| 225 | ram_addr_t *zero; |
| 226 | /* num of zero pages */ |
| 227 | uint32_t zero_num; |
Juan Quintela | ab7cbb0 | 2019-05-15 13:37:46 +0200 | [diff] [blame] | 228 | /* used for de-compression methods */ |
Fabiano Rosas | 402dd7a | 2024-02-29 12:30:06 -0300 | [diff] [blame] | 229 | void *compress_data; |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 230 | } MultiFDRecvParams; |
| 231 | |
Juan Quintela | ab7cbb0 | 2019-05-15 13:37:46 +0200 | [diff] [blame] | 232 | typedef struct { |
Fabiano Rosas | 62e1af1 | 2024-08-28 11:56:50 -0300 | [diff] [blame] | 233 | /* |
| 234 | * The send_setup, send_cleanup, send_prepare are only called on |
| 235 | * the QEMU instance at the migration source. |
| 236 | */ |
| 237 | |
| 238 | /* |
| 239 | * Setup for sending side. Called once per channel during channel |
| 240 | * setup phase. |
| 241 | * |
| 242 | * Must allocate p->iov. If packets are in use (default), one |
| 243 | * extra iovec must be allocated for the packet header. Any memory |
| 244 | * allocated in this hook must be released at send_cleanup. |
| 245 | * |
| 246 | * p->write_flags may be used for passing flags to the QIOChannel. |
| 247 | * |
| 248 | * p->compression_data may be used by compression methods to store |
| 249 | * compression data. |
| 250 | */ |
Juan Quintela | ab7cbb0 | 2019-05-15 13:37:46 +0200 | [diff] [blame] | 251 | int (*send_setup)(MultiFDSendParams *p, Error **errp); |
Fabiano Rosas | 62e1af1 | 2024-08-28 11:56:50 -0300 | [diff] [blame] | 252 | |
| 253 | /* |
| 254 | * Cleanup for sending side. Called once per channel during |
| 255 | * channel cleanup phase. |
| 256 | */ |
Juan Quintela | ab7cbb0 | 2019-05-15 13:37:46 +0200 | [diff] [blame] | 257 | void (*send_cleanup)(MultiFDSendParams *p, Error **errp); |
Fabiano Rosas | 62e1af1 | 2024-08-28 11:56:50 -0300 | [diff] [blame] | 258 | |
| 259 | /* |
| 260 | * Prepare the send packet. Called as a result of multifd_send() |
| 261 | * on the client side, with p pointing to the MultiFDSendParams of |
| 262 | * a channel that is currently idle. |
| 263 | * |
| 264 | * Must populate p->iov with the data to be sent, increment |
| 265 | * p->iovs_num to match the amount of iovecs used and set |
| 266 | * p->next_packet_size with the amount of data currently present |
| 267 | * in p->iov. |
| 268 | * |
| 269 | * Must indicate whether this is a compression packet by setting |
| 270 | * p->flags. |
| 271 | * |
| 272 | * As a last step, if packets are in use (default), must prepare |
| 273 | * the packet by calling multifd_send_fill_packet(). |
| 274 | */ |
Juan Quintela | 02fb810 | 2021-11-22 12:08:08 +0100 | [diff] [blame] | 275 | int (*send_prepare)(MultiFDSendParams *p, Error **errp); |
Fabiano Rosas | 62e1af1 | 2024-08-28 11:56:50 -0300 | [diff] [blame] | 276 | |
| 277 | /* |
| 278 | * The recv_setup, recv_cleanup, recv are only called on the QEMU |
| 279 | * instance at the migration destination. |
| 280 | */ |
| 281 | |
| 282 | /* |
| 283 | * Setup for receiving side. Called once per channel during |
| 284 | * channel setup phase. May be empty. |
| 285 | * |
| 286 | * May allocate data structures for the receiving of data. May use |
| 287 | * p->iov. Compression methods may use p->compress_data. |
| 288 | */ |
Juan Quintela | ab7cbb0 | 2019-05-15 13:37:46 +0200 | [diff] [blame] | 289 | int (*recv_setup)(MultiFDRecvParams *p, Error **errp); |
Fabiano Rosas | 62e1af1 | 2024-08-28 11:56:50 -0300 | [diff] [blame] | 290 | |
| 291 | /* |
| 292 | * Cleanup for receiving side. Called once per channel during |
| 293 | * channel cleanup phase. May be empty. |
| 294 | */ |
Juan Quintela | ab7cbb0 | 2019-05-15 13:37:46 +0200 | [diff] [blame] | 295 | void (*recv_cleanup)(MultiFDRecvParams *p); |
Fabiano Rosas | 62e1af1 | 2024-08-28 11:56:50 -0300 | [diff] [blame] | 296 | |
| 297 | /* |
| 298 | * Data receive method. Called as a result of multifd_recv() on |
| 299 | * the client side, with p pointing to the MultiFDRecvParams of a |
| 300 | * channel that is currently idle. Only called if there is data |
| 301 | * available to receive. |
| 302 | * |
| 303 | * Must validate p->flags according to what was set at |
| 304 | * send_prepare. |
| 305 | * |
| 306 | * Must read the data from the QIOChannel p->c. |
| 307 | */ |
Fabiano Rosas | 9db1912 | 2024-02-29 12:30:07 -0300 | [diff] [blame] | 308 | int (*recv)(MultiFDRecvParams *p, Error **errp); |
Juan Quintela | ab7cbb0 | 2019-05-15 13:37:46 +0200 | [diff] [blame] | 309 | } MultiFDMethods; |
| 310 | |
Fabiano Rosas | 308d165 | 2024-08-27 14:46:04 -0300 | [diff] [blame] | 311 | void multifd_register_ops(int method, const MultiFDMethods *ops); |
Peter Xu | 25a1f87 | 2024-02-02 18:28:47 +0800 | [diff] [blame] | 312 | void multifd_send_fill_packet(MultiFDSendParams *p); |
Hao Xiang | 303e6f5 | 2024-03-11 18:00:12 +0000 | [diff] [blame] | 313 | bool multifd_send_prepare_common(MultiFDSendParams *p); |
| 314 | void multifd_send_zero_page_detect(MultiFDSendParams *p); |
| 315 | void multifd_recv_zero_page_process(MultiFDRecvParams *p); |
Juan Quintela | 7ec2c2b | 2019-01-04 15:30:06 +0100 | [diff] [blame] | 316 | |
Peter Xu | 452b205 | 2024-02-02 18:28:46 +0800 | [diff] [blame] | 317 | static inline void multifd_send_prepare_header(MultiFDSendParams *p) |
| 318 | { |
| 319 | p->iov[0].iov_len = p->packet_len; |
| 320 | p->iov[0].iov_base = p->packet; |
| 321 | p->iovs_num++; |
| 322 | } |
| 323 | |
Fabiano Rosas | b7b03eb | 2024-02-29 12:30:11 -0300 | [diff] [blame] | 324 | void multifd_channel_connect(MultiFDSendParams *p, QIOChannel *ioc); |
Fabiano Rosas | 40c9471 | 2024-08-27 14:46:03 -0300 | [diff] [blame] | 325 | bool multifd_send(MultiFDSendData **send_data); |
| 326 | MultiFDSendData *multifd_send_data_alloc(void); |
Peter Xu | 452b205 | 2024-02-02 18:28:46 +0800 | [diff] [blame] | 327 | |
Fabiano Rosas | 90fa121 | 2024-08-27 14:45:49 -0300 | [diff] [blame] | 328 | static inline uint32_t multifd_ram_page_size(void) |
| 329 | { |
| 330 | return qemu_target_page_size(); |
| 331 | } |
| 332 | |
| 333 | static inline uint32_t multifd_ram_page_count(void) |
| 334 | { |
| 335 | return MULTIFD_PACKET_SIZE / qemu_target_page_size(); |
| 336 | } |
Fabiano Rosas | a71ef5c | 2024-08-27 14:45:59 -0300 | [diff] [blame] | 337 | |
| 338 | void multifd_ram_save_setup(void); |
| 339 | void multifd_ram_save_cleanup(void); |
Fabiano Rosas | a0c78d8 | 2024-08-27 14:46:00 -0300 | [diff] [blame] | 340 | int multifd_ram_flush_and_sync(void); |
Fabiano Rosas | 40c9471 | 2024-08-27 14:46:03 -0300 | [diff] [blame] | 341 | size_t multifd_ram_payload_size(void); |
| 342 | void multifd_ram_fill_packet(MultiFDSendParams *p); |
| 343 | int multifd_ram_unfill_packet(MultiFDRecvParams *p, Error **errp); |
Juan Quintela | d32ca5a | 2020-01-22 16:16:07 +0100 | [diff] [blame] | 344 | #endif |