From: Carsten Otte <cotte@de.ibm.com>
To: Avi Kivity <avi@redhat.com>, Marcelo Tossati <mtosatti@redhat.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Cornelia Huck <cornelia.huck@de.ibm.com>,
KVM <kvm@vger.kernel.org>,
Joachim von Buttlar <joachim_von_buttlar@de.ibm.com>,
Jens Freimann <jfrei@de.ibm.com>,
agraf@suse.de
Subject: [patch 07/12] [PATCH] kvm-s390-ucontrol: interface to inject faults on a vcpu page table
Date: Wed, 14 Dec 2011 13:23:54 +0100 [thread overview]
Message-ID: <20111214123126.703428041@de.ibm.com> (raw)
In-Reply-To: 20111214122347.275452567@de.ibm.com
[-- Attachment #1: guest-fault-interface.patch --]
[-- Type: text/plain, Size: 2507 bytes --]
This patch allows the user to fault in pages on a virtual cpus
address space for user controlled virtual machines. Typically this
is superfluous because userspace can just create a mapping and
let the kernel's page fault logic take are of it. There is one
exception: SIE won't start if the lowcore is not present. Normally
the kernel takes care of this [handle_validity() in
arch/s390/kvm/intercept.c] but since the kernel does not handle
intercepts for user controlled virtual machines, userspace needs to
be able to handle this condition.
Signed-off-by: Carsten Otte <cotte@de.ibm.com>
---
---
Documentation/virtual/kvm/api.txt | 16 ++++++++++++++++
arch/s390/kvm/kvm-s390.c | 6 ++++++
include/linux/kvm.h | 1 +
3 files changed, 23 insertions(+)
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -1498,6 +1498,22 @@ This ioctl unmaps the memory in the vcpu
"vcpu_addr" with the length "length". The field "user_addr" is ignored.
All parameters need to be alligned by 1 megabyte.
+4.66 KVM_S390_VCPU_FAULT
+
+Capability: KVM_CAP_S390_UCONTROL
+Architectures: s390
+Type: vcpu ioctl
+Parameters: vcpu absolute address (in)
+Returns: 0 in case of success
+
+This call creates a page table entry on the virtual cpu's address space
+(for user controlled virtual machines) or the virtual machine's address
+space (for regular virtual machines). This only works for minor faults,
+thus it's recommended to access subject memory page via the user page
+table upfront. This is useful to handle validity intercepts for user
+controlled virtual machines to fault in the virtual cpu's lowcore pages
+prior to calling the KVM_RUN ioctl.
+
5. The kvm_run structure
Application code obtains a pointer to the kvm_run structure by
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -761,6 +761,12 @@ long kvm_arch_vcpu_ioctl(struct file *fi
break;
}
#endif
+ case KVM_S390_VCPU_FAULT: {
+ r = gmap_fault(arg, vcpu->arch.gmap);
+ if (!IS_ERR_VALUE(r))
+ r = 0;
+ break;
+ }
default:
r = -EINVAL;
}
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -674,6 +674,7 @@ struct kvm_s390_ucas_mapping {
};
#define KVM_S390_UCAS_MAP _IOW(KVMIO, 0x50, struct kvm_s390_ucas_mapping)
#define KVM_S390_UCAS_UNMAP _IOW(KVMIO, 0x51, struct kvm_s390_ucas_mapping)
+#define KVM_S390_VCPU_FAULT _IOW(KVMIO, 0x52, unsigned long)
/* Device model IOC */
#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60)
next prev parent reply other threads:[~2011-12-14 12:31 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-14 12:23 [patch 00/12] Ucontrol patchset V6 Carsten Otte
2011-12-14 12:23 ` [patch 01/12] [PATCH] kvm-s390: add parameter for KVM_CREATE_VM Carsten Otte
2011-12-14 12:23 ` [patch 02/12] [PATCH] kvm-s390-ucontrol: per vcpu address spaces Carsten Otte
2011-12-14 12:23 ` [patch 03/12] [PATCH] kvm-s390-ucontrol: export page faults to user Carsten Otte
2011-12-14 12:23 ` [patch 04/12] [PATCH] kvm-s390-ucontrol: export SIE control block " Carsten Otte
2011-12-14 12:23 ` [patch 05/12] [PATCH] kvm-s390-ucontrol: disable in-kernel handling of SIE intercepts Carsten Otte
2011-12-14 12:23 ` [patch 06/12] [PATCH] kvm-s390-ucontrol: disable in-kernel irq stack Carsten Otte
2011-12-14 12:23 ` Carsten Otte [this message]
2011-12-14 12:23 ` [patch 08/12] [PATCH] kvm-s390-ucontrol: disable sca Carsten Otte
2011-12-14 12:23 ` [patch 09/12] [PATCH] kvm-s390: fix assumption for KVM_MAX_VCPUS Carsten Otte
2011-12-14 12:23 ` [patch 10/12] [PATCH] kvm-s390: storage key interface Carsten Otte
2011-12-15 10:28 ` Carsten Otte
2011-12-15 16:11 ` Heiko Carstens
2011-12-15 16:49 ` Christian Borntraeger
2011-12-15 17:18 ` Heiko Carstens
2011-12-15 17:14 ` Martin Schwidefsky
2011-12-14 12:23 ` [patch 11/12] [PATCH] kvm-s390-ucontrol: announce capability for user controlled vms Carsten Otte
2011-12-14 12:23 ` [patch 12/12] [PATCH] kvm-s390: Fix return code for unknown ioctl numbers Carsten Otte
-- strict thread matches above, loose matches on Subject: below --
2011-12-10 12:35 [patch 00/12] Ucontrol patchset V5 Carsten Otte
2011-12-10 12:35 ` [patch 07/12] [PATCH] kvm-s390-ucontrol: interface to inject faults on a vcpu page table Carsten Otte
2011-12-09 12:49 [patch 00/12] Ucontrol patchset V4 Carsten Otte
2011-12-09 12:49 ` [patch 07/12] [PATCH] kvm-s390-ucontrol: interface to inject faults on a vcpu page table Carsten Otte
2011-12-09 11:23 [patch 00/12] Ucontrol patches V3 Carsten Otte
2011-12-09 11:23 ` [patch 07/12] [PATCH] kvm-s390-ucontrol: interface to inject faults on a vcpu page table Carsten Otte
2011-12-08 9:12 [patch 00/12] Ucontrol patchset V2 Carsten Otte
2011-12-08 9:12 ` [patch 07/12] [PATCH] kvm-s390-ucontrol: interface to inject faults on a vcpu page table Carsten Otte
2011-12-01 12:57 [patch 00/12] User controlled virtual machines Carsten Otte
2011-12-01 12:57 ` [patch 07/12] [PATCH] kvm-s390-ucontrol: interface to inject faults on a vcpu page table Carsten Otte
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=20111214123126.703428041@de.ibm.com \
--to=cotte@de.ibm.com \
--cc=agraf@suse.de \
--cc=avi@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=jfrei@de.ibm.com \
--cc=joachim_von_buttlar@de.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=schwidefsky@de.ibm.com \
/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).