qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] RFC: Move SPICE to a load module
@ 2020-06-26 16:42 Christophe de Dinechin
  2020-06-26 16:42 ` [PATCH 01/10] modules: Provide macros making it easier to identify module exports Christophe de Dinechin
                   ` (9 more replies)
  0 siblings, 10 replies; 33+ messages in thread
From: Christophe de Dinechin @ 2020-06-26 16:42 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Michael S. Tsirkin, qemu-trivial, Cleber Rosa,
	Michael Tokarev, Laurent Vivier, Dr. David Alan Gilbert,
	Gerd Hoffmann, Marc-André Lureau, Paolo Bonzini,
	Richard Henderson

There has been a bit of discussion regarding the possibility to move
SPICE code to a module in order to reduce the attack surface and
memory usage when SPICE is not used.

This WIP series proposes one way to do it that is relatively cheap in
terms of code changes, relative to other ideas I tested, and seems to
be working on simple test cases, unlike a couple of more
"sophisiticated" ideas I tried where I ran into rather nasty SPICE
initialization order issues.

Furthermore, the approach presented here requires relatively few code
changes in order to apply to other components as well. It relies on a
couple of macros added to the module.h file, MODIFACE and MODIMPLE.

MODIFACE declare the interface for a module function. A module
function is transformed into a pointer when you build with modules,
and that pointer is used instead of the original function.

MODIMPL implements a MODIFACE, and patches the pointer at load time to
call the function in the shared library.

Thanks to some suggestions from Gerd, I also moved QXL to a module,
although at the moment it does not load correctly.

There are a few known hacks in the present state, including:

- Adding various non-UI files into spice-app.so, which required a
  couple of ../pwd/foo.o references in the makefile. Not very nice,
  but I did not want to spend too much time fixing the makefiles.

- qmp_query_spice had to be dealt with "manually" because its
  interface is generated.

With these changes, the following shared libraries are no longer
needed in the main binary:

 	libspice-server.so.1 => /lib64/libspice-server.so.1 (HEX)
 	libopus.so.0 => /lib64/libopus.so.0 (HEX)
 	liblz4.so.1 => /lib64/liblz4.so.1 (HEX)
 	libgstapp-1.0.so.0 => /lib64/libgstapp-1.0.so.0 (HEX)
 	libgstvideo-1.0.so.0 => /lib64/libgstvideo-1.0.so.0 (HEX)
 	libgstbase-1.0.so.0 => /lib64/libgstbase-1.0.so.0 (HEX)
 	libgstreamer-1.0.so.0 => /lib64/libgstreamer-1.0.so.0 (HEX)
 	libssl.so.1.1 => /lib64/libssl.so.1.1 (HEX)
 	liborc-0.4.so.0 => /lib64/liborc-0.4.so.0 (HEX)

I will keep pushing updates on branch "modular-spice"
on https://github.com/c3d/qemu.git

Christophe de Dinechin (10):
  modules: Provide macros making it easier to identify module exports
  minikconf: Pass variables for modules
  spice: Make spice a module configuration
  spice: Move all the spice-related code in spice-app.so
  build: Avoid build failure when building drivers as modules
  trivial: Remove extra trailing whitespace
  qxl - FIXME: Build as module
  build: Add SPICE_CFLAGS and SPICE_LIBS to relevant files
  spice: Put spice functions in a separate load module
  REMOVE: Instrumentation to show the module functions being replaced

 Makefile                 |  1 +
 Makefile.objs            |  2 ++
 Makefile.target          |  7 +++++++
 audio/Makefile.objs      |  2 +-
 chardev/Makefile.objs    |  2 +-
 configure                |  6 +++---
 hw/Makefile.objs         |  1 +
 hw/display/Makefile.objs |  4 +++-
 hw/display/qxl.c         |  2 +-
 hw/i386/Makefile.objs    |  1 +
 include/qemu/module.h    | 28 ++++++++++++++++++++++++++++
 include/ui/qemu-spice.h  | 24 +++++++++++++++---------
 monitor/Makefile.objs    |  3 +++
 monitor/hmp-cmds.c       |  6 ++++++
 scripts/minikconf.py     |  4 ++--
 softmmu/Makefile.objs    |  2 +-
 softmmu/vl.c             |  1 +
 stubs/Makefile.objs      |  2 +-
 ui/Makefile.objs         | 12 ++++++------
 ui/spice-core.c          | 31 +++++++++++++++++++++----------
 ui/spice-display.c       |  2 +-
 util/module.c            | 13 +++++++++++--
 22 files changed, 117 insertions(+), 39 deletions(-)

-- 
2.26.2




^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2020-06-30 13:59 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-26 16:42 [PATCH 00/10] RFC: Move SPICE to a load module Christophe de Dinechin
2020-06-26 16:42 ` [PATCH 01/10] modules: Provide macros making it easier to identify module exports Christophe de Dinechin
2020-06-29 10:13   ` Claudio Fontana
2020-06-30 13:48     ` Christophe de Dinechin
2020-06-30  9:38   ` Michael S. Tsirkin
2020-06-30 13:39     ` Christophe de Dinechin
2020-06-26 16:42 ` [PATCH 02/10] minikconf: Pass variables for modules Christophe de Dinechin
2020-06-26 16:43 ` [PATCH 03/10] spice: Make spice a module configuration Christophe de Dinechin
2020-06-26 16:43 ` [PATCH 04/10] spice: Move all the spice-related code in spice-app.so Christophe de Dinechin
2020-06-26 17:20   ` Daniel P. Berrangé
2020-06-29  9:22     ` Christophe de Dinechin
2020-06-29  9:47       ` Daniel P. Berrangé
2020-06-29 23:37   ` Gerd Hoffmann
2020-06-26 16:43 ` [PATCH 05/10] build: Avoid build failure when building drivers as modules Christophe de Dinechin
2020-06-26 17:23   ` Daniel P. Berrangé
2020-06-29 23:26     ` Gerd Hoffmann
2020-06-26 16:43 ` [PATCH 06/10] trivial: Remove extra trailing whitespace Christophe de Dinechin
2020-06-29  9:56   ` Philippe Mathieu-Daudé
2020-06-26 16:43 ` [PATCH 07/10] qxl - FIXME: Build as module Christophe de Dinechin
2020-06-26 16:43 ` [PATCH 08/10] build: Add SPICE_CFLAGS and SPICE_LIBS to relevant files Christophe de Dinechin
2020-06-26 17:26   ` Daniel P. Berrangé
2020-06-29  9:27     ` Christophe de Dinechin
2020-06-29 23:08   ` Gerd Hoffmann
2020-06-30 13:56     ` Christophe de Dinechin
2020-06-26 16:43 ` [PATCH 09/10] spice: Put spice functions in a separate load module Christophe de Dinechin
2020-06-26 17:35   ` Daniel P. Berrangé
2020-06-29 17:19     ` Christophe de Dinechin
2020-06-29 17:30       ` Daniel P. Berrangé
2020-06-29 23:00       ` Gerd Hoffmann
2020-06-30 12:54         ` Christophe de Dinechin
2020-06-26 16:43 ` [PATCH 10/10] REMOVE: Instrumentation to show the module functions being replaced Christophe de Dinechin
2020-06-26 17:29   ` Daniel P. Berrangé
2020-06-30 12:48     ` Christophe de Dinechin

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).