merge some xen bits into qemu
cover merge some xen bits into qemu
Hi folks,
This is the second version of the xen support for qemu patch series, addressing review comments. Lots of little changes, the largest change probably is the switch-over to the esisting sys-queue.h list implementation instead of bringing in a copy of the linux kernel list.h header.
The console and framebuffer backend drivers are largely based on the xen code, the other bits are rewritten from scratch. Nevertheless the code should be functionally identical.
Overview (individual patches have longer descriptions):
#1 -- groundwork: build system, cmd line options, ... #2 -- xen backend driver infrastructrure
#3 -- xen console backend driver
#4 -- xen framebuffer backend driver
#5 -- xen block backend driver
#6 -- xen nic backend driver
#7 -- allow xen disks and nics being configured via qemu command
line options.
With the first four patches in place upstream qemu can replace xen's qemu-dm for paravirtual domains. The block and nic backend drivers are full userspace implementations using the grant table device (gntdev).
xen support is implemented using another machine type. xen's qemu-dm already uses the machine type to switch between paravirtualized and fully virtualized machines, so this was the natural choice. qemu has gets a new "xenpv" machine type additionally to the "pc" and "isapc" ones.
Comments?
cheers,
Gerd
PATCH 1/7 xen: groundwork for xen support
- configure script and build system changes.
- wind up new machine type.
- add -domid command line option.
- allow xenpv machines run without disk and kernel specified by adding a nodisk_ok field to QEMUMachine.
- detect xen being present.
--- Makefile.target | 8 +++ configure | 27 +++++++++ hw/boards.h | 4 + hw/xen-machine.c | 146 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/xen.h | 18 ++++++ target-i386/machine.c | 3 + vl.c | 19 ++++++- 7 files changed, 223 insertions(+), 2 deletions(-) create mode 100644 hw/xen-machine.c create mode 100644 hw/xen.h
Makefile.target +8 -0
@@ -515,6 +515,14 @@ CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS) LIBS += $(CONFIG_VNC_TLS_LIBS) endif +# xen backend driver support +XEN_OBJS := xen-machine.o +ifeq ($(CONFIG_XEN), yes) + OBJS += $(XEN_OBJS) + LIBS += $(XEN_LIBS) + $(XEN_OBJS) : CFLAGS += -Wall -Wmissing-prototypes -Wstrict-prototypes +endif + # SCSI layer OBJS+= lsi53c895a.o esp.o
configure +27 -0
@@ -108,6 +108,7 @@ uname_release="" curses="yes" nptl="yes" mixemu="no" +xen="no" # OS specific targetos=`uname -s`
@@ -202,6 +203,7 @@ linux="yes" linux_user="yes" if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then kqemu="yes" + xen="yes" audio_possible_drivers="$audio_possible_drivers fmod" fi ;;
@@ -285,6 +287,8 @@ for opt do ;; --disable-kqemu) kqemu="no" ;; + --disable-xen) xen="no" + ;; --disable-brlapi) brlapi="no" ;; --enable-profiler) profiler="yes"
@@ -421,6 +425,7 @@ echo " Available drivers: $audio_possible_drivers" echo " --audio-card-list=LIST set list of additional emulated audio cards" echo " Available cards: ac97 adlib cs4231a gus" echo " --enable-mixemu enable mixer emulation" +echo " --disable-xen disable xen backend driver support" echo " --disable-brlapi disable BrlAPI" echo " --disable-vnc-tls disable TLS encryption for VNC server" echo " --disable-curses disable curses output"
@@ -681,6 +686,22 @@ else fi ########################################## +# xen probe + +if test "$xen" = "yes" ; then +cat > $TMPC <<EOF +#include <xs.h> +#include <xenctrl.h> +int main(void) { xs_daemon_open; xc_interface_open; } +EOF + if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev/null ; then + : + else + xen="no" + fi +fi + +########################################## # SDL probe sdl_too_old=no
@@ -917,6 +938,7 @@ if test -n "$sparc_cpu"; then echo "Target Sparc Arch $sparc_cpu" fi echo "kqemu support $kqemu" +echo "xen support $xen" echo "brlapi support $brlapi" echo "Documentation $build_docs" [ ! -z "$uname_release" ] && \
@@ -1168,6 +1190,11 @@ if test "$brlapi" = "yes" ; then echo "#define CONFIG_BRLAPI 1" >> $config_h echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak fi +if test "$xen" = "yes" ; then + echo "CONFIG_XEN=yes" >> $config_mak + echo "#define CONFIG_XEN 1" >> $config_h + echo "XEN_LIBS=-lxenstore -lxenctrl" >> $config_mak +fi # XXX: suppress that if [ "$bsd" = "yes" ] ; then
hw/boards.h +4 -0
@@ -16,6 +16,7 @@ typedef struct QEMUMachine {QEMUMachineInitFunc *init;#define RAMSIZE_FIXED (1 << 0)ram_addr_t ram_require; +int nodisk_ok;struct QEMUMachine *next; } QEMUMachine;
@@ -29,6 +30,9 @@ extern QEMUMachine bareetraxfs_machine;extern QEMUMachine pc_machine;extern QEMUMachine isapc_machine; +/* xen_machine.c */ +extern QEMUMachine xenpv_machine; +/* ppc.c */ extern QEMUMachine prep_machine;extern QEMUMachine core99_machine;
hw/xen-machine.c new file +146 -0
146 lines not on this page · raw message
hw/xen.h new file +18 -0
@@ -0,0 +1,18 @@ +#ifndef QEMU_XEN_H +#define QEMU_XEN_H 1 +/* +* public xen header +* stuff needed outside xen-*.c, i.e. interfaces to qemu. +* must not depend on any xen headers being present in +* /usr/include/xen, so it can be included unconditionally. +*/ + +/* xen-machine.c */ +extern int xen_domid; +extern int xen_present; +extern int xen_emulate; +extern int xen_domainbuild; + +int xen_detect (void ); + +#endif /* QEMU_XEN_H */
target-i386/machine.c +3 -0
@@ -9,6 +9,9 @@ void register_machines(void) {qemu_register_machine (&pc_machine);qemu_register_machine (&isapc_machine); +#ifdef CONFIG_XEN +qemu_register_machine (&xenpv_machine); +#endif }static void cpu_put_seg (QEMUFile *f,SegmentCache *dt)
vl.c +17 -2
@@ -29,6 +29,7 @@#include "hw/audiodev.h" #include "hw/isa.h" #include "hw/baum.h" +#include "hw/xen.h" #include "net.h" #include "console.h" #include "sysemu.h"
@@ -7744,6 +7745,9 @@ static void help(int exitcode) "-startdate select initial date of the clock\n" "-icount [N|auto]\n" " Enable virtual instruction counter with 2^N clock ticks per instruction\n" +#ifdef CONFIG_XEN + "-domid specify xen guest domain id\n" +#endif"\n" "During emulation, the following keys are useful:\n" "ctrl-alt-f toggle full screen\n"
@@ -7849,6 +7853,9 @@ enum { QEMU_OPTION_startdate, QEMU_OPTION_tb_size, QEMU_OPTION_icount, +#ifdef CONFIG_XEN + QEMU_OPTION_domid, +#endif }; typedef struct QEMUOption {
@@ -7937,6 +7944,9 @@ const QEMUOption qemu_options[] = { #ifdef CONFIG_CURSES { "curses", 0, QEMU_OPTION_curses }, #endif +#ifdef CONFIG_XEN + { "domid", HAS_ARG, QEMU_OPTION_domid }, +#endif /* temporary options */ { "usb", 0, QEMU_OPTION_usb },
@@ -8784,6 +8794,11 @@ int main(int argc, char **argv) icount_time_shift =strtol (optarg,NULL ,0 ); }break ; +#ifdef CONFIG_XEN +case QEMU_OPTION_domid: + xen_domid =atoi (optarg); +break ; +#endif } } }
@@ -8858,9 +8873,9 @@ int main(int argc, char **argv) linux_boot = (kernel_filename !=NULL ); net_boot = (boot_devices_bitmap >> ('n' -'a' )) &0xF ; -/* XXX: this should not be: some embedded targets just have flash */ +/* need a disk for this machine to boot ? */ if (!linux_boot && net_boot ==0 && - nb_drives_opt ==0 ) + !machine->nodisk_ok && nb_drives_opt ==0 )help (1 );if (!linux_boot && *kernel_cmdline !='\0' ) {
Signature · 1 line
1.5.5.1
Re: [Qemu-devel] [PATCH 1/7] xen: groundwork for xen support
Quoted 2 lines · Gerd Hoffmann
- allow xenpv machines run without disk and kernel specified by adding a
nodisk_okfield to QEMUMachine.
Nice idea, this would be a useful feature by itself.
Quoted 1 line
+ $(XEN_OBJS) : CFLAGS += -Wall -Wmissing-prototypes -Wstrict-prototypes
These aren't needed for Xen. Though I wonder why at least -Wall -Wstrict-prototypes could not be added globally.
Quoted 1 line
+ if (-1 !=
xen_present)
This style looks alien to me. Do you really find it readable?
Re: [Qemu-devel] [PATCH 1/7] xen: groundwork for xen support
Quoted 5 lines · Blue Swirl
Quoted 2 lines · Gerd Hoffmann
- allow xenpv machines run without disk and kernel specified by adding a
nodisk_okfield to QEMUMachine.Nice idea, this would be a useful feature by itself.
Yes, some embedded devices probably can use that too according to the source code comment. Guess thats why anthony suggested to do it that way, and I liked the idea too, so I just did ;)
Quoted 4 lines
Quoted 1 line
+ $(XEN_OBJS) : CFLAGS += -Wall -Wmissing-prototypes -Wstrict-prototypes
These aren't needed for Xen. Though I wonder why at least -Wall -Wstrict-prototypes could not be added globally.
IIRC I tried to turn them on globally and found myself swamped with warnings. So I took the easy way out and enabled them only for the xen bits I'm working on. I like those warnings, they catch sloppyness and help writing clean code. They are in no way required though. We can add them globally nevertheless, I can keep them as local patch, I don't mind much.
Quoted 3 lines
Quoted 1 line
+ if (-1 !=
xen_present)This style looks alien to me. Do you really find it readable?
Bad habit. gcc warns these days on "if (foo = 42)", so the reason to write "if (42 = foo)" is gone. I'm still doing that for -- say -- historical reasons?
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Re: [Qemu-devel] [PATCH 1/7] xen: groundwork for xen support
In reply to Gerd Hoffmannconfigure linux="yes" · line 209
Quoted 10 lines · Gerd Hoffmann
# OS specific
targetos=uname -sconfigure +1
-0@@ -202,6 +203,7 @@ linux="yes" linux_user="yes" if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then kqemu="yes" + xen="yes" audio_possible_drivers="$audio_possible_drivers fmod" fi
Is this really necessary? The compile check will take care of the non i386/x86_64 cases. It works a lot better when using a cross-compiler too.
Regards,
Anthony Liguori
Re: [Qemu-devel] [PATCH 1/7] xen: groundwork for xen support
Quoted 14 lines · Anthony Liguori
configure linux="yes" · line 209
Quoted 10 lines · Gerd Hoffmann
# OS specific
targetos=uname -sconfigure +1
-0@@ -202,6 +203,7 @@ linux="yes" linux_user="yes" if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then kqemu="yes" + xen="yes" audio_possible_drivers="$audio_possible_drivers fmod" fiIs this really necessary? The compile check will take care of the non i386/x86_64 cases. It works a lot better when using a cross-compiler too.
This is just me being conservative and enable the cases I know it works for. There is ia64 xen ...
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
PATCH 2/7 xen: backend driver core
In reply to Gerd HoffmannThis patch adds infrastructure for xen backend drivers living in qemu, so drivers don't need to implement common stuff on their own. It's mostly xenbus management stuff: some functions to access xentore, setting up xenstore watches, callbacks on device discovery and state changes, handle event channel, ...
--- Makefile.target | 2 +- hw/xen-backend.c | 665 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ hw/xen-backend.h | 87 +++++++ hw/xen-common.h | 38 +++ hw/xen-machine.c | 7 +- 5 files changed, 797 insertions(+), 2 deletions(-) create mode 100644 hw/xen-backend.c create mode 100644 hw/xen-backend.h create mode 100644 hw/xen-common.h
Makefile.target +1 -1
@@ -516,7 +516,7 @@ LIBS += $(CONFIG_VNC_TLS_LIBS) endif # xen backend driver support -XEN_OBJS := xen-machine.o +XEN_OBJS := xen-machine.o xen-backend.o ifeq ($(CONFIG_XEN), yes) OBJS += $(XEN_OBJS) LIBS += $(XEN_LIBS)
hw/xen-backend.c new file +665 -0
665 lines not on this page · raw message
hw/xen-backend.h new file +87 -0
87 lines not on this page · raw message
hw/xen-common.h new file +38 -0
@@ -0,0 +1,38 @@ +#ifndef QEMU_XEN_COMMON_H +#define QEMU_XEN_COMMON_H 1 + +#include <stddef.h> +#include <inttypes.h> + +#include <xenctrl.h> +#include <xs.h> +#include <xen/io/xenbus.h> + +#include "hw.h" +#include "xen.h" +#include "sys-queue.h" /* BSD list implementation */ + +/* +* tweaks needed to build with different xen versions +* 0x00030205 -> 3.1.0 +* 0x00030207 -> 3.2.0 +* 0x00030208 -> unstable +*/ +#include <xen/xen-compat.h> +#if __XEN_LATEST_INTERFACE_VERSION__ <0x00030207 +# define xc_map_foreign_pages xc_map_foreign_batch +#endif +#if __XEN_LATEST_INTERFACE_VERSION__ <0x00030208 +# define xen_mb () mb() +# define xen_rmb () rmb() +# define xen_wmb () wmb() +#endif + +/* ------------------------------------------------------------- */ +/* useful defines */ + +#define container_of (ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + +#endif /* QEMU_XEN_COMMON_H */
hw/xen-machine.c +6 -1
@@ -25,7 +25,7 @@#include "hw.h" #include "boards.h" -#include <xenctrl.h> +#include "xen-backend.h" /* -------------------------------------------------------------------- */ /* variables */
@@ -81,6 +81,11 @@ static int xen_init(void) xen_emulate =1 ; } +if (-1 ==xen_be_init ()) { +fprintf (stderr,"%s: xen backend core setup failed\n" , __FUNCTION__); +return -1 ; + } +return 0 ; }
Signature · 1 line
1.5.5.1
PATCH 3/7 xen: add console backend driver.
In reply to Gerd HoffmannThis patch adds a xenconsole backend driver. It it based on current xen-unstable code. It has been changed to make use of the common backend driver code.
--- Makefile.target | 1 + hw/xen-backend.h | 3 + hw/xen-console.c | 270 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ hw/xen-machine.c | 3 + 4 files changed, 277 insertions(+), 0 deletions(-) create mode 100644 hw/xen-console.c
Makefile.target +1 -0
@@ -517,6 +517,7 @@ endif # xen backend driver support XEN_OBJS := xen-machine.o xen-backend.o +XEN_OBJS += xen-console.o ifeq ($(CONFIG_XEN), yes) OBJS += $(XEN_OBJS) LIBS += $(XEN_LIBS)
hw/xen-backend.h +3 -0
@@ -84,4 +84,7 @@ int xen_be_send_notify(struct XenDevice *xendev);void xen_be_printf (struct XenDevice *xendev,int msg_level,const char *fmt, ...) __attribute__ ((format (printf,3 ,4 ))); +/* actual backend drivers */ +struct XenDevOps xen_console_ops;/* xen_console.c */ +#endif /* QEMU_XEN_BACKEND_H */
hw/xen-console.c new file +270 -0
270 lines not on this page · raw message
hw/xen-machine.c +3 -0
@@ -97,6 +97,9 @@ static int xen_init_pv(DisplayState *ds)if (rc <0 )return rc; +/* xenbus backend drivers */ +xen_be_register ("console" , &xen_console_ops); +return 0 ; }
Signature · 1 line
1.5.5.1
Re: [Qemu-devel] [PATCH 3/7] xen: add console backend driver.
Quoted 1 line · Gerd Hoffmann
+
buffer->data=realloc(buffer->data, buffer->capacity);
On Qemu, instead of malloc, qemu_malloc should be used to allocate memory. Though there isn't qemu_realloc.
Quoted 1 line
+ if (!type || 0 !=
strcmp(type, "ioemu")) {
Shouldn't this be "qemu"?
Re: [Qemu-devel] [PATCH 3/7] xen: add console backend driver.
Quoted 5 lines · Blue Swirl
Quoted 1 line · Gerd Hoffmann
+
buffer->data=realloc(buffer->data, buffer->capacity);On Qemu, instead of malloc,
qemu_mallocshould be used to allocate memory. Though there isn'tqemu_realloc.
Should I add qemu_realloc then?
Quoted 3 lines
Quoted 1 line
+ if (!type || 0 !=
strcmp(type, "ioemu")) {Shouldn't this be "qemu"?
No, "ioemu" is correct. xend writes that value into xenstore.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Re: [Qemu-devel] [PATCH 3/7] xen: add console backend driver.
Quoted 9 lines · Gerd Hoffmann
Quoted 5 lines · Blue Swirl
Quoted 1 line · Gerd Hoffmann
+
buffer->data=realloc(buffer->data, buffer->capacity);On Qemu, instead of malloc,
qemu_mallocshould be used to allocate memory. Though there isn'tqemu_realloc.Should I add
qemu_reallocthen?
That would be nice, but changing also all reallocs to qemu_realloc calls for a new patch.
PATCH 4/7 xen: add framebuffer backend driver
In reply to Gerd HoffmannThis patch adds a frsamebuffer (and kbd+mouse) backend driver. It it based on current xen-unstable code. It has been changed to make use of the common backend driver code. It also has been changed to compile with xen headers older than unstable (aka son-to-be 3.3).
--- Makefile.target | 2 +- hw/xen-backend.h | 4 + hw/xen-framebuffer.c | 933 ++++++++++++++++++++++++++++++++++++++++++++++++++ hw/xen-machine.c | 5 + 4 files changed, 943 insertions(+), 1 deletions(-) create mode 100644 hw/xen-framebuffer.c
Makefile.target +1 -1
@@ -517,7 +517,7 @@ endif # xen backend driver support XEN_OBJS := xen-machine.o xen-backend.o -XEN_OBJS += xen-console.o +XEN_OBJS += xen-console.o xen-framebuffer.o ifeq ($(CONFIG_XEN), yes) OBJS += $(XEN_OBJS) LIBS += $(XEN_LIBS)
hw/xen-backend.h +4 -0
@@ -86,5 +86,9 @@ void xen_be_printf(struct XenDevice *xendev, int msg_level, const char *fmt, .../* actual backend drivers */ struct XenDevOps xen_console_ops;/* xen_console.c */ +struct XenDevOps xen_kbdmouse_ops;/* xen_framebuffer.c */ +struct XenDevOps xen_framebuffer_ops;/* xen_framebuffer.c */ + +void xen_set_display (int domid,DisplayState *ds);#endif /* QEMU_XEN_BACKEND_H */
hw/xen-framebuffer.c new file +933 -0
933 lines not on this page · raw message
hw/xen-machine.c +5 -0
@@ -99,6 +99,11 @@ static int xen_init_pv(DisplayState *ds)/* xenbus backend drivers */ xen_be_register ("console" , &xen_console_ops); +xen_be_register ("vkbd" , &xen_kbdmouse_ops); +xen_be_register ("vfb" , &xen_framebuffer_ops); + +/* setup framebuffer */ +xen_set_display (xen_domid, ds);return 0 ; }
Signature · 1 line
1.5.5.1
Re: [Qemu-devel] [PATCH 4/7] xen: add framebuffer backend driver
Quoted 1 line · Gerd Hoffmann
+const unsigned char atkbd_set2_keycode[512] = {
Missing "static"?
Quoted 1 line
+const unsigned char atkbd_unxlate_table[128] = {
Ditto.
Quoted 5 lines
+ for (i = 0; i < 128; i++) {
+ scancode2linux[i] = atkbd_set2_keycode[atkbd_unxlate_table[i]];
+ scancode2linux[i |0x80] =
+ atkbd_set2_keycode[atkbd_unxlate_table[i] |0x80];
+ }
Can't these table be calculated so that this initial run-time lookup is not needed?
The framebuffer does not use dirty memory detection. Is this intentional? I understand that in Xen that's not possible.
Re: [Qemu-devel] [PATCH 4/7] xen: add framebuffer backend driver
Quoted 4 lines · Blue Swirl
Quoted 1 line · Gerd Hoffmann
+const unsigned char atkbd_set2_keycode[512] = {
Missing "static"?
Yep, I'll fix it up.
Quoted 8 lines
Quoted 5 lines
+ for (i = 0; i < 128; i++) {
+ scancode2linux[i] = atkbd_set2_keycode[atkbd_unxlate_table[i]];
+ scancode2linux[i |0x80] =
+ atkbd_set2_keycode[atkbd_unxlate_table[i] |0x80];
+ }Can't these table be calculated so that this initial run-time lookup is not needed?
Should be doable, yes.
Quoted 2 lines
The framebuffer does not use dirty memory detection. Is this intentional? I understand that in Xen that's not possible.
The guest frontend driver does that and sends the info to the backend driver (XENFB_TYPE_UPDATE messages).
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
PATCH 5/7 xen: add block device backend driver.
In reply to Gerd HoffmannThis patch adds a block device backend driver to qemu. It is a pure userspace implemention using the gntdev interface. It uses "qdisk" as backend name in xenstore so it doesn't interfere with the other existing backends (blkback aka "vbd" and tapdisk aka "tap").
--- Makefile.target | 2 +- hw/xen-backend.h | 2 + hw/xen-blkif.h | 103 ++++++++ hw/xen-disk.c | 677 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ hw/xen-machine.c | 1 + sysemu.h | 2 +- vl.c | 4 + 7 files changed, 789 insertions(+), 2 deletions(-) create mode 100644 hw/xen-blkif.h create mode 100644 hw/xen-disk.c
Makefile.target +1 -1
@@ -517,7 +517,7 @@ endif # xen backend driver support XEN_OBJS := xen-machine.o xen-backend.o -XEN_OBJS += xen-console.o xen-framebuffer.o +XEN_OBJS += xen-console.o xen-framebuffer.o xen-disk.o ifeq ($(CONFIG_XEN), yes) OBJS += $(XEN_OBJS) LIBS += $(XEN_LIBS)
hw/xen-backend.h +2 -0
@@ -2,6 +2,7 @@#define QEMU_XEN_BACKEND_H 1#include "xen-common.h" +#include "sysemu.h" /* ------------------------------------------------------------- */
@@ -88,6 +89,7 @@ void xen_be_printf(struct XenDevice *xendev, int msg_level, const char *fmt, ...struct XenDevOps xen_console_ops;/* xen_console.c */ struct XenDevOps xen_kbdmouse_ops;/* xen_framebuffer.c */ struct XenDevOps xen_framebuffer_ops;/* xen_framebuffer.c */ +struct XenDevOps xen_blkdev_ops;/* xen_disk.c */ void xen_set_display (int domid,DisplayState *ds);
hw/xen-blkif.h new file +103 -0
103 lines not on this page · raw message
hw/xen-disk.c new file +677 -0
677 lines not on this page · raw message
hw/xen-machine.c +1 -0
@@ -101,6 +101,7 @@ static int xen_init_pv(DisplayState *ds)xen_be_register ("console" , &xen_console_ops);xen_be_register ("vkbd" , &xen_kbdmouse_ops);xen_be_register ("vfb" , &xen_framebuffer_ops); +xen_be_register ("qdisk" , &xen_blkdev_ops);/* setup framebuffer */ xen_set_display (xen_domid, ds);
sysemu.h +1 -1
@@ -113,7 +113,7 @@ extern unsigned int nb_prom_envs;#endif typedef enum { -IF_IDE ,IF_SCSI ,IF_FLOPPY ,IF_PFLASH ,IF_MTD ,IF_SD +IF_IDE ,IF_SCSI ,IF_FLOPPY ,IF_PFLASH ,IF_MTD ,IF_SD ,IF_XEN }BlockInterfaceType ; typedef struct DriveInfo {
vl.c +4 -0
@@ -5484,6 +5484,9 @@ static int drive_init(struct drive_opt *arg, int snapshot, }else if (!strcmp (buf,"sd" )) { type =IF_SD ; max_devs =0 ; + }else if (!strcmp (buf,"xen" )) { + type =IF_XEN ; + max_devs =0 ; }else {fprintf (stderr,"qemu: '%s' unsupported bus type '%s'\n" , str, buf);return -1 ;
@@ -5669,6 +5672,7 @@ static int drive_init(struct drive_opt *arg, int snapshot,switch (type) {case IF_IDE :case IF_SCSI : +case IF_XEN :switch (media) {case MEDIA_DISK :if (cyls !=0 ) {
Signature · 1 line
1.5.5.1
Re: [Qemu-devel] [PATCH 5/7] xen: add block device backend driver.
Quoted 2 lines · Gerd Hoffmann
+/* i386 protocol version */
+#pragmapack(push, 4)
What's wrong with __attribute__(__aligned__)?
Quoted 3 lines
+ * FIXME: the code is designed to handle multiple outstanding + * requests (using aio or using threads), which isn't used right + * now due to limitations of the qemu block driver interface.
Yes, what happened to vectored DMA patches?
Quoted 1 line
+
RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blkdev->rings.common, send_notify);
EUGLY_LONG_NAME_WITH_ALL_CAPS
Quoted 3 lines
+ mode = O_RDONLY; + qflags = BDRV_O_RDONLY; + info |= VDISK_READONLY | VDISK_REMOVABLE | VDISK_CDROM;
Does this mean that all read-only disks are assumed to be CDROMs or that all removable disks are read-only?
Why IF_XEN?
Why different protocols for i386 and x86_64? Would I need to add Sparc32 and Sparc64 versions some day?
Re: [Qemu-devel] [PATCH 5/7] xen: add block device backend driver.
Quoted 3 lines · Blue Swirl, le Mon 04 Aug 2008 20:26:42 +0300, a écrit :
Quoted 1 line
+
RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blkdev->rings.common, send_notify);
EUGLY_LONG_NAME_WITH_ALL_CAPS
That's unfortunately the xen API.
Quoted 1 line
Why different protocols for i386 and
x86_64?
Because the xen block shared structures have been defined at API level, not ABI, so they differ.
Quoted 1 line
Would I need to add Sparc32 and Sparc64 versions some day?
Should there be a Xen port to these archs, yes.
Samuel
Re: [Qemu-devel] [PATCH 5/7] xen: add block device backend driver.
In reply to Blue SwirlQuoted 9 lines · Blue Swirl
Quoted 3 lines · Gerd Hoffmann
+/* i386 protocol version */
+#pragmapack(push, 4)What's wrong with
__attribute__(__aligned__)?
Quoted 7 lines
Quoted 4 lines
+ * FIXME: the code is designed to handle multiple outstanding + * requests (using aio or using threads), which isn't used right + * now due to limitations of the qemu block driver interface.Yes, what happened to vectored DMA patches?
Believe it or not, they were hurting performance in KVM. Passing a vector to the block layer will force the IO operation to be split up into multiple requests that are all executed in serial (since QEMU only supports 1 outstanding request at a time). Copying the vectored IO to a linear buffer increased performance significantly because it avoided this serialization.
The block layer needs some refactoring to support proper vectored AIO operations before a zero-copy API will make sense from a performance perspective.
Regards,
Anthony Liguori
Re: [Qemu-devel] [PATCH 5/7] xen: add block device backend driver.
In reply to Blue SwirlQuoted 5 lines · Blue Swirl
Quoted 2 lines · Gerd Hoffmann
+/* i386 protocol version */
+#pragmapack(push, 4)What's wrong with
__attribute__(__aligned__)?
That one is tricky because we must be binary compatible with xen. And the block driver protocol has a small design flaw: It has a 64bit value
which is not aligned on a 64bit border. This leads to different struct
layouts on i386 and x86_64 due to different alignment rules. Unless you force them into something else, like we do in that header file to deal with it. Which is needed to run 32bit guests on 64bit hosts.
Quoted 3 lines
Quoted 1 line
+
RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blkdev->rings.common, send_notify);
EUGLY_LONG_NAME_WITH_ALL_CAPS
Xen API, no way around that, sorry.
Quoted 6 lines
Quoted 3 lines
+ mode = O_RDONLY; + qflags = BDRV_O_RDONLY; + info |= VDISK_READONLY | VDISK_REMOVABLE | VDISK_CDROM;Does this mean that all read-only disks are assumed to be CDROMs or that all removable disks are read-only?
I'll double-check, but I think there is no media=[disk|cdrom] indicator in xenstore. So that was the best I could come up with ...
Quoted 1 line
Why
IF_XEN?
I've seen you've noticed meanwhile in patch #7 ;)
Quoted 1 line
Why different protocols for i386 and
x86_64?
See above.
Quoted 2 lines
Would I need to add
Sparc32 and Sparc64 versions some day?
Not sure whenever the same 32/64bit ABI issue exists on sparc. If so, the code handling this on x86 should work for sparc too.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Re: [Qemu-devel] [PATCH 5/7] xen: add block device backend driver.
Quoted 5 lines · Gerd Hoffmann
Quoted 4 lines · Blue Swirl
Quoted 2 lines · Gerd Hoffmann
+/* i386 protocol version */
+#pragmapack(push, 4)
Quoted 8 lines
Quoted 1 line
What's wrong with
__attribute__(__aligned__)?That one is tricky because we must be binary compatible with xen. And the block driver protocol has a small design flaw: It has a 64bit value
which is not aligned on a 64bit border. This leads to different struct
layouts on i386 andx86_64due to different alignment rules. Unless you force them into something else, like we do in that header file to deal with it. Which is needed to run 32bit guests on 64bit hosts.
qemu should be host independent. You need to use packed structures with appropriate padding.
Paul
Re: [Qemu-devel] [PATCH 5/7] xen: add block device backend driver.
Quoted 13 lines · Paul Brook
Quoted 11 lines · Gerd Hoffmann
Quoted 4 lines · Blue Swirl
Quoted 2 lines · Gerd Hoffmann
+/* i386 protocol version */
+#pragmapack(push, 4)What's wrong with
__attribute__(__aligned__)?That one is tricky because we must be binary compatible with xen. And the block driver protocol has a small design flaw: It has a 64bit value
which is not aligned on a 64bit border. This leads to different struct
layouts on i386 andx86_64due to different alignment rules. Unless you force them into something else, like we do in that header file to deal with it. Which is needed to run 32bit guests on 64bit hosts.
Quoted 2 lines
qemu should be host independent. You need to use packed structures with appropriate padding.
I think the current code is correct. Ok, the verbose version. The struct in question looks like this:
struct blkif_request {
uint8_t operation;
uint8_t nr_segments;
blkif_vdev_t handle;
uint64_t id;
[ ... ]};
The critical element is id. blkif_vdev_t is uint16_t, which means id is 32bit aligned but not 64bit aligned.
On i386 64bit values get 32bit alignments by default. On x86_64 64bit values get 64bit alignments by default. Thus x86_64 has a 32bit padding hole just before id. i386 hasn't.
So we define a i386 and a x86_64 version of the struct. The i386 version is wrapped into a pragma like this ...
#pragma pack(push, 4)
struct blkif_x86_32_request {
[ ... ]
}
#pragma pack(pop)... to enforce i386 alignment rules everythere.
The x86_64 version looks like this ...
struct blkif_x86_64_request {
[ ... ]
uint64_t __attribute__((__aligned__(8))) id;
[ ... ]};
... to make sure the id element is 64bit aligned everythere.
That gives us the correct struct layouts for both i386 and x86_64 builds.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Re: [Qemu-devel] [PATCH 5/7] xen: add block device backend driver.
In reply to Gerd HoffmannQuoted 8 lines · Gerd Hoffmann
Quoted 5 lines · Blue Swirl
Quoted 2 lines · Gerd Hoffmann
+/* i386 protocol version */
+#pragmapack(push, 4)What's wrong with
__attribute__(__aligned__)?
Quoted 6 lines
That one is tricky because we must be binary compatible with xen. And
the block driver protocol has a small design flaw: It has a 64bit value
which is not aligned on a 64bit border. This leads to different struct
layouts on i386 andx86_64due to different alignment rules. Unless you force them into something else, like we do in that header file to deal with it. Which is needed to run 32bit guests on 64bit hosts.
Isn't this internal Xen protocol, so hopefully next version of Xen could use more efficient structures?
Quoted 6 lines
Quoted 2 lines
Would I need to add
Sparc32 and Sparc64 versions some day?Not sure whenever the same 32/64bit ABI issue exists on sparc. If so,
the code handling this on x86 should work for sparc too.
Well, I'd rather define a new, more architecturally neutral structure.
Re: [Qemu-devel] [PATCH 5/7] xen: add block device backend driver.
Quoted 16 lines · Blue Swirl
Quoted 8 lines · Gerd Hoffmann
Quoted 5 lines · Blue Swirl
Quoted 2 lines · Gerd Hoffmann
+/* i386 protocol version */
+#pragmapack(push, 4)What's wrong with
__attribute__(__aligned__)?Quoted 6 lines
That one is tricky because we must be binary compatible with xen. And
the block driver protocol has a small design flaw: It has a 64bit value
which is not aligned on a 64bit border. This leads to different struct
layouts on i386 andx86_64due to different alignment rules. Unless you force them into something else, like we do in that header file to deal with it. Which is needed to run 32bit guests on 64bit hosts.
Quoted 2 lines
Isn't this internal Xen protocol, so hopefully next version of Xen could use more efficient structures?
No. It is part of the guest <=> host ABI. So changing that would break existing guest kernels. Otherwise we wouldn't hop through these loops in the first place.
In case the ABI is changed anyway at some point in the future (like it was done from xen 2.x -> 3.0) this can be cleaned up of course. I doubt that will happen though.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Re: [Xen-devel] Re: [Qemu-devel] [PATCH 5/7] xen: add block device backend driver.
In reply to Gerd HoffmannQuoted 9 lines · Gerd Hoffmann, le Mon 04 Aug 2008 21:50:50 +0200, a écrit :
Quoted 6 lines
Quoted 3 lines
+ mode = O_RDONLY; + qflags = BDRV_O_RDONLY; + info |= VDISK_READONLY | VDISK_REMOVABLE | VDISK_CDROM;Does this mean that all read-only disks are assumed to be CDROMs or that all removable disks are read-only?
I'll double-check, but I think there is no media=[disk|cdrom] indicator in xenstore.
There is: the info node, which is an OR of the
VDISK_CDROM/REMOVABLE/READONLY flags.
Samuel
Re: [Xen-devel] Re: [Qemu-devel] [PATCH 5/7] xen: add block device backend driver.
Quoted 11 lines · Samuel Thibault
Quoted 7 lines · Gerd Hoffmann, le Mon 04 Aug 2008 21:50:50 +0200, a écrit :
Quoted 5 lines
Quoted 3 lines
+ mode = O_RDONLY; + qflags = BDRV_O_RDONLY; + info |= VDISK_READONLY | VDISK_REMOVABLE | VDISK_CDROM;Does this mean that all read-only disks are assumed to be CDROMs or that all removable disks are read-only?
I'll double-check, but I think there is no media=[disk|cdrom] indicator in xenstore.
There is: the info node, which is an OR of the
VDISK_CDROM/REMOVABLE/READONLY flags.
Who sets that node? Backend driver or xend?
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Re: [Xen-devel] Re: [Qemu-devel] [PATCH 5/7] xen: add block device backend driver.
Quoted 4 lines · Gerd Hoffmann, le Tue 05 Aug 2008 08:52:26 +0200, a écrit :
Quoted 2 lines
There is: the info node, which is an OR of the
VDISK_CDROM/REMOVABLE/READONLY flags.Who sets that node? Backend driver or xend?
backend, see linux/driver/xen/blkback/xenbus.c
Samuel
Re: [Xen-devel] Re: [Qemu-devel] [PATCH 5/7] xen: add block device backend driver.
Quoted 6 lines · Samuel Thibault
Quoted 3 lines · Gerd Hoffmann, le Tue 05 Aug 2008 08:52:26 +0200, a écrit :
Quoted 2 lines
There is: the info node, which is an OR of the
VDISK_CDROM/REMOVABLE/READONLY flags.Who sets that node? Backend driver or xend?
backend, see
linux/driver/xen/blkback/xenbus.c
Hmm, ok.
mode="r" (in backend directory) means readonly, ok. device-type="cdrom" (backend dir too) means cdrom, ok.
fixed up these.
removable can't be indicated to the backend via xenstore?
ignoring that for now.
btw: Looks like blktap doesn't set any VDISK_* flags?
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Re: [Xen-devel] Re: [Qemu-devel] [PATCH 5/7] xen: add block device backend driver.
Quoted 4 lines · Gerd Hoffmann, le Tue 05 Aug 2008 13:07:52 +0200, a écrit :
Quoted 3 lines · Samuel Thibault
Quoted 2 lines · Gerd Hoffmann, le Tue 05 Aug 2008 08:52:26 +0200, a écrit :
Quoted 2 lines
There is: the info node, which is an OR of the
VDISK_CDROM/REMOVABLE/READONLY flags.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Who sets that node? Backend driver or xend?
backend, see
linux/driver/xen/blkback/xenbus.cHmm, ok.
mode="r" (in backend directory) means readonly, ok. device-type="cdrom" (backend dir too) means cdrom, ok.
These are set by xend, i.e. when they come from the config, indeed.
Quoted 1 line
removable can't be indicated to the backend via xenstore?
Doesn't look like it is possible. Why would you want to do that?
Quoted 1 line
btw: Looks like blktap doesn't set any VDISK_* flags?
I guess that's because blktap doesn't have the information. The "info" node is information about the underlying source of data, detected by the block backend, while "mode" and "device-type" are configured by the user (and should override the "info" information I guess).
Samuel
PATCH 6/7 xen: add net backend driver.
In reply to Gerd HoffmannThis patch adds a network interface backend driver to qemu. It is a pure userspace implemention using the gntdev interface. It uses "qnet" as backend name in xenstore so it doesn't interfere with the netback backend (aka "vnif").
The network backend is hooked into the corrosponding qemu vlan, i.e. vif 0 is hooked into vlan 0. To make the packages actually arrive somewhere you additionally have to link the vlan to the outside world using the usual qemu command line options such as "-net tap,...".
--- Makefile.target | 2 +- hw/xen-backend.h | 1 + hw/xen-machine.c | 1 + hw/xen-nic.c | 380 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 383 insertions(+), 1 deletions(-) create mode 100644 hw/xen-nic.c
Makefile.target +1 -1
@@ -517,7 +517,7 @@ endif # xen backend driver support XEN_OBJS := xen-machine.o xen-backend.o -XEN_OBJS += xen-console.o xen-framebuffer.o xen-disk.o +XEN_OBJS += xen-console.o xen-framebuffer.o xen-disk.o xen-nic.o ifeq ($(CONFIG_XEN), yes) OBJS += $(XEN_OBJS) LIBS += $(XEN_LIBS)
hw/xen-backend.h +1 -0
@@ -90,6 +90,7 @@ struct XenDevOps xen_console_ops; /* xen_console.c */struct XenDevOps xen_kbdmouse_ops;/* xen_framebuffer.c */ struct XenDevOps xen_framebuffer_ops;/* xen_framebuffer.c */ struct XenDevOps xen_blkdev_ops;/* xen_disk.c */ +struct XenDevOps xen_netdev_ops;/* xen_nic.c */ void xen_set_display (int domid,DisplayState *ds);
hw/xen-machine.c +1 -0
@@ -102,6 +102,7 @@ static int xen_init_pv(DisplayState *ds)xen_be_register ("vkbd" , &xen_kbdmouse_ops);xen_be_register ("vfb" , &xen_framebuffer_ops);xen_be_register ("qdisk" , &xen_blkdev_ops); +xen_be_register ("qnic" , &xen_netdev_ops);/* setup framebuffer */ xen_set_display (xen_domid, ds);
hw/xen-nic.c new file +380 -0
380 lines not on this page · raw message
Signature · 1 line
1.5.5.1
PATCH 7/7 xen: blk & nic configuration via cmd line.
In reply to Gerd HoffmannThis patch makes qemu create backend and frontend device entries in xenstore for devices configured on the command line. It will use qdisk and qnic backend names, so the qemu internal backends will be used.
Disks can be created using -drive if=xen,file=...
Nics can be created using -net nic,macaddr=...
--- Makefile.target | 2 +- hw/xen-backend.h | 7 +++ hw/xen-config.c | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ hw/xen-machine.c | 19 +++++++- 4 files changed, 165 insertions(+), 2 deletions(-) create mode 100644 hw/xen-config.c
Makefile.target +1 -1
@@ -516,7 +516,7 @@ LIBS += $(CONFIG_VNC_TLS_LIBS) endif # xen backend driver support -XEN_OBJS := xen-machine.o xen-backend.o +XEN_OBJS := xen-machine.o xen-backend.o xen-config.o XEN_OBJS += xen-console.o xen-framebuffer.o xen-disk.o xen-nic.o ifeq ($(CONFIG_XEN), yes) OBJS += $(XEN_OBJS)
hw/xen-backend.h +7 -0
@@ -3,6 +3,8 @@#include "xen-common.h" #include "sysemu.h" +#include "net.h" +#include "block_int.h" /* ------------------------------------------------------------- */
@@ -94,4 +96,9 @@ struct XenDevOps xen_netdev_ops; /* xen_nic.c */void xen_set_display (int domid,DisplayState *ds); +/* configuration (aka xenbus setup) */ +void xen_config_cleanup (void ); +int xen_config_dev_blk (DriveInfo *disk); +int xen_config_dev_nic (NICInfo *nic); +#endif /* QEMU_XEN_BACKEND_H */
hw/xen-config.c new file +139 -0
139 lines not on this page · raw message
hw/xen-machine.c +18 -1
@@ -121,7 +121,7 @@ static void xenpv_init(ram_addr_t ram_size, int vga_ram_size, const char *cpu_model) {CPUState *env; -int rc; +int index,i,rc; rc =xen_init_pv (ds);if (-1 == rc)
@@ -147,6 +147,23 @@ static void xenpv_init(ram_addr_t ram_size, int vga_ram_size, env =cpu_init (cpu_model); env->halted =1 ; +/* configure disks */ +for (i =0 ; i <16 ; i++) { + index =drive_get_index (IF_XEN ,0 , i); +if (index ==-1 ) +continue ; +xen_config_dev_blk (drives_table + index); + } + +/* configure nics */ +for (i =0 ; i < nb_nics; i++) { +if (nd_table[i].model &&0 !=strcmp (nd_table[i].model,"xen" )) +continue ; +xen_config_dev_nic (nd_table + i); + } + +/* config cleanup hook */ +atexit (xen_config_cleanup);return ; err:
Signature · 1 line
1.5.5.1
Re: [Qemu-devel] [PATCH 7/7] xen: blk & nic configuration via cmd line.
Quoted 1 line · Gerd Hoffmann
+ index =
drive_get_index(IF_XEN, 0, i);
Oh, that's why IF_XEN.
Quoted 2 lines
+ /* config cleanup hook */
+atexit(xen_config_cleanup);
I'd put this in vl.c, it's not machine specific.
Re: [Qemu-devel] [PATCH 7/7] xen: blk & nic configuration via cmd line.
Quoted 4 lines · Blue Swirl
Quoted 2 lines
+ /* config cleanup hook */
+atexit(xen_config_cleanup);I'd put this in
vl.c, it's not machine specific.
It actually is because it cleans up stuff only created for the xenpv machine type. Moving it to vl.c doesn't hurt, I would have to wrap it into "#ifdef CONFIG_XEN" though ...
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Re: [Qemu-devel] [PATCH 7/7] xen: blk & nic configuration via cmd line.
Quoted 10 lines · Gerd Hoffmann
Quoted 4 lines · Blue Swirl
Quoted 2 lines
+ /* config cleanup hook */
+atexit(xen_config_cleanup);I'd put this in
vl.c, it's not machine specific.It actually is because it cleans up stuff only created for the xenpv
machine type. Moving it tovl.cdoesn't hurt, I would have to wrap it into "#ifdefCONFIG_XEN" though ...
I was thinking that for example Sparc32/64 would need another machine, but it looks like the changes could be small and all CPUs could use the same xenpv machine type. So it's fine as it is now.
Quoted 10 lines · Gerd Hoffmann
Hi folks,
xen support is implemented using another machine type. xen's qemu-dm already uses the machine type to switch between paravirtualized and fully virtualized machines, so this was the natural choice. qemu has gets a new "xenpv" machine type additionally to the "pc" and "isapc" ones.
Comments?
Modulo some of the stylistic feedback that needs to be addressed, I think these series looks pretty good. It fits pretty well into QEMU. Unless there are major objections, I'll apply an updated series once people have had some time to look through it.
However, I'd like to see agreement within the Xen community that this is the right approach first. In particular, I would like to see these patches either merged with upstream Xen or for upstream Xen to plan to rebase against QEMU to pick them up and use them for PV support. This doesn't mean they have to use the block and net backends of course. I really don't want to support two implementations of Xen support in QEMU.
Regards,
Anthony Liguori
Quoted 6 lines
cheers,
Gerd
Quoted 5 lines · Anthony Liguori
However, I'd like to see agreement within the Xen community that this
is the right approach first. In particular, I would like to see
these patches either merged with upstream Xen or for upstream Xen to plan to rebase against QEMU to pick them up and use them for PV support.
Ian Jackson has a qemu git tree at
http://www.chiark.greenend.org.uk/~ijackson/qemu-xen.git
As far I know it is rebased now and then and the long-term plan is to get the delta to upstream qemu at least smaller. Dunno whenever it ever will be zero due to stuff like mapcache.
There are a few compatibility issues to be solved somehow before upstream qemu is able to completely replace xen's qemu-dm:
(1) my patches use -domid to specify the domain id. xen uses (used?) -d instead. Which isn't going to work because upstream qemu uses that switch for something else. Ian's tree supports both -d and -domid, with a comment saying -d is deprecated. So I think we have an agreement to use -domid here ;)
(2) xen added a -domain-name switch. upstream qemu has a -name switch. my patches do not implement -domain-name, I use the name set via -name instead. IMHO xen should pick up the upstream way to do things here, i.e. switch over to -name.
(3) vnc configuration is different. This one is not so easy due to xenstore being involved. So the way things work are pretty xen specific and don't make that much sense for upstream qemu. The differences are:
Setting the vnc password: qemu uses a monitor command. xen reads it from xenstore (set by xend). I think we can just support both ways here.
xen has a -vncunused switch which makes qemu scan for a free vnc display. The tcp port actually used is written to xenstore. Dunno how to handle that one best. First, I think should be a -vnc switch option instead of a separate command line switch. Second, propagating the used port via xenstore doesn't make sense at all for upstream qemu ...
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Quoted 7 lines · Gerd Hoffmann, le Tue 05 Aug 2008 11:58:55 +0200, a écrit :
Quoted 5 lines · Anthony Liguori
However, I'd like to see agreement within the Xen community that this
is the right approach first. In particular, I would like to see
these patches either merged with upstream Xen or for upstream Xen to plan to rebase against QEMU to pick them up and use them for PV support.
Quoted 6 lines
Ian Jackson has a qemu git tree at
http://www.chiark.greenend.org.uk/~ijackson/qemu-xen.gitAs far I know it is rebased now and then and the long-term plan is to get the delta to upstream qemu at least smaller. Dunno whenever it ever will be zero due to stuff like mapcache.
There are two branches there: the xen branch is stuff that Ian indeed doesn't intend to push. The qemu branch is stuff that he wishes to push.
Samuel
Quoted 2 lines · Anthony Liguori, le Mon 04 Aug 2008 12:42:38 -0500, a écrit :
However, I'd like to see agreement within the Xen community that this is the right approach first.
Unfortunately, Ian Jackson (who will continue to maintain his qemu tree) is away this week.
Quoted 3 lines
In particular, I would like to see these
patches either merged with upstream Xen or for upstream Xen to plan to rebase against QEMU to pick them up and use them for PV support.
I have not had a precise look at e.g. the xenfb.c code, but if what Gerd has submitted is exactly the same as xen-unstable's, then that part is already merged :)
As for the rest, as Gerd said Ian is maintaining a rebased tree, which is currently used by default in the upcoming xen 4.0 (aka 3.3). He won't rebase it until that release, but after that he will probably regularly, with much less pain than previously anyway since we now have a fine git tree.
Samuel
Quoted 3 lines
I have not had a precise look at e.g. the
xenfb.ccode, but if what Gerd has submitted is exactly the same as xen-unstable's, then that part is already merged :)
It isn't exactly the same code. For example the xenbus state engine has been factored out into generic code, shared by all backend drivers. The behaviour should be identical though.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Quoted 6 lines · Gerd Hoffmann, le Tue 05 Aug 2008 13:12:35 +0200, a écrit :
Quoted 3 lines
I have not had a precise look at e.g. the
xenfb.ccode, but if what Gerd has submitted is exactly the same as xen-unstable's, then that part is already merged :)It isn't exactly the same code. For example the xenbus state engine has been factored out into generic code, shared by all backend drivers.
Then it'd probably be good to push that upstream Xen.
Samuel
Quoted 8 lines · Samuel Thibault
Quoted 5 lines · Gerd Hoffmann, le Tue 05 Aug 2008 13:12:35 +0200, a écrit :
Quoted 3 lines
I have not had a precise look at e.g. the
xenfb.ccode, but if what Gerd has submitted is exactly the same as xen-unstable's, then that part is already merged :)It isn't exactly the same code. For example the xenbus state engine has been factored out into generic code, shared by all backend drivers.
Then it'd probably be good to push that upstream Xen.
I'm cross-posting the patches to xen-devel for a reason.
Whenever you want to pick them up now or just wait for them appear in upstream qemu and handle it with the next rebase is your call. But at least reviewing and commenting now would be very helpful, so I don't break things for xen by mistake and we can proceed with merging those bits.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Quoted 4 lines · Gerd Hoffmann, le Tue 05 Aug 2008 15:18:46 +0200, a écrit :
Quoted 1 line · Samuel Thibault
Then it'd probably be good to push that upstream Xen.
I'm cross-posting the patches to xen-devel for a reason.
Well, cross-posting qemu patches to xen-devel is not the same as posting xen patches to xen-devel...
Samuel
Quoted 8 lines · Samuel Thibault, le Tue 05 Aug 2008 16:03:28 +0100, a écrit :
Quoted 4 lines · Gerd Hoffmann, le Tue 05 Aug 2008 15:18:46 +0200, a écrit :
Quoted 1 line · Samuel Thibault
Then it'd probably be good to push that upstream Xen.
I'm cross-posting the patches to xen-devel for a reason.
Well, cross-posting qemu patches to xen-devel is not the same as posting xen patches to xen-devel...
Just to explain a bit more, now that I have read the patches a bit: what is there is somehow far from the xen unstable tree, at least because of the backend driver core, and because of other 'details' (renaming, moving). I doubt Ian will be happy to have to make the effort to merge that in his tree and I guess he will probably just drop everything and keep the xen-unstable version.
Samuel
Quoted 8 lines · Samuel Thibault
Quoted 5 lines · Samuel Thibault, le Tue 05 Aug 2008 16:03:28 +0100, a écrit :
Gerd Hoffmann, le Tue 05 Aug 2008 15:18:46 +0200, a écrit :
Well, cross-posting qemu patches to xen-devel is not the same as posting xen patches to xen-devel...
Quoted 7 lines
Just to explain a bit more, now that I have read the patches a bit: what is there is somehow far from the xen unstable tree, at least because of the backend driver core, and because of other 'details' (renaming, moving). I doubt Ian will be happy to have to make the effort to merge that in his tree and I guess he will probably just drop everything and keep the xen-unstable version.
Which is why ya'll need to work something out before we apply these patches to QEMU :-)
Regards,
Anthony Liguori
Quoted 2 lines
Samuel
Quoted 21 lines · Anthony Liguori
Quoted 5 lines · Samuel Thibault
Quoted 2 lines · Samuel Thibault, le Tue 05 Aug 2008 16:03:28 +0100, a écrit :
Gerd Hoffmann, le Tue 05 Aug 2008 15:18:46 +0200, a écrit :
Well, cross-posting qemu patches to xen-devel is not the same asposting
Quoted 4 lines
Quoted 3 lines
xen patches to xen-devel...
Quoted 8 lines
Just to explain a bit more, now that I have read the patches a bit: what is there is somehow far from the xen unstable tree, at least because of the backend driver core, and because of other 'details' (renaming, moving). I doubt Ian will be happy to have to make the effort to merge that in his tree and I guess he will probably just drop everything and keep the xen-unstable version.
Quoted 2 lines
Which is why ya'll need to work something out before we apply these patches
to QEMU :-)
I'd salvage nodisk feature (useful for Sparc and embedded systems) and if ever produced, patch that introduces qemu_realloc and does s/realloc/qemu_realloc/g.
For global -Wall -Wstrict-prototypes flags probably the project leaders should agree that it will be useful.
Quoted 11 lines · Samuel Thibault, le Tue 05 Aug 2008 16:41:40 +0100, a écrit :
Quoted 8 lines · Samuel Thibault, le Tue 05 Aug 2008 16:03:28 +0100, a écrit :
Quoted 4 lines · Gerd Hoffmann, le Tue 05 Aug 2008 15:18:46 +0200, a écrit :
Quoted 1 line · Samuel Thibault
Then it'd probably be good to push that upstream Xen.
I'm cross-posting the patches to xen-devel for a reason.
Well, cross-posting qemu patches to xen-devel is not the same as posting xen patches to xen-devel...
Just to explain a bit more, now that I have read the patches a bit:
And to be even more explicit, by "I have read the patches", I mean: I have applied them to upstream qemu, them vimdiffed the files there with the ones from Ian's tree (sometimes with different names), in order to have an idea of what the merge would be (i.e. the "xen patches" I mentioned above, which is what we care about from the point of view of xen-unstable).
Samuel
Quoted 8 lines · Samuel Thibault
Quoted 6 lines · Samuel Thibault, le Tue 05 Aug 2008 16:03:28 +0100, a écrit :
Quoted 3 lines · Gerd Hoffmann, le Tue 05 Aug 2008 15:18:46 +0200, a écrit :
Quoted 1 line · Samuel Thibault
Then it'd probably be good to push that upstream Xen.
I'm cross-posting the patches to xen-devel for a reason.
Well, cross-posting qemu patches to xen-devel is not the same as posting xen patches to xen-devel...
Quoted 6 lines
Just to explain a bit more, now that I have read the patches a bit: what is there is somehow far from the xen unstable tree, at least because of the backend driver core, and because of other 'details' (renaming, moving). I doubt Ian will be happy to have to make the effort to merge that in his tree and I guess he will probably just drop everything and keep the xen-unstable version.
Sure, merging stuff upstream involves alot of work short-term, you'll get the benefits long-term.
pv domain support is easy, as this is largely self-contained. hvm will be even more work, because hvm support is much more invasive and on top of that the qemu interfaces will change to nicely support the various ways to run code natively instead of emulated (kqemu, kvm, xen).
The rough way to merge would look like this:
- drop xen_console.[ch]
- drop xenfb.[ch]
- drop xen_machine_pv.c
- add xen.h
- add xen-machine.c
- add xen-backend.[ch]
- add xen-console.c
- add xen-framebuffer.c
- wind up stuff in the Makefiles.
- some global renames (domid -> xen_domid for example) as I took care to prefix global xen variables & functions with xen_.
- probably some small fixups are needed ...
You probably wouldn't do that before the 3.3 (4.0?) release. If you keep the xenish vl.c version the differences between upstream qemu and qemu-dm command line options and vnc handling go away. The you can gradually move qemu-dm to be more upstream-ish while also updating xend accordingly.
Note that qemu-dm has a few optimizations in the qemu display code to avoid unneeded work. I'd suggest to submit them upstream. The we can enable the bits in xen-framebuffer.c which make use of them. DisplayState->idle for example.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Quoted 12 lines · Gerd Hoffmann, le Wed 06 Aug 2008 12:14:25 +0200, a écrit :
The rough way to merge would look like this:
- drop xen_console.[ch]
- drop xenfb.[ch]
- dropxen_machine_pv.c- add
xen.h
- addxen-machine.c
- add xen-backend.[ch]
- addxen-console.c
- addxen-framebuffer.c
Quoted 4 lines
- wind up stuff in the Makefiles.
- some global renames (domid ->xen_domidfor example) as I took care to prefix global xen variables & functions withxen_.
- probably some small fixups are needed ...
You forgot the _test_ stage. You are basically asking us to replace our well-tested implementation with your implementation, that's quite a move. You are not even providing a patch for us to check that nothing has been left behind...
Quoted 2 lines
Note that qemu-dm has a few optimizations in the qemu display code to avoid unneeded work. I'd suggest to submit them upstream.
That's planned, yes. But you too could do the same for the device backend core for instance...
Quoted 2 lines
The you can gradually move qemu-dm to be more upstream-ish while also updating xend accordingly.
That's what we are already doing in Ian's tree.
Samuel
Quoted 18 lines · Samuel Thibault
Quoted 12 lines · Gerd Hoffmann, le Wed 06 Aug 2008 12:14:25 +0200, a écrit :
The rough way to merge would look like this:
- drop xen_console.[ch]
- drop xenfb.[ch]
- dropxen_machine_pv.c- add
xen.h
- addxen-machine.c
- add xen-backend.[ch]
- addxen-console.c
- addxen-framebuffer.cQuoted 4 lines
- wind up stuff in the Makefiles.
- some global renames (domid ->xen_domidfor example) as I took care to prefix global xen variables & functions withxen_.
- probably some small fixups are needed ...
Quoted 4 lines
You forgot the _test_ stage. You are basically asking us to replace our well-tested implementation with your implementation, that's quite a move. You are not even providing a patch for us to check that nothing has been left behind...
It *is* quite move, becauses it accomplishes a lot: it goes from a heavily modified fork of an oldish version all the way to merge with upstream, as far as PV is concerned.
If that's where we want to go, we can of course still argue whether we should go in leaps or baby steps, and whether Gerd's leap lands in quite the right spot. But the distance to conquer remains the same, and so does the testing challenge.
For what it's worth, I went over significant parts of Gerd's patch (all the generic stuff + pvfb) with a fine comb, comparing it to what we have now. I consider it sound.
[...]
Quoted 3 lines · Markus Armbruster, le Wed 06 Aug 2008 08:43:49 -0400, a écrit :
It *is* quite move, becauses it accomplishes a lot: it goes from a heavily modified fork of an oldish version all the way to merge with upstream, as far as PV is concerned.
Then why doing it in qemu before having it tested in the xen unstable tree? That's not the way I usually see merging happen.
Quoted 3 lines
For what it's worth, I went over significant parts of Gerd's patch (all the generic stuff + pvfb) with a fine comb, comparing it to what we have now. I consider it sound.
I'm not saying it's not fine. I had a look and the code looked fine indeed. But what I'm afraid of is the delta with Ian would have to bear when merging: is it save/restore safe, does it work with PCI pass-through, VT-D, etc.?
Quoted 3 lines
If that's where we want to go, we can of course still argue whether we should go in leaps or baby steps, and whether Gerd's leap lands in quite the right spot.
Baby steps are much easier to review. That's how things are usually done, and here it looks to me like it is feasible to achieve in Xen (and have it tested) before event thinking about importing a pile of code in qemu where it won't receive as much testing as the xen-unstable tree receives.
Samuel
Hi,
Quoted 5 lines
Baby steps are much easier to review. That's how things are usually done, and here it looks to me like it is feasible to achieve in Xen (and have it tested) before event thinking about importing a pile of code in qemu where it won't receive as much testing as the xen-unstable tree receives.
IMHO the best way to address this issue is to rebase frequently. The xen-unstable testing will also covers qemu then. It also keeps the delta smaller and makes it easier to test qemu patches in qemu-dm.
I'm trying to fiddle my bits into qemu-dm right now. One problem is that I get build failures simply because of the fact that the qemu-dm base is old compared to upstream qemu.
It would also be great if you can clean up the header mess. qemu-dm doesn't build without xen-unstable.hg. And just a checked out tree isn't good enougth, it must be compiled because qemu-dm depends on some generated header files. Aiee. IMHO qemu-dm should only need /usr/include/xen. If headers are missing there, they should be installed.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Quoted 1 line · Gerd Hoffmann, le Wed 06 Aug 2008 15:54:33 +0200, a écrit :
IMHO the best way to address this issue is to rebase frequently.
Then why not pushing the changes to xen repositories in the first place?
Quoted 3 lines
I'm trying to fiddle my bits into qemu-dm right now. One problem is that I get build failures simply because of the fact that the qemu-dm base is old compared to upstream qemu.
Use Ian Jackson's tree!
Quoted 5 lines
It would also be great if you can clean up the header mess. qemu-dm doesn't build without xen-unstable.hg. And just a checked out tree isn't good enougth, it must be compiled because qemu-dm depends on some generated header files. Aiee. IMHO qemu-dm should only need
/usr/include/xen. If headers are missing there, they should be installed.
You could submit patches...
Samuel
Quoted 4 lines · Samuel Thibault
Quoted 1 line · Gerd Hoffmann, le Wed 06 Aug 2008 15:54:33 +0200, a écrit :
IMHO the best way to address this issue is to rebase frequently.
Then why not pushing the changes to xen repositories in the first place?
Because I want have xen support in *upstream* qemu.
Quoted 5 lines
Quoted 3 lines
I'm trying to fiddle my bits into qemu-dm right now. One problem is that I get build failures simply because of the fact that the qemu-dm base is old compared to upstream qemu.
Use Ian Jackson's tree!
Adapt my patches to an oldish qemu fork, so they must be adapted again for submitting upstream? No, thank you.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Quoted 7 lines · Gerd Hoffmann, le Wed 06 Aug 2008 16:08:47 +0200, a écrit :
Quoted 4 lines · Samuel Thibault
Quoted 1 line · Gerd Hoffmann, le Wed 06 Aug 2008 15:54:33 +0200, a écrit :
IMHO the best way to address this issue is to rebase frequently.
Then why not pushing the changes to xen repositories in the first place?
Because I want have xen support in *upstream* qemu.
I know, but you are basically saying "ok, guys, you'll just manage the breakage of the big merge, thanks", that's not very convenient, to say the least. For instance, where should fix patches be sent to? Both qemu-devel and xen-devel? Just xen-devel and thus make Ian have to push them to qemu-devel?
Pushing the cleaning changes to Xen first can be done and would entail much easier to tackle breakage, and the merge back from qemu would then be trivial, why not doing so?
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
I'm trying to fiddle my bits into qemu-dm right now. One problem is that I get build failures simply because of the fact that the qemu-dm base is old compared to upstream qemu.
Use Ian Jackson's tree!
Adapt my patches to an oldish qemu fork, so they must be adapted again for submitting upstream? No, thank you.
AGAIN, THERE IS THE IAN JACKSON TREE.
Thanks for reading. Ian has _already_ done that hard work.
Samuel
Quoted 4 lines · Samuel Thibault
Quoted 3 lines · Gerd Hoffmann, le Wed 06 Aug 2008 16:08:47 +0200, a écrit :
Quoted 2 lines · Samuel Thibault
Quoted 1 line · Gerd Hoffmann, le Wed 06 Aug 2008 15:54:33 +0200, a écrit :
IMHO the best way to address this issue is to rebase frequently.
Quoted 8 lines
Quoted 2 lines
Quoted 1 line
Then why not pushing the changes to xen repositories in the first place?
Because I want have xen support in *upstream* qemu.
I know, but you are basically saying "ok, guys, you'll just manage the breakage of the big merge, thanks", that's not very convenient, to say the least. For instance, where should fix patches be sent to? Both qemu-devel and xen-devel? Just xen-devel and thus make Ian have to push them to qemu-devel?
Most of the patches probably to both qemu-devel and xen-devel. Stuff unrelated to xen (say e1000 emulation bugs) qemu-devel only.
Quoted 7 lines
Pushing the cleaning changes to Xen first can be done and would entail much easier to tackle breakage, and the merge back from qemu would then be trivial, why not doing so?
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
I'm trying to fiddle my bits into qemu-dm right now. One problem is that I get build failures simply because of the fact that the qemu-dm base is old compared to upstream qemu.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Use Ian Jackson's tree!
Adapt my patches to an oldish qemu fork, so they must be adapted again for submitting upstream? No, thank you.
AGAIN, THERE IS THE IAN JACKSON TREE.
Thanks for reading.
I get build failures when patching THE IAN JACKSON TREE due to THE IAN JACKSON TREE lagging behind upstream.
I can read, thank you. Please stop crying.
Quoted 1 line
Ian has _already_ done that hard work.
Oh, rebasing isn't a one-shot thing. You have to do it over and over again. Unless you get your code upstream of course.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Quoted 6 lines · Gerd Hoffmann, le Wed 06 Aug 2008 17:35:39 +0200, a écrit :
Quoted 3 lines
AGAIN, THERE IS THE IAN JACKSON TREE.
Thanks for reading.
I get build failures when patching THE IAN JACKSON TREE due to THE IAN JACKSON TREE lagging behind upstream.
You didn't mention that. "lagging" a few months indeed, while merging stuff. And because xen 4.0 is about to be released, but it will probably catch up soon. Anyway that's not a reason for not using it, I guess the build failures can be fixed more easily than redoing Ian's work.
Quoted 4 lines
Quoted 1 line
Ian has _already_ done that hard work.
Oh, rebasing isn't a one-shot thing. You have to do it over and over again.
Sure, that's why Ian was quite harsh on the modifications to the qemu code, and these are quite small now (I'm talking about the Xen-specific things, non-Xen-specific will be pushed upstream), so that shouldn't be a problem any more.
SAmuel
Quoted 10 lines · Samuel Thibault
Quoted 5 lines · Gerd Hoffmann, le Wed 06 Aug 2008 17:35:39 +0200, a écrit :
Quoted 3 lines
AGAIN, THERE IS THE IAN JACKSON TREE.
Thanks for reading.
I get build failures when patching THE IAN JACKSON TREE due to THE IAN JACKSON TREE lagging behind upstream.
You didn't mention that. "lagging" a few months indeed, while merging stuff. And because xen 4.0 is about to be released, but it will probably catch up soon.
Well, for 4.0.x you probably have to branch off anyway, so the release shouldn't stop catching up with upstream.
Quoted 3 lines
Anyway that's not a reason for not using it, I
guess the build failures can be fixed more easily than redoing Ian's work.
I'm using upstream qemu for development, and I'm not going to change that.
I can adapt the patches for the xen tree. Having the xen tree *not* lagging behind would be *very* helpful for keeping the trees and patches in sync.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Quoted 5 lines · Gerd Hoffmann, le Thu 07 Aug 2008 00:10:12 +0200, a écrit :
Quoted 4 lines · Samuel Thibault
Quoted 3 lines · Gerd Hoffmann, le Wed 06 Aug 2008 17:35:39 +0200, a écrit :
Quoted 3 lines
AGAIN, THERE IS THE IAN JACKSON TREE.
Thanks for reading.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I get build failures when patching THE IAN JACKSON TREE due to THE IAN JACKSON TREE lagging behind upstream.
You didn't mention that. "lagging" a few months indeed, while merging stuff. And because xen 4.0 is about to be released, but it will probably catch up soon.
Well, for 4.0.x you probably have to branch off anyway,
When 4.0 gets released, yes.
Quoted 1 line
so the release shouldn't stop catching up with upstream.
The way Xen has been working up to now is to branch the trunk just after the release, not before.
Quoted 5 lines
Quoted 3 lines
Anyway that's not a reason for not using it, I
guess the build failures can be fixed more easily than redoing Ian's work.I'm using upstream qemu for development, and I'm not going to change that.
No problem.
Quoted 1 line
I can adapt the patches for the xen tree.
That's what I'm asking you from the start of the thread, I guess my english is not so clear.
Quoted 2 lines
Having the xen tree *not* lagging behind would be *very* helpful for keeping the trees and patches in sync.
Sure, it just happens that it couldn't be done before we get Ian's tree working. Once the 4.0 release is done we can tighten the gap. And things that shouldn't be only in Ian's tree (e.g. the enhanced serial support) are being pushed already.
Samuel
Quoted 1 line · Gerd Hoffmann
Samuel Thibault wrote:
[...]
Quoted 8 lines
Quoted 3 lines
AGAIN, THERE IS THE IAN JACKSON TREE.
Thanks for reading.
I get build failures when patching THE IAN JACKSON TREE due to THE IAN JACKSON TREE lagging behind upstream.
I can read, thank you. Please stop crying.
Hi guys,
if you want to merge your "xen-bits" into qemu, I think you should work together not against each other...
(whereas personally I prefer KVM ;-) )
Gerd, IMHO, starting from scratch is never the best solution.
Samuel, perhaps you can help Gerd...
Regards,
Laurent
Signature · 3 lines
----------------- [email protected] ------------------ "La perfection est atteinte non quand il ne reste rien à ajouter mais quand il ne reste rien à enlever." Saint Exupéry
Quoted 3 lines · Samuel Thibault, le Wed 06 Aug 2008 15:25:26 +0100, a écrit :
Pushing the cleaning changes to Xen first can be done and would entail much easier to tackle breakage, and the merge back from qemu would then be trivial, why not doing so?
You didn't answer that part. Really, my only concern is about having things tested. Isn't it possible for instance to just merge the backend core (and console/xenfb updates) in Ian's tree first for a start? As Markus and I said, it looked sane. Then you can push your code to qemu, I guess that could be fine, as you said xen will not need to use e.g. the block and net backends.
Samuel
Quoted 8 lines · Samuel Thibault
Quoted 3 lines · Samuel Thibault, le Wed 06 Aug 2008 15:25:26 +0100, a écrit :
Pushing the cleaning changes to Xen first can be done and would entail much easier to tackle breakage, and the merge back from qemu would then be trivial, why not doing so?
You didn't answer that part. Really, my only concern is about having things tested. Isn't it possible for instance to just merge the backend core (and console/xenfb updates) in Ian's tree first for a start?
http://kraxel.fedorapeople.org/patches/qemu-xen/
I didn't touch the build system, it is even more scary than the qemu one alone, I just set CONFIG_XEN unconditionally.
I also largely left vl.c as-is, so xend shouldn't need any changes. The -domid switch sets an additional (redundant) variable, to keep the amount of changes as small as possible for now. Also -name and -domain-name are aliased, both set qemu_name and domain_name.
In upstream qemu xenpv support is a runtime-switch for the normal qemu, the xen patches leave the qemu-dm target in place.
The framebuffer driver probably has some performance regressions. Fixing those depends on the display patches being pushed upstream.
Quoted 3 lines
Then you can push your code to qemu,
I guess that could be fine, as you said xen will not need to use e.g. the block and net backends.
blk and net backends are not there (yet). But they should be a nop for xen anyway as long as you don't wind up stuff in xend to put them in use. For the net backend it probably wouldn't be that useful. The block backend should be a good replacement for blktap though and maybe can save you the effort of porting the blktap kernel driver to the pv_ops kernel.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Quoted 11 lines · Gerd Hoffmann, le Thu 07 Aug 2008 09:33:06 +0200, a écrit :
Quoted 8 lines · Samuel Thibault
Quoted 3 lines · Samuel Thibault, le Wed 06 Aug 2008 15:25:26 +0100, a écrit :
Pushing the cleaning changes to Xen first can be done and would entail much easier to tackle breakage, and the merge back from qemu would then be trivial, why not doing so?
You didn't answer that part. Really, my only concern is about having things tested. Isn't it possible for instance to just merge the backend core (and console/xenfb updates) in Ian's tree first for a start?
Ok, thanks, that's already better.
I'd still say that "delete a file then add another one" is far from convenient both from a point of view of proof-reading the patches and repository history, but I guess we can manage that with a renaming step first.
Any reason for the renames, though? (they tend to bother developpers who have to change their habits, so we can not do that without a reason)
- Why dashes instead of underscores?
- In Xen, we call xen-machine.c xen_machine_pv.c because there is also a xen_machine_fv.c. Can't the xen_machine_pv.c name be fine for qemu upstream too? Or xen can keep its own xen_machine_{pv,fv}.c and your xen-machine.c goes upstream, I don't think that would be a problem.
- I guess a xenfb -> xen[-_]{fb,framebuffer} rename is indeed more coherent, Markus, do you prefer just "fb" or the longer "framebuffer"?
Misc stuff:
- I guess the sys-queue.h file should be merged and used in qemu first?
- xen_domid is re-declared in xen-backend.h
- The BUFSIZE macro in xen-backend.h is a bit unfortunate, but still better than what we have currently. Maybe it should be renamed with a
- XEN_ prefix to avoid any clash?
- container_of would probably be useful in other parts of qemu, I guess it could be merged in qemu first?
- nice work on moving stuff from console and fb to the backend, console is easier to read now :)
Quoted 4 lines
I also largely left
vl.cas-is, so xend shouldn't need any changes. The -domid switch sets an additional (redundant) variable, to keep the amount of changes as small as possible for now. Also -name and -domain-name are aliased, both setqemu_nameanddomain_name.
That's a good thing :)
Quoted 2 lines
The framebuffer driver probably has some performance regressions. Fixing those depends on the display patches being pushed upstream.
It would have been easier to review if you had provided a delta patch, not a delete/add patch </grin>.
That's actually the kind of things I was afraid of and that would have been harder to spot when just pulling your work from qemu upstream.
In your xen patch, since idle and GUI_REFRESH_INTERVAL are there, you can just use them. We'll push them to qemu. We'll manage the _shared stuff (and push it eventually).
I'll let Markus comment on the rest (again, thanks for moving the xenbus stuff to the backend part). There is one change that is not backend changes or just moving code around: you are queuing rectangle updates, why? (I'm not arguing, just wondering the kind of optimization that can be).
Quoted 6 lines
Quoted 3 lines
Then you can push your code to qemu,
I guess that could be fine, as you said xen will not need to use e.g. the block and net backends.blk and net backends are not there (yet). But they should be a nop for xen anyway
Indeed, I'd say don't bother to port those.
Quoted 3 lines
The block backend should be a good replacement for blktap though and maybe can save you the effort of porting the blktap kernel driver to the
pv_opskernel.
Well, for better performance an in-kernel blktap would still be useful.
Samuel
Quoted 6 lines
Ok, thanks, that's already better.
I'd still say that "delete a file then add another one" is far from convenient both from a point of view of proof-reading the patches and repository history, but I guess we can manage that with a renaming step first.
Fine with me, I can't send patches with renames though ...
Quoted 2 lines
Any reason for the renames, though? (they tend to bother developpers who have to change their habits, so we can not do that without a reason)
Get consistent naming (all xen stuff in hw/ is prefixed with xen-).
Quoted 1 line
- Why dashes instead of underscores?
(1) It looks more pleasent to my eyes.
(2) It is easier to type (no shift needed) on both us and german keyboards.
(3) The files in the qemu source tree don't have a consistent style in respect to '-' vs. '_', so I had no reason to not use my personal preference ;)
Quoted 3 lines
- In Xen, we call
xen-machine.cxen_machine_pv.cbecause there is also axen_machine_fv.c. Can't thexen_machine_pv.cname be fine for qemu upstream too?
Dunno whenever there ever will be a xenfv machine type upstream as most likely the normal 'pc' machine type will get a fancy interface to switch between emulation, kqemu and kvm. And I think the best option for xen hvm would be to hook in there too. That is a long-term thing though, xen_machine_fv.c will probably stay for quite a while at in the xen tree, so maybe 'pv' in the name helps avoiding confusion. I'd prefer to stay with the xen-machine.c though.
Quoted 2 lines
Or xen can keep its own xen_machine_{pv,fv}.c and your
xen-machine.cgoes upstream, I don't think that would be a problem.
We have two files defining xenpv_machine then. I don't think it is a good idea.
Quoted 2 lines
Misc stuff:
- I guess thesys-queue.hfile should be merged and used in qemu first?
Rebase. Then it will be there, and you can skip the patch ;)
Quoted 1 line
-
xen_domidis re-declared inxen-backend.h
Oops. Fixed.
Quoted 3 lines
- The BUFSIZE macro in
xen-backend.his a bit unfortunate, but still better than what we have currently. Maybe it should be renamed with a
-XEN_prefix to avoid any clash?
xen-backend.h is supposed to be included by xen-related code only (it barfs when /usr/include/xen isn't there), so it shouldn't clash in theory. Well, I can prefix it nevertheless, better safe than sorry.
Quoted 2 lines
-
container_ofwould probably be useful in other parts of qemu, I guess it could be merged in qemu first?
Has qemu a nice place for that kind of helper macros?
Quoted 3 lines
In your xen patch, since idle and
GUI_REFRESH_INTERVALare there, you can just use them. We'll push them to qemu. We'll manage the_sharedstuff (and push it eventually).
I'd prefer to do it the other way around (push depending changes upstream, then adapt xen-framebuffer.c). I want xen-framebuffer.c look the same in xen and upstream.
Quoted 5 lines
I'll let Markus comment on the rest (again, thanks for moving the xenbus stuff to the backend part). There is one change that is not backend changes or just moving code around: you are queuing rectangle updates, why? (I'm not arguing, just wondering the kind of optimization that can be).
Thats actually a bugfix. Doing screen updates outside the ->update callback isn't safe.
And as we must queuing up update rectangles anyway to fix that it also tries to optimize stuff a bit and avoid unneeded bitblits. Right now that catches only frequent fullscreen updates (such as a scrolling textconsole) and doesn't copy stuff multiple times in case the update events from the guest are more frequent than update callback calls from qemu.
Could be improved to analyze the rectangles in more detail (for example:
figure a update is a superset of another one, so one can be dropped).
Quoted 5 lines
Quoted 3 lines
The block backend should be a good replacement for blktap though and maybe can save you the effort of porting the blktap kernel driver to the
pv_opskernel.Well, for better performance an in-kernel blktap would still be useful.
Don't confuse blkback and blktap. I don't want to replace the in-kernel blkback driver. blktap isn't a in-kernel driver though. It is just an interface between the hypervisor and a userspace application, specialized for block devices. My backend driver does pretty much the same, but uses the generic gntdev interface instead of blktap. I can't see any reason why it shouldn't match blktap performance-wise. I have no benchmarks numbers though.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Quoted 4 lines · Gerd Hoffmann, le Thu 07 Aug 2008 14:13:22 +0200, a écrit :
Quoted 2 lines
Any reason for the renames, though? (they tend to bother developpers who have to change their habits, so we can not do that without a reason)
Get consistent naming (all xen stuff in hw/ is prefixed with xen-).
Err, no, in xen they are all prefixed with xen_ (except xenfb).
Quoted 5 lines
Quoted 1 line
- Why dashes instead of underscores?
(1) It looks more pleasent to my eyes.
(2) It is easier to type (no shift needed) on both us and german keyboards.
Not on fr keyboard :p
Quoted 2 lines
(3) The files in the qemu source tree don't have a consistent style
in respect to '-' vs. '_',
There are far more _ than - in qemu. - seems to be only used for things that just share a very generic idea (i.e. usb- and scsi-), while _ seems to be used for things that are more closely related, like arm_*, mips_*, ppc_*, ... xen_* would make sense to my mind.
Quoted 1 line
so I had no reason to not use my personal preference ;)
Yes, there is a reason: as I said, that puts a little burden on developpers that have already been working on it in Xen for some time. That also asks Ian to do the move, that makes history digging more tricky, etc.
Quoted 1 line
I'd prefer to stay with the
xen-machine.cthough.
Ok for your taste, but as I said the burden involved by renamings looks more important to me.
Quoted 4 lines
Quoted 2 lines
Misc stuff:
- I guess thesys-queue.hfile should be merged and used in qemu first?Rebase. Then it will be there, and you can skip the patch ;)
Ah ok, sorry, then fine.
Quoted 7 lines
Quoted 3 lines
- The BUFSIZE macro in
xen-backend.his a bit unfortunate, but still better than what we have currently. Maybe it should be renamed with a
-XEN_prefix to avoid any clash?
xen-backend.his supposed to be included by xen-related code only (it barfs when/usr/include/xenisn't there), so it shouldn't clash in theory.
In theory yes, but even people working on the xen part could want to define a very local BUFSIZE, and then they could get a clash. Of course they can easily fix their code, but as you say
Quoted 6 lines
Well, I can prefix it nevertheless, better safe than sorry.
Quoted 2 lines
-
container_ofwould probably be useful in other parts of qemu, I guess it could be merged in qemu first?Has qemu a nice place for that kind of helper macros?
I'll leave that one for more experienced qemu people.
Quoted 7 lines
Quoted 3 lines
In your xen patch, since idle and
GUI_REFRESH_INTERVALare there, you can just use them. We'll push them to qemu. We'll manage the_sharedstuff (and push it eventually).I'd prefer to do it the other way around (push depending changes upstream, then adapt
xen-framebuffer.c). I wantxen-framebuffer.clook the same in xen and upstream.
Sure, it's just that your code could be merged earlier with these modifications. But well we can handle that later it's not a problem.
Quoted 8 lines
Quoted 5 lines
I'll let Markus comment on the rest (again, thanks for moving the xenbus stuff to the backend part). There is one change that is not backend changes or just moving code around: you are queuing rectangle updates, why? (I'm not arguing, just wondering the kind of optimization that can be).
Thats actually a bugfix. Doing screen updates outside the ->update callback isn't safe.
Oh. Well, that's the kind of comments which you could have put somewhere along your patches, for us to not frown on it while reviewing...
For more performance, maybe it'd be better to only move the dpy_update() part. It's better to do the xenfb_guest_copy() immediately since the source data is probably already hot in the cache.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
The block backend should be a good replacement for blktap though and maybe can save you the effort of porting the blktap kernel driver to the
pv_opskernel.Well, for better performance an in-kernel blktap would still be useful.
Don't confuse blkback and blktap. I don't want to replace the in-kernel blkback driver. blktap isn't a in-kernel driver though.
Well, actually _you_ confused me about this above :)
Quoted 3 lines
My backend driver does pretty much the same, but uses the generic gntdev interface instead of blktap. I can't see any reason why it shouldn't match blktap performance-wise.
That's possible indeed.
Quoted 1 line
I have no benchmarks numbers though.
That'd be good :)
Samuel
Quoted 6 lines · Samuel Thibault
Quoted 3 lines · Gerd Hoffmann, le Thu 07 Aug 2008 14:13:22 +0200, a écrit :
Quoted 2 lines
Any reason for the renames, though? (they tend to bother developpers who have to change their habits, so we can not do that without a reason)
Get consistent naming (all xen stuff in hw/ is prefixed with xen-).
Err, no, in xen they are all prefixed with
xen_(except xenfb).
Uhm, No.
~/xen/qemu-dm# grep ^OBJS xen-hooks.mak
OBJS += piix4acpi.o
OBJS += xenstore.o
OBJS += xen_platform.o
OBJS += xen_machine_fv.o
OBJS += xen_machine_fv.o
OBJS += xen_blktap.o
OBJS += exec-dm.o
OBJS += pci_emulation.o
OBJS += tpm_tis.o
OBJS+= pass-through.o pt-msi.o
OBJS := $(filter-out $(BAD_OBJS), $(OBJS))
That is neither consistent wrt using _ everythere nor all files are prefixed consistently. At least all prefixed ones use underscores.
Quoted 7 lines
Quoted 2 lines
(3) The files in the qemu source tree don't have a consistent style
in respect to '-' vs. '_',There are far more _ than - in qemu. - seems to be only used for things that just share a very generic idea (i.e. usb- and scsi-), while _ seems to be used for things that are more closely related, like arm_*, mips_*, ppc_*, ... xen_* would make sense to my mind.
To me it looks pretty random, probably depending on the person creating that file. And when you count them, then there is no clear winner:
~/projects/qemu# find -name "*.[ch]" -print | grep "-" | wc -l 293
~/projects/qemu# find -name "*.[ch]" -print | grep "_" | wc -l 231
Quoted 6 lines
Quoted 1 line
so I had no reason to not use my personal preference ;)
Yes, there is a reason: as I said, that puts a little burden on developpers that have already been working on it in Xen for some time. That also asks Ian to do the move, that makes history digging more tricky, etc.
git handles renames just fine.
Quoted 3 lines
For more performance, maybe it'd be better to only move the
dpy_update()part. It's better to do thexenfb_guest_copy()immediately since the source data is probably already hot in the cache.
No. The copy is unsafe.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Quoted 9 lines · Gerd Hoffmann, le Thu 07 Aug 2008 18:17:39 +0200, a écrit :
Quoted 6 lines · Samuel Thibault
Quoted 3 lines · Gerd Hoffmann, le Thu 07 Aug 2008 14:13:22 +0200, a écrit :
Quoted 2 lines
Any reason for the renames, though? (they tend to bother developpers who have to change their habits, so we can not do that without a reason)
Get consistent naming (all xen stuff in hw/ is prefixed with xen-).
Err, no, in xen they are all prefixed with
xen_(except xenfb).Uhm, No.
Right, there is xenstore as well.
Quoted 8 lines
~/xen/qemu-dm# grep ^OBJS xen-hooks.mak
OBJS += piix4acpi.o
[snip xen*]
OBJS += exec-dm.o
OBJS += pci_emulation.o
OBJS += tpm_tis.o
OBJS+= pass-through.o pt-msi.o
OBJS := $(filter-out $(BAD_OBJS), $(OBJS))
These aren't really xen-specific, that's why they don't have a xen or xen_ prefix.
Quoted 2 lines
That is neither consistent wrt using _ everythere nor all files are prefixed consistently. At least all prefixed ones use underscores.
And that's my point. I don't see why we should take the burden of renaming them with dashes.
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
(3) The files in the qemu source tree don't have a consistent style
in respect to '-' vs. '_',There are far more _ than - in qemu.
Just to comment on that. I actually meant in hw/ . There are a lot of - in the root, because there are block-*, qemu-*, cpu-*, config-*, etc.
Quoted 6 lines
- seems to be only used for
Quoted 3 lines
things that just share a very generic idea (i.e. usb- and scsi-), while _ seems to be used for things that are more closely related, like arm_*, mips_*, ppc_*, ... xen_* would make sense to my mind.
To me it looks pretty random,
I doesn't look so much random to me. There are oddities, but the rule above seems mostly respected.
Quoted 6 lines
And when you count them, then there is no clear winner:
~/projects/qemu# find -name "*.[ch]" -print | grep "-" | wc -l 293
~/projects/qemu# find -name "*.[ch]" -print | grep "_" | wc -l 231
Sure, they have different purpose. As I said, _ for closely related (like must be compiled together), - for not closely related (i.e. independant matter that just have some generic link, like the block interface, scsi or usb bus).
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
so I had no reason to not use my personal preference ;)
Yes, there is a reason: as I said, that puts a little burden on developpers that have already been working on it in Xen for some time. That also asks Ian to do the move, that makes history digging more tricky, etc.
git handles renames just fine.
Yes, sure, that's what I meant before ("having a renaming step first"). But that's still work to actually do it, change the Makefiles, and then when you want to git annotate an old version it becomes tricky: you have to remember the old name. So renaming really needs a reason.
Quoted 5 lines
Quoted 3 lines
For more performance, maybe it'd be better to only move the
dpy_update()part. It's better to do thexenfb_guest_copy()immediately since the source data is probably already hot in the cache.No. The copy is unsafe.
Ah, because we're writing to ds->data which is handled by the display backend, right.
Samuel
Quoted 4 lines · Samuel Thibault, le Thu 07 Aug 2008 17:48:43 +0100, a écrit :
Quoted 1 line
OBJS += exec-dm.o
These aren't really xen-specific, that's why they don't have a xen or
xen_prefix.
Except this one of course since it's the way it's supposed to be called.
Samuel
Quoted 5 lines · Gerd Hoffmann, le Thu 07 Aug 2008 14:13:22 +0200, a écrit :
Quoted 2 lines
Or xen can keep its own xen_machine_{pv,fv}.c and your
xen-machine.cgoes upstream, I don't think that would be a problem.We have two files defining
xenpv_machinethen. I don't think it is a good idea.
I guess Ian would just drop the xen_machine.c file in his tree.
Samuel
Quoted 6 lines · Gerd Hoffmann, le Thu 07 Aug 2008 14:13:22 +0200, a écrit :
Quoted 2 lines
In your xen patch, since idle and
GUI_REFRESH_INTERVALare there, you can just use them. We'll push them to qemu.I'd prefer to do it the other way around (push depending changes upstream, then adapt
xen-framebuffer.c). I wantxen-framebuffer.clook the same in xen and upstream.
Mmm, looking at that again, most of my idleness patch is actually already upstream. What wasn't pushed is what is specific to xenfb:
transmitting the idleness to the backend. For this xenfb needs to get idleness information. Below is the patch that does that, you can just fold it in your qemu-upstream/0008-xen-add-framebuffer-backend-driver.patch About GUI_REFRESH_INTERVAL, you can just move it to a header.
Samuel
console.h +1 -0
@@ -80,6 +80,7 @@void *opaque;struct QEMUTimer *gui_timer;uint64_t gui_timer_interval; +int idle;void (*dpy_update)(struct DisplayState *s,int x,int y,int w,int h);void (*dpy_resize)(struct DisplayState *s,int w,int h);
vl.c +2 -0
@@ -5930,6 +5930,8 @@ ds->dpy_update = dumb_update; ds->dpy_resize = dumb_resize; ds->dpy_refresh = dumb_refresh; + ds->gui_timer_interval =500 ; + ds->idle =1 ; }/***********************************************************/
sdl.c +2 -0
@@ -526,9 +526,11 @@if (ev->active.gain) {/* Back to default interval */ ds->gui_timer_interval =0 ; + ds->idle =0 ; }else {/* Sleeping interval */ ds->gui_timer_interval =500 ; + ds->idle =1 ; } }break ;
vnc.c +3 -0
@@ -660,6 +660,7 @@ client_io_errorqemu_set_fd_handler2 (vs->csock,NULL ,NULL ,NULL ,NULL );closesocket (vs->csock); vs->csock =-1 ; + vs->ds->idle =1 ;buffer_reset (&vs->input);buffer_reset (&vs->output); vs->need_update =0 ;
@@ -1920,6 +1921,7 @@static void vnc_connect (VncState *vs) {VNC_DEBUG ("New client on socket %d\n" , vs->csock); + vs->ds->idle =0 ;socket_set_nonblock (vs->csock);qemu_set_fd_handler2 (vs->csock,NULL , vnc_client_read,NULL , vs);vnc_write (vs,"RFB 003.008\n" ,12 );
@@ -1959,6 +1961,7 @@exit (1 ); ds->opaque = vs; + ds->idle =1 ; vnc_state = vs; vs->display =NULL ; vs->password =NULL ;
Hi,
Quoted 6 lines
Mmm, looking at that again, most of my idleness patch is actually already upstream. What wasn't pushed is what is specific to xenfb:
transmitting the idleness to the backend. For this xenfb needs to get idleness information. Below is the patch that does that, you can just fold it in yourqemu-upstream/0008-xen-add-framebuffer-backend-driver.patchAboutGUI_REFRESH_INTERVAL, you can just move it to a header.
Thanks, I'll stick it into my patch queue.
That leaves the DisplayState->shared_buf bits which should be upstreamed too ...
cheers,
Gerd
Quoted 9 lines · Gerd Hoffmann
Hi,
Quoted 6 lines
Mmm, looking at that again, most of my idleness patch is actually already upstream. What wasn't pushed is what is specific to xenfb:
transmitting the idleness to the backend. For this xenfb needs to get idleness information. Below is the patch that does that, you can just fold it in yourqemu-upstream/0008-xen-add-framebuffer-backend-driver.patchAboutGUI_REFRESH_INTERVAL, you can just move it to a header.
Quoted 5 lines
Thanks, I'll stick it into my patch queue.
That leaves the
DisplayState->shared_bufbits which should be upstreamed too ...
It is the next item on my TODO :)
Gerd Hoffmann writes ("Re: [Xen-devel] Re: [Qemu-devel] [PATCH 0/7] merge some xen bits into qemu"):
Quoted 9 lines
[Samuel asks:]
Quoted 1 line
- Why dashes instead of underscores?
(1) It looks more pleasent to my eyes.
(2) It is easier to type (no shift needed) on both us and german keyboards.
(3) The files in the qemu source tree don't have a consistent style in respect to '-' vs. '_', so I had no reason to not use my personal preference ;)
I basically agree with this. However:
Quoted 4 lines
Quoted 2 lines
Any reason for the renames, though? (they tend to bother developpers who have to change their habits, so we can not do that without a reason)
Get consistent naming (all xen stuff in hw/ is prefixed with xen-).
I absolutely and vehemently disagree that files should be renamed (or indeed code style changed) to make things prettier or more consistent.
There are currently at least three substantial branches and numerous smaller branches of this xen code in at least two different revision control systems - and there are probably many more.
The very last thing we want is to make porting patches between the various branches difficult.
Ian.
Quoted 13 lines · Gerd Hoffmann
Quoted 8 lines · Samuel Thibault
Quoted 3 lines · Samuel Thibault, le Wed 06 Aug 2008 15:25:26 +0100, a écrit :
Pushing the cleaning changes to Xen first can be done and would entail much easier to tackle breakage, and the merge back from qemu would then be trivial, why not doing so?
You didn't answer that part. Really, my only concern is about having things tested. Isn't it possible for instance to just merge the backend core (and console/xenfb updates) in Ian's tree first for a start?
Quoted 7 lines
I didn't touch the build system, it is even more scary than the qemu one alone, I just set
CONFIG_XENunconditionally.I also largely left
vl.cas-is, so xend shouldn't need any changes. The -domid switch sets an additional (redundant) variable, to keep the amount of changes as small as possible for now. Also -name and -domain-name are aliased, both setqemu_nameanddomain_name.
0004-xenpv-groundwork.patch
You dropped nodisk_ok support from vl.c.
0005-xen-backend-core.patch
container_of could go to osdep.h.
0006-xen-console-backend.patch
Not your fault, but a lot of places (at least ps2.c and slavio_serial.c) define some kind of ring buffers. Maybe these could be consolidated some time.
0007-xen-framebuffer-backend.patch
After you optimized scancode2linux[], it looks like atkbd_set2_keycode[] and atkbd_unxlate_table[] are not needed.
Quoted 2 lines · Blue Swirl, le Thu 07 Aug 2008 18:06:07 +0300, a écrit :
After you optimized scancode2linux[], it looks like atkbd_set2_keycode[] and atkbd_unxlate_table[] are not needed.
They should however probably be kept as comments just to know where scancode2linux comes from.
Samuel
Quoted 3 lines · Blue Swirl, le Thu 07 Aug 2008 18:06:07 +0300, a écrit :
0004-xenpv-groundwork.patch
You dropped
nodisk_oksupport fromvl.c.
I guess that's ok for a merge in Ian's tree, which probably has it already in another form.
Samuel
Quoted 5 lines · Blue Swirl
Quoted 1 line
0004-xenpv-groundwork.patch
You dropped
nodisk_oksupport fromvl.c.
Oh, there are *two* patchsets:
http://kraxel.fedorapeople.org/patches/qemu-upstream/
http://kraxel.fedorapeople.org/patches/qemu-xen/
The first also includes some not-yet submitted work-in-progress bits. It is against upstream qemu svn. The second is against xen's qemu fork, so the xen-related changes can get a test-drive there.
Especially the vl.c changes are very different in the two patch sets because xen's vl.c looks very different (lot of CONFIG_DM conditional code) and because I don't want to break the command line interface for now to not break xend's expectations.
That doesn't mean that the nodisk_ok got lost. It is only in the first patchset though.
Quoted 3 lines
0005-xen-backend-core.patch
container_ofcould go toosdep.h.
Will do.
Quoted 5 lines
0006-xen-console-backend.patch
Not your fault, but a lot of places (at least
ps2.candslavio_serial.c) define some kind of ring buffers. Maybe these could be consolidated some time.
Will have a look if I find some time.
Quoted 4 lines
0007-xen-framebuffer-backend.patch
After you optimized scancode2linux[], it looks like atkbd_set2_keycode[] and atkbd_unxlate_table[] are not needed.
Indeed. Think I just ifdef them out and leave them in there as documentation.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Quoted 19 lines · Gerd Hoffmann
Quoted 6 lines · Blue Swirl
Quoted 1 line
0004-xenpv-groundwork.patch
You dropped
nodisk_oksupport fromvl.c.Oh, there are *two* patchsets:
http://kraxel.fedorapeople.org/patches/qemu-upstream/http://kraxel.fedorapeople.org/patches/qemu-xen/
The first also includes some not-yet submitted work-in-progress bits.
It is against upstream qemu svn. The second is against xen's qemu fork, so the xen-related changes can get a test-drive there.
Quoted 7 lines
Especially the
vl.cchanges are very different in the two patch sets because xen'svl.clooks very different (lot ofCONFIG_DMconditional code) and because I don't want to break the command line interface for now to not break xend's expectations.That doesn't mean that the
nodisk_okgot lost. It is only in the first patchset though.
I extracted a small patch that only introduces the nodisk_ok part. Anybody unhappy if I commit it?
hw/boards.h +1 -0
@@ -16,6 +16,7 @@QEMUMachineInitFunc *init;#define RAMSIZE_FIXED (1 << 0)ram_addr_t ram_require; +int nodisk_ok;struct QEMUMachine *next; } QEMUMachine;
vl.c +1 -2
@@ -8848,9 +8848,8 @@ linux_boot = (kernel_filename !=NULL ); net_boot = (boot_devices_bitmap >> ('n' -'a' )) &0xF ; -/* XXX: this should not be: some embedded targets just have flash */ if (!linux_boot && net_boot ==0 && - nb_drives_opt ==0 ) + !machine->nodisk_ok && nb_drives_opt ==0 )help (1 );if (!linux_boot && *kernel_cmdline !='\0' ) {
hw/sun4m.c +10 -0
@@ -1242,6 +1242,7 @@"Sun4m platform, SPARCstation 5" , ss5_init,PROM_SIZE_MAX +TCX_SIZE , + .nodisk_ok = 1, }; QEMUMachine ss10_machine = {
@@ -1249,6 +1250,7 @@"Sun4m platform, SPARCstation 10" , ss10_init,PROM_SIZE_MAX +TCX_SIZE , + .nodisk_ok = 1, }; QEMUMachine ss600mp_machine = {
@@ -1256,6 +1258,7 @@"Sun4m platform, SPARCserver 600MP" , ss600mp_init,PROM_SIZE_MAX +TCX_SIZE , + .nodisk_ok = 1, }; QEMUMachine ss20_machine = {
@@ -1263,6 +1266,7 @@"Sun4m platform, SPARCstation 20" , ss20_init,PROM_SIZE_MAX +TCX_SIZE , + .nodisk_ok = 1, }; QEMUMachine ss2_machine = {
@@ -1270,6 +1274,7 @@"Sun4c platform, SPARCstation 2" , ss2_init,PROM_SIZE_MAX +TCX_SIZE , + .nodisk_ok = 1, }; QEMUMachine voyager_machine = {
@@ -1277,6 +1282,7 @@"Sun4m platform, SPARCstation Voyager" , vger_init,PROM_SIZE_MAX +TCX_SIZE , + .nodisk_ok = 1, }; QEMUMachine ss_lx_machine = {
@@ -1284,6 +1290,7 @@"Sun4m platform, SPARCstation LX" , ss_lx_init,PROM_SIZE_MAX +TCX_SIZE , + .nodisk_ok = 1, }; QEMUMachine ss4_machine = {
@@ -1291,6 +1298,7 @@"Sun4m platform, SPARCstation 4" , ss4_init,PROM_SIZE_MAX +TCX_SIZE , + .nodisk_ok = 1, }; QEMUMachine scls_machine = {
@@ -1298,6 +1306,7 @@"Sun4m platform, SPARCClassic" , scls_init,PROM_SIZE_MAX +TCX_SIZE , + .nodisk_ok = 1, }; QEMUMachine sbook_machine = {
@@ -1305,6 +1314,7 @@"Sun4m platform, SPARCbook" , sbook_init,PROM_SIZE_MAX +TCX_SIZE , + .nodisk_ok = 1, }; static const struct sun4d_hwdef sun4d_hwdefs[] = {
hw/sun4u.c +2 -0
@@ -450,6 +450,7 @@"Sun4u platform" , sun4u_init,PROM_SIZE_MAX +VGA_RAM_SIZE , + .nodisk_ok = 1, }; QEMUMachine sun4v_machine = {
@@ -457,4 +458,5 @@"Sun4v platform" , sun4v_init,PROM_SIZE_MAX +VGA_RAM_SIZE , + .nodisk_ok = 1, };
Quoted 2 lines · Blue Swirl
I extracted a small patch that only introduces the
nodisk_okpart. Anybody unhappy if I commit it?
How about converting all struct fields to C99 initializers in hw/sun4*.c? Mixing the two styles looks quite odd.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Quoted 7 lines · Gerd Hoffmann
Quoted 2 lines · Blue Swirl
I extracted a small patch that only introduces the
nodisk_okpart. Anybody unhappy if I commit it?How about converting all struct fields to C99 initializers in
hw/sun4*.c? Mixing the two styles looks quite odd.
Good idea, I'll do the switch.
Quoted 5 lines · Blue Swirl, le Thu 07 Aug 2008 18:06:07 +0300, a écrit :
0006-xen-console-backend.patch
Not your fault, but a lot of places (at least
ps2.candslavio_serial.c) define some kind of ring buffers. Maybe these could be consolidated some time.
There is also one in console.c
It'd be probably be good to have an implementation of a ring of arbitrary structures. We have a pending patch of usb-hid to fix double clicks by queueing click events.
Samuel
Quoted 6 lines · Gerd Hoffmann
It would also be great if you can clean up the header mess. qemu-dm doesn't build without xen-unstable.hg. And just a checked out tree isn't good enougth, it must be compiled because qemu-dm depends on some generated header files. Aiee. IMHO qemu-dm should only need
/usr/include/xen. If headers are missing there, they should be installed.
It is not difficult to make Ian's qemu tree compile against /usr/include/xen.
Expect a patch to fix this on Monday.
Quoted 9 lines · Stefano Stabellini
Quoted 6 lines · Gerd Hoffmann
It would also be great if you can clean up the header mess. qemu-dm doesn't build without xen-unstable.hg. And just a checked out tree isn't good enougth, it must be compiled because qemu-dm depends on some generated header files. Aiee. IMHO qemu-dm should only need
/usr/include/xen. If headers are missing there, they should be installed.
Quoted 3 lines
It is not difficult to make Ian's qemu tree compile against
/usr/include/xen.
Expect a patch to fix this on Monday.
[cc list stripped]
It goes without saying that this shouldn't be the default when building out of the Xen repository using our build system. Not everyone wants to install our headers on the build machine. But making /usr/include the default and having Xen's build system override at configure time would be fine.
-- Keir
Quoted 15 lines · Keir Fraser
Quoted 11 lines · Stefano Stabellini
Quoted 6 lines · Gerd Hoffmann
It would also be great if you can clean up the header mess. qemu-dm doesn't build without xen-unstable.hg. And just a checked out tree isn't good enougth, it must be compiled because qemu-dm depends on some generated header files. Aiee. IMHO qemu-dm should only need
/usr/include/xen. If headers are missing there, they should be installed.It is not difficult to make Ian's qemu tree compile against
/usr/include/xen.
Expect a patch to fix this on Monday.
Quoted 7 lines
[cc list stripped]
It goes without saying that this shouldn't be the default when building out of the Xen repository using our build system. Not everyone wants to install our headers on the build machine. But making
/usr/includethe default and having Xen's build system override at configure time would be fine.
Yes, that was the idea.
Keir Fraser writes ("Re: [Xen-devel] Re: [Qemu-devel] [PATCH 0/7] merge some xen bits into qemu"):
Quoted 4 lines
It goes without saying that this shouldn't be the default when building out of the Xen repository using our build system. Not everyone wants to install our headers on the build machine. But making
/usr/includethe default and having Xen's build system override at configure time would be fine.
I agree that having this as a build option is a good idea.
I think it would be better not to have it be the default, though. Autobuilder systems typically want to avoid accidentally picking up stuff from the build system environment, so that builds stay reproducible.
Ian.
Quoted 9 lines · Ian Jackson
Keir Fraser writes ("Re: [Xen-devel] Re: [Qemu-devel] [PATCH 0/7] merge some xen bits into qemu"):
Quoted 4 lines
It goes without saying that this shouldn't be the default when building out of the Xen repository using our build system. Not everyone wants to install our headers on the build machine. But making
/usr/includethe default and having Xen's build system override at configure time would be fine.I agree that having this as a build option is a good idea.
I think it would be better not to have it be the default, though.
It should be the default for the git tree, so it can be checked out and built as-is without having to pull more stuff.
The xen build system can easily override it when it builds qemu-dm as part of a complete xen build.
Quoted 3 lines
Autobuilder systems typically want to avoid accidentally picking up stuff from the build system environment, so that builds stay reproducible.
... or they prepare the environment the way they want it.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Gerd Hoffmann writes ("Re: [Xen-devel] Re: [Qemu-devel] [PATCH 0/7] merge some xen bits into qemu"):
Quoted 3 lines
IMHO the best way to address this issue is to rebase frequently. The xen-unstable testing will also covers qemu then. It also keeps the delta smaller and makes it easier to test qemu patches in qemu-dm.
I'm not going to be rebasing, but I will merge instead.
Quoted 3 lines
I'm trying to fiddle my bits into qemu-dm right now. One problem is that I get build failures simply because of the fact that the qemu-dm base is old compared to upstream qemu.
Yes, that's currently the case because qemu-xen-unstable is frozen for the forthcoming Xen release.
Quoted 2 lines
It would also be great if you can clean up the header mess. qemu-dm doesn't build without xen-unstable.hg.
This is true and is likely to continue to be the case indefinitely.
Quoted 4 lines
And just a checked out tree
isn't good enougth, it must be compiled because qemu-dm depends on some generated header files. Aiee. IMHO qemu-dm should only need/usr/include/xen. If headers are missing there, they should be installed.
qemu-dm also needs libxc, libthis, libthat from xen-unstable.
Ian.
Quoted 6 lines · Ian Jackson
Quoted 4 lines
And just a checked out tree
isn't good enougth, it must be compiled because qemu-dm depends on some generated header files. Aiee. IMHO qemu-dm should only need/usr/include/xen. If headers are missing there, they should be installed.qemu-dm also needs libxc, libthis, libthat from xen-unstable.
That kind of stuff is usually packed up as xen-devel in linux distributions. I want being able to just install xen-devel on my machine, then compile qemu with xen support.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Hi,
Quoted 3 lines
You forgot the _test_ stage. You are basically asking us to replace our well-tested implementation with your implementation, that's quite a move.
Sure, and more will follow. I'd expect the merge involves rewriting large parts of the code anyway, especially the hvm bits due to the nessesary interface cleanups in qemu, but also because the code must pass the review process before it can be merged. Pretty much like upstreaming the xen support into the linux kernel. All that also needs testing, no doubt.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Quoted 5 lines · Gerd Hoffmann, le Wed 06 Aug 2008 15:24:39 +0200, a écrit :
Quoted 3 lines
You forgot the _test_ stage. You are basically asking us to replace our well-tested implementation with your implementation, that's quite a move.
Sure, and more will follow.
But by having it merged into just upstream qemu you won't magically get Xen people actually test it, so it would be mostly dead code.
Quoted 1 line
Pretty much like upstreaming the xen support into the linux kernel.
There's a big difference here. The upstream linux kernel merge won't be merged back to the linux-2.6.18 tree. And people do test upstream xen support.
Samuel
Quoted 6 lines · Samuel Thibault
Quoted 4 lines · Gerd Hoffmann, le Wed 06 Aug 2008 15:24:39 +0200, a écrit :
Quoted 3 lines
You forgot the _test_ stage. You are basically asking us to replace our well-tested implementation with your implementation, that's quite a move.
Sure, and more will follow.
Quoted 7 lines
But by having it merged into just upstream qemu you won't magically get Xen people actually test it, so it would be mostly dead code.
Quoted 1 line
Pretty much like upstreaming the xen support into the linux kernel.
There's a big difference here. The upstream linux kernel merge won't be merged back to the linux-2.6.18 tree.
Oh, we can also arrange things without merging back. Stop rebasing qemu-dm (pretty much like 2.6.18), additionally hook upstream qemu as-is into testing (like pv_ops kernels). Then start submitting patches to qemu. When done, zap old qemu-dm.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Quoted 6 lines · Gerd Hoffmann, le Wed 06 Aug 2008 16:18:51 +0200, a écrit :
Quoted 5 lines · Samuel Thibault
But by having it merged into just upstream qemu you won't magically get Xen people actually test it, so it would be mostly dead code.
Quoted 1 line
Pretty much like upstreaming the xen support into the linux kernel.
Quoted 7 lines
Quoted 2 lines
There's a big difference here. The upstream linux kernel merge won't be merged back to the linux-2.6.18 tree.
Oh, we can also arrange things without merging back. Stop rebasing qemu-dm (pretty much like 2.6.18), additionally hook upstream qemu as-is into testing (like
pv_opskernels). Then start submitting patches to qemu. When done, zap old qemu-dm.
Again, there's a difference. The interface between Linux and Xen has always been meant to be a "public" thing. The interface between ioemu and the other xen components has not, and changing it is considered fine (we still do it). Sure that could be cleaned up, but that's probably not something that should happen on the upstream qemu side.
Samuel
Quoted 10 lines · Samuel Thibault
Quoted 4 lines
Oh, we can also arrange things without merging back. Stop rebasing qemu-dm (pretty much like 2.6.18), additionally hook upstream qemu as-is into testing (like
pv_opskernels). Then start submitting patches to qemu. When done, zap old qemu-dm.Again, there's a difference. The interface between Linux and Xen has always been meant to be a "public" thing. The interface between ioemu and the other xen components has not, and changing it is considered fine (we still do it). Sure that could be cleaned up, but that's probably not something that should happen on the upstream qemu side.
Hmm. That makes me think that starting over from scratch really is the best option. Drop the old cruft, design a clean interface, code it up, discuss it in public and submit to upstream qemu.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
[Qemu-devel] Xen's qemu branches, etc.
In reply to Anthony LiguoriI thought that following that lovely discussion it might be helpful to summarise a few things about the way I see things:
As Samuel says, I'm currently maintaining two branches: one contains code which I would like to get to upstream qemu in the nearish future, and one which contains changes which I don't think have a practical chance of going upstream any time soon. (I also have a gaggle of topic branches of course.)
Because Xen 3.3 is nearing release and currently firmly frozen, both of these branches are currently based on a few months' old version of qemu upstream. I intend to fork off new development branches of both very soon, and then bring both of them up to parity with a modern qemu upstream. One natural output of such a merge process is a number of patches for upstream.
Once that merge is done I intend, while Xen development is fully open, to frequently update both my new trees from upstream - say, weekly. As before, shortly before the Xen freeze I will stop pulling from qemu upstream.
It would be very nice to get the differences between qemu in Xen and qemu upstream down to zero. There are three kinds of change in our tree which will prevent this in the short to medium term:
Firstly, there are some things in our tree which are simply too ugly. We would like to improve them and feed them upstream in due course, but that's more of a medium to long term project. A top priority in this area is display handling.
Secondly, there are changes which are only useful in a Xen context. An example would be the machinery to monitor `disk change' events which are injected via the Xen management tools. This is done in our qemu by xen-specific code which talks to the xenstore IPC/IDC daemon. This code is completely Xen specific and depends on the presence of the Xen management stack, so it must only be compiled in to the specific Xen device model qemu executable. We would be happy to have this code in qemu upstream, but it is quite closely linked to much of the Xen management toolstack and quite loosely coupled to the rest of qemu so in practice this is not currently a priority for us.
Thirdly, there are some changes which we have been told are not suitable for qemu upstream, but which we (Xen) are pretty convinced we need to retain. An example is the mapcache. (Please don't explain again why the mapcache is not necessary. That conversation has been had and we've come to different conclusions, which is fine - this is Free Software after all, which means that we can work together well, and hopefully without rancour, even though we sometimes disagree.)
There are also another set of concievable things: _emulations_ in qemu of the Xen environment, so that a Xen PV guest can be run without the Xen hypervisor and host infrastructure, or so that Xen PV drivers can be used to improve the performance of a plain qemu guest.
That includes, for example, xenstore/xenbus emulation, Xen PV backend drivers, and the like. Gerd's patches contained several such things.
I think a qemu emulator which can support Xen guests without needing Xen is in principle a fine and good thing to have in qemu upstream. We don't have it in our Xen tree because we have the real hypervisor and dom0-provided backends. But I'm sure we'd find them useful for debugging.
BUT we have to not get confused so the names must be different.
It is necessary to clearly distinguish these two use cases:
* qemu-dm run under the Xen hypervisor, xend, with xenstore, to support Xen guests as currently done in the Xen upstream project
* qemu emulating the Xen environment
I think these should be given different names. We should not use `xen' for both.
The plumbing involved is quite different. Users will get confused and the results will be mysterious failures. Developers will get confused and the results will be people talking and coding past each other.
I would like to suggest that the first of these two options should be called xen' or xen-hvm' or xen-pv' or xen-fv' or some such. Code in qemu intended to support running under the Xen hypervisor and upstream Xen toolstack should use the name `xen'. This includes (for example) portability to the Xen minios embedded system, frontend drivers for Xen PV block and network devices, interaction with xenstore, interaction with the hypervisor to collect IO requests from the running guest and return the responses, and so on.
Code in qemu intended to support Xen guests without the use of the Xen hypervisor and tools should be called `xenemu' or some such. This includes backend drivers for block and network devices, xenstore/xenbus emulation, and so on.
Ian.
[Qemu-devel] Re: [Xen-devel] Xen's qemu branches, etc.
Quoted 4 lines · Ian Jackson, le Mon 11 Aug 2008 17:36:22 +0100, a écrit :
Code in qemu intended to support Xen guests without the use of the Xen hypervisor and tools should be called `xenemu' or some such. This includes backend drivers for block and network devices, xenstore/xenbus emulation, and so on.
Mmm, for backends it would be a bit odd, since in xen upstream we do have backends too (console and framebuffer), and as Gerd said we could in theory use the block and network backends too.
Samuel
[Qemu-devel] Re: Xen's qemu branches, etc.
In reply to Ian JacksonHi Ian,
Quoted 7 lines · Ian Jackson
Because Xen 3.3 is nearing release and currently firmly frozen, both of these branches are currently based on a few months' old version of qemu upstream. I intend to fork off new development branches of both very soon, and then bring both of them up to parity with a modern qemu upstream. One natural output of such a merge process is a number of patches for upstream.
I'm looking forward to this and appreciate your work here.
Quoted 9 lines
It would be very nice to get the differences between qemu in Xen and qemu upstream down to zero. There are three kinds of change in our tree which will prevent this in the short to medium term:
Firstly, there are some things in our tree which are simply too ugly. We would like to improve them and feed them upstream in due course, but that's more of a medium to long term project. A top priority in this area is display handling.
Quoted 11 lines
Secondly, there are changes which are only useful in a Xen context. An example would be the machinery to monitor `disk change' events which are injected via the Xen management tools. This is done in our qemu by xen-specific code which talks to the xenstore IPC/IDC daemon. This code is completely Xen specific and depends on the presence of the Xen management stack, so it must only be compiled in to the specific Xen device model qemu executable. We would be happy to have this code in qemu upstream, but it is quite closely linked to much of the Xen management toolstack and quite loosely coupled to the rest of qemu so in practice this is not currently a priority for us.
I think that there is room to discuss these sort of things. I think most of these things will actually fall into the first category where we could add the same mechanism to QEMU (perhaps via the monitor), and then Xen could have a small shim that interacted with both XenStore and the QEMU monitor. But really, this isn't the low hanging fruit so we can cross this bridge when we come to it :-)
Quoted 8 lines
There are also another set of concievable things: _emulations_ in qemu of the Xen environment, so that a Xen PV guest can be run without the Xen hypervisor and host infrastructure, or so that Xen PV drivers can be used to improve the performance of a plain qemu guest.
That includes, for example, xenstore/xenbus emulation, Xen PV backend drivers, and the like. Gerd's patches contained several such things.
The patch series that Gerd posted has nothing to do with a Xen shim or emulation layer. The PV backends are directly usable by Xen. Now if ya'll want nothing to do with these backends, then I'm inclined to wait to add those backends until they are being used by something before pulling it into QEMU. There's no point in adding code to QEMU that noone is actually going to use.
So that may mean waiting to pull in the userspace net/block backends until Xenner can be merged into QEMU. That seems fine to me.
Quoted 8 lines
I think a qemu emulator which can support Xen guests without needing Xen is in principle a fine and good thing to have in qemu upstream. We don't have it in our Xen tree because we have the real hypervisor and dom0-provided backends. But I'm sure we'd find them useful for debugging.
BUT we have to not get confused so the names must be different.
So far, I haven't seen patches on qemu-devel that are for a Xen shim/emulation layer so that doesn't seem like a problem to me. I assume anything related to the shim/emulation layer will be clearly identified as 'Xenner' anyway.
Quoted 10 lines
It is necessary to clearly distinguish these two use cases:
* qemu-dm run under the Xen hypervisor, xend, with xenstore, to support Xen guests as currently done in the Xen upstream project
* qemu emulating the Xen environment
I think these should be given different names. We should not use `xen' for both.
To me, this isn't a big issue. Whether we have one or two machine types will be determined by the implementations. What I want to see is as much code sharing as possible for both cases.
Regards,
Anthony Liguori
Re: [Qemu-devel] Xen's qemu branches, etc.
In reply to Ian JacksonHi,
Quoted 2 lines
Code in qemu intended to support Xen guests without the use of the Xen hypervisor and tools should be called `xenemu' or some such.
Sure, right now I have the files and functions prefixed with "xenner".
Quoted 3 lines
This
includes backend drivers for block and network devices, xenstore/xenbus emulation, and so on.
Yes, for xenstore/xenbus/... emulation.
No for the backends. They run on xen just fine too.
Additionally you can run xen domains *with* the xen hypervisor but *without* the management stack.
cheers,
Gerd
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/