[PATCH 00/33] Cleanups and automatic init/exit calls

2012-09-05 Thread Sasha Levin
This patch series is mostly about cleanups:

 - Clean all the global variables we have to store configuration options.
 - Remove externed config options between objects.
 - Adding several exit routines to clean up on exit.
 - Remove the global 'kvm' object.
 - Contain arch specific init/exit calls within the corresponding non-arch
 specific code instead of the global init.


This patch series also adds a method to call init/exit functions automatically
after we've finished intializing config options.

Doing so clears out a big chunk of repetetive code in our builtin-run init
function, and makes adding new modules easier since there's now no need to
link them to builtin-run.


Sasha Levin (33):
  kvm tools: introduce kvm_config to store instance-specific config
options
  kvm tools: generate command line options dynamically
  kvm tools: split struct kvm into arch specific part
  kvm tools: move kvm_config into struct kvm
  kvm tools: remove redundancy between kvm_config and kvm
  kvm tools: move ioport_debug into struct kvm_config
  kvm tools: move mmio_debug into struct kvm_config
  kvm tools: move active_console into struct kvm_config
  kvm tools: add private ptr to option parser
  kvm tools: disk image related cleanup
  kvm tools: move nrcpus into struct kvm_config
  kvm tools: move kvm_cpus into struct kvm
  kvm tools: improve framebuffer manager initialization
  kvm tools: improve term init/exit functions
  kvm tools: threadpool exit routine
  kvm tools: timer cleanup
  kvm tools: virtio-console init/exit
  kvm tools: virtio-rng init/exit
  kvm tools: virtio-bln init/exit
  kvm tools: pci-shmem init-exit
  kvm tools: virtio-net init/exit
  kvm tools: kvm-ipc cleanup
  kvm tools: kbd initialization check
  kvm tools: ui improvements
  kvm tools: kernel load/firmware cleanup
  kvm tools: ioport arch init
  kvm tools: ram init
  kvm tools: move the rest of the config initializations
  kvm tools: virtio-9p cleanup
  kvm tools: add init/exit automatic calls
  kvm tools: use init/exit where possible
  kvm tools: pass kvm ptr directly to timer injection
  kvm tools: remove global kvm object

 tools/kvm/Makefile   |3 +-
 tools/kvm/builtin-run.c  |  +-
 tools/kvm/disk/core.c|   73 +-
 tools/kvm/framebuffer.c  |9 +-
 tools/kvm/hw/i8042.c |   15 +-
 tools/kvm/hw/pci-shmem.c |  147 +++-
 tools/kvm/hw/rtc.c   |   14 +-
 tools/kvm/hw/serial.c|   24 +-
 tools/kvm/hw/vesa.c  |6 +-
 tools/kvm/include/kvm/brlock.h   |   16 +-
 tools/kvm/include/kvm/disk-image.h   |9 +-
 tools/kvm/include/kvm/framebuffer.h  |5 +-
 tools/kvm/include/kvm/i8042.h|2 +-
 tools/kvm/include/kvm/ioport.h   |7 +-
 tools/kvm/include/kvm/kvm-config.h   |   60 ++
 tools/kvm/include/kvm/kvm-cpu.h  |6 +-
 tools/kvm/include/kvm/kvm-ipc.h  |8 +-
 tools/kvm/include/kvm/kvm.h  |   38 +-
 tools/kvm/include/kvm/parse-options.h|   16 +-
 tools/kvm/include/kvm/pci-shmem.h|6 +-
 tools/kvm/include/kvm/sdl.h  |8 +-
 tools/kvm/include/kvm/term.h |   16 +-
 tools/kvm/include/kvm/threadpool.h   |3 +-
 tools/kvm/include/kvm/util-init.h|   51 ++
 tools/kvm/include/kvm/virtio-9p.h|3 +
 tools/kvm/include/kvm/virtio-balloon.h   |3 +-
 tools/kvm/include/kvm/virtio-console.h   |3 +-
 tools/kvm/include/kvm/virtio-net.h   |6 +-
 tools/kvm/include/kvm/vnc.h  |   10 +-
 tools/kvm/ioeventfd.c|2 +
 tools/kvm/ioport.c   |   23 +-
 tools/kvm/kvm-cpu.c  |   81 ++-
 tools/kvm/kvm-ipc.c  |  301 +++-
 tools/kvm/kvm.c  |  229 ++
 tools/kvm/mmio.c |   13 +-
 tools/kvm/pci.c  |   12 +-
 tools/kvm/powerpc/cpu_info.c |2 +-
 tools/kvm/powerpc/include/kvm/kvm-arch.h |   24 +-
 tools/kvm/powerpc/irq.c  |2 +-
 tools/kvm/powerpc/kvm-cpu.c  |8 +-
 tools/kvm/powerpc/kvm.c  |   42 +-
 tools/kvm/powerpc/spapr_hvcons.c |   14 +-
 tools/kvm/powerpc/spapr_pci.c|2 +-
 tools/kvm/powerpc/xics.c |   24 +-
 tools/kvm/symbol.c   |4 +-
 tools/kvm/term.c |   61 +-
 tools/kvm/ui/sdl.c   |   26 +-
 tools/kvm/ui/vnc.c   |   26 +-
 tools/kvm/util/init.c|   69 ++
 tools/kvm/util/threadpool.c  |   36 +-
 tools/kvm/virtio/9p.c|   69 ++
 tools/kvm/virtio/balloon.c   |   23 +-
 tools/kvm/virtio/blk.c   |2 +
 tools/kvm/virtio/console.c   |   26 +-
 tools/kvm/virtio/net.c 

