All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Miles <daniel.t.miles@hp.com>
To: Hollis Blanchard <hollisb@us.ibm.com>
Cc: John Levon <levon@movementarian.org>,
	xen-ia64-devel <xen-ia64-devel@lists.xensource.com>,
	Ewan Mellor <ewan@xensource.com>,
	xen-devel <xen-devel@lists.xensource.com>,
	xen-ppc-devel <xen-ppc-devel@lists.xensource.com>
Subject: Re: [PATCH] architecture-specific stuff in xend
Date: Fri, 11 Aug 2006 16:59:18 -0600	[thread overview]
Message-ID: <1155337158.9030.41.camel@localhost.localdomain> (raw)
In-Reply-To: <1155244357.2833.23.camel@basalt.austin.ibm.com>


[-- Attachment #1.1: Type: text/plain, Size: 9112 bytes --]

I tried the patch on an ia64 box and it seemed to work just fine, I
think it's a great idea.

On Thu, 2006-08-10 at 16:12 -0500, Hollis Blanchard wrote:
> On Wed, 2006-08-09 at 17:18 +0100, Ewan Mellor wrote:
> > 
> > Yes, your proposal sounds fine to me. 
> 
> OK, here is the first proof-of-concept.
> 
> IA64 and HVM people will definitely need to check this over, because it
> looks like there was some *serious* bitrot in this area. (For example, I
> can't see how an HVM domain would have made it into class ImageHandler
> in the first place.)
> 
> John, would you extend this scheme to cover host OS differences? I think
> it's worth separating the attributes of the host and the guest, and this
> patch below is all about guest stuff. W.R.T.
> tools/python/xen/util/Brctl.py, wouldn't it make more sense to replace
> that file entirely depending on the host OS?
> 
> 
> 
> [XEND] Abstract architecture-specific guest code into a module.
> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
> 
> diff -r 8cca42e2610a tools/python/xen/xend/XendDomainInfo.py
> --- a/tools/python/xen/xend/XendDomainInfo.py	Thu Aug 10 14:29:04 2006 +0100
> +++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Aug 10 15:45:00 2006 -0500
> @@ -1279,23 +1279,14 @@ class XendDomainInfo:
>                      cpu = [ int( cpus[v % len(cpus)] ) ]
>                      xc.vcpu_setaffinity(self.domid, v, cpu)
>  
> -            # set domain maxmem in KiB
> -            xc.domain_setmaxmem(self.domid, self.info['maxmem'] * 1024)
> -
> -            m = self.image.getDomainMemory(self.info['memory'] * 1024)
> -            balloon.free(m)
> -
> -            init_reservation = self.info['memory'] * 1024
> -            if os.uname()[4] in ('ia64', 'ppc64'):
> -                # Workaround for architectures that don't yet support
> -                # ballooning.
> -                init_reservation = m
> -                # Following line from xiantao.zhang@intel.com
> -                # Needed for IA64 until supports ballooning -- okay for PPC64?
> -                xc.domain_setmaxmem(self.domid, m)
> -
> -            xc.domain_memory_increase_reservation(self.domid, init_reservation,
> -                                                  0, 0)
> +            # set memory limit
> +            maxmem = self.image.getRequiredMemory(self.info['maxmem'] * 1024)
> +            xc.domain_setmaxmem(self.domid, maxmem)
> +
> +            # initial memory allocation
> +            mem_kb = self.image.getRequiredMemory(self.info['memory'] * 1024)
> +            balloon.free(mem_kb)
> +            xc.domain_memory_increase_reservation(self.domid, mem_kb, 0, 0)
>  
>              self.createChannels()
>  
> diff -r 8cca42e2610a tools/python/xen/xend/image.py
> --- a/tools/python/xen/xend/image.py	Thu Aug 10 14:29:04 2006 +0100
> +++ b/tools/python/xen/xend/image.py	Thu Aug 10 15:45:21 2006 -0500
> @@ -27,6 +27,7 @@ from xen.xend.XendLogging import log
>  from xen.xend.XendLogging import log
>  from xen.xend.server.netif import randomMAC
>  from xen.xend.xenstore.xswatch import xswatch
> +from xen.xend import arch
>  
> 
>  xc = xen.lowlevel.xc.xc()
> @@ -141,17 +142,8 @@ class ImageHandler:
>              raise VmError('Building domain failed: ostype=%s dom=%d err=%s'
>                            % (self.ostype, self.vm.getDomid(), str(result)))
>  
> -
> -    def getDomainMemory(self, mem_kb):
> -        """@return The memory required, in KiB, by the domain to store the
> -        given amount, also in KiB."""
> -        if os.uname()[4] != 'ia64':
> -            # A little extra because auto-ballooning is broken w.r.t. HVM
> -            # guests. Also, slack is necessary for live migration since that
> -            # uses shadow page tables.
> -            if 'hvm' in xc.xeninfo()['xen_caps']:
> -                mem_kb += 4*1024;
> -        return mem_kb
> +    def getRequiredMemory(self, domain_kb):
> +        return domain_kb
>  
>      def buildDomain(self):
>          """Build the domain. Define in subclass."""
> @@ -349,20 +341,8 @@ class HVMImageHandler(ImageHandler):
>          os.waitpid(self.pid, 0)
>          self.pid = 0
>  
> -    def getDomainMemory(self, mem_kb):
> -        """@see ImageHandler.getDomainMemory"""
> -        if os.uname()[4] == 'ia64':
> -            page_kb = 16
> -            # ROM size for guest firmware, ioreq page and xenstore page
> -            extra_pages = 1024 + 2
> -        else:
> -            page_kb = 4
> -            # This was derived emperically:
> -            #   2.4 MB overhead per 1024 MB RAM + 8 MB constant
> -            #   + 4 to avoid low-memory condition
> -            extra_mb = (2.4/1024) * (mem_kb/1024.0) + 12;
> -            extra_pages = int( math.ceil( extra_mb*1024 / page_kb ))
> -        return mem_kb + extra_pages * page_kb
> +    def getRequiredMemory(self, domain_kb):
> +        return arch.HVMRequiredMemory(domain_kb)
>  
>      def register_shutdown_watch(self):
>          """ add xen store watch on control/shutdown """
> diff -r 8cca42e2610a tools/python/xen/xend/arch/__init__.py
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/tools/python/xen/xend/arch/__init__.py	Thu Aug 10 15:18:58 2006 -0500
> @@ -0,0 +1,28 @@
> +#!/usr/bin/env python
> +#
> +# This library is free software; you can redistribute it and/or
> +# modify it under the terms of version 2.1 of the GNU Lesser General Public
> +# License as published by the Free Software Foundation.
> +#
> +# This library is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +# Lesser General Public License for more details.
> +#
> +# You should have received a copy of the GNU Lesser General Public
> +# License along with this library; if not, write to the Free Software
> +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> +#
> +# Copyright (C) IBM Corp. 2006
> +#
> +# Authors: Hollis Blanchard <hollisb@us.ibm.com>
> +
> +import os
> +
> +_uname = os.uname()[4] 
> +if _uname in ("i386", "i486", "i586", "i686"):
> +	from x86 import *
> +elif _uname in ("ia64"):
> +	from ia64 import *
> +elif _uname in ("ppc", "ppc64"):
> +	from powerpc import *
> diff -r 8cca42e2610a tools/python/xen/xend/arch/ia64.py
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/tools/python/xen/xend/arch/ia64.py	Thu Aug 10 15:45:08 2006 -0500
> @@ -0,0 +1,24 @@
> +#!/usr/bin/env python
> +#
> +# This library is free software; you can redistribute it and/or
> +# modify it under the terms of version 2.1 of the GNU Lesser General Public
> +# License as published by the Free Software Foundation.
> +#
> +# This library is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +# Lesser General Public License for more details.
> +#
> +# You should have received a copy of the GNU Lesser General Public
> +# License along with this library; if not, write to the Free Software
> +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> +#
> +# Copyright (C) IBM Corp. 2006
> +#
> +# Authors: Hollis Blanchard <hollisb@us.ibm.com>
> +
> +def HVMRequiredMemory(mem_kb):
> +    page_kb = 16
> +    # ROM size for guest firmware, ioreq page and xenstore page
> +    extra_pages = 1024 + 2
> +    return mem_kb + extra_pages * page_kb
> diff -r 8cca42e2610a tools/python/xen/xend/arch/x86.py
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/tools/python/xen/xend/arch/x86.py	Thu Aug 10 15:45:13 2006 -0500
> @@ -0,0 +1,27 @@
> +#!/usr/bin/env python
> +#
> +# This library is free software; you can redistribute it and/or
> +# modify it under the terms of version 2.1 of the GNU Lesser General Public
> +# License as published by the Free Software Foundation.
> +#
> +# This library is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +# Lesser General Public License for more details.
> +#
> +# You should have received a copy of the GNU Lesser General Public
> +# License along with this library; if not, write to the Free Software
> +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> +#
> +# Copyright (C) IBM Corp. 2006
> +#
> +# Authors: Hollis Blanchard <hollisb@us.ibm.com>
> +
> +def HVMRequiredMemory(mem_kb):
> +    page_kb = 4
> +    # This was derived emperically:
> +    #   2.4 MB overhead per 1024 MB RAM + 8 MB constant
> +    #   + 4 to avoid low-memory condition
> +    extra_mb = (2.4/1024) * (mem_kb/1024.0) + 12;
> +    extra_pages = int( math.ceil( extra_mb*1024 / page_kb ))
> +    return mem_kb + extra_pages * page_kb
> 
> 
> 

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

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

  parent reply	other threads:[~2006-08-11 22:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-08 15:34 architecture-specific stuff in xend Hollis Blanchard
2006-08-08 15:59 ` [XenPPC] Re: [Xen-devel] " John Levon
2006-08-08 16:15   ` Hollis Blanchard
2006-08-08 17:12     ` John Levon
2006-08-09  9:28   ` Ewan Mellor
2006-08-09 15:07     ` Hollis Blanchard
2006-08-09 16:18       ` Ewan Mellor
2006-08-10 21:12         ` [PATCH] " Hollis Blanchard
2006-08-10 21:27           ` John Levon
2006-08-11 22:59           ` Daniel Miles [this message]
2006-08-14 17:40         ` Hollis Blanchard
2006-08-15  2:14           ` Hollis Blanchard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1155337158.9030.41.camel@localhost.localdomain \
    --to=daniel.t.miles@hp.com \
    --cc=ewan@xensource.com \
    --cc=hollisb@us.ibm.com \
    --cc=levon@movementarian.org \
    --cc=xen-devel@lists.xensource.com \
    --cc=xen-ia64-devel@lists.xensource.com \
    --cc=xen-ppc-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.