From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Otte Subject: Re: [patch 07/11] [PATCH] kvm-s390-ucontrol: interface to inject faults on a vcpu page table Date: Wed, 04 Jan 2012 17:09:43 +0100 Message-ID: <4F0479C7.4060500@de.ibm.com> References: <20120104092519.060746143@de.ibm.com> <20120104093602.530415566@de.ibm.com> <4F0467BE.8010908@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tossati , borntrae@linux.vnet.ibm.com, heicars2@linux.vnet.ibm.com, mschwid2@linux.vnet.ibm.com, huckc@linux.vnet.ibm.com, KVM , Joachim von Buttlar , Jens Freimann , agraf@suse.de To: Avi Kivity Return-path: Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:43287 "EHLO e06smtp10.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754584Ab2ADQKK (ORCPT ); Wed, 4 Jan 2012 11:10:10 -0500 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Jan 2012 16:10:09 -0000 Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by d06nrmr1407.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q04GA7Q71958098 for ; Wed, 4 Jan 2012 16:10:07 GMT Received: from d06av01.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q04GA6G4010787 for ; Wed, 4 Jan 2012 09:10:07 -0700 In-Reply-To: <4F0467BE.8010908@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 04.01.2012 15:52, Avi Kivity wrote: > On 01/04/2012 11:25 AM, Carsten Otte wrote: >> 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. > > There is an alternative, if you can recognize this condition exactly > from the hardware fault, you can fault the lowcore yourself and retry. > This eliminates a user interface. Is this workable? The situation is very easy to detect, SIE won't start and it'll tell us in the intercept info (processed in userspace in case of ucontrol) that the lowcore is not mapped in. Now userspace can a) create a mapping of a guest to user space for the vcpu using KVM_S390_UCAS_MAP which will create an invalid segment table entry (pmd), and b) touch the page to make the pte for it valid in user space, but it cannot create a segment table entry (pmd) on the guest table that points to the page table that is shared between both spaces. It is an optimization that KVM_S390_UCAS_MAP does'nt create a whole page table right away. If we did that, we'd run out of memory pretty fast once our regression runs simulate a couple of mainframes in parallel with some terabytes of simulated memory each.