* [PATCH v1] softmmu/vl: make default prealloc-threads work w/o -mem-prealloc
@ 2021-03-11 8:59 Denis Plotnikov
2021-03-11 10:31 ` Paolo Bonzini
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Denis Plotnikov @ 2021-03-11 8:59 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, yc-core
Preallocation in memory backends can be specified with either global
QEMU option "-mem-prealloc", or with per-backend property
"prealloc=true". In the latter case, however, the default for the
number of preallocation threads is not set to the number of vcpus, but
remains at 1 instead.
Fix it by setting the "prealloc-threads" sugar property of
"memory-backend" to the number of vcpus unconditionally.
Fixes: ffac16fab3 ("hostmem: introduce "prealloc-threads" property")
Signed-off-by: Denis Plotnikov <den-plotnikov@yandex-team.ru>
---
softmmu/vl.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/softmmu/vl.c b/softmmu/vl.c
index ff488ea3e7db..e392e226a2d3 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2300,14 +2300,17 @@ static void qemu_validate_options(void)
static void qemu_process_sugar_options(void)
{
- if (mem_prealloc) {
- char *val;
+ char *val;
- val = g_strdup_printf("%d",
- (uint32_t) qemu_opt_get_number(qemu_find_opts_singleton("smp-opts"), "cpus", 1));
- object_register_sugar_prop("memory-backend", "prealloc-threads", val,
- false);
- g_free(val);
+ val = g_strdup_printf("%d",
+ (uint32_t) qemu_opt_get_number(
+ qemu_find_opts_singleton("smp-opts"), "cpus", 1));
+
+ object_register_sugar_prop("memory-backend", "prealloc-threads", val,
+ false);
+ g_free(val);
+
+ if (mem_prealloc) {
object_register_sugar_prop("memory-backend", "prealloc", "on", false);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1] softmmu/vl: make default prealloc-threads work w/o -mem-prealloc
2021-03-11 8:59 [PATCH v1] softmmu/vl: make default prealloc-threads work w/o -mem-prealloc Denis Plotnikov
@ 2021-03-11 10:31 ` Paolo Bonzini
2021-05-05 15:31 ` Paolo Bonzini
2021-05-17 14:33 ` Igor Mammedov
2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2021-03-11 10:31 UTC (permalink / raw)
To: Denis Plotnikov, qemu-devel; +Cc: yc-core
On 11/03/21 09:59, Denis Plotnikov wrote:
> Preallocation in memory backends can be specified with either global
> QEMU option "-mem-prealloc", or with per-backend property
> "prealloc=true". In the latter case, however, the default for the
> number of preallocation threads is not set to the number of vcpus, but
> remains at 1 instead.
>
> Fix it by setting the "prealloc-threads" sugar property of
> "memory-backend" to the number of vcpus unconditionally.
>
> Fixes: ffac16fab3 ("hostmem: introduce "prealloc-threads" property")
>
> Signed-off-by: Denis Plotnikov <den-plotnikov@yandex-team.ru>
> ---
> softmmu/vl.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index ff488ea3e7db..e392e226a2d3 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -2300,14 +2300,17 @@ static void qemu_validate_options(void)
>
> static void qemu_process_sugar_options(void)
> {
> - if (mem_prealloc) {
> - char *val;
> + char *val;
>
> - val = g_strdup_printf("%d",
> - (uint32_t) qemu_opt_get_number(qemu_find_opts_singleton("smp-opts"), "cpus", 1));
> - object_register_sugar_prop("memory-backend", "prealloc-threads", val,
> - false);
> - g_free(val);
> + val = g_strdup_printf("%d",
> + (uint32_t) qemu_opt_get_number(
> + qemu_find_opts_singleton("smp-opts"), "cpus", 1));
> +
> + object_register_sugar_prop("memory-backend", "prealloc-threads", val,
> + false);
> + g_free(val);
> +
> + if (mem_prealloc) {
> object_register_sugar_prop("memory-backend", "prealloc", "on", false);
> }
>
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] softmmu/vl: make default prealloc-threads work w/o -mem-prealloc
2021-03-11 8:59 [PATCH v1] softmmu/vl: make default prealloc-threads work w/o -mem-prealloc Denis Plotnikov
2021-03-11 10:31 ` Paolo Bonzini
@ 2021-05-05 15:31 ` Paolo Bonzini
2021-05-17 14:33 ` Igor Mammedov
2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2021-05-05 15:31 UTC (permalink / raw)
To: Denis Plotnikov, qemu-devel; +Cc: yc-core
On 11/03/21 09:59, Denis Plotnikov wrote:
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index ff488ea3e7db..e392e226a2d3 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -2300,14 +2300,17 @@ static void qemu_validate_options(void)
>
> static void qemu_process_sugar_options(void)
> {
> - if (mem_prealloc) {
> - char *val;
> + char *val;
>
> - val = g_strdup_printf("%d",
> - (uint32_t) qemu_opt_get_number(qemu_find_opts_singleton("smp-opts"), "cpus", 1));
> - object_register_sugar_prop("memory-backend", "prealloc-threads", val,
> - false);
> - g_free(val);
> + val = g_strdup_printf("%d",
> + (uint32_t) qemu_opt_get_number(
> + qemu_find_opts_singleton("smp-opts"), "cpus", 1));
> +
> + object_register_sugar_prop("memory-backend", "prealloc-threads", val,
> + false);
> + g_free(val);
> +
> + if (mem_prealloc) {
> object_register_sugar_prop("memory-backend", "prealloc", "on", false);
> }
Hi Denis, this patch breaks make check-qtest-arm:
G_TEST_DBUS_DAEMON=/home/pbonzini/work/upstream/qemu/tests/dbus-vmstate-daemon.sh QTEST_QEMU_IMG=./qemu-img MALLOC_PERTURB_=45 QTEST_QEMU_BINARY=./qemu-system-arm /home/pbonzini/work/upstream/qemu/+bb/tests/qtest/npcm7xx_emc-test --tap -k
# random seed: R02Sac2b21edc4fb48abab9f9723147ddbd5
1..6
# Start of arm tests
# Start of npcm7xx_emc tests
# Start of emc[0] tests
# starting QEMU: exec ./qemu-system-arm -qtest unix:/tmp/qtest-839596.sock -qtest-log /dev/null -chardev socket,path=/tmp/qtest-839596.qmp,id=char0 -mon chardev=char0,mode=control -display none -machine quanta-gsj -accel qtest
qemu-system-arm: Invalid SMP CPUs 1. The min CPUs supported by machine 'quanta-gsj' is 2
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] softmmu/vl: make default prealloc-threads work w/o -mem-prealloc
2021-03-11 8:59 [PATCH v1] softmmu/vl: make default prealloc-threads work w/o -mem-prealloc Denis Plotnikov
2021-03-11 10:31 ` Paolo Bonzini
2021-05-05 15:31 ` Paolo Bonzini
@ 2021-05-17 14:33 ` Igor Mammedov
2 siblings, 0 replies; 4+ messages in thread
From: Igor Mammedov @ 2021-05-17 14:33 UTC (permalink / raw)
To: Denis Plotnikov; +Cc: pbonzini, qemu-devel, yc-core
On Thu, 11 Mar 2021 11:59:18 +0300
Denis Plotnikov <den-plotnikov@yandex-team.ru> wrote:
> Preallocation in memory backends can be specified with either global
> QEMU option "-mem-prealloc", or with per-backend property
> "prealloc=true". In the latter case, however, the default for the
> number of preallocation threads is not set to the number of vcpus, but
> remains at 1 instead.
>
> Fix it by setting the "prealloc-threads" sugar property of
> "memory-backend" to the number of vcpus unconditionally.
well, number of prealloc-threads are policy that should be set by user.
it was kept equal to vcpus for compat reasons with "-mem-prealloc",
for if one goes with supplying memory backends explicitly, one is supposed
to set prealloc-threads explicitly as well if default(==1) doesn't
suit user. It could be equal to #vcpus or be a different numbers
depending on host CPU configuration. That was intent when
commit ffac16fab3 was introduced.
Imagine one has a VM with a lot of VCPUs but not so much of of RAM,
setting prealloc-threads to #VCPUs will be wasting CPU resources
at least.
> Fixes: ffac16fab3 ("hostmem: introduce "prealloc-threads" property")
>
> Signed-off-by: Denis Plotnikov <den-plotnikov@yandex-team.ru>
> ---
> softmmu/vl.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index ff488ea3e7db..e392e226a2d3 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -2300,14 +2300,17 @@ static void qemu_validate_options(void)
>
> static void qemu_process_sugar_options(void)
> {
> - if (mem_prealloc) {
> - char *val;
> + char *val;
>
> - val = g_strdup_printf("%d",
> - (uint32_t) qemu_opt_get_number(qemu_find_opts_singleton("smp-opts"), "cpus", 1));
> - object_register_sugar_prop("memory-backend", "prealloc-threads", val,
> - false);
> - g_free(val);
> + val = g_strdup_printf("%d",
> + (uint32_t) qemu_opt_get_number(
> + qemu_find_opts_singleton("smp-opts"), "cpus", 1));
> +
> + object_register_sugar_prop("memory-backend", "prealloc-threads", val,
> + false);
> + g_free(val);
> +
> + if (mem_prealloc) {
> object_register_sugar_prop("memory-backend", "prealloc", "on", false);
> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-17 14:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-11 8:59 [PATCH v1] softmmu/vl: make default prealloc-threads work w/o -mem-prealloc Denis Plotnikov
2021-03-11 10:31 ` Paolo Bonzini
2021-05-05 15:31 ` Paolo Bonzini
2021-05-17 14:33 ` Igor Mammedov
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).