From: "Pat Campbell" Subject: QEMU PV guests and xenstore_parse_domain_config() Date: Tue, 08 Jan 2008 13:19:34 -0700 Message-ID: <47837806.3E48.0018.0@novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartB09679C6.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org --=__PartB09679C6.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline New 3.2 QEMU PV guests are calling xenstore-parse_domain_config() = opening=20 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. =20 I have attached a patch that adds a xenstore parse pointer into the = QEMUMachine=20 struct. main() will call that machine specific function if set otherwise = calls=20 generic xenstore-parse_domain_config. Attached patch is just something as = a=20 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.i= so() 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 --=__PartB09679C6.0__= Content-Type: text/plain; name="xen-qemupv.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="xen-qemupv.patch" diff -r 4ef5df520e2e tools/ioemu/hw/xen_machine_pv.c --- a/tools/ioemu/hw/xen_machine_pv.c Tue Jan 08 11:11:15 2008 -0700 +++ b/tools/ioemu/hw/xen_machine_pv.c Tue Jan 08 13:02:13 2008 -0700 @@ -58,10 +58,20 @@ static void xen_init_pv(uint64_t ram_siz } } =20 +/*=20 + * 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 =3D { "xenpv", "Xen Para-virtualized PC", xen_init_pv, + xen_parse_xenstore, }; =20 /* diff -r 4ef5df520e2e tools/ioemu/vl.c --- a/tools/ioemu/vl.c Tue Jan 08 11:11:15 2008 -0700 +++ b/tools/ioemu/vl.c Tue Jan 08 11:33:08 2008 -0700 @@ -7593,7 +7593,11 @@ int main(int argc, char **argv) #ifdef CONFIG_DM bdrv_init(); xc_handle =3D 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 */ =20 #ifdef USE_KQEMU diff -r 4ef5df520e2e tools/ioemu/vl.h --- a/tools/ioemu/vl.h Tue Jan 08 11:11:15 2008 -0700 +++ b/tools/ioemu/vl.h Tue Jan 08 11:49:47 2008 -0700 @@ -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); =20 typedef struct QEMUMachine { const char *name; const char *desc; QEMUMachineInitFunc *init; + QEMUMachineXenStoreParseFunc *parse; struct QEMUMachine *next; } QEMUMachine; =20 @@ -1454,6 +1456,7 @@ void readline_start(const char *prompt,=20 ReadLineFunc *readline_func, void *opaque); =20 /* xenstore.c */ +void xenstore_open(void); void xenstore_parse_domain_config(int domid); int xenstore_fd(void); void xenstore_process_event(void *opaque); diff -r 4ef5df520e2e tools/ioemu/xenstore.c --- a/tools/ioemu/xenstore.c Tue Jan 08 11:11:15 2008 -0700 +++ b/tools/ioemu/xenstore.c Tue Jan 08 13:01:51 2008 -0700 @@ -77,6 +77,20 @@ static void waitForDevice(char *fn) return; } =20 +void xenstore_open() +{ + int i; + + for(i =3D 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++) + media_filename[i] =3D NULL; + + xsh =3D xs_daemon_open(); + if (xsh =3D=3D NULL) { + fprintf(logfile, "Could not contact xenstore for domain config\n")= ; + return; + } +} + void xenstore_parse_domain_config(int domid) { char **e =3D NULL; @@ -86,10 +100,6 @@ void xenstore_parse_domain_config(int do int i, is_scsi, is_hdN =3D 0; unsigned int len, num, hd_index; =20 - for(i =3D 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++) - media_filename[i] =3D NULL; - - xsh =3D xs_daemon_open(); if (xsh =3D=3D NULL) { fprintf(logfile, "Could not contact xenstore for domain config\n")= ; return; --=__PartB09679C6.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__PartB09679C6.0__=--