All of lore.kernel.org
 help / color / mirror / Atom feed
* QEMU PV guests and xenstore_parse_domain_config()
@ 2008-01-08 20:19 Pat Campbell
  2008-01-08 20:31 ` Daniel P. Berrange
  0 siblings, 1 reply; 3+ messages in thread
From: Pat Campbell @ 2008-01-08 20:19 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 2519 bytes --]


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






[-- Attachment #2: xen-qemupv.patch --]
[-- Type: text/plain, Size: 3105 bytes --]

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
     }
 }
 
+/* 
+ * 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,
 };
 
 /*
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 = 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
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);
 
 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);
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;
 }
 
+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 do
     int 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;

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

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

* Re: QEMU PV guests and xenstore_parse_domain_config()
  2008-01-08 20:19 QEMU PV guests and xenstore_parse_domain_config() Pat Campbell
@ 2008-01-08 20:31 ` Daniel P. Berrange
       [not found]   ` <47846CF5.3E48.0018.0@novell.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel P. Berrange @ 2008-01-08 20:31 UTC (permalink / raw)
  To: Pat Campbell; +Cc: xen-devel

On Tue, Jan 08, 2008 at 01:19:34PM -0700, Pat Campbell wrote:
> 
> 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.
-- 
|=- 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  -=| 

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

* Re: QEMU PV guests and xenstore_parse_domain_config()
       [not found]   ` <47846CF5.3E48.0018.0@novell.com>
@ 2008-01-09 14:45     ` Daniel P. Berrange
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel P. Berrange @ 2008-01-09 14:45 UTC (permalink / raw)
  To: Pat Campbell; +Cc: xen-devel

On Wed, Jan 09, 2008 at 06:44:39AM -0700, Pat Campbell wrote:
> >>> On Tue, Jan 8, 2008 at  1:31 PM, in message
> <20080108203102.GO21294@redhat.com>, "Daniel P. Berrange" <berrange@redhat.com>
> wrote: 
> > On Tue, Jan 08, 2008 at 01:19:34PM - 0700, Pat Campbell wrote:
> >> 
> >> 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.
>
> Side effect of xenstore_parse_domain_config method is to open the
> domain, setting variable xsh which is used in xenstore_read_vncpasswd() 
> and xenstore_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.
-- 
|=- 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  -=| 

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

end of thread, other threads:[~2008-01-09 14:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-08 20:19 QEMU PV guests and xenstore_parse_domain_config() Pat Campbell
2008-01-08 20:31 ` Daniel P. Berrange
     [not found]   ` <47846CF5.3E48.0018.0@novell.com>
2008-01-09 14:45     ` Daniel P. Berrange

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.