Re: [PATCH 00/33] Cleanups and automatic init/exit calls

2012-09-05 Thread Pekka Enberg
On Wed, Sep 5, 2012 at 11:31 AM, Sasha Levin levinsasha...@gmail.com wrote:
 This patch series is mostly about cleanups:

  - Clean all the global variables we have to store configuration options.
  - Remove externed config options between objects.
  - Adding several exit routines to clean up on exit.
  - Remove the global 'kvm' object.
  - Contain arch specific init/exit calls within the corresponding non-arch
  specific code instead of the global init.

 This patch series also adds a method to call init/exit functions automatically
 after we've finished intializing config options.

 Doing so clears out a big chunk of repetetive code in our builtin-run init
 function, and makes adding new modules easier since there's now no need to
 link them to builtin-run.

I'm getting an instant SIGSEGV for vm run with these patches:

  [penberg@tux kvm]$ gdb --args ./lkvm run
  GNU gdb (GDB) Fedora (7.3.50.20110722-13.fc16)
  Copyright (C) 2011 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.  Type show copying
  and show warranty for details.
  This GDB was configured as x86_64-redhat-linux-gnu.
  For bug reporting instructions, please see:
  http://www.gnu.org/software/gdb/bugs/...
  Reading symbols from /home/penberg/linux/tools/kvm/lkvm...done.
  (gdb) r
  Starting program: /home/penberg/linux/tools/kvm/lkvm run
  [Thread debugging using libthread_db enabled]
  Using host libthread_db library /lib64/libthread_db.so.1.
# lkvm run -k ../../arch/x86/boot/bzImage -m 448 -c 4 --name guest-6703
  [New Thread 0x7fffdbfd5700 (LWP 6707)]
  [New Thread 0x7fffdb7d4700 (LWP 6708)]
  warning: Range for type (null) has invalid bounds 0..-109

  Program received signal SIGSEGV, Segmentation fault.
  0x0040fb14 in kvm__pause (kvm=0x712010) at kvm.c:419
  419   if (!kvm-cpus[0] || kvm-cpus[0]-thread == 0)
  Missing separate debuginfos, use: debuginfo-install
SDL-1.2.14-13.fc16.x86_64 glibc-2.14.90-24.fc16.7.x86_64
zlib-1.2.5-6.fc16.x86_64
  (gdb) bt
  #0  0x0040fb14 in kvm__pause (kvm=0x712010) at kvm.c:419
  #1  0x0040f898 in ioport__register (kvm=0x712010, port=3324,
ops=0x638ce0, count=4, param=0x0) at ioport.c:63
  #2  0x0040f6c4 in pci__init (kvm=0x712010) at pci.c:194
  #3  0x00414f94 in init_list__init (kvm=0x712010) at util/init.c:41
  #4  0x0041dc4e in kvm_cmd_run_init.2726 (argc=0,
argv=0x7fffe168) at builtin-run.c:655
  #5  0x00419d8e in kvm_cmd_run (argc=0, argv=0x7fffe168,
prefix=0x0) at builtin-run.c:689
  #6  0x004198ce in handle_command (command=0x6396e0, argc=1,
argv=0x7fffe160) at kvm-cmd.c:84
  #7  0x00419797 in handle_kvm_command.5445 (argc=1,
argv=0x7fffe160) at main.c:11
  #8  0x0042753e in main (argc=2, argv=0x7fffe158) at main.c:18
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html