1 Index: new/qemu-options.hx
2 ===================================================================
3 --- new.orig/qemu-options.hx 2012-03-12 06:44:56.000000000 +0100
4 +++ new/qemu-options.hx 2012-03-13 07:25:22.000000000 +0100
9 +DEF("id", HAS_ARG, QEMU_OPTION_id,
10 + "-id n set the faisched ID\n", QEMU_ARCH_ALL)
12 +DEF("cpuunits", HAS_ARG, QEMU_OPTION_cpuunits,
13 + "-cpuuinits n set fairsched cpu units\n", QEMU_ARCH_ALL)
15 DEF("fda", HAS_ARG, QEMU_OPTION_fda,
16 "-fda/-fdb file use 'file' as floppy disk 0/1 image\n", QEMU_ARCH_ALL)
17 DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL)
19 ===================================================================
20 --- new.orig/vl.c 2012-03-12 06:44:56.000000000 +0100
21 +++ new/vl.c 2012-03-13 07:25:22.000000000 +0100
23 #include "fsdev/qemu-fsdev.h"
26 +#include "vzsyscalls.h"
30 #include "qemu_socket.h"
32 int win2k_install_hack = 0;
35 +int fairsched_id = 0;
42 static int debugcon_parse(const char *devname)
47 if (!qemu_chr_new("debugcon", devname, NULL)) {
49 int main(int argc, char **argv, char **envp)
53 int snapshot, linux_boot;
54 const char *icount_option = NULL;
55 const char *initrd_filename;
56 @@ -3022,6 +3026,20 @@
60 + case QEMU_OPTION_id:
61 + fairsched_id = atoi(optarg);
62 + if (fairsched_id < 100 || fairsched_id >= 1000000) {
63 + fprintf(stderr, "Invalid ID\n");
67 + case QEMU_OPTION_cpuunits:
68 + cpuunits = atoi(optarg);
69 + if (cpuunits < 8 || cpuunits > 500000) {
70 + fprintf(stderr, "Invalid value for cpuunits\n");
86 case QEMU_OPTION_prom_env:
87 if (nb_prom_envs >= MAX_PROM_ENVS) {
88 @@ -3411,6 +3429,39 @@
92 + if (cpuunits && !fairsched_id) {
93 + fprintf(stderr, "cpuunits specified without -id");
97 + if (fairsched_id && cpuunits) {
99 + int weight = cpuunits ? 500000/cpuunits : 500;
100 + pid_t cpid = getpid();
102 + ret = syscall(__NR_fairsched_rmnod, fairsched_id);
103 + if (ret == -EBUSY) {
104 + fprintf (stderr, "unable to create fairsched node - still in use\n");
108 + ret = syscall(__NR_fairsched_mknod, 0, weight, fairsched_id);
109 + if (ret != fairsched_id) {
110 + fprintf (stderr, "unable to create fairsched node\n");
114 + ret = syscall(__NR_fairsched_mvpr, cpid, fairsched_id);
116 + fprintf (stderr, "unable to move procces to fairsched group");
120 + /* note: we can never remove ourself from the group, so the empty group
121 + will exist after we finish
127 bdrv_init_with_whitelist();
128 Index: new/vzsyscalls.h
129 ===================================================================
130 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
131 +++ new/vzsyscalls.h 2012-03-13 07:25:22.000000000 +0100
134 + * Copyright (C) 2000-2008, Parallels, Inc. All rights reserved.
136 + * This program is free software; you can redistribute it and/or modify
137 + * it under the terms of the GNU General Public License as published by
138 + * the Free Software Foundation; either version 2 of the License, or
139 + * (at your option) any later version.
141 + * This program is distributed in the hope that it will be useful,
142 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
143 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
144 + * GNU General Public License for more details.
146 + * You should have received a copy of the GNU General Public License
147 + * along with this program; if not, write to the Free Software
148 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
150 +#ifndef _VZSYSCALLS_H_
151 +#define _VZSYSCALLS_H_
153 +#include <sys/syscall.h>
156 +#define __NR_fairsched_vcpus 499
157 +#define __NR_setluid 501
158 +#define __NR_setublimit 502
159 +#define __NR_fairsched_mknod 504
160 +#define __NR_fairsched_rmnod 505
161 +#define __NR_fairsched_chwt 506
162 +#define __NR_fairsched_mvpr 507
163 +#define __NR_fairsched_rate 508
164 +#define __NR_ioprio_set 251
165 +#elif defined(__i386__)
166 +#define __NR_fairsched_mknod 500
167 +#define __NR_fairsched_rmnod 501
168 +#define __NR_fairsched_chwt 502
169 +#define __NR_fairsched_mvpr 503
170 +#define __NR_fairsched_rate 504
171 +#define __NR_fairsched_vcpus 505
172 +#define __NR_setluid 511
173 +#define __NR_setublimit 512
174 +#define __NR_ioprio_set 289
176 +#error "no syscall for this arch"