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

[Xen-devel] [PATCH] 4/4 "nemesis" scheduling domains for Xen

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] 4/4 "nemesis" scheduling domains for Xen
From: "Mike D. Day" <ncmike@xxxxxxxxxx>
Date: Fri, 4 May 2007 18:32:36 -0400
Delivery-date: Fri, 04 May 2007 15:31:05 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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>
Organization: IBM Linux Technology Center
Reply-to: ncmike@xxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.13 (2006-08-11)
C program to create and destroy scheduling domains.
signed-off-by: Mike D. Day <ncmike@xxxxxxxxxx>

--
Makefile  |   38 ++++++++++++++++++++++++++
nemesis.c |   88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
--

diff -r 90e7ec389b4e tools/nemesis/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/nemesis/Makefile    Fri May 04 17:53:36 2007 -0400
@@ -0,0 +1,38 @@
+XEN_ROOT=../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+CFLAGS   += -Werror
+
+INCLUDES += -I $(XEN_XC)
+INCLUDES += -I $(XEN_LIBXC)
+CFLAGS   += $(INCLUDES)
+
+HDRS     = $(wildcard *.h)
+
+TARGETS := nemesis
+
+INSTALL_BIN  = $(TARGETS)
+INSTALL_SBIN =
+
+.PHONY: all
+all: build
+
+.PHONY: build
+build: $(TARGETS)
+
+.PHONY: install
+install: build
+       [ -d $(DESTDIR)/usr/bin ] || $(INSTALL_DIR) $(DESTDIR)/usr/bin
+       [ -d $(DESTDIR)/usr/sbin ] || $(INSTALL_DIR) $(DESTDIR)/usr/sbin
+       $(INSTALL_PROG) $(INSTALL_BIN) $(DESTDIR)/usr/bin
+       $(INSTALL_PROG) $(INSTALL_SBIN) $(DESTDIR)/usr/sbin
+
+.PHONY: clean
+clean:
+       $(RM) *.o $(TARGETS) *~
+
+%.o: %.c $(HDRS) Makefile
+       $(CC) -c $(CFLAGS) -o $@ $<
+
+nemesis: %: %.o Makefile
+       $(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -lxenctrl
diff -r 90e7ec389b4e tools/nemesis/nemesis.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/nemesis/nemesis.c   Fri May 04 18:28:48 2007 -0400
@@ -0,0 +1,88 @@
+/*
+ *  Copyright (C) International Business Machines  Corp., 2007
+ *  Author(s): Mike D. Day <ncmike@xxxxxxxxxx>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; under version 2 of the License.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <xenctrl.h>
+
+void usage(void)
+{
+    printf("usage: nemesis <action> -d dom -s ndom\n");
+    printf("\taction can be -a to add <dom> to <ndom> , or\n");
+    printf("\t -r to remove <dom> from <ndom>\n");
+    printf("\t for example: nemesis -a -d3 -s1\n");
+}
+
+int main(int argc, char *argv[])
+{
+
+    int i, handle, action = 0, ret;
+    uint16_t adom = 0, ndom = 0, reason;
+    char *tail;
+
+    if (argc != 4)
+    {
+        usage();
+        return 0;
+    }
+
+
+    for (i = 1; i < 4; i++)
+    {
+        if (*(argv[i] + 1) == 'a')
+            action = 1;
+        else if (*(argv[i] + 1) == 'r')
+            action = 2;
+        else if (*(argv[i] + 1) == 'd')
+        {
+            adom = strtol(argv[i]+2, &tail, 0);
+        }
+        else if (*(argv[i] + 1) == 's')
+        {
+            ndom = strtol(argv[i]+2, &tail, 0);
+        }
+        else
+        {
+            usage();
+            return 0;
+        }
+    }
+
+    handle = xc_interface_open();
+    if (handle < 0)
+    {
+        printf("unable to open library - must execute as root\n");
+        return 0;
+    }
+
+    if (action == 1)
+        ret = xc_add_adom(handle, adom, ndom, &reason);
+    else if (action == 2)
+        ret = xc_del_adom(handle, adom, ndom, &reason);
+    else
+    {
+        usage();
+        ret = 1;
+    }
+    xc_interface_close(handle);
+    return ret;
+}

--
Mike D. Day
IBM LTC
Cell: 919 412-3900
Sametime: ncmike@xxxxxxxxxx AIM: ncmikeday  Yahoo: ultra.runner
PGP key: http://www.ncultra.org/ncmike/pubkey.asc

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] 4/4 "nemesis" scheduling domains for Xen, Mike D. Day <=