Felipe Alfaro Solana
2005-Feb-07  13:57 UTC
[Xen-devel] ctxt->pt_base != 0 when creating a new domain
Hi!
Since upgrading to the latest bkbits from xeno-unstable, I''m unable to
create a XenU domain I was previously able to create with no problems
at all:
# xm list
Name              Id  Mem(MB)  CPU  State  Time(s)  Console
Domain-0           0      414    0  r----     23.4        
# xm create xenU
Using config file "xenU"
Error: Error creating domain: (0, ''Error'')
# cat /var/log/xend-debug.log
network start bridge=xen-br0 netdev=eth1 antispoof=no
ERROR: Domain is already constructed
op_create> Exception creating domain:
Traceback (most recent call last):
  File "/usr/lib/python/xen/xend/server/SrvDomainDir.py", line 66, in
op_create
    deferred = self.xd.domain_create(config)
  File "/usr/lib/python/xen/xend/XendDomain.py", line 357, in
domain_create
    deferred = XendDomainInfo.vm_create(config)
  File "/usr/lib/python/xen/xend/XendDomainInfo.py", line 195, in
vm_create
    ptr = vm.construct(config)
  File "/usr/lib/python/xen/xend/XendDomainInfo.py", line 469, in
construct
    self.construct_image()
  File "/usr/lib/python/xen/xend/XendDomainInfo.py", line 503, in
construct_image
    self.image_handler(self, image)
  File "/usr/lib/python/xen/xend/XendDomainInfo.py", line 1137, in
vm_image_linux
    vm.create_domain("linux", kernel, ramdisk, cmdline)
  File "/usr/lib/python/xen/xend/XendDomainInfo.py", line 809, in
create_domain
    self.build_domain(ostype, kernel, ramdisk, cmdline, memmap)
  File "/usr/lib/python/xen/xend/XendDomainInfo.py", line 789, in
build_domain
    vcpus          = self.vcpus)
error: (0, ''Error'')
I have made the following testcase patch:
--- tools/libxc/xc_linux_build.c.old    2005-02-07 13:49:57.000000000 +0100
+++ tools/libxc/xc_linux_build.c        2005-02-07 14:45:35.242555000 +0100
@@ -360,46 +360,51 @@
             goto error_out;
         }
     }
 
     if ( mlock(&st_ctxt, sizeof(st_ctxt) ) )
     {   
         PERROR("Unable to mlock ctxt");
         return 1;
     }
 
     op.cmd = DOM0_GETDOMAININFO;
     op.u.getdomaininfo.domain = (domid_t)domid;
     op.u.getdomaininfo.exec_domain = 0;
     op.u.getdomaininfo.ctxt = ctxt;
     if ( (do_dom0_op(xc_handle, &op) < 0) || 
          ((u16)op.u.getdomaininfo.domain != domid) )
     {
         PERROR("Could not get info on domain");
         goto error_out;
     }
