summaryrefslogtreecommitdiffstats
path: root/backends/hostmem.c
Commit message (Collapse)AuthorAgeFilesLines
* hostmem: Ignore ENOSYS while setting MPOL_DEFAULTPavel Fedin2015-11-231-3/+5
| | | | | | | | | | | | | | | Currently hostmem backend fails if CONFIG_NUMA is enabled in QEMU (the default) but NUMA is not supported by the kernel. This makes it impossible to use ivshmem in such configurations. This patch fixes the problem by ignoring ENOSYS error if policy is set to MPOL_DEFAULT. This way the code behaves in the same way as if CONFIG_NUMA was not defined. qemu will still fail if the user specifies some other policy, so that the user knows it. Signed-off-by: Pavel Fedin <p.fedin@samsung.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* hostmem: Fix qemu_opt_get_bool() crash in host_memory_backend_init()Eduardo Habkost2015-07-221-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | This fixes the following crash, introduced by commit 49d2e648e8087d154d8bf8b91f27c8e05e79d5a6: $ gdb --args qemu-system-x86_64 -machine pc,mem-merge=off -object memory-backend-ram,id=ram-node0,size=1024 [...] Program received signal SIGABRT, Aborted. (gdb) bt #0 0x00007ffff253b8c7 in raise () at /lib64/libc.so.6 #1 0x00007ffff253d52a in abort () at /lib64/libc.so.6 #2 0x00007ffff253446d in __assert_fail_base () at /lib64/libc.so.6 #3 0x00007ffff2534522 in () at /lib64/libc.so.6 #4 0x00005555558bb80a in qemu_opt_get_bool_helper (opts=0x55555621b650, name=name@entry=0x5555558ec922 "mem-merge", defval=defval@entry=true, del=del@entry=false) at qemu/util/qemu-option.c:388 #5 0x00005555558bbb5a in qemu_opt_get_bool (opts=<optimized out>, name=name@entry=0x5555558ec922 "mem-merge", defval=defval@entry=true) at qemu/util/qemu-option.c:398 #6 0x0000555555720a24 in host_memory_backend_init (obj=0x5555562ac970) at qemu/backends/hostmem.c:226 Instead of using qemu_opt_get_bool(), that didn't work with qemu_machine_opts for a long time, we can use the corresponding MachineState fields. Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* Include qapi/qmp/qerror.h exactly where neededMarkus Armbruster2015-06-221-1/+0
| | | | | | | | | In particular, don't include it into headers. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
* qom: Don't pass string table to object_get_enum() functionDaniel P. Berrange2015-06-191-14/+8
| | | | | | | | | | | | | | | Now that properties can be explicitly registered as an enum type, there is no need to pass the string table to the object_get_enum() function. The object property registration already has a pointer to the string table. In changing this method signature, the hostmem backend object has to be converted to use the new enum property registration code, which simplifies it somewhat. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* backends: Fix typename of 'policy' enum property in hostmem objDaniel P. Berrange2015-06-191-1/+1
| | | | | | | | | | The 'policy' property was being registered with a typename of 'str', but it is in fact an enum of the 'HostMemPolicy' type. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* hostmem: Prevent removing an in-use memory backendLin Ma2015-04-011-0/+14
| | | | | | | | | | | | | | | | | | | | showing a memory device whose memdev is removed leads an assert: (qemu) object_add memory-backend-ram,id=ram0,size=128M (qemu) device_add pc-dimm,id=d0,memdev=ram0 (qemu) object_del ram0 (qemu) info memory-devices ** ERROR:qom/object.c:1274:object_get_canonical_path_component:\ assertion failed: (obj->parent != NULL) Aborted The patch prevents removing an in-use mem backend and error out. Signed-off-by: Lin Ma <lma@suse.com> Message-Id: <1427704589-7688-3-git-send-email-lma@suse.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* hostmem: set MPOL_MF_MOVEMichael S. Tsirkin2014-08-201-1/+1
| | | | | | | | | | | | | | | When memory is allocated on a wrong node, MPOL_MF_STRICT doesn't move it - it just fails the allocation. A simple way to reproduce the failure is with mlock=on realtime feature. The code comment actually says: "ensure policy won't be ignored" so setting MPOL_MF_MOVE seems like a better way to do this. Cc: qemu-stable@nongnu.org Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* memory: remove memory_region_destroyPaolo Bonzini2014-08-181-10/+0
| | | | | | | The function is empty after the previous patch, so remove it. Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* hostmem: add properties for NUMA memory policyHu Tao2014-06-191-1/+135
| | | | | | | | | | | Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> [Raise errors on setting properties if !CONFIG_NUMA. Add BUILD_BUG_ON checks. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* hostmem: allow preallocation of any memory regionPaolo Bonzini2014-06-191-0/+42
| | | | | | | | | | | And allow preallocation of file-based memory even without -mem-prealloc. Some care is necessary because -mem-prealloc does not allow disabling preallocation for hostmem-file. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* hostmem: add merge and dump propertiesPaolo Bonzini2014-06-191-1/+83
| | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* hostmem: separate allocation from UserCreatable complete methodHu Tao2014-06-191-0/+20
| | | | | | | | | | | This allows the superclass to set various policies on the memory region that the subclass creates. Drops hostmem-ram's complete method accordingly. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* backend:hostmem: replace hostmemory with host_memoryHu Tao2014-06-191-12/+12
| | | | | | | | ..to keep names consistant. Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* add memdev backend infrastructureIgor Mammedov2014-06-181-0/+97
Provides framework for splitting host RAM allocation/ policies into a separate backend that could be used by devices. Initially only legacy RAM backend is provided, which uses memory_region_init_ram() allocator and compatible with every CLI option that affects memory_region_init_ram(). Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
OpenPOWER on IntegriCloud