[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 1/1] Fix to show vfio migration stat in migration status
From: |
Alex Williamson |
Subject: |
Re: [PATCH v2 1/1] Fix to show vfio migration stat in migration status |
Date: |
Wed, 2 Dec 2020 12:24:32 -0700 |
On Wed, 2 Dec 2020 00:43:14 +0530
Kirti Wankhede <kwankhede@nvidia.com> wrote:
> Header file where CONFIG_VFIO is defined is not included in migration.c
> file.
>
> Moved populate_vfio_info() to hw/vfio/common.c file. Added its stub in
> stubs/vfio.c file. Updated header files and meson file accordingly.
>
> Fixes: 3710586caa5d ("qapi: Add VFIO devices migration stats in Migration
> stats")
>
> Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
> ---
> hw/vfio/common.c | 12 +++++++++++-
> include/hw/vfio/vfio-common.h | 1 -
> include/hw/vfio/vfio.h | 2 ++
> migration/migration.c | 16 +---------------
> stubs/meson.build | 1 +
> stubs/vfio.c | 7 +++++++
> 6 files changed, 22 insertions(+), 17 deletions(-)
> create mode 100644 stubs/vfio.c
>
> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
> index 6ff1daa763f8..4868c0fef504 100644
> --- a/hw/vfio/common.c
> +++ b/hw/vfio/common.c
> @@ -25,6 +25,7 @@
> #endif
> #include <linux/vfio.h>
>
> +#include "qapi/qapi-types-migration.h"
> #include "hw/vfio/vfio-common.h"
> #include "hw/vfio/vfio.h"
> #include "exec/address-spaces.h"
> @@ -292,7 +293,7 @@ const MemoryRegionOps vfio_region_ops = {
> * Device state interfaces
> */
>
> -bool vfio_mig_active(void)
> +static bool vfio_mig_active(void)
> {
> VFIOGroup *group;
> VFIODevice *vbasedev;
> @@ -311,6 +312,15 @@ bool vfio_mig_active(void)
> return true;
> }
>
> +void populate_vfio_info(MigrationInfo *info)
> +{
> + if (vfio_mig_active()) {
> + info->has_vfio = true;
> + info->vfio = g_malloc0(sizeof(*info->vfio));
> + info->vfio->transferred = vfio_mig_bytes_transferred();
> + }
> +}
> +
> static bool vfio_devices_all_saving(VFIOContainer *container)
> {
> VFIOGroup *group;
> diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
> index 6141162d7aea..cc47bd7d4456 100644
> --- a/include/hw/vfio/vfio-common.h
> +++ b/include/hw/vfio/vfio-common.h
> @@ -205,7 +205,6 @@ extern const MemoryRegionOps vfio_region_ops;
> typedef QLIST_HEAD(VFIOGroupList, VFIOGroup) VFIOGroupList;
> extern VFIOGroupList vfio_group_list;
>
> -bool vfio_mig_active(void);
> int64_t vfio_mig_bytes_transferred(void);
>
> #ifdef CONFIG_LINUX
> diff --git a/include/hw/vfio/vfio.h b/include/hw/vfio/vfio.h
> index 86248f54360a..d1e6f4b26f35 100644
> --- a/include/hw/vfio/vfio.h
> +++ b/include/hw/vfio/vfio.h
> @@ -4,4 +4,6 @@
> bool vfio_eeh_as_ok(AddressSpace *as);
> int vfio_eeh_as_op(AddressSpace *as, uint32_t op);
>
> +void populate_vfio_info(MigrationInfo *info);
> +
> #endif
> diff --git a/migration/migration.c b/migration/migration.c
> index 87a9b59f83f4..c164594c1d8d 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -56,10 +56,7 @@
> #include "net/announce.h"
> #include "qemu/queue.h"
> #include "multifd.h"
> -
> -#ifdef CONFIG_VFIO
> -#include "hw/vfio/vfio-common.h"
> -#endif
> +#include "hw/vfio/vfio.h"
>
> #define MAX_THROTTLE (128 << 20) /* Migration transfer speed
> throttling */
>
> @@ -1041,17 +1038,6 @@ static void populate_disk_info(MigrationInfo *info)
> }
> }
>
> -static void populate_vfio_info(MigrationInfo *info)
> -{
> -#ifdef CONFIG_VFIO
> - if (vfio_mig_active()) {
> - info->has_vfio = true;
> - info->vfio = g_malloc0(sizeof(*info->vfio));
> - info->vfio->transferred = vfio_mig_bytes_transferred();
> - }
> -#endif
> -}
> -
> static void fill_source_migration_info(MigrationInfo *info)
> {
> MigrationState *s = migrate_get_current();
> diff --git a/stubs/meson.build b/stubs/meson.build
> index 82b7ba60abe5..909956674847 100644
> --- a/stubs/meson.build
> +++ b/stubs/meson.build
> @@ -53,3 +53,4 @@ if have_system
> stub_ss.add(files('semihost.c'))
> stub_ss.add(files('xen-hw-stub.c'))
> endif
> +stub_ss.add(files('vfio.c'))
> diff --git a/stubs/vfio.c b/stubs/vfio.c
> new file mode 100644
> index 000000000000..9cc8753cd102
> --- /dev/null
> +++ b/stubs/vfio.c
> @@ -0,0 +1,7 @@
> +#include "qemu/osdep.h"
> +#include "qapi/qapi-types-migration.h"
> +#include "hw/vfio/vfio.h"
> +
> +void populate_vfio_info(MigrationInfo *info)
> +{
> +}
[989/8466] Compiling C object libqemu-s390x-softmmu.fa.p/hw_vfio_ap.c.o
FAILED: libqemu-s390x-softmmu.fa.p/hw_vfio_ap.c.o
cc -Ilibqemu-s390x-softmmu.fa.p -I. -I.. -Itarget/s390x -I../target/s390x
-Iqapi -Itrace -Iui -Iui/shader -I/usr/include/spice-1
-I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0
-I/usr/lib64/glib-2.0/include -I/usr/include/nss3 -I/usr/include/nspr4
-I/usr/include/libmount -I/usr/include/blkid -I/usr/include/pixman-1
-I/usr/include/capstone -fdiagnostics-color=auto -pipe -Wall -Winvalid-pch
-std=gnu99 -O2 -g -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -m64 -mcx16
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes
-Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes
-fno-strict-aliasing -fno-common -fwrapv -Wold-style-declaration
-Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self
-Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels
-Wexpansion-to-defined -Wno-missing-include-dirs -Wno-shift-negative-value
-Wno-psabi -fstack-protector-strong -isystem /tmp/tmp.JZOEQpImbX/linux-headers
-isystem linux-headers -iquote /tmp/tmp.JZOEQpImbX/tcg/i386 -iquote . -iquote
/tmp/tmp.JZOEQpImbX -iquote /tmp/tmp.JZOEQpImbX/accel/tcg -iquote
/tmp/tmp.JZOEQpImbX/include -iquote /tmp/tmp.JZOEQpImbX/disas/libvixl -pthread
-fPIC -isystem../linux-headers -isystemlinux-headers -DNEED_CPU_H
'-DCONFIG_TARGET="s390x-softmmu-config-target.h"'
'-DCONFIG_DEVICES="s390x-softmmu-config-devices.h"' -MD -MQ
libqemu-s390x-softmmu.fa.p/hw_vfio_ap.c.o -MF
libqemu-s390x-softmmu.fa.p/hw_vfio_ap.c.o.d -o
libqemu-s390x-softmmu.fa.p/hw_vfio_ap.c.o -c ../hw/vfio/ap.c
In file included from ../hw/vfio/ap.c:18:
/tmp/tmp.JZOEQpImbX/include/hw/vfio/vfio.h:7:25: error: unknown type name
‘MigrationInfo’
7 | void populate_vfio_info(MigrationInfo *info);
| ^~~~~~~~~~~~~