QEMU PV guests and xenstore_parse_domain_config()
New 3.2 QEMU PV guests are calling xenstore-parse_domain_config() opening block devices and setting watches that might not be necessary.
Seems like each machine type should have it's own specific xenstore parse routine if it needs one.
I have attached a patch that adds a xenstore parse pointer into the QEMUMachine struct. main() will call that machine specific function if set otherwise calls generic xenstore-parse_domain_config. Attached patch is just something as a starting point for discussion not something I propose be applied.
----------------------------------
Some dump log traces
----------------------------------
qemu.log of PV guest running current xen-unstable tip
xenstore_parse_domain_config()
Change xvda to look like hda
bdrv_open filename:/var/lib/xen/images/sles10-sp2-pv/disk0() bdrv_open2 filename:/var/lib/xen/images/sles10-sp2-pv/disk0() bdrv_open2 filename:/var/lib/xen/images/sles10-sp2-pv/disk0() Change xvdb to look like hdb
bdrv_open filename:/home/tests/iso/sles/SLES-10-SP2-DVD-i386-Alpha2-DVD1.iso() bdrv_open2 filename:/home/tests/iso/sles/SLES-10-SP2-DVD-i386-Alpha2-DVD1.iso() bdrv_open2 filename:/home/tests/iso/sles/SLES-10-SP2-DVD-i386-Alpha2-DVD1.iso() Change xvdc to look like hdc
bdrv_open filename:/dev/cdrom()
bdrv_open2 filename:/dev/cdrom()
Watching /local/domain/0/device-model/8/logdirty/next-active Watching /local/domain/0/device-model/8/command
shift keysym 003e keycode 86
-----------------------------------
qemu.log of PV guest PV guest running current xen-unstable tip + patch
xenstore_open()
xen_parse_xenstore()
shift keysym 003e keycode 86
------------------------------------
qemu.log of FV guest with proposed patch ( no change )
xenstore_open()
xenstore_parse_domain_config()
bdrv_open filename:/var/lib/xen/images/sles10-sp2/disk0() bdrv_open2 filename:/var/lib/xen/images/sles10-sp2/disk0() bdrv_open2 filename:/var/lib/xen/images/sles10-sp2/disk0() bdrv_open filename:/home/tests/iso/sles/SLES-10-SP1-DVD-i386-RC5-DVD1.iso() bdrv_open2 filename:/home/tests/iso/sles/SLES-10-SP1-DVD-i386-RC5-DVD1.iso() bdrv_open2 filename:/home/tests/iso/sles/SLES-10-SP1-DVD-i386-RC5-DVD1.iso() bdrv_open filename:/dev/cdrom()
bdrv_open2 filename:/dev/cdrom()
Watching /local/domain/0/device-model/7/logdirty/next-active Watching /local/domain/0/device-model/7/command
config qemu network with xen bridge for tap0 xenbr0
shift keysym 003e keycode 86
tools/ioemu/hw/xen_machine_pv.c +10 -0
@@ -58,10 +58,20 @@ static void xen_init_pv(uint64_t ram_siz } } +/* +* Nothing to do here yet. Stops normal xenstore_parse_config() +* processing that causes opens of block device we don't need +*/ +static void xen_parse_xenstore (int domid) +{ +return ; +} +QEMUMachine xenpv_machine = {"xenpv" ,"Xen Para-virtualized PC" , xen_init_pv, + xen_parse_xenstore, };/*
tools/ioemu/vl.c +5 -1
@@ -7593,7 +7593,11 @@ int main(int argc, char **argv)#ifdef CONFIG_DM bdrv_init (); xc_handle =xc_interface_open (); -xenstore_parse_domain_config (domid); +xenstore_open (); +if (machine->parse) + machine->parse (domid); +else +xenstore_parse_domain_config (domid);#endif /* CONFIG_DM */ #ifdef USE_KQEMU
tools/ioemu/vl.h +3 -0
@@ -722,11 +722,13 @@ typedef void QEMUMachineInitFunc(uint64_ DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *direct_pci); +typedef void QEMUMachineXenStoreParseFunc (int domid);typedef struct QEMUMachine {const char *name;const char *desc;QEMUMachineInitFunc *init; +QEMUMachineXenStoreParseFunc *parse;struct QEMUMachine *next; }QEMUMachine ;
@@ -1454,6 +1456,7 @@ void readline_start(const char *prompt, ReadLineFunc *readline_func, void *opaque);/* xenstore.c */ +void xenstore_open (void );void xenstore_parse_domain_config (int domid);int xenstore_fd (void );void xenstore_process_event (void *opaque);
tools/ioemu/xenstore.c +14 -4
@@ -77,6 +77,20 @@ static void waitForDevice(char *fn)return ; } +void xenstore_open () +{ +int i; + +for (i =0 ; i <MAX_DISKS +MAX_SCSI_DISKS ; i++) + media_filename[i] =NULL ; + + xsh =xs_daemon_open (); +if (xsh ==NULL ) { +fprintf (logfile,"Could not contact xenstore for domain config\n" ); +return ; + } +} +void xenstore_parse_domain_config (int domid) {char **e =NULL ;
@@ -86,10 +100,6 @@ void xenstore_parse_domain_config(int doint i, is_scsi, is_hdN =0 ;unsigned int len, num, hd_index; -for (i =0 ; i <MAX_DISKS +MAX_SCSI_DISKS ; i++) - media_filename[i] =NULL ; - - xsh =xs_daemon_open ();if (xsh ==NULL ) {fprintf (logfile,"Could not contact xenstore for domain config\n" );return ;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 11 lines · Pat Campbell
New 3.2 QEMU PV guests are calling xenstore-parse_domain_config() opening block devices and setting watches that might not be necessary.
Seems like each machine type should have it's own specific xenstore parse routine if it needs one.
I have attached a patch that adds a xenstore parse pointer into the QEMUMachine struct.
main()will call that machine specific function if set otherwise calls generic xenstore-parse_domain_config. Attached patch is just something as a starting point for discussion not something I propose be applied.
Since the xenstore_parse_domain_config method is doing stuff specific to HVM guests, it shoudl really be moved out of vl.c and into the init method for xenfv_machine. vl.c should only contain generic code - this must be something I missed when tidying up this code for the initial PV QEMU support.
Dan.
Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 24 lines · Pat Campbell
Quoted 1 line
Quoted 1 line
Quoted 1 line
On Tue, Jan 8, 2008 at 1:31 PM, in message
<[email protected]>, "Daniel P. Berrange" <[email protected]>
Quoted 12 lines · wrote:
Quoted 8 lines · Pat Campbell
New 3.2 QEMU PV guests are calling xenstore-
parse_domain_config()opening block devices and setting watches that might not be necessary.Seems like each machine type should have it's own specific xenstore parse routine if it needs one.
I have attached a patch that adds a xenstore parse pointer into the
QEMUMachine
Quoted 1 line
struct.
main()will call that machine specific function if set otherwisecalls
Quoted 8 lines
Quoted 2 lines
generic xenstore-
parse_domain_config. Attached patch is just something as a starting point for discussion not something I propose be applied.Since the
xenstore_parse_domain_configmethod is doing stuff specific to HVM guests, it shoudl really be moved out ofvl.cand into the init method forxenfv_machine.vl.cshould only contain generic code - this must be something I missed when tidying up this code for the initial PV QEMU support.
Quoted 3 lines
Side effect of
xenstore_parse_domain_configmethod is to open the domain, setting variable xsh which is used inxenstore_read_vncpasswd()andxenstore_write_vncport(). These are used in both machine types.
Hmm, lets just have a direct call
xsh = xs_daemon_open();
if (xsh == NULL) {
fprintf(logfile, "Could not contact xenstore for domain config\n");
return;
}in vl.c, then we ought to be able to move xenstore_parse_domain_config into the xen_machine_fv.c
Regards,
Dan.
Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|