* [PATCH 1/3] KVM-userspace: introduce -nodes command line option
@ 2008-11-27 22:25 Andre Przywara
2008-11-28 10:15 ` Daniel P. Berrange
0 siblings, 1 reply; 2+ messages in thread
From: Andre Przywara @ 2008-11-27 22:25 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm
[-- Attachment #1: Type: text/plain, Size: 619 bytes --]
The attached patch parses a list of host nodes given on the command line
and passes it on to lower levels (namely qemu-kvm.c)
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
--
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 277-84917
----to satisfy European Law for business letters:
AMD Saxony Limited Liability Company & Co. KG,
Wilschdorfer Landstr. 101, 01109 Dresden, Germany
Register Court Dresden: HRA 4896, General Partner authorized
to represent: AMD Saxony LLC (Wilmington, Delaware, US)
General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy
[-- Attachment #2: kvmnuma_cmdline.patch --]
[-- Type: text/plain, Size: 2700 bytes --]
commit d34354eb622f667169edebd830364f646cd8f93e
Author: Andre Przywara <andre.przywara@amd.com>
Date: Tue Nov 25 23:01:24 2008 +0100
introduce -nodes comand line option
diff --git a/qemu/sysemu.h b/qemu/sysemu.h
index 5abda5c..07acaf4 100644
--- a/qemu/sysemu.h
+++ b/qemu/sysemu.h
@@ -99,6 +99,11 @@ extern int win2k_install_hack;
extern int alt_grab;
extern int usb_enabled;
extern int smp_cpus;
+
+#define MAX_NODES 64
+extern int numnumanodes;
+extern int hostnodes[MAX_NODES];
+
extern int cursor_hide;
extern int graphic_rotate;
extern int no_quit;
diff --git a/qemu/vl.c b/qemu/vl.c
index 92325e6..681b3de 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -228,6 +228,8 @@ int usb_enabled = 0;
const char *assigned_devices[MAX_DEV_ASSIGN_CMDLINE];
int assigned_devices_index;
int smp_cpus = 1;
+int numnumanodes = 0;
+int hostnodes[MAX_NODES];
const char *vnc_display;
int acpi_enabled = 1;
int fd_bootchk = 1;
@@ -4193,6 +4195,7 @@ enum {
QEMU_OPTION_usb,
QEMU_OPTION_usbdevice,
QEMU_OPTION_smp,
+ QEMU_OPTION_nodes,
QEMU_OPTION_vnc,
QEMU_OPTION_no_acpi,
QEMU_OPTION_curses,
@@ -4320,6 +4323,7 @@ static const QEMUOption qemu_options[] = {
{ "win2k-hack", 0, QEMU_OPTION_win2k_hack },
{ "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice },
{ "smp", HAS_ARG, QEMU_OPTION_smp },
+ { "nodes", HAS_ARG, QEMU_OPTION_nodes },
{ "vnc", HAS_ARG, QEMU_OPTION_vnc },
#ifdef CONFIG_CURSES
{ "curses", 0, QEMU_OPTION_curses },
@@ -4711,6 +4715,25 @@ static void termsig_setup(void)
#endif
+static int parse_to_array (const char *arg, int *array, int maxentries)
+{
+const char *s;
+char *end;
+int num;
+int value;
+
+ num=0;
+ for (s=arg; s!=NULL; s = strchr (end, ','))
+ {
+ while (*s == ',') s++;
+ value = strtol (s, &end, 10);
+ if (end == s) break;
+ if (num >= maxentries) break;
+ array[num++] = value;
+ }
+ return num;
+}
+
int main(int argc, char **argv)
{
#ifdef CONFIG_GDBSTUB
@@ -5290,6 +5313,13 @@ int main(int argc, char **argv)
exit(1);
}
break;
+ case QEMU_OPTION_nodes:
+ numnumanodes = parse_to_array (optarg, hostnodes,MAX_NODES);
+ if (numnumanodes < 0) {
+ fprintf(stderr, "Invalid number of NUMA nodes\n");
+ exit(1);
+ }
+ break;
case QEMU_OPTION_vnc:
vnc_display = optarg;
break;
@@ -5442,6 +5472,9 @@ int main(int argc, char **argv)
monitor_device = "stdio";
}
+ if (numnumanodes > smp_cpus)
+ numnumanodes = smp_cpus;
+
#ifndef _WIN32
if (daemonize) {
pid_t pid;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/3] KVM-userspace: introduce -nodes command line option
2008-11-27 22:25 [PATCH 1/3] KVM-userspace: introduce -nodes command line option Andre Przywara
@ 2008-11-28 10:15 ` Daniel P. Berrange
0 siblings, 0 replies; 2+ messages in thread
From: Daniel P. Berrange @ 2008-11-28 10:15 UTC (permalink / raw)
To: Andre Przywara; +Cc: Avi Kivity, kvm
On Thu, Nov 27, 2008 at 11:25:12PM +0100, Andre Przywara wrote:
> The attached patch parses a list of host nodes given on the command line
> and passes it on to lower levels (namely qemu-kvm.c)
> diff --git a/qemu/sysemu.h b/qemu/sysemu.h
> index 5abda5c..07acaf4 100644
> --- a/qemu/sysemu.h
> +++ b/qemu/sysemu.h
> @@ -99,6 +99,11 @@ extern int win2k_install_hack;
> extern int alt_grab;
> extern int usb_enabled;
> extern int smp_cpus;
> +
> +#define MAX_NODES 64
> +extern int numnumanodes;
> +extern int hostnodes[MAX_NODES];
This is rather less than Linux / libnuma seems to allow for max
nodes. In numa.h there is
#if defined(__x86_64__) || defined(__i386__)
#define NUMA_NUM_NODES 128
#else
#define NUMA_NUM_NODES 2048
#endif
Should we just use that NUMA_NUM_NODES constant directly from numa.h
when numa is compiled in, so we're guarenteed to match.
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-11-28 10:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-27 22:25 [PATCH 1/3] KVM-userspace: introduce -nodes command line option Andre Przywara
2008-11-28 10:15 ` Daniel P. Berrange
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox