WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] Prevent changing a memory size of Domain-0 even

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] [PATCH] Prevent changing a memory size of Domain-0 even if users make a careless mistake
From: Mark Williamson <mark.williamson@xxxxxxxxxxxx>
Date: Sat, 5 Apr 2008 19:36:07 +0100
Cc: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
Delivery-date: Sat, 05 Apr 2008 11:36:37 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C41BBDDD.1ECB4%keir.fraser@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <C41BBDDD.1ECB4%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.6 (enterprise 0.20070907.709405)
> I think it's fair to just say "Don't do that then, you idiot!". :-)

I think if we have a "dom0-min-mem" parameter then we may as well use it 
consistently.  We already use it to prevent event quite determined 
foot-shooting attempts (like starting up too many domains!).

Seems consistent to apply the rule whenever an xm command might balloon dom0.

Kan, a comment on your patch:


diff -r db943e8d1051 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Tue Apr 01 10:09:33 2008 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Fri Apr 04 13:43:55 2008 +0900
@@ -986,6 +986,14 @@ class XendDomainInfo:
                   self.info['name_label'], str(self.domid), target)
         
         MiB = 1024 * 1024
+
+        if self.domid == 0:
+            dom0_min_mem = xoptions.get_dom0_min_mem()
+            memory_cur = self.get_memory_dynamic_max() / MiB
+            if target < memory_cur:
+                if dom0_min_mem == 0 or dom0_min_mem > target:

If I recall correctly, the current meaning of dom0_min_mem set to 0 is "No 
limiting", so I think you can just remove that check to be consistent with 
existing behaviour.

Cheers,
Mark

+                    raise XendError("memory_dynamic_max cannot be changed for 
safety reasons")
+
         self._safe_set_memory('memory_dynamic_min', target * MiB)
         self._safe_set_memory('memory_dynamic_max', target * MiB)
 


>  -- Keir
>
> On 4/4/08 11:06, "Masaki Kanno" <kanno.masaki@xxxxxxxxxxxxxx> wrote:
> > Hi,
> >
> > If users accidentally change a memory size of Domain-0 to very small
> > memory size by xm mem-set command, users will be not able to operate
> > Domain-0.  I think that Domain-0 is important for Xen, so I'd like to
> > prevent the accident by xm mem-set command.
> >
> > This patch prevents changing the memory size of Domain-0 by xm mem-set
> > command if specified memory size is smaller than dom0-min-mem in
> > xend-config.sxp.
> >
> >  # cat /etc/xen/xend-config.sxp | grep "(dom0-min-mem"
> >  (dom0-min-mem 384)
> >  # xm list Domain-0
> >  Name                                        ID   Mem VCPUs      State
> > Time(s)
> >  Domain-0                                     0   941     2     r-----
> > 62.6
> >  # xm mem-set Domain-0 1
> >  Error: memory_dynamic_max cannot be changed for safety reasons
> >  Usage: xm mem-set <Domain> <Mem>
> >
> >  Set the current memory usage for a domain.
> >  # xm list Domain-0
> >  Name                                        ID   Mem VCPUs      State
> > Time(s)
> >  Domain-0                                     0   941     2     r-----
> > 63.6
> >
> >
> > Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
> >
> > Best regards,
> >  Kan
> >
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@xxxxxxxxxxxxxxxxxxx
> > http://lists.xensource.com/xen-devel
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



-- 
Push Me Pull You - Distributed SCM tool (http://www.cl.cam.ac.uk/~maw48/pmpu/)

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

<Prev in Thread] Current Thread [Next in Thread>