Message ID | 20200626164307.3327380-9-dinechin@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | RFC: Move SPICE to a load module | expand |
On Fri, Jun 26, 2020 at 06:43:05PM +0200, Christophe de Dinechin wrote: > Instead of adding the spice build flags to the top-level build > options, add them where they are necessary. This is a step to move the > burden of linking with spice libraries away from the top-level qemu. > > Signed-off-by: Christophe de Dinechin <dinechin@redhat.com> > --- > configure | 4 ++-- > hw/display/Makefile.objs | 1 + > hw/i386/Makefile.objs | 1 + > monitor/Makefile.objs | 3 +++ > softmmu/Makefile.objs | 2 +- > stubs/Makefile.objs | 2 +- > ui/Makefile.objs | 4 ++-- > util/module.c | 13 +++++++++++-- > 8 files changed, 22 insertions(+), 8 deletions(-) > diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs > index f32b9e47a3..1df8bb3814 100644 > --- a/stubs/Makefile.objs > +++ b/stubs/Makefile.objs > @@ -19,10 +19,10 @@ stub-obj-y += replay.o > stub-obj-y += runstate-check.o > stub-obj-$(CONFIG_SOFTMMU) += semihost.o > stub-obj-y += set-fd-handler.o > -stub-obj-y += vmgenid.o > stub-obj-y += sysbus.o > stub-obj-y += tpm.o > stub-obj-y += trace-control.o > +stub-obj-y += vmgenid.o > stub-obj-y += vmstate.o > stub-obj-$(CONFIG_SOFTMMU) += win32-kbd-hook.o > This looks unrelated to this series. > diff --git a/util/module.c b/util/module.c > index 2fa93561fe..29b4806520 100644 > --- a/util/module.c > +++ b/util/module.c > @@ -22,11 +22,11 @@ > #ifdef CONFIG_MODULE_UPGRADES > #include "qemu-version.h" > #endif > -#ifdef CONFIG_TRACE_RECORDER > #include "trace/recorder.h" > -#endif > > > +RECORDER(modules, 16, "QEMU load modules"); > + > typedef struct ModuleEntry > { > void (*init)(void); > @@ -85,6 +85,15 @@ void register_dso_module_init(void (*fn)(void), module_init_type type) > { > ModuleEntry *e; > > +#ifdef CONFIG_TRACE_RECORDER > + static const char *name[] = { > + "MIGRATION", "BLOCK", "OPTS", "QOM", > + "TRACE", "XEN_BACKEND", "LIBQOS", "FUZZ_TARGET", > + "MAX" > + }; > +#endif > + record(modules, "Register DSO module init %p type %u %+s", > + fn, type, name[type]); > init_lists(); This looks unrelated too, but in general debugging should go via QEMU's standard trace backends. Regards, Daniel
On 2020-06-26 at 19:26 CEST, Daniel P. Berrangé wrote... > On Fri, Jun 26, 2020 at 06:43:05PM +0200, Christophe de Dinechin wrote: >> Instead of adding the spice build flags to the top-level build >> options, add them where they are necessary. This is a step to move the >> burden of linking with spice libraries away from the top-level qemu. >> >> Signed-off-by: Christophe de Dinechin <dinechin@redhat.com> >> --- >> configure | 4 ++-- >> hw/display/Makefile.objs | 1 + >> hw/i386/Makefile.objs | 1 + >> monitor/Makefile.objs | 3 +++ >> softmmu/Makefile.objs | 2 +- >> stubs/Makefile.objs | 2 +- >> ui/Makefile.objs | 4 ++-- >> util/module.c | 13 +++++++++++-- >> 8 files changed, 22 insertions(+), 8 deletions(-) > >> diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs >> index f32b9e47a3..1df8bb3814 100644 >> --- a/stubs/Makefile.objs >> +++ b/stubs/Makefile.objs >> @@ -19,10 +19,10 @@ stub-obj-y += replay.o >> stub-obj-y += runstate-check.o >> stub-obj-$(CONFIG_SOFTMMU) += semihost.o >> stub-obj-y += set-fd-handler.o >> -stub-obj-y += vmgenid.o >> stub-obj-y += sysbus.o >> stub-obj-y += tpm.o >> stub-obj-y += trace-control.o >> +stub-obj-y += vmgenid.o >> stub-obj-y += vmstate.o >> stub-obj-$(CONFIG_SOFTMMU) += win32-kbd-hook.o >> > > This looks unrelated to this series. I'll send a separate trivial patch to fix the alphabetical ordering. I used to have a spice.c stub here, which conflicted every time. This is how I noticed the alphabetical order was not respected here. > > > >> diff --git a/util/module.c b/util/module.c >> index 2fa93561fe..29b4806520 100644 >> --- a/util/module.c >> +++ b/util/module.c >> @@ -22,11 +22,11 @@ >> #ifdef CONFIG_MODULE_UPGRADES >> #include "qemu-version.h" >> #endif >> -#ifdef CONFIG_TRACE_RECORDER >> #include "trace/recorder.h" >> -#endif >> >> >> +RECORDER(modules, 16, "QEMU load modules"); >> + >> typedef struct ModuleEntry >> { >> void (*init)(void); >> @@ -85,6 +85,15 @@ void register_dso_module_init(void (*fn)(void), module_init_type type) >> { >> ModuleEntry *e; >> >> +#ifdef CONFIG_TRACE_RECORDER >> + static const char *name[] = { >> + "MIGRATION", "BLOCK", "OPTS", "QOM", >> + "TRACE", "XEN_BACKEND", "LIBQOS", "FUZZ_TARGET", >> + "MAX" >> + }; >> +#endif >> + record(modules, "Register DSO module init %p type %u %+s", >> + fn, type, name[type]); >> init_lists(); > > This looks unrelated too, but in general debugging should go via QEMU's > standard trace backends. > Yes. I apparently botched a fixup. That was supposed to be a private patch for my own use. -- Cheers, Christophe de Dinechin (IRC c3d)
Hi, > obj-$(CONFIG_PC) += pc.o pc_sysfw.o > +pc.o-cflags += $(SPICE_CFLAGS) Hmm, looks strange. Why does pc.c need spice? > +qmp-cmds.o-cflags += $(SPICE_CFLAGS) > +hmp-cmds.o-cflags += $(SPICE_CFLAGS) spice monitor commands need this I guess? > +misc.o-cflags += $(SPICE_CFLAGS) Why this? > +vl.o-cflags := $(GPROF_CFLAGS) $(SDL_CFLAGS) $(SPICE_CFLAGS) spice init probably. > -stub-obj-y += vmgenid.o > stub-obj-y += sysbus.o > stub-obj-y += tpm.o > stub-obj-y += trace-control.o > +stub-obj-y += vmgenid.o Huh? > -spice-app.mo-cflags := $(GIO_CFLAGS) > -spice-app.mo-libs := $(GIO_LIBS) > +spice-app.mo-cflags := $(GIO_CFLAGS) $(SPICE_CFLAGS) > +spice-app.mo-libs := $(GIO_LIBS) $(SPICE_LIBS) Good. > --- a/util/module.c > +++ b/util/module.c > @@ -22,11 +22,11 @@ > #ifdef CONFIG_MODULE_UPGRADES > #include "qemu-version.h" > #endif > -#ifdef CONFIG_TRACE_RECORDER > #include "trace/recorder.h" > -#endif > > > +RECORDER(modules, 16, "QEMU load modules"); > + > typedef struct ModuleEntry > { > void (*init)(void); > @@ -85,6 +85,15 @@ void register_dso_module_init(void (*fn)(void), module_init_type type) > { > ModuleEntry *e; > > +#ifdef CONFIG_TRACE_RECORDER > + static const char *name[] = { > + "MIGRATION", "BLOCK", "OPTS", "QOM", > + "TRACE", "XEN_BACKEND", "LIBQOS", "FUZZ_TARGET", > + "MAX" > + }; > +#endif > + record(modules, "Register DSO module init %p type %u %+s", > + fn, type, name[type]); > init_lists(); > > e = g_malloc0(sizeof(*e)); Unrelated change. (the recorder stuff should probably integrate with qemu trace support, so you can record any trace point qemu has, but that'll be another patch series ...) take care, Gerd
On 2020-06-30 at 01:08 CEST, Gerd Hoffmann wrote... > Hi, > >> obj-$(CONFIG_PC) += pc.o pc_sysfw.o >> +pc.o-cflags += $(SPICE_CFLAGS) > > Hmm, looks strange. Why does pc.c need spice? It includes ui/qemu-spice.h, and I did not check why. Turns out this is not needed. So I'll remove it. > >> +qmp-cmds.o-cflags += $(SPICE_CFLAGS) >> +hmp-cmds.o-cflags += $(SPICE_CFLAGS) > > spice monitor commands need this I guess? Yes. > >> +misc.o-cflags += $(SPICE_CFLAGS) > > Why this? qemu_using_spice and qemu_spice_migrate_info > >> +vl.o-cflags := $(GPROF_CFLAGS) $(SDL_CFLAGS) $(SPICE_CFLAGS) > > spice init probably Yes. . > >> -stub-obj-y += vmgenid.o >> stub-obj-y += sysbus.o >> stub-obj-y += tpm.o >> stub-obj-y += trace-control.o >> +stub-obj-y += vmgenid.o > > Huh? I sent it separately as a trivial patch. Wrong alphabetical order, and where that change was placed was causing a conflict on each rebase with a spice.c stub I had at some point "at the right spot" ;-) > >> -spice-app.mo-cflags := $(GIO_CFLAGS) >> -spice-app.mo-libs := $(GIO_LIBS) >> +spice-app.mo-cflags := $(GIO_CFLAGS) $(SPICE_CFLAGS) >> +spice-app.mo-libs := $(GIO_LIBS) $(SPICE_LIBS) > > Good. > >> --- a/util/module.c >> +++ b/util/module.c >> @@ -22,11 +22,11 @@ >> #ifdef CONFIG_MODULE_UPGRADES >> #include "qemu-version.h" >> #endif >> -#ifdef CONFIG_TRACE_RECORDER >> #include "trace/recorder.h" >> -#endif >> >> >> +RECORDER(modules, 16, "QEMU load modules"); >> + >> typedef struct ModuleEntry >> { >> void (*init)(void); >> @@ -85,6 +85,15 @@ void register_dso_module_init(void (*fn)(void), module_init_type type) >> { >> ModuleEntry *e; >> >> +#ifdef CONFIG_TRACE_RECORDER >> + static const char *name[] = { >> + "MIGRATION", "BLOCK", "OPTS", "QOM", >> + "TRACE", "XEN_BACKEND", "LIBQOS", "FUZZ_TARGET", >> + "MAX" >> + }; >> +#endif >> + record(modules, "Register DSO module init %p type %u %+s", >> + fn, type, name[type]); >> init_lists(); >> >> e = g_malloc0(sizeof(*e)); > > Unrelated change. > > (the recorder stuff should probably integrate with qemu trace support, > so you can record any trace point qemu has, but that'll be another patch > series ...) I sent it separately, and fixed the leftover patch. > > take care, > Gerd -- Cheers, Christophe de Dinechin (IRC c3d)
diff --git a/configure b/configure index 2de1715800..ac83aea242 100755 --- a/configure +++ b/configure @@ -5148,8 +5148,6 @@ EOF $pkg_config --atleast-version=0.12.3 spice-protocol && \ compile_prog "$spice_cflags" "$spice_libs" ; then spice="yes" - libs_softmmu="$libs_softmmu $spice_libs" - QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" spice_protocol_version=$($pkg_config --modversion spice-protocol) spice_server_version=$($pkg_config --modversion spice-server) else @@ -7472,6 +7470,8 @@ fi if test "$spice" = "yes" ; then echo "CONFIG_SPICE=m" >> $config_host_mak + echo "SPICE_CFLAGS=$spice_cflags" >> $config_host_mak + echo "SPICE_LIBS=$spice_libs" >> $config_host_mak fi if test "$smartcard" = "yes" ; then diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs index f51411619b..273a956d96 100644 --- a/hw/display/Makefile.objs +++ b/hw/display/Makefile.objs @@ -46,6 +46,7 @@ obj-$(CONFIG_VGA) += vga.o common-obj-$(CONFIG_QXL:y=m) += qxl.mo qxl.mo-objs := qxl.o qxl-logger.o qxl-render.o +qxl.mo-cflags += $(SPICE_CFLAGS) obj-$(CONFIG_VIRTIO_GPU) += virtio-gpu-base.o virtio-gpu.o virtio-gpu-3d.o obj-$(CONFIG_VHOST_USER_GPU) += vhost-user-gpu.o diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs index 6abc74551a..bf9856be2a 100644 --- a/hw/i386/Makefile.objs +++ b/hw/i386/Makefile.objs @@ -2,6 +2,7 @@ obj-$(CONFIG_KVM) += kvm/ obj-y += e820_memory_layout.o multiboot.o obj-y += x86.o obj-$(CONFIG_PC) += pc.o pc_sysfw.o +pc.o-cflags += $(SPICE_CFLAGS) obj-$(CONFIG_I440FX) += pc_piix.o obj-$(CONFIG_Q35) += pc_q35.o obj-$(CONFIG_MICROVM) += microvm.o diff --git a/monitor/Makefile.objs b/monitor/Makefile.objs index a8533c9dd7..fd58d80195 100644 --- a/monitor/Makefile.objs +++ b/monitor/Makefile.objs @@ -2,5 +2,8 @@ obj-y += misc.o common-obj-y += monitor.o qmp.o hmp.o common-obj-y += qmp-cmds.o qmp-cmds-control.o common-obj-y += hmp-cmds.o +qmp-cmds.o-cflags += $(SPICE_CFLAGS) +hmp-cmds.o-cflags += $(SPICE_CFLAGS) +misc.o-cflags += $(SPICE_CFLAGS) storage-daemon-obj-y += monitor.o qmp.o qmp-cmds-control.o diff --git a/softmmu/Makefile.objs b/softmmu/Makefile.objs index dd15c24346..0e7605bd32 100644 --- a/softmmu/Makefile.objs +++ b/softmmu/Makefile.objs @@ -1,3 +1,3 @@ softmmu-main-y = softmmu/main.o obj-y += vl.o -vl.o-cflags := $(GPROF_CFLAGS) $(SDL_CFLAGS) +vl.o-cflags := $(GPROF_CFLAGS) $(SDL_CFLAGS) $(SPICE_CFLAGS) diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index f32b9e47a3..1df8bb3814 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -19,10 +19,10 @@ stub-obj-y += replay.o stub-obj-y += runstate-check.o stub-obj-$(CONFIG_SOFTMMU) += semihost.o stub-obj-y += set-fd-handler.o -stub-obj-y += vmgenid.o stub-obj-y += sysbus.o stub-obj-y += tpm.o stub-obj-y += trace-control.o +stub-obj-y += vmgenid.o stub-obj-y += vmstate.o stub-obj-$(CONFIG_SOFTMMU) += win32-kbd-hook.o diff --git a/ui/Makefile.objs b/ui/Makefile.objs index 1ab515e23d..6a6fda2f06 100644 --- a/ui/Makefile.objs +++ b/ui/Makefile.objs @@ -57,8 +57,8 @@ spice-app.mo-objs += spice-core.o spice-input.o spice-display.o ifeq ($(CONFIG_GIO)$(CONFIG_SPICE),ym) spice-app.mo-objs += spice-app.o endif -spice-app.mo-cflags := $(GIO_CFLAGS) -spice-app.mo-libs := $(GIO_LIBS) +spice-app.mo-cflags := $(GIO_CFLAGS) $(SPICE_CFLAGS) +spice-app.mo-libs := $(GIO_LIBS) $(SPICE_LIBS) common-obj-$(CONFIG_OPENGL) += shader.o common-obj-$(CONFIG_OPENGL) += console-gl.o diff --git a/util/module.c b/util/module.c index 2fa93561fe..29b4806520 100644 --- a/util/module.c +++ b/util/module.c @@ -22,11 +22,11 @@ #ifdef CONFIG_MODULE_UPGRADES #include "qemu-version.h" #endif -#ifdef CONFIG_TRACE_RECORDER #include "trace/recorder.h" -#endif +RECORDER(modules, 16, "QEMU load modules"); + typedef struct ModuleEntry { void (*init)(void); @@ -85,6 +85,15 @@ void register_dso_module_init(void (*fn)(void), module_init_type type) { ModuleEntry *e; +#ifdef CONFIG_TRACE_RECORDER + static const char *name[] = { + "MIGRATION", "BLOCK", "OPTS", "QOM", + "TRACE", "XEN_BACKEND", "LIBQOS", "FUZZ_TARGET", + "MAX" + }; +#endif + record(modules, "Register DSO module init %p type %u %+s", + fn, type, name[type]); init_lists(); e = g_malloc0(sizeof(*e));
Instead of adding the spice build flags to the top-level build options, add them where they are necessary. This is a step to move the burden of linking with spice libraries away from the top-level qemu. Signed-off-by: Christophe de Dinechin <dinechin@redhat.com> --- configure | 4 ++-- hw/display/Makefile.objs | 1 + hw/i386/Makefile.objs | 1 + monitor/Makefile.objs | 3 +++ softmmu/Makefile.objs | 2 +- stubs/Makefile.objs | 2 +- ui/Makefile.objs | 4 ++-- util/module.c | 13 +++++++++++-- 8 files changed, 22 insertions(+), 8 deletions(-)