[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH V6 18/27] vfio-pci: refactor for cpr
From: |
Steven Sistare |
Subject: |
Re: [PATCH V6 18/27] vfio-pci: refactor for cpr |
Date: |
Mon, 23 Aug 2021 12:52:39 -0400 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 |
Thanks for reviewing, and sorry for the delayed response, I just returned from
vacation.
On 8/10/2021 12:53 PM, Alex Williamson wrote:
> On Fri, 6 Aug 2021 14:43:52 -0700
> Steve Sistare <steven.sistare@oracle.com> wrote:
>
>> Export vfio_address_spaces and vfio_listener_skipped_section.
>> Add optional name arg to vfio_add_kvm_msi_virq.
>> Refactor vector use into a helper vfio_vector_init.
>> All for use by cpr in a subsequent patch. No functional change.
>
> Why is the name arg optional? It seems really inconsistent to me that
> everything other than MSI/X uses this with a name, but MSI/X use NULL
> and in an entirely separate pre-save step we then iterate through all
> the {event,irq}fds to save them. If we asked for a named notifier,
> shouldn't we go ahead and save it under that name at that time? ie.
>
> static int vfio_named_notifier_init(VFIOPCIDevice *vdev, EventNotifier *e,
> const char *name, int nr)
> {
> int ret, fd = load_event_fd(vdev, name, nr);
>
> if (fd >= 0) {
> event_notifier_init_fd(e, fd);
> } else {
> ret = event_notifier_init(e, 0);
> if (ret) {
> return ret;
> }
> save_event_fd(vdev, name, nr, e);
> }
> return 0;
> }
>
> Are we not doing this to avoid runtime overhead?
OK, I will delete the pre-save function and align the life-cycle of the fd and
the event
notifier. (Currently the vfio-pci code does not call cpr_delete_fd.)
> In the process, maybe we can use more descriptive names than
> "interrupt", ex. "msi" or "msix".
I chose "interrupt" and "kvm_interrupt" to match the names of the corresponding
VFIOMSIVector fields. Ditto for intx-interrupt, intx-unmask, err, and req, with
minor differences.
> It also feels a bit forced to me that the entire fd saving uses {name,
> id} but vfio is the only caller that makes use of a non-zero id.
> Should we instead just wrap all the calls from vfio to append the id to
> the name so the common code can just use strcmp()? Thanks,
I liked the simplification in the vfio code, but I will remove the id if you
prefer,
and add g_autoptr and g_strdup_printf to each call site.
- Steve
- [PATCH V6 10/27] machine: memfd-alloc option, (continued)
- [PATCH V6 10/27] machine: memfd-alloc option, Steve Sistare, 2021/08/06
- [PATCH V6 11/27] qapi: list utility functions, Steve Sistare, 2021/08/06
- [PATCH V6 12/27] vl: helper to request re-exec, Steve Sistare, 2021/08/06
- [PATCH V6 13/27] cpr: preserve extra state, Steve Sistare, 2021/08/06
- [PATCH V6 14/27] cpr: restart mode, Steve Sistare, 2021/08/06
- [PATCH V6 15/27] cpr: restart HMP interfaces, Steve Sistare, 2021/08/06
- [PATCH V6 16/27] hostmem-memfd: cpr for memory-backend-memfd, Steve Sistare, 2021/08/06
- [PATCH V6 17/27] pci: export functions for cpr, Steve Sistare, 2021/08/06
- [PATCH V6 18/27] vfio-pci: refactor for cpr, Steve Sistare, 2021/08/06
- [PATCH V6 20/27] vfio-pci: cpr part 2 (msi), Steve Sistare, 2021/08/06
- [PATCH V6 19/27] vfio-pci: cpr part 1 (fd and dma), Steve Sistare, 2021/08/06
- [PATCH V6 22/27] vhost: reset vhost devices for cpr, Steve Sistare, 2021/08/06
- [PATCH V6 23/27] chardev: cpr framework, Steve Sistare, 2021/08/06
- [PATCH V6 25/27] chardev: cpr for pty, Steve Sistare, 2021/08/06
- [PATCH V6 26/27] chardev: cpr for sockets, Steve Sistare, 2021/08/06
- [PATCH V6 27/27] cpr: only-cpr-capable option, Steve Sistare, 2021/08/06
- [PATCH V6 01/27] memory: qemu_check_ram_volatile, Steve Sistare, 2021/08/06