mirror of https://github.com/xemu-project/xemu.git
backends/hostmem: Fix support of memory-backend-memfd in qemu_maxrampagesize()
It is currently not possible yet to use "memory-backend-memfd" on s390x with hugepages enabled. This problem is caused by qemu_maxrampagesize() not taking memory-backend-memfd objects into account yet, so the code in s390_memory_init() fails to enable the huge page support there via s390_set_max_pagesize(). Fix it by generalizing the code, so that it looks at qemu_ram_pagesize(memdev->mr.ram_block) instead of re-trying to get the information from the filesystem. Suggested-by: David Hildenbrand <david@redhat.com> Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2116496 Message-Id: <20220810125720.3849835-2-thuth@redhat.com> Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
d324c21ba0
commit
8be934b70e
|
@ -306,22 +306,12 @@ bool host_memory_backend_is_mapped(HostMemoryBackend *backend)
|
|||
return backend->is_mapped;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
size_t host_memory_backend_pagesize(HostMemoryBackend *memdev)
|
||||
{
|
||||
Object *obj = OBJECT(memdev);
|
||||
char *path = object_property_get_str(obj, "mem-path", NULL);
|
||||
size_t pagesize = qemu_mempath_getpagesize(path);
|
||||
|
||||
g_free(path);
|
||||
size_t pagesize = qemu_ram_pagesize(memdev->mr.ram_block);
|
||||
g_assert(pagesize >= qemu_real_host_page_size());
|
||||
return pagesize;
|
||||
}
|
||||
#else
|
||||
size_t host_memory_backend_pagesize(HostMemoryBackend *memdev)
|
||||
{
|
||||
return qemu_real_host_page_size();
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
host_memory_backend_memory_complete(UserCreatable *uc, Error **errp)
|
||||
|
|
Loading…
Reference in New Issue