[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH V5 16/25] vfio-pci: cpr part 1
From: |
Steven Sistare |
Subject: |
Re: [PATCH V5 16/25] vfio-pci: cpr part 1 |
Date: |
Fri, 30 Jul 2021 08:50:14 -0400 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 |
On 7/28/2021 12:56 AM, Zheng Chuan wrote:
> On 2021/7/8 1:20, Steve Sistare wrote:
>> Enable vfio-pci devices to be saved and restored across an exec restart
>> of qemu.
>>
>> [...]
>> --- a/migration/cpr.c
>> +++ b/migration/cpr.c
>> @@ -31,6 +31,13 @@
>> #include "hw/virtio/vhost.h"
>> #include "qemu/env.h"
>>
>> +static CprMode cpr_active_mode = CPR_MODE_NONE;
>> +
>> +CprMode cpr_mode(void)
>> +{
>> + return cpr_active_mode;
>> +}
>> +
>> QEMUFile *qf_file_open(const char *path, int flags, int mode,
>> const char *name, Error **errp)
>> {
>> @@ -92,6 +99,7 @@ void cprsave(const char *file, CprMode mode, Error **errp)
>> }
>> vm_stop(RUN_STATE_SAVE_VM);
>>
>> + cpr_active_mode = mode;
>> ret = qemu_save_device_state(f);
>> qemu_fclose(f);
>> if (ret < 0) {
>> @@ -105,6 +113,7 @@ err:
>> if (saved_vm_running) {
>> vm_start();
>> }
>> + cpr_active_mode = CPR_MODE_NONE;
>> done:
>> return;
>> }
>> @@ -125,6 +134,13 @@ void cprexec(strList *args, Error **errp)
>> error_setg(errp, "runstate is not save-vm");
>> return;
>> }
>> + if (cpr_active_mode != CPR_MODE_RESTART) {
>> + error_setg(errp, "cprexec requires cprsave with restart mode");
>> + return;
>> + }
>> + if (vfio_cprsave(errp)) {
>> + return;
>> + }
>> walkenv(FD_PREFIX, preserve_fd, 0);
>> qemu_system_exec_request(args);
>> }
>> @@ -158,6 +174,10 @@ void cprload(const char *file, Error **errp)
>> return;
>> }
>>
>> + if (vfio_cprload(errp)) {
>> + return;
>> + }
>> +
> It will compile failed in some targets without vfio support such as m68k.
> Maybe CONFIG_VFIO should be added for vfio_{save, load}.
>
>> state = global_state_get_runstate();
>> if (state == RUN_STATE_RUNNING) {
>> vm_start();
Thank-you Zheng. I will fix this and the other mistakes you found.
- Steve
- [PATCH V5 19/25] hostmem-memfd: cpr support, (continued)
[PATCH V5 16/25] vfio-pci: cpr part 1, Steve Sistare, 2021/07/07
[PATCH V5 17/25] vfio-pci: cpr part 2, Steve Sistare, 2021/07/07
- Re: [PATCH V5 17/25] vfio-pci: cpr part 2, Alex Williamson, 2021/07/16
- Re: [PATCH V5 17/25] vfio-pci: cpr part 2, Steven Sistare, 2021/07/19
- Re: [PATCH V5 17/25] vfio-pci: cpr part 2, Alex Williamson, 2021/07/19
- Re: [PATCH V5 17/25] vfio-pci: cpr part 2, Steven Sistare, 2021/07/19
- Re: [PATCH V5 17/25] vfio-pci: cpr part 2, Zheng Chuan, 2021/07/28
- Re: [PATCH V5 17/25] vfio-pci: cpr part 2, Steven Sistare, 2021/07/30
- Re: [PATCH V5 17/25] vfio-pci: cpr part 2, Zheng Chuan, 2021/07/31
[PATCH V5 14/25] pci: export functions for cpr, Steve Sistare, 2021/07/07
[PATCH V5 15/25] vfio-pci: refactor for cpr, Steve Sistare, 2021/07/07