From: Alex Williamson <alex.williamson@redhat.com>
To: Kirti Wankhede <kwankhede@nvidia.com>
Cc: cjia@nvidia.com, quintela@redhat.com, qemu-devel@nongnu.org,
dgilbert@redhat.com, dnigam@nvidia.com, pbonzini@redhat.com
Subject: Re: [PATCH v2 1/1] Fix to show vfio migration stat in migration status
Date: Wed, 2 Dec 2020 12:24:32 -0700 [thread overview]
Message-ID: <20201202122432.73aa3d12@w520.home> (raw)
In-Reply-To: <1606849994-10625-1-git-send-email-kwankhede@nvidia.com>
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);
| ^~~~~~~~~~~~~
prev parent reply other threads:[~2020-12-02 19:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-01 19:13 [PATCH v2 1/1] Fix to show vfio migration stat in migration status Kirti Wankhede
2020-12-02 19:24 ` Alex Williamson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201202122432.73aa3d12@w520.home \
--to=alex.williamson@redhat.com \
--cc=cjia@nvidia.com \
--cc=dgilbert@redhat.com \
--cc=dnigam@nvidia.com \
--cc=kwankhede@nvidia.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).