+#if 1
     if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) ||
          (ctxt->pt_base != 0) )
     {
-               ERROR("Domain is already constructed");
+       if (!(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED))
+               ERROR("Cannot create an unpaused domain");
+       else
+               ERROR("Domain is already constructed or ctxt->pt_base !=
0");
         goto error_out;
     }
+#endif
 
     if ( setup_guestos(xc_handle, domid, image, image_size, 
                        initrd_gfd, initrd_size, nr_pages, 
                        &vstartinfo_start, &vkern_entry,
                        ctxt, cmdline,
                        op.u.getdomaininfo.shared_info_frame,
                        control_evtchn, flags, vcpus) < 0 )
     {
         ERROR("Error constructing guest OS");
         goto error_out;
     }
 
     if ( initrd_fd >= 0 )
         close(initrd_fd);
     if ( initrd_gfd )
         gzclose(initrd_gfd);
     if ( image != NULL )
         free(image);
 
     ctxt->flags = 0;
After applying the previous patch, rebuilnding and rebooting, this is
what gets logged into xend-debug.log:
# cat /var/log/xend-debug.log
network start bridge=xen-br0 netdev=eth1 antispoof=no
ERROR: Domain is already constructed or ctxt->pt_base != 0
op_create> Exception creating domain:
Traceback (most recent call last):
  File "/usr/lib/python/xen/xend/server/SrvDomainDir.py", line 66, in
op_create
    deferred = self.xd.domain_create(config)
  File "/usr/lib/python/xen/xend/XendDomain.py", line 357, in
domain_create
    deferred = XendDomainInfo.vm_create(config)
  File "/usr/lib/python/xen/xend/XendDomainInfo.py", line 195, in
vm_create
    ptr = vm.construct(config)
  File "/usr/lib/python/xen/xend/XendDomainInfo.py", line 469, in
construct
    self.construct_image()
  File "/usr/lib/python/xen/xend/XendDomainInfo.py", line 503, in
construct_image
    self.image_handler(self, image)
  File "/usr/lib/python/xen/xend/XendDomainInfo.py", line 1137, in
vm_image_linux
    vm.create_domain("linux", kernel, ramdisk, cmdline)
  File "/usr/lib/python/xen/xend/XendDomainInfo.py", line 809, in
create_domain
    self.build_domain(ostype, kernel, ramdisk, cmdline, memmap)
  File "/usr/lib/python/xen/xend/XendDomainInfo.py", line 789, in
build_domain
    vcpus          = self.vcpus)
