From: Janosch Frank <frankja@linux.ibm.com>
To: qemu-devel@nongnu.org
Cc: borntraeger@de.ibm.com, david@redhat.com, cohuck@redhat.com
Subject: [Qemu-devel] [PATCH v3 2/2] s390x: Enable KVM huge page backing support
Date: Tue, 31 Jul 2018 13:09:08 +0100 [thread overview]
Message-ID: <20180731120908.9202-3-frankja@linux.ibm.com> (raw)
In-Reply-To: <20180731120908.9202-1-frankja@linux.ibm.com>
QEMU has had huge page support for a longer time already, but KVM
memory management under s390x needed some changes to work with huge
backings.
Now that we have support, let's enable it if requested and
available. Otherwise we now properly tell the user if there is no
support and back out instead of failing to run the VM later on.
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
target/s390x/kvm.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
index d923cf4240..f961c3b84a 100644
--- a/target/s390x/kvm.c
+++ b/target/s390x/kvm.c
@@ -34,6 +34,7 @@
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "qemu/timer.h"
+#include "qemu/mmap-alloc.h"
#include "sysemu/sysemu.h"
#include "sysemu/hw_accel.h"
#include "hw/hw.h"
@@ -285,6 +286,20 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
{
MachineClass *mc = MACHINE_GET_CLASS(ms);
+ if (mem_path) {
+ if (qemu_mempath_getpagesize(mem_path) != (1 << 20)) {
+ error_report("Huge page backing with pages > 1M was specified, "
+ "but KVM does not support this memory backing");
+ return -EINVAL;
+
+ }
+ if (kvm_vm_enable_cap(s, KVM_CAP_S390_HPAGE_1M, 0)) {
+ error_report("Huge page backing with 1M pages was specified, "
+ "but KVM does not support this memory backing");
+ return -EINVAL;
+ }
+ }
+
mc->default_cpu_type = S390_CPU_TYPE_NAME("host");
cap_sync_regs = kvm_check_extension(s, KVM_CAP_SYNC_REGS);
cap_async_pf = kvm_check_extension(s, KVM_CAP_ASYNC_PF);
--
2.14.3
next prev parent reply other threads:[~2018-07-31 12:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-31 12:09 [Qemu-devel] [PATCH v3 0/2] s390x: Enable KVM huge page backing support Janosch Frank
2018-07-31 12:09 ` [Qemu-devel] [PATCH v3 1/2] kvm: sync linux headers Janosch Frank
2018-07-31 12:09 ` Janosch Frank [this message]
2018-07-31 13:06 ` [Qemu-devel] [PATCH v3 2/2] s390x: Enable KVM huge page backing support Cornelia Huck
2018-07-31 13:19 ` Janosch Frank
2018-08-01 11:30 ` Thomas Huth
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=20180731120908.9202-3-frankja@linux.ibm.com \
--to=frankja@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@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).