From: Thomas Huth Subject: Re: [PATCH] KVM: s390: Add MEMOP ioctls for reading/writing guest memory Date: Thu, 19 Feb 2015 10:53:56 +0100 Message-ID: <20150219105356.797e4059@oc7435384737.ibm.com> References: <1424089001-13876-1-git-send-email-thuth@linux.vnet.ibm.com> <20150219104729.5db2d2d1.cornelia.huck@de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org, pbonzini@redhat.com, agraf@suse.de, borntraeger@de.ibm.com To: Cornelia Huck Return-path: Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:36553 "EHLO e06smtp17.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752752AbbBSJyE (ORCPT ); Thu, 19 Feb 2015 04:54:04 -0500 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 19 Feb 2015 09:54:02 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id A865C1B08061 for ; Thu, 19 Feb 2015 09:54:12 +0000 (GMT) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t1J9rxGI10813854 for ; Thu, 19 Feb 2015 09:53:59 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t1J9rv5x005049 for ; Thu, 19 Feb 2015 02:53:59 -0700 In-Reply-To: <20150219104729.5db2d2d1.cornelia.huck@de.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, 19 Feb 2015 10:47:29 +0100 Cornelia Huck wrote: > On Mon, 16 Feb 2015 13:16:41 +0100 > Thomas Huth wrote: > > > On s390, we've got to make sure to hold the IPTE lock while accessing > > logical memory. So let's add an ioctl for reading and writing logical > > memory to provide this feature for userspace, too. > > > > Signed-off-by: Thomas Huth > > --- > > Documentation/virtual/kvm/api.txt | 45 +++++++++++++++++++++++ > > arch/s390/kvm/gaccess.c | 22 +++++++++++ > > arch/s390/kvm/gaccess.h | 2 + > > arch/s390/kvm/kvm-s390.c | 70 +++++++++++++++++++++++++++++++++++++ > > include/uapi/linux/kvm.h | 20 ++++++++++ > > 5 files changed, 159 insertions(+), 0 deletions(-) > > Looks good, except for one minor thing: > > > +static long kvm_s390_guest_mem_op(struct kvm_vcpu *vcpu, > > + struct kvm_s390_mem_op *mop) > > +{ > > + void __user *uaddr = (void __user *)mop->buf; > > + void *tmpbuf = NULL; > > + int r, srcu_idx; > > + const u64 supported_flags = KVM_S390_MEMOP_F_INJECT_EXCEPTION > > + | KVM_S390_MEMOP_F_CHECK_ONLY; > > + > > + if (mop->flags & ~supported_flags) > > + return -EINVAL; > > + > > + if (mop->size > 16 * PAGE_SIZE) > > + return -E2BIG; > > Do you want to document this limit? Or make it discoverable by having > the capability check return the number of pages? I like the idea with the capability ... I think I'll add that feature. Thomas