error: (0, ''Error'')
This reveals that, for some misterious reason, the condition
"ctxt->pt_base != 0" evaluates TRUE. Why is this happening?
What''s
more, replacing the "#if 1" with an "#if 0" fixes the
problem for me:
the domain is created and works properly.
Any ideas?
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-devel
Ian Pratt
2005-Feb-07  14:49 UTC
RE: [Xen-devel] ctxt->pt_base != 0 when creating a new domain
This is fixed in the latest unstable tree -- it got introduced over the weekend by the re-organisation of struct exec_domain and struct domain. Ian> -----Original Message----- > From: xen-devel-admin@lists.sourceforge.net > [mailto:xen-devel-admin@lists.sourceforge.net] On Behalf Of > Felipe Alfaro Solana > Sent: 07 February 2005 13:58 > To: xen-devel > Subject: [Xen-devel] ctxt->pt_base != 0 when creating a new domain > > Hi! > > Since upgrading to the latest bkbits from xeno-unstable, I''m unable to > create a XenU domain I was previously able to create with no problems > at all: > > # xm list > Name Id Mem(MB) CPU State Time(s) Console > Domain-0 0 414 0 r---- 23.4 > > # xm create xenU > Using config file "xenU" > Error: Error creating domain: (0, ''Error'') > > # cat /var/log/xend-debug.log > network start bridge=xen-br0 netdev=eth1 antispoof=no > ERROR: Domain is already constructed > op_create> Exception creating domain: > Traceback (most recent call last): > File "/usr/lib/python/xen/xend/server/SrvDomainDir.py", > line 66, in op_create > deferred = self.xd.domain_create(config) > File "/usr/lib/python/xen/xend/XendDomain.py", line 357, in > domain_create > deferred = XendDomainInfo.vm_create(config) > File "/usr/lib/python/xen/xend/XendDomainInfo.py", line > 195, in vm_create > ptr = vm.construct(config) > File "/usr/lib/python/xen/xend/XendDomainInfo.py", line > 469, in construct > self.construct_image() > File "/usr/lib/python/xen/xend/XendDomainInfo.py", line 503, in > construct_image > self.image_handler(self, image) > File "/usr/lib/python/xen/xend/XendDomainInfo.py", line 1137, in > vm_image_linux > vm.create_domain("linux", kernel, ramdisk, cmdline) > File "/usr/lib/python/xen/xend/XendDomainInfo.py", line > 809, in create_domain > self.build_domain(ostype, kernel, ramdisk, cmdline, memmap) > File "/usr/lib/python/xen/xend/XendDomainInfo.py", line > 789, in build_domain > vcpus = self.vcpus) > error: (0, ''Error'') > > I have made the following testcase patch: > > --- tools/libxc/xc_linux_build.c.old 2005-02-07 > 13:49:57.000000000 +0100 > +++ tools/libxc/xc_linux_build.c 2005-02-07 > 14:45:35.242555000 +0100 > @@ -360,46 +360,51 @@ > goto error_out; > } > } > > if ( mlock(&st_ctxt, sizeof(st_ctxt) ) ) > { > PERROR("Unable to mlock ctxt"); > return 1; > } > > op.cmd = DOM0_GETDOMAININFO; > op.u.getdomaininfo.domain = (domid_t)domid; > op.u.getdomaininfo.exec_domain = 0; > op.u.getdomaininfo.ctxt = ctxt; > if ( (do_dom0_op(xc_handle, &op) < 0) || > ((u16)op.u.getdomaininfo.domain != domid) ) > { > PERROR("Could not get info on domain"); > goto error_out; > } > +#if 1 > if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) || > (ctxt->pt_base != 0) ) > { > - ERROR("Domain is already constructed"); > + if (!(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED)) > + ERROR("Cannot create an unpaused domain"); > + else > + ERROR("Domain is already constructed or > ctxt->pt_base != 0"); > goto error_out; > } > +#endif > > if ( setup_guestos(xc_handle, domid, image, image_size, > initrd_gfd, initrd_size, nr_pages, > &vstartinfo_start, &vkern_entry, > ctxt, cmdline, > op.u.getdomaininfo.shared_info_frame, > control_evtchn, flags, vcpus) < 0 ) > { > ERROR("Error constructing guest OS"); > goto error_out; > } > > if ( initrd_fd >= 0 ) > close(initrd_fd); > if ( initrd_gfd ) > gzclose(initrd_gfd); > if ( image != NULL ) > free(image); > > ctxt->flags = 0; > > > After applying the previous patch, rebuilnding and rebooting, this is > what gets logged into xend-debug.log: > > # cat /var/log/xend-debug.log > network start bridge=xen-br0 netdev=eth1 antispoof=no > ERROR: Domain is already constructed or ctxt->pt_base != 0 > op_create> Exception creating domain: > Traceback (most recent call last): > File "/usr/lib/python/xen/xend/server/SrvDomainDir.py", > line 66, in op_create > deferred = self.xd.domain_create(config) > File "/usr/lib/python/xen/xend/XendDomain.py", line 357, in > domain_create > deferred = XendDomainInfo.vm_create(config) > File "/usr/lib/python/xen/xend/XendDomainInfo.py", line > 195, in vm_create > ptr = vm.construct(config) > File "/usr/lib/python/xen/xend/XendDomainInfo.py", line > 469, in construct > self.construct_image() > File "/usr/lib/python/xen/xend/XendDomainInfo.py", line 503, in > construct_image > self.image_handler(self, image) > File "/usr/lib/python/xen/xend/XendDomainInfo.py", line 1137, in > vm_image_linux > vm.create_domain("linux", kernel, ramdisk, cmdline) > File "/usr/lib/python/xen/xend/XendDomainInfo.py", line > 809, in create_domain > self.build_domain(ostype, kernel, ramdisk, cmdline, memmap) > File "/usr/lib/python/xen/xend/XendDomainInfo.py", line > 789, in build_domain > vcpus = self.vcpus) > error: (0, ''Error'') > > This reveals that, for some misterious reason, the condition > "ctxt->pt_base != 0" evaluates TRUE. Why is this happening? What''s > more, replacing the "#if 1" with an "#if 0" fixes the problem for me: > the domain is created and works properly. > > Any ideas? > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IntelliVIEW -- Interactive > Reporting > Tool for open source databases. Create drag-&-drop reports. Save time > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. > Download a FREE copy at http://www.intelliview.com/go/osdn_nl > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/xen-devel >------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel