1 Index: qemu-kvm/qemu-options.hx
2 ===================================================================
3 --- qemu-kvm.orig/qemu-options.hx 2009-12-21 10:37:57.000000000 +0100
4 +++ qemu-kvm/qemu-options.hx 2009-12-21 10:41:25.000000000 +0100
9 +DEF("id", HAS_ARG, QEMU_OPTION_id,
10 + "-id n set the faisched ID\n")
12 +DEF("cpuunits", HAS_ARG, QEMU_OPTION_cpuunits,
13 + "-cpuuinits n set fairsched cpu units\n")
15 DEF("fda", HAS_ARG, QEMU_OPTION_fda,
16 "-fda/-fdb file use 'file' as floppy disk 0/1 image\n")
17 DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "")
19 ===================================================================
20 --- qemu-kvm.orig/vl.c 2009-12-21 10:37:58.000000000 +0100
21 +++ qemu-kvm/vl.c 2009-12-21 10:42:50.000000000 +0100
23 #include "qemu-objects.h"
25 #include "hw/device-assignment.h"
26 +#include "vzsyscalls.h"
34 +int fairsched_id = 0;
35 const char *vnc_display;
39 prctl(PR_SET_NAME, name);
48 const char *gdbstub_dev = NULL;
49 uint32_t boot_devices_bitmap = 0;
52 int snapshot, linux_boot, net_boot;
53 const char *initrd_filename;
54 const char *kernel_filename, *kernel_cmdline;
55 @@ -5550,6 +5553,20 @@
59 + case QEMU_OPTION_id:
60 + fairsched_id = atoi(optarg);
61 + if (fairsched_id < 100 || fairsched_id >= 1000000) {
62 + fprintf(stderr, "Invalid ID\n");
66 + case QEMU_OPTION_cpuunits:
67 + cpuunits = atoi(optarg);
68 + if (cpuunits < 8 || cpuunits > 500000) {
69 + fprintf(stderr, "Invalid value for cpuunits\n");
74 display_type = DT_VNC;
76 @@ -5947,6 +5964,39 @@
78 ram_size = DEFAULT_RAM_SIZE * 1024 * 1024;
80 + if (cpuunits && !fairsched_id) {
81 + fprintf(stderr, "cpuunits specified without -id");
87 + int weight = cpuunits ? 500000/cpuunits : 500;
88 + pid_t cpid = getpid();
90 + ret = syscall(__NR_fairsched_rmnod, fairsched_id);
91 + if (ret == -EBUSY) {
92 + fprintf (stderr, "unable to create fairsched node - still in use\n");
96 + ret = syscall(__NR_fairsched_mknod, 0, weight, fairsched_id);
97 + if (ret != fairsched_id) {
98 + fprintf (stderr, "unable to create fairsched node\n");
102 + ret = syscall(__NR_fairsched_mvpr, cpid, fairsched_id);
104 + fprintf (stderr, "unable to move procces to fairsched group");
108 + /* note: we can never remove ourself from the group, so the empty group
109 + will exist after we finish
113 /* init the dynamic translator */
114 cpu_exec_init_all(tb_size * 1024 * 1024);
116 Index: qemu-kvm/vzsyscalls.h
117 ===================================================================
118 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
119 +++ qemu-kvm/vzsyscalls.h 2009-12-21 10:41:25.000000000 +0100
122 + * Copyright (C) 2000-2008, Parallels, Inc. All rights reserved.
124 + * This program is free software; you can redistribute it and/or modify
125 + * it under the terms of the GNU General Public License as published by
126 + * the Free Software Foundation; either version 2 of the License, or
127 + * (at your option) any later version.
129 + * This program is distributed in the hope that it will be useful,
130 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
131 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
132 + * GNU General Public License for more details.
134 + * You should have received a copy of the GNU General Public License
135 + * along with this program; if not, write to the Free Software
136 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
138 +#ifndef _VZSYSCALLS_H_
139 +#define _VZSYSCALLS_H_
141 +#include <sys/syscall.h>
144 +#define __NR_fairsched_vcpus 499
145 +#define __NR_setluid 501
146 +#define __NR_setublimit 502
147 +#define __NR_fairsched_mknod 504
148 +#define __NR_fairsched_rmnod 505
149 +#define __NR_fairsched_chwt 506
150 +#define __NR_fairsched_mvpr 507
151 +#define __NR_fairsched_rate 508
152 +#define __NR_ioprio_set 251
153 +#elif defined(__i386__)
154 +#define __NR_fairsched_mknod 500
155 +#define __NR_fairsched_rmnod 501
156 +#define __NR_fairsched_chwt 502
157 +#define __NR_fairsched_mvpr 503
158 +#define __NR_fairsched_rate 504
159 +#define __NR_fairsched_vcpus 505
160 +#define __NR_setluid 511
161 +#define __NR_setublimit 512
162 +#define __NR_ioprio_set 289
164 +#error "no syscall for this arch"