From: Igor Mammedov <imammedo@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: pasic@linux.ibm.com, pbonzini@redhat.com, philmd@redhat.com,
qemu-devel@nongnu.org, ehabkost@redhat.com
Subject: Re: [PATCH v4 03/80] machine: alias -mem-path and -mem-prealloc into memory-foo backend
Date: Mon, 3 Feb 2020 10:27:20 +0100 [thread overview]
Message-ID: <20200203102720.6de2374e@redhat.com> (raw)
In-Reply-To: <20200203040204-mutt-send-email-mst@kernel.org>
On Mon, 3 Feb 2020 04:04:15 -0500
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> On Fri, Jan 31, 2020 at 04:08:33PM +0100, Igor Mammedov wrote:
> > Allow machine to opt in for hostmem backend based initial RAM
> > even if user uses old -mem-path/prealloc options by providing
> > MachineClass::default_ram_id
> > Follow up patches will incrementally convert machines to new API,
> > by dropping memory_region_allocate_system_memory() and setting
> > default_ram_id that board used to use before conversion to keep
> > migration stream the same.
> >
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
>
> What about non-versioned machines though?
> Why do these need to set default_ram_id?
> Seems redundant as they don't need to support cross-version
> migration ...
They need at least some id for migration to work,
so this series reuses id that they are using today.
Basically default_ram_id is a means to optin into hostmem
based allocation with (-m).
>
> > ---
> > v3:
> > * rename "ram-memdev" property to "memory-backend"
> > (Paolo Bonzini <pbonzini@redhat.com>)
> > v4:
> > * previous patch changed memory-backend property from link
> > to string to allow for delayed backend creation, when
> > backend comes explicitly from CLI.
> > So s/object_property_set_link()/object_property_set_str()/
> > to account for that.
> >
> > CC: ehabkost@redhat.com
> > CC: pbonzini@redhat.com
> > CC: philmd@redhat.com
> > CC: pasic@linux.ibm.com
> > ---
> > include/hw/boards.h | 5 +++++
> > include/sysemu/hostmem.h | 16 ++++++++++++++++
> > backends/hostmem-file.c | 7 -------
> > backends/hostmem-ram.c | 2 --
> > vl.c | 25 +++++++++++++++++++++++++
> > 5 files changed, 46 insertions(+), 9 deletions(-)
> >
> > diff --git a/include/hw/boards.h b/include/hw/boards.h
> > index 7b4b6b7..106de87 100644
> > --- a/include/hw/boards.h
> > +++ b/include/hw/boards.h
> > @@ -170,6 +170,10 @@ typedef struct {
> > * false is returned, an error must be set to show the reason of
> > * the rejection. If the hook is not provided, all hotplug will be
> > * allowed.
> > + * @default_ram_id:
> > + * Specifies inital RAM MemoryRegion name to be used for default backend
> > + * creation if user explicitly hasn't specified backend with "memory-backend"
> > + * property.
> > */
> > struct MachineClass {
> > /*< private >*/
> > @@ -226,6 +230,7 @@ struct MachineClass {
> > bool nvdimm_supported;
> > bool numa_mem_supported;
> > bool auto_enable_numa;
> > + const char *default_ram_id;
> >
> > HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
> > DeviceState *dev);
> > diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h
> > index 4dbdadd..5db0d66 100644
> > --- a/include/sysemu/hostmem.h
> > +++ b/include/sysemu/hostmem.h
> > @@ -27,6 +27,22 @@
> > #define MEMORY_BACKEND_CLASS(klass) \
> > OBJECT_CLASS_CHECK(HostMemoryBackendClass, (klass), TYPE_MEMORY_BACKEND)
> >
> > +/* hostmem-ram.c */
> > +/**
> > + * @TYPE_MEMORY_BACKEND_RAM:
> > + * name of backend that uses mmap on the anonymous RAM
> > + */
> > +
> > +#define TYPE_MEMORY_BACKEND_RAM "memory-backend-ram"
> > +
> > +/* hostmem-file.c */
> > +/**
> > + * @TYPE_MEMORY_BACKEND_FILE:
> > + * name of backend that uses mmap on a file descriptor
> > + */
> > +#define TYPE_MEMORY_BACKEND_FILE "memory-backend-file"
> > +
> > +typedef struct HostMemoryBackend HostMemoryBackend;
> > typedef struct HostMemoryBackendClass HostMemoryBackendClass;
> >
> > /**
> > diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
> > index be64020..cb319a9 100644
> > --- a/backends/hostmem-file.c
> > +++ b/backends/hostmem-file.c
> > @@ -18,13 +18,6 @@
> > #include "sysemu/sysemu.h"
> > #include "qom/object_interfaces.h"
> >
> > -/* hostmem-file.c */
> > -/**
> > - * @TYPE_MEMORY_BACKEND_FILE:
> > - * name of backend that uses mmap on a file descriptor
> > - */
> > -#define TYPE_MEMORY_BACKEND_FILE "memory-backend-file"
> > -
> > #define MEMORY_BACKEND_FILE(obj) \
> > OBJECT_CHECK(HostMemoryBackendFile, (obj), TYPE_MEMORY_BACKEND_FILE)
> >
> > diff --git a/backends/hostmem-ram.c b/backends/hostmem-ram.c
> > index 6aab8d3..5cc53e7 100644
> > --- a/backends/hostmem-ram.c
> > +++ b/backends/hostmem-ram.c
> > @@ -16,8 +16,6 @@
> > #include "qemu/module.h"
> > #include "qom/object_interfaces.h"
> >
> > -#define TYPE_MEMORY_BACKEND_RAM "memory-backend-ram"
> > -
> > static void
> > ram_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
> > {
> > diff --git a/vl.c b/vl.c
> > index 24951b5..2367cb6 100644
> > --- a/vl.c
> > +++ b/vl.c
> > @@ -75,6 +75,7 @@ int main(int argc, char **argv)
> > #include "ui/input.h"
> > #include "sysemu/sysemu.h"
> > #include "sysemu/numa.h"
> > +#include "sysemu/hostmem.h"
> > #include "exec/gdbstub.h"
> > #include "qemu/timer.h"
> > #include "chardev/char.h"
> > @@ -2839,6 +2840,26 @@ static void configure_accelerators(const char *progname)
> > }
> > }
> >
> > +static void create_default_memdev(MachineState *ms, const char *path,
> > + bool prealloc)
> > +{
> > + Object *obj;
> > + MachineClass *mc = MACHINE_GET_CLASS(ms);
> > +
> > + obj = object_new(path ? TYPE_MEMORY_BACKEND_FILE : TYPE_MEMORY_BACKEND_RAM);
> > + if (path) {
> > + object_property_set_str(obj, path, "mem-path", &error_fatal);
> > + }
> > + object_property_set_bool(obj, prealloc, "prealloc", &error_fatal);
> > + object_property_set_int(obj, ms->ram_size, "size", &error_fatal);
> > + object_property_add_child(object_get_objects_root(), mc->default_ram_id,
> > + obj, &error_fatal);
> > + user_creatable_complete(USER_CREATABLE(obj), &error_fatal);
> > + object_unref(obj);
> > + object_property_set_str(OBJECT(ms), mc->default_ram_id, "memory-backend",
> > + &error_fatal);
> > +}
> > +
> > int main(int argc, char **argv, char **envp)
> > {
> > int i;
> > @@ -4302,6 +4323,10 @@ int main(int argc, char **argv, char **envp)
> > }
> > parse_numa_opts(current_machine);
> >
> > + if (machine_class->default_ram_id && current_machine->ram_size &&
> > + !current_machine->ram_memdev_id) {
> > + create_default_memdev(current_machine, mem_path, mem_prealloc);
> > + }
> > /* do monitor/qmp handling at preconfig state if requested */
> > main_loop();
>
> So this check for default_ram_id will become redundant after the
> patchset is fully applied, this is just for bisect to work well, right?
> I couldn't find patches that drop this check though.
there was a patch to that effect in earlier versions,
but I dropped it for following reasons (from cover letter):
"
v3:
[...]
- drop "[PATCH v2 76/86] post conversion default_ram_id cleanup"
so that default memory-backedend won't be created for boards that do not care
about -m. Which makes -m optin feature. We should decide what do in case
board doesn't use -m (but that's out of scope of this series)
[...]
"
>
> > --
> > 2.7.4
> >
> >
>
next prev parent reply other threads:[~2020-02-03 9:28 UTC|newest]
Thread overview: 102+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-31 15:08 [PATCH v4 00/80] refactor main RAM allocation to use hostmem backend Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 01/80] numa: remove deprecated -mem-path fallback to anonymous RAM Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 02/80] machine: introduce memory-backend property Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 03/80] machine: alias -mem-path and -mem-prealloc into memory-foo backend Igor Mammedov
2020-02-03 9:04 ` Michael S. Tsirkin
2020-02-03 9:27 ` Igor Mammedov [this message]
2020-02-03 9:42 ` Michael S. Tsirkin
2020-02-03 10:40 ` Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 04/80] machine: introduce convenience MachineState::ram Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 05/80] initialize MachineState::ram in NUMA case Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 06/80] vl.c: move -m parsing after memory backends has been processed Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 07/80] vl.c: ensure that ram_size matches size of machine.memory-backend Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 08/80] alpha/dp264: use memdev for RAM Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 09/80] arm/aspeed: actually check RAM size Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 10/80] arm/aspeed: use memdev for RAM Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 11/80] arm/collie: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 12/80] arm/cubieboard: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 13/80] arm/digic_boards: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 14/80] arm/highbank: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 15/80] arm/imx25_pdk: drop RAM size fixup Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 16/80] arm/imx25_pdk: use memdev for RAM Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 17/80] arm/integratorcp: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 18/80] arm/kzm: drop RAM size fixup Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 19/80] arm/kzm: use memdev for RAM Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 20/80] arm/mcimx6ul-evk: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 21/80] arm/mcimx7d-sabre: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 22/80] arm/mps2-tz: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 23/80] arm/mps2: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 24/80] arm/musicpal: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 25/80] arm/nseries: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 26/80] arm/omap_sx1: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 27/80] arm/palm: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 28/80] arm/raspi: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 29/80] arm/sabrelite: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 30/80] arm/sbsa-ref: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 31/80] arm/versatilepb: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 32/80] arm/vexpress: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 33/80] arm/virt: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 34/80] arm/xilinx_zynq: drop RAM size fixup Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 35/80] arm/xilinx_zynq: use memdev for RAM Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 36/80] arm/xlnx-versal-virt: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 37/80] arm/xlnx-zcu102: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 38/80] s390x/s390-virtio-ccw: " Igor Mammedov
2020-02-05 20:11 ` Halil Pasic
2020-02-06 13:15 ` Igor Mammedov
2020-02-10 19:33 ` Halil Pasic
2020-01-31 15:09 ` [PATCH v4 39/80] null-machine: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 40/80] cris/axis_dev88: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 41/80] hppa: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 42/80] x86/microvm: " Igor Mammedov
2020-02-03 8:58 ` Michael S. Tsirkin
2020-01-31 15:09 ` [PATCH v4 43/80] x86/pc: " Igor Mammedov
2020-02-03 9:07 ` Michael S. Tsirkin
2020-02-03 9:45 ` Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 44/80] lm32/lm32_boards: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 45/80] lm32/milkymist: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 46/80] m68k/an5206: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 47/80] m68k/q800: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 48/80] m68k/mcf5208: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 49/80] m68k/next-cube: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 50/80] mips/boston: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 51/80] mips/mips_fulong2e: drop RAM size fixup Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 52/80] mips/mips_fulong2e: use memdev for RAM Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 53/80] mips/mips_jazz: " Igor Mammedov
2020-02-09 16:41 ` Philippe Mathieu-Daudé
2020-02-10 15:06 ` [PATCH v5 81/80] mips/mips_jazz: add max ram size check Igor Mammedov
2020-02-10 17:04 ` Philippe Mathieu-Daudé
2020-01-31 15:09 ` [PATCH v4 54/80] mips/mips_malta: use memdev for RAM Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 55/80] mips/mips_mipssim: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 56/80] mips/mips_r4k: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 57/80] ppc/e500: drop RAM size fixup Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 58/80] ppc/e500: use memdev for RAM Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 59/80] ppc/mac_newworld: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 60/80] ppc/mac_oldworld: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 61/80] ppc/pnv: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 62/80] ppc/ppc405_boards: add RAM size checks Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 63/80] ppc/ppc405_boards: use memdev for RAM Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 64/80] ppc/{ppc440_bamboo, sam460ex}: drop RAM size fixup Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 65/80] ppc/{ppc440_bamboo, sam460ex}: use memdev for RAM Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 66/80] ppc/prep: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 67/80] ppc/spapr: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 68/80] ppc/virtex_ml507: remove unused arguments Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 69/80] ppc/virtex_ml507: use memdev for RAM Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 70/80] sparc/leon3: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 71/80] sparc/sun4m: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 72/80] sparc/niagara: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 73/80] remove no longer used memory_region_allocate_system_memory() Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 74/80] exec: cleanup qemu_minrampagesize()/qemu_maxrampagesize() Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 75/80] exec: drop bogus mem_path from qemu_ram_alloc_from_fd() Igor Mammedov
2020-02-07 14:42 ` Marc-André Lureau
2020-01-31 15:09 ` [PATCH v4 76/80] make mem_path local variable Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 77/80] hostmem: introduce "prealloc-threads" property Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 78/80] hostmem: fix strict bind policy Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 79/80] tests/numa-test: make top level args dynamic and g_autofree(cli) cleanups Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 80/80] tests:numa-test: use explicit memdev to specify node RAM Igor Mammedov
2020-01-31 16:16 ` [PATCH v4 00/80] refactor main RAM allocation to use hostmem backend no-reply
2020-01-31 16:28 ` no-reply
2020-02-03 9:49 ` Igor Mammedov
2020-02-04 15:08 ` Igor Mammedov
2020-02-04 15:39 ` Igor Mammedov
2020-02-04 22:05 ` Paolo Bonzini
2020-02-05 13:20 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200203102720.6de2374e@redhat.com \
--to=imammedo@redhat.com \
--cc=ehabkost@redhat.com \
--cc=mst@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).