Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 146761 Details for
Bug 222467
[XEN-VT]'Cannot allocate memory' error
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
[XEN]: Enable shadow before memory reservation for HVM
p (text/plain), 5.28 KB, created by
Herbert Xu
on 2007-01-28 10:57:35 UTC
(
hide
)
Description:
[XEN]: Enable shadow before memory reservation for HVM
Filename:
MIME Type:
Creator:
Herbert Xu
Created:
2007-01-28 10:57:35 UTC
Size:
5.28 KB
patch
obsolete
>From: Herbert Xu <herbert.xu@redhat.com> >To: virtualist@redhat.com >Subject: Re: [XEN]: Enable shadow before memory reservation for HVM >Cc: virtualist@redhat.com >Fcc: =sent >Organization: Core >In-Reply-To: <20070127052138.GA13865@gondor.apana.org.au> > >Herbert Xu <herbert.xu@redhat.com> wrote: >> >> This patch fixes the "cannot allocate memory" error when starting HVM >> guests. The cause of this is that shadow mode is enabled after memory >> allocation for the guest and before the physmap is filled. >> >> It turns out that the bogus m2p entries are a recent introduction. When >> shadow2 (changeset 11151) was introduced, upstream moved the code that enables >> shadow mode for HVM guests to user-space. In particular, this was done after >> memory allocation and before the physmap has been populated. This only >> affected HVM because PV translate mode populated the physmap before enabling >> shadow mode. >> >> Upstream has since fixed it by moving the enabling of shadow mode back into the >> hypervisor which means that it will occur before memory allocation. This patch >> tries to do this in a more conservative way by simply moving the enabling of >> shadow mode before memory allocation. >> >> I've verified that running this version of xend allows me to start HVM guests >> on a host where otherwise you can't start HVM guests at all due to this bug. >> >> When we move to 3.0.4 we can remove this patch. > >Sorry guys but there was actually a bug in this patch. I added the >shadow_enable call to the generic path without checking whether the >guest is HVM. > >Here is a corrected and tested version. > >diff -ur xen-3.0.3_0-src.orig/tools/libxc/xc_hvm_build.c xen-3.0.3_0-src/tools/libxc/xc_hvm_build.c >--- xen-3.0.3_0-src.orig/tools/libxc/xc_hvm_build.c 2006-10-15 22:22:03.000000000 +1000 >+++ xen-3.0.3_0-src/tools/libxc/xc_hvm_build.c 2007-01-27 15:46:43.000000000 +1100 >@@ -441,18 +441,6 @@ > goto error_out; > } > >- /* HVM domains must be put into shadow mode at the start of day */ >- if ( xc_shadow_control(xc_handle, domid, XEN_DOMCTL_SHADOW_OP_ENABLE, >- NULL, 0, NULL, >- XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT | >- XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE | >- XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL, >- NULL) ) >- { >- PERROR("Could not enable shadow paging for domain.\n"); >- goto error_out; >- } >- > memset(ctxt, 0, sizeof(*ctxt)); > > ctxt->flags = VGCF_HVM_GUEST; >diff -ur xen-3.0.3_0-src.orig/tools/python/xen/lowlevel/xc/xc.c xen-3.0.3_0-src/tools/python/xen/lowlevel/xc/xc.c >--- xen-3.0.3_0-src.orig/tools/python/xen/lowlevel/xc/xc.c 2007-01-23 22:51:50.000000000 +1100 >+++ xen-3.0.3_0-src/tools/python/xen/lowlevel/xc/xc.c 2007-01-27 15:40:48.000000000 +1100 >@@ -647,6 +647,31 @@ > return Py_BuildValue("i", mbarg); > } > >+static PyObject *pyxc_hvm_shadow_enable(PyObject *self, >+ PyObject *args, >+ PyObject *kwds) >+{ >+ XcObject *xc = (XcObject *)self; >+ >+ uint32_t dom; >+ >+ static char *kwd_list[] = { "dom", NULL }; >+ >+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) ) >+ return NULL; >+ >+ if ( xc_shadow_control(xc->xc_handle, dom, XEN_DOMCTL_SHADOW_OP_ENABLE, >+ NULL, 0, NULL, >+ XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT | >+ XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE | >+ XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL, >+ NULL) ) >+ return PyErr_SetFromErrno(xc_error); >+ >+ Py_INCREF(zero); >+ return zero; >+} >+ > static PyObject *pyxc_sched_credit_domain_set(XcObject *self, > PyObject *args, > PyObject *kwds) >@@ -1089,6 +1114,13 @@ > " mb [int, -1]: MB of shadow memory this domain should have.\n\n" > "Returns: [int] MB of shadow memory in use by this domain.\n" }, > >+ { "hvm_shadow_enable", >+ (PyCFunction)pyxc_hvm_shadow_enable, >+ METH_VARARGS | METH_KEYWORDS, "\n" >+ "Enable shadow pagetable\n" >+ " dom [int]: Identifier of domain.\n\n" >+ "Returns: [int] 0 on success; -1 on error.\n" }, >+ > { "domain_setmaxmem", > (PyCFunction)pyxc_domain_setmaxmem, > METH_VARARGS, "\n" >diff -ur xen-3.0.3_0-src.orig/tools/python/xen/xend/XendDomainInfo.py xen-3.0.3_0-src/tools/python/xen/xend/XendDomainInfo.py >--- xen-3.0.3_0-src.orig/tools/python/xen/xend/XendDomainInfo.py 2007-01-23 22:51:50.000000000 +1100 >+++ xen-3.0.3_0-src/tools/python/xen/xend/XendDomainInfo.py 2007-01-28 21:47:26.000000000 +1100 >@@ -1349,6 +1349,9 @@ > shadow_cur = xc.shadow_mem_control(self.domid, shadow / 1024) > self.info['shadow_memory'] = shadow_cur > >+ if self.image.ostype == "hvm": >+ xc.hvm_shadow_enable(self.domid); >+ > # initial memory reservation > xc.domain_memory_increase_reservation(self.domid, reservation, 0, > 0) > >Cheers, >-- >Visit Openswan at http://www.openswan.org/ >Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> >Home Page: http://gondor.apana.org.au/~herbert/ >PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 222467
:
146739
| 146761