* [Qemu-devel] [PATCH RFC 0/2] numa: allocate CPUs masks dynamically @ 2016-11-16 16:02 Igor Mammedov 2016-11-16 16:02 ` [Qemu-devel] [PATCH RFC 1/2] add bitmap_free() wrapper Igor Mammedov ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Igor Mammedov @ 2016-11-16 16:02 UTC (permalink / raw) To: qemu-devel Cc: Alexey Kardashevskiy, Greg Kurz, David Gibson, Eduardo Habkost, Paolo Bonzini This series removes global MAX_CPUMASK_BITS constant so that it won't inderectly influence maximum CPUs count supported by different targets. It replaces statically allocated bitmasks with dynamically allocated ones using '-smp maxcpus' value for setting bitmasks size. That would allocate just enough memory to handle all CPUs indexes that a QEMU instance would ever have. CC: Alexey Kardashevskiy <aik@ozlabs.ru> CC: Greg Kurz <gkurz@linux.vnet.ibm.com> CC: David Gibson <david@gibson.dropbear.id.au> CC: Eduardo Habkost <ehabkost@redhat.com> CC: Paolo Bonzini <pbonzini@redhat.com> Igor Mammedov (2): add bitmap_free() wrapper numa: make -numa parser dynamically allocate CPUs masks include/qemu/bitmap.h | 5 +++++ include/sysemu/numa.h | 2 +- include/sysemu/sysemu.h | 7 ------- numa.c | 19 ++++++++++++------- vl.c | 5 ----- 5 files changed, 18 insertions(+), 20 deletions(-) -- 2.7.4 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH RFC 1/2] add bitmap_free() wrapper 2016-11-16 16:02 [Qemu-devel] [PATCH RFC 0/2] numa: allocate CPUs masks dynamically Igor Mammedov @ 2016-11-16 16:02 ` Igor Mammedov 2016-11-16 17:05 ` Eduardo Habkost 2016-11-16 16:02 ` [Qemu-devel] [PATCH RFC 2/2] numa: make -numa parser dynamically allocate CPUs masks Igor Mammedov 2016-11-17 6:27 ` [Qemu-devel] [PATCH RFC 0/2] numa: allocate CPUs masks dynamically Alexey Kardashevskiy 2 siblings, 1 reply; 9+ messages in thread From: Igor Mammedov @ 2016-11-16 16:02 UTC (permalink / raw) To: qemu-devel Cc: Alexey Kardashevskiy, Greg Kurz, David Gibson, Eduardo Habkost, Paolo Bonzini it will be used for freeing bitmaps allocated with bitmap_[try]_new() Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- include/qemu/bitmap.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/qemu/bitmap.h b/include/qemu/bitmap.h index 63ea2d0..0289836 100644 --- a/include/qemu/bitmap.h +++ b/include/qemu/bitmap.h @@ -98,6 +98,11 @@ static inline unsigned long *bitmap_new(long nbits) return ptr; } +static inline void bitmap_free(unsigned long *bitmap) +{ + g_free(bitmap); +} + static inline void bitmap_zero(unsigned long *dst, long nbits) { if (small_nbits(nbits)) { -- 2.7.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH RFC 1/2] add bitmap_free() wrapper 2016-11-16 16:02 ` [Qemu-devel] [PATCH RFC 1/2] add bitmap_free() wrapper Igor Mammedov @ 2016-11-16 17:05 ` Eduardo Habkost 0 siblings, 0 replies; 9+ messages in thread From: Eduardo Habkost @ 2016-11-16 17:05 UTC (permalink / raw) To: Igor Mammedov Cc: qemu-devel, Alexey Kardashevskiy, Greg Kurz, David Gibson, Paolo Bonzini On Wed, Nov 16, 2016 at 05:02:55PM +0100, Igor Mammedov wrote: > it will be used for freeing bitmaps allocated with bitmap_[try]_new() > > Signed-off-by: Igor Mammedov <imammedo@redhat.com> We need to change all code using g_free() for bitmaps to use bitmap_free(), as people in the future might assume that changing bitmap_free() is safe (and it won't be). Personally, I think g_free() is good enough and we don't need bitmap_free(). The assumption that bitmap_new() returns g_free()-able memory is part of the API. > --- > include/qemu/bitmap.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/include/qemu/bitmap.h b/include/qemu/bitmap.h > index 63ea2d0..0289836 100644 > --- a/include/qemu/bitmap.h > +++ b/include/qemu/bitmap.h > @@ -98,6 +98,11 @@ static inline unsigned long *bitmap_new(long nbits) > return ptr; > } > > +static inline void bitmap_free(unsigned long *bitmap) > +{ > + g_free(bitmap); > +} > + > static inline void bitmap_zero(unsigned long *dst, long nbits) > { > if (small_nbits(nbits)) { > -- > 2.7.4 > -- Eduardo ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Qemu-devel] [PATCH RFC 2/2] numa: make -numa parser dynamically allocate CPUs masks 2016-11-16 16:02 [Qemu-devel] [PATCH RFC 0/2] numa: allocate CPUs masks dynamically Igor Mammedov 2016-11-16 16:02 ` [Qemu-devel] [PATCH RFC 1/2] add bitmap_free() wrapper Igor Mammedov @ 2016-11-16 16:02 ` Igor Mammedov 2016-11-16 17:08 ` Eduardo Habkost 2016-11-17 6:27 ` [Qemu-devel] [PATCH RFC 0/2] numa: allocate CPUs masks dynamically Alexey Kardashevskiy 2 siblings, 1 reply; 9+ messages in thread From: Igor Mammedov @ 2016-11-16 16:02 UTC (permalink / raw) To: qemu-devel Cc: Alexey Kardashevskiy, Greg Kurz, David Gibson, Eduardo Habkost, Paolo Bonzini so it won't impose an additional limits on max_cpus limits supported by different targets. It removes global MAX_CPUMASK_BITS constant and need to bump it up whenever max_cpus is being increased for a target above MAX_CPUMASK_BITS value. Use runtime max_cpus value instead to allocate sufficiently sized node_cpu bitmasks in numa parser. Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- include/sysemu/numa.h | 2 +- include/sysemu/sysemu.h | 7 ------- numa.c | 19 ++++++++++++------- vl.c | 5 ----- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h index 4da808a..8f09dcf 100644 --- a/include/sysemu/numa.h +++ b/include/sysemu/numa.h @@ -17,7 +17,7 @@ struct numa_addr_range { typedef struct node_info { uint64_t node_mem; - DECLARE_BITMAP(node_cpu, MAX_CPUMASK_BITS); + unsigned long *node_cpu; struct HostMemoryBackend *node_memdev; bool present; QLIST_HEAD(, numa_addr_range) addr; /* List to store address ranges */ diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 66c6f15..cccde56 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -168,13 +168,6 @@ extern int mem_prealloc; #define MAX_NODES 128 #define NUMA_NODE_UNASSIGNED MAX_NODES -/* The following shall be true for all CPUs: - * cpu->cpu_index < max_cpus <= MAX_CPUMASK_BITS - * - * Note that cpu->get_arch_id() may be larger than MAX_CPUMASK_BITS. - */ -#define MAX_CPUMASK_BITS 288 - #define MAX_OPTION_ROMS 16 typedef struct QEMUOptionRom { const char *name; diff --git a/numa.c b/numa.c index 9c09e45..5542e40 100644 --- a/numa.c +++ b/numa.c @@ -266,20 +266,20 @@ static char *enumerate_cpus(unsigned long *cpus, int max_cpus) static void validate_numa_cpus(void) { int i; - DECLARE_BITMAP(seen_cpus, MAX_CPUMASK_BITS); + unsigned long *seen_cpus = bitmap_new(max_cpus); - bitmap_zero(seen_cpus, MAX_CPUMASK_BITS); + bitmap_zero(seen_cpus, max_cpus); for (i = 0; i < nb_numa_nodes; i++) { - if (bitmap_intersects(seen_cpus, numa_info[i].node_cpu, - MAX_CPUMASK_BITS)) { + if (bitmap_intersects(seen_cpus, numa_info[i].node_cpu, max_cpus)) { bitmap_and(seen_cpus, seen_cpus, - numa_info[i].node_cpu, MAX_CPUMASK_BITS); + numa_info[i].node_cpu, max_cpus); error_report("CPU(s) present in multiple NUMA nodes: %s", enumerate_cpus(seen_cpus, max_cpus)); + bitmap_free(seen_cpus); exit(EXIT_FAILURE); } bitmap_or(seen_cpus, seen_cpus, - numa_info[i].node_cpu, MAX_CPUMASK_BITS); + numa_info[i].node_cpu, max_cpus); } if (!bitmap_full(seen_cpus, max_cpus)) { @@ -291,12 +291,17 @@ static void validate_numa_cpus(void) "in NUMA config"); g_free(msg); } + bitmap_free(seen_cpus); } void parse_numa_opts(MachineClass *mc) { int i; + for (i = 0; i < MAX_NODES; i++) { + numa_info[i].node_cpu = bitmap_new(max_cpus); + } + if (qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, NULL, NULL)) { exit(1); } @@ -362,7 +367,7 @@ void parse_numa_opts(MachineClass *mc) numa_set_mem_ranges(); for (i = 0; i < nb_numa_nodes; i++) { - if (!bitmap_empty(numa_info[i].node_cpu, MAX_CPUMASK_BITS)) { + if (!bitmap_empty(numa_info[i].node_cpu, max_cpus)) { break; } } diff --git a/vl.c b/vl.c index d77dd86..37790e5 100644 --- a/vl.c +++ b/vl.c @@ -1277,11 +1277,6 @@ static void smp_parse(QemuOpts *opts) max_cpus = qemu_opt_get_number(opts, "maxcpus", cpus); - if (max_cpus > MAX_CPUMASK_BITS) { - error_report("unsupported number of maxcpus"); - exit(1); - } - if (max_cpus < cpus) { error_report("maxcpus must be equal to or greater than smp"); exit(1); -- 2.7.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH RFC 2/2] numa: make -numa parser dynamically allocate CPUs masks 2016-11-16 16:02 ` [Qemu-devel] [PATCH RFC 2/2] numa: make -numa parser dynamically allocate CPUs masks Igor Mammedov @ 2016-11-16 17:08 ` Eduardo Habkost 2016-11-18 8:36 ` Igor Mammedov 0 siblings, 1 reply; 9+ messages in thread From: Eduardo Habkost @ 2016-11-16 17:08 UTC (permalink / raw) To: Igor Mammedov Cc: qemu-devel, Alexey Kardashevskiy, Greg Kurz, David Gibson, Paolo Bonzini On Wed, Nov 16, 2016 at 05:02:56PM +0100, Igor Mammedov wrote: > so it won't impose an additional limits on max_cpus limits > supported by different targets. > > It removes global MAX_CPUMASK_BITS constant and need to > bump it up whenever max_cpus is being increased for > a target above MAX_CPUMASK_BITS value. > > Use runtime max_cpus value instead to allocate sufficiently > sized node_cpu bitmasks in numa parser. > > Signed-off-by: Igor Mammedov <imammedo@redhat.com> > --- > include/sysemu/numa.h | 2 +- > include/sysemu/sysemu.h | 7 ------- > numa.c | 19 ++++++++++++------- > vl.c | 5 ----- > 4 files changed, 13 insertions(+), 20 deletions(-) > > diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h > index 4da808a..8f09dcf 100644 > --- a/include/sysemu/numa.h > +++ b/include/sysemu/numa.h > @@ -17,7 +17,7 @@ struct numa_addr_range { > > typedef struct node_info { > uint64_t node_mem; > - DECLARE_BITMAP(node_cpu, MAX_CPUMASK_BITS); > + unsigned long *node_cpu; > struct HostMemoryBackend *node_memdev; > bool present; > QLIST_HEAD(, numa_addr_range) addr; /* List to store address ranges */ > diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h > index 66c6f15..cccde56 100644 > --- a/include/sysemu/sysemu.h > +++ b/include/sysemu/sysemu.h > @@ -168,13 +168,6 @@ extern int mem_prealloc; > #define MAX_NODES 128 > #define NUMA_NODE_UNASSIGNED MAX_NODES > > -/* The following shall be true for all CPUs: > - * cpu->cpu_index < max_cpus <= MAX_CPUMASK_BITS > - * > - * Note that cpu->get_arch_id() may be larger than MAX_CPUMASK_BITS. > - */ > -#define MAX_CPUMASK_BITS 288 > - Nice! > #define MAX_OPTION_ROMS 16 > typedef struct QEMUOptionRom { > const char *name; > diff --git a/numa.c b/numa.c > index 9c09e45..5542e40 100644 > --- a/numa.c > +++ b/numa.c > @@ -266,20 +266,20 @@ static char *enumerate_cpus(unsigned long *cpus, int max_cpus) > static void validate_numa_cpus(void) > { > int i; > - DECLARE_BITMAP(seen_cpus, MAX_CPUMASK_BITS); > + unsigned long *seen_cpus = bitmap_new(max_cpus); > > - bitmap_zero(seen_cpus, MAX_CPUMASK_BITS); > + bitmap_zero(seen_cpus, max_cpus); bitmap_new() already returns a zeroed bitmap. > for (i = 0; i < nb_numa_nodes; i++) { > - if (bitmap_intersects(seen_cpus, numa_info[i].node_cpu, > - MAX_CPUMASK_BITS)) { > + if (bitmap_intersects(seen_cpus, numa_info[i].node_cpu, max_cpus)) { > bitmap_and(seen_cpus, seen_cpus, > - numa_info[i].node_cpu, MAX_CPUMASK_BITS); > + numa_info[i].node_cpu, max_cpus); > error_report("CPU(s) present in multiple NUMA nodes: %s", > enumerate_cpus(seen_cpus, max_cpus)); > + bitmap_free(seen_cpus); > exit(EXIT_FAILURE); > } > bitmap_or(seen_cpus, seen_cpus, > - numa_info[i].node_cpu, MAX_CPUMASK_BITS); > + numa_info[i].node_cpu, max_cpus); > } > > if (!bitmap_full(seen_cpus, max_cpus)) { > @@ -291,12 +291,17 @@ static void validate_numa_cpus(void) > "in NUMA config"); > g_free(msg); > } > + bitmap_free(seen_cpus); See comment about bitmap_free() on patch 1/2. I think g_free() is good enough (unless you really want to review all callers of bitmap_[try_]new()). > } > > void parse_numa_opts(MachineClass *mc) > { > int i; > > + for (i = 0; i < MAX_NODES; i++) { > + numa_info[i].node_cpu = bitmap_new(max_cpus); > + } > + > if (qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, NULL, NULL)) { > exit(1); > } > @@ -362,7 +367,7 @@ void parse_numa_opts(MachineClass *mc) > numa_set_mem_ranges(); > > for (i = 0; i < nb_numa_nodes; i++) { > - if (!bitmap_empty(numa_info[i].node_cpu, MAX_CPUMASK_BITS)) { > + if (!bitmap_empty(numa_info[i].node_cpu, max_cpus)) { > break; > } > } > diff --git a/vl.c b/vl.c > index d77dd86..37790e5 100644 > --- a/vl.c > +++ b/vl.c > @@ -1277,11 +1277,6 @@ static void smp_parse(QemuOpts *opts) > > max_cpus = qemu_opt_get_number(opts, "maxcpus", cpus); > > - if (max_cpus > MAX_CPUMASK_BITS) { > - error_report("unsupported number of maxcpus"); > - exit(1); > - } > - > if (max_cpus < cpus) { > error_report("maxcpus must be equal to or greater than smp"); > exit(1); > -- > 2.7.4 > -- Eduardo ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH RFC 2/2] numa: make -numa parser dynamically allocate CPUs masks 2016-11-16 17:08 ` Eduardo Habkost @ 2016-11-18 8:36 ` Igor Mammedov 0 siblings, 0 replies; 9+ messages in thread From: Igor Mammedov @ 2016-11-18 8:36 UTC (permalink / raw) To: Eduardo Habkost Cc: qemu-devel, Alexey Kardashevskiy, Greg Kurz, David Gibson, Paolo Bonzini On Wed, 16 Nov 2016 15:08:26 -0200 Eduardo Habkost <ehabkost@redhat.com> wrote: > On Wed, Nov 16, 2016 at 05:02:56PM +0100, Igor Mammedov wrote: > > so it won't impose an additional limits on max_cpus limits > > supported by different targets. > > > > It removes global MAX_CPUMASK_BITS constant and need to > > bump it up whenever max_cpus is being increased for > > a target above MAX_CPUMASK_BITS value. > > > > Use runtime max_cpus value instead to allocate sufficiently > > sized node_cpu bitmasks in numa parser. > > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com> > > --- > > include/sysemu/numa.h | 2 +- > > include/sysemu/sysemu.h | 7 ------- > > numa.c | 19 ++++++++++++------- > > vl.c | 5 ----- > > 4 files changed, 13 insertions(+), 20 deletions(-) > > > > diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h > > index 4da808a..8f09dcf 100644 > > --- a/include/sysemu/numa.h > > +++ b/include/sysemu/numa.h > > @@ -17,7 +17,7 @@ struct numa_addr_range { > > > > typedef struct node_info { > > uint64_t node_mem; > > - DECLARE_BITMAP(node_cpu, MAX_CPUMASK_BITS); > > + unsigned long *node_cpu; > > struct HostMemoryBackend *node_memdev; > > bool present; > > QLIST_HEAD(, numa_addr_range) addr; /* List to store address ranges */ > > diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h > > index 66c6f15..cccde56 100644 > > --- a/include/sysemu/sysemu.h > > +++ b/include/sysemu/sysemu.h > > @@ -168,13 +168,6 @@ extern int mem_prealloc; > > #define MAX_NODES 128 > > #define NUMA_NODE_UNASSIGNED MAX_NODES > > > > -/* The following shall be true for all CPUs: > > - * cpu->cpu_index < max_cpus <= MAX_CPUMASK_BITS > > - * > > - * Note that cpu->get_arch_id() may be larger than MAX_CPUMASK_BITS. > > - */ > > -#define MAX_CPUMASK_BITS 288 > > - > > Nice! > > > #define MAX_OPTION_ROMS 16 > > typedef struct QEMUOptionRom { > > const char *name; > > diff --git a/numa.c b/numa.c > > index 9c09e45..5542e40 100644 > > --- a/numa.c > > +++ b/numa.c > > @@ -266,20 +266,20 @@ static char *enumerate_cpus(unsigned long *cpus, int max_cpus) > > static void validate_numa_cpus(void) > > { > > int i; > > - DECLARE_BITMAP(seen_cpus, MAX_CPUMASK_BITS); > > + unsigned long *seen_cpus = bitmap_new(max_cpus); > > > > - bitmap_zero(seen_cpus, MAX_CPUMASK_BITS); > > + bitmap_zero(seen_cpus, max_cpus); > > bitmap_new() already returns a zeroed bitmap. > > > for (i = 0; i < nb_numa_nodes; i++) { > > - if (bitmap_intersects(seen_cpus, numa_info[i].node_cpu, > > - MAX_CPUMASK_BITS)) { > > + if (bitmap_intersects(seen_cpus, numa_info[i].node_cpu, max_cpus)) { > > bitmap_and(seen_cpus, seen_cpus, > > - numa_info[i].node_cpu, MAX_CPUMASK_BITS); > > + numa_info[i].node_cpu, max_cpus); > > error_report("CPU(s) present in multiple NUMA nodes: %s", > > enumerate_cpus(seen_cpus, max_cpus)); > > + bitmap_free(seen_cpus); > > exit(EXIT_FAILURE); > > } > > bitmap_or(seen_cpus, seen_cpus, > > - numa_info[i].node_cpu, MAX_CPUMASK_BITS); > > + numa_info[i].node_cpu, max_cpus); > > } > > > > if (!bitmap_full(seen_cpus, max_cpus)) { > > @@ -291,12 +291,17 @@ static void validate_numa_cpus(void) > > "in NUMA config"); > > g_free(msg); > > } > > + bitmap_free(seen_cpus); > > See comment about bitmap_free() on patch 1/2. I think g_free() is > good enough (unless you really want to review all callers of > bitmap_[try_]new()). ok, I'll replace bitmap_free() with g_free() and respin. > > > } > > > > void parse_numa_opts(MachineClass *mc) > > { > > int i; > > > > + for (i = 0; i < MAX_NODES; i++) { > > + numa_info[i].node_cpu = bitmap_new(max_cpus); > > + } > > + > > if (qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, NULL, NULL)) { > > exit(1); > > } > > @@ -362,7 +367,7 @@ void parse_numa_opts(MachineClass *mc) > > numa_set_mem_ranges(); > > > > for (i = 0; i < nb_numa_nodes; i++) { > > - if (!bitmap_empty(numa_info[i].node_cpu, MAX_CPUMASK_BITS)) { > > + if (!bitmap_empty(numa_info[i].node_cpu, max_cpus)) { > > break; > > } > > } > > diff --git a/vl.c b/vl.c > > index d77dd86..37790e5 100644 > > --- a/vl.c > > +++ b/vl.c > > @@ -1277,11 +1277,6 @@ static void smp_parse(QemuOpts *opts) > > > > max_cpus = qemu_opt_get_number(opts, "maxcpus", cpus); > > > > - if (max_cpus > MAX_CPUMASK_BITS) { > > - error_report("unsupported number of maxcpus"); > > - exit(1); > > - } > > - > > if (max_cpus < cpus) { > > error_report("maxcpus must be equal to or greater than smp"); > > exit(1); > > -- > > 2.7.4 > > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH RFC 0/2] numa: allocate CPUs masks dynamically 2016-11-16 16:02 [Qemu-devel] [PATCH RFC 0/2] numa: allocate CPUs masks dynamically Igor Mammedov 2016-11-16 16:02 ` [Qemu-devel] [PATCH RFC 1/2] add bitmap_free() wrapper Igor Mammedov 2016-11-16 16:02 ` [Qemu-devel] [PATCH RFC 2/2] numa: make -numa parser dynamically allocate CPUs masks Igor Mammedov @ 2016-11-17 6:27 ` Alexey Kardashevskiy 2016-11-21 18:46 ` Greg Kurz 2 siblings, 1 reply; 9+ messages in thread From: Alexey Kardashevskiy @ 2016-11-17 6:27 UTC (permalink / raw) To: Igor Mammedov, qemu-devel Cc: Greg Kurz, David Gibson, Eduardo Habkost, Paolo Bonzini On 17/11/16 03:02, Igor Mammedov wrote: > This series removes global MAX_CPUMASK_BITS constant > so that it won't inderectly influence maximum CPUs count > supported by different targets. > > It replaces statically allocated bitmasks with dynamically > allocated ones using '-smp maxcpus' value for setting > bitmasks size. > That would allocate just enough memory to handle all > CPUs indexes that a QEMU instance would ever have. > > CC: Alexey Kardashevskiy <aik@ozlabs.ru> > CC: Greg Kurz <gkurz@linux.vnet.ibm.com> > CC: David Gibson <david@gibson.dropbear.id.au> > CC: Eduardo Habkost <ehabkost@redhat.com> > CC: Paolo Bonzini <pbonzini@redhat.com> > > > Igor Mammedov (2): > add bitmap_free() wrapper > numa: make -numa parser dynamically allocate CPUs masks Nice, with "ulimit -n 3072", guest kernel with CONFIG_NR_CPUS=2048, "mc->max_cpus = 2048;" in hw/ppc/spapr.c, and "-smp 2048,threads=8" in QEMU cmdline, I get all 2048 CPUs in the guest. Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru> > > include/qemu/bitmap.h | 5 +++++ > include/sysemu/numa.h | 2 +- > include/sysemu/sysemu.h | 7 ------- > numa.c | 19 ++++++++++++------- > vl.c | 5 ----- > 5 files changed, 18 insertions(+), 20 deletions(-) > -- Alexey ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH RFC 0/2] numa: allocate CPUs masks dynamically 2016-11-17 6:27 ` [Qemu-devel] [PATCH RFC 0/2] numa: allocate CPUs masks dynamically Alexey Kardashevskiy @ 2016-11-21 18:46 ` Greg Kurz 2016-11-22 3:05 ` Alexey Kardashevskiy 0 siblings, 1 reply; 9+ messages in thread From: Greg Kurz @ 2016-11-21 18:46 UTC (permalink / raw) To: Alexey Kardashevskiy Cc: Igor Mammedov, qemu-devel, David Gibson, Eduardo Habkost, Paolo Bonzini On Thu, 17 Nov 2016 17:27:20 +1100 Alexey Kardashevskiy <aik@ozlabs.ru> wrote: > On 17/11/16 03:02, Igor Mammedov wrote: > > This series removes global MAX_CPUMASK_BITS constant > > so that it won't inderectly influence maximum CPUs count > > supported by different targets. > > > > It replaces statically allocated bitmasks with dynamically > > allocated ones using '-smp maxcpus' value for setting > > bitmasks size. > > That would allocate just enough memory to handle all > > CPUs indexes that a QEMU instance would ever have. > > > > CC: Alexey Kardashevskiy <aik@ozlabs.ru> > > CC: Greg Kurz <gkurz@linux.vnet.ibm.com> > > CC: David Gibson <david@gibson.dropbear.id.au> > > CC: Eduardo Habkost <ehabkost@redhat.com> > > CC: Paolo Bonzini <pbonzini@redhat.com> > > > > > > Igor Mammedov (2): > > add bitmap_free() wrapper > > numa: make -numa parser dynamically allocate CPUs masks > > Nice, with "ulimit -n 3072", guest kernel with CONFIG_NR_CPUS=2048, > "mc->max_cpus = 2048;" in hw/ppc/spapr.c, and "-smp 2048,threads=8" in > QEMU cmdline, I get all 2048 CPUs in the guest. > Nice ! And mc->max_cpus in hw/ppc/spapr.c no longer depends on MAX_CPUMASK_BITS since commit 079019f2e319b, so it is already possible to bump that value (1024 ? 2048 ?). Will you send a patch ? > > Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru> > > > > > > include/qemu/bitmap.h | 5 +++++ > > include/sysemu/numa.h | 2 +- > > include/sysemu/sysemu.h | 7 ------- > > numa.c | 19 ++++++++++++------- > > vl.c | 5 ----- > > 5 files changed, 18 insertions(+), 20 deletions(-) > > > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH RFC 0/2] numa: allocate CPUs masks dynamically 2016-11-21 18:46 ` Greg Kurz @ 2016-11-22 3:05 ` Alexey Kardashevskiy 0 siblings, 0 replies; 9+ messages in thread From: Alexey Kardashevskiy @ 2016-11-22 3:05 UTC (permalink / raw) To: Greg Kurz Cc: Igor Mammedov, qemu-devel, David Gibson, Eduardo Habkost, Paolo Bonzini On 22/11/16 05:46, Greg Kurz wrote: > On Thu, 17 Nov 2016 17:27:20 +1100 > Alexey Kardashevskiy <aik@ozlabs.ru> wrote: > >> On 17/11/16 03:02, Igor Mammedov wrote: >>> This series removes global MAX_CPUMASK_BITS constant >>> so that it won't inderectly influence maximum CPUs count >>> supported by different targets. >>> >>> It replaces statically allocated bitmasks with dynamically >>> allocated ones using '-smp maxcpus' value for setting >>> bitmasks size. >>> That would allocate just enough memory to handle all >>> CPUs indexes that a QEMU instance would ever have. >>> >>> CC: Alexey Kardashevskiy <aik@ozlabs.ru> >>> CC: Greg Kurz <gkurz@linux.vnet.ibm.com> >>> CC: David Gibson <david@gibson.dropbear.id.au> >>> CC: Eduardo Habkost <ehabkost@redhat.com> >>> CC: Paolo Bonzini <pbonzini@redhat.com> >>> >>> >>> Igor Mammedov (2): >>> add bitmap_free() wrapper >>> numa: make -numa parser dynamically allocate CPUs masks >> >> Nice, with "ulimit -n 3072", guest kernel with CONFIG_NR_CPUS=2048, >> "mc->max_cpus = 2048;" in hw/ppc/spapr.c, and "-smp 2048,threads=8" in >> QEMU cmdline, I get all 2048 CPUs in the guest. >> > > Nice ! And mc->max_cpus in hw/ppc/spapr.c no longer depends on > MAX_CPUMASK_BITS since commit 079019f2e319b, so it is already > possible to bump that value (1024 ? 2048 ?). > > Will you send a patch ? Sure, when these two hit upstream. > >> >> Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru> >> >> >>> >>> include/qemu/bitmap.h | 5 +++++ >>> include/sysemu/numa.h | 2 +- >>> include/sysemu/sysemu.h | 7 ------- >>> numa.c | 19 ++++++++++++------- >>> vl.c | 5 ----- >>> 5 files changed, 18 insertions(+), 20 deletions(-) >>> >> >> > -- Alexey ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-11-22 3:05 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-11-16 16:02 [Qemu-devel] [PATCH RFC 0/2] numa: allocate CPUs masks dynamically Igor Mammedov 2016-11-16 16:02 ` [Qemu-devel] [PATCH RFC 1/2] add bitmap_free() wrapper Igor Mammedov 2016-11-16 17:05 ` Eduardo Habkost 2016-11-16 16:02 ` [Qemu-devel] [PATCH RFC 2/2] numa: make -numa parser dynamically allocate CPUs masks Igor Mammedov 2016-11-16 17:08 ` Eduardo Habkost 2016-11-18 8:36 ` Igor Mammedov 2016-11-17 6:27 ` [Qemu-devel] [PATCH RFC 0/2] numa: allocate CPUs masks dynamically Alexey Kardashevskiy 2016-11-21 18:46 ` Greg Kurz 2016-11-22 3:05 ` Alexey Kardashevskiy
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).