From: Cornelia Huck Subject: Re: [PATCH] KVM: s390: Add MEMOP ioctls for reading/writing guest memory Date: Thu, 19 Feb 2015 10:47:29 +0100 Message-ID: <20150219104729.5db2d2d1.cornelia.huck@de.ibm.com> References: <1424089001-13876-1-git-send-email-thuth@linux.vnet.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: Thomas Huth Return-path: Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:57944 "EHLO e06smtp10.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752514AbbBSJri (ORCPT ); Thu, 19 Feb 2015 04:47:38 -0500 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 19 Feb 2015 09:47:36 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 9CC2E1B0806B for ; Thu, 19 Feb 2015 09:47:45 +0000 (GMT) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t1J9lWVO5964210 for ; Thu, 19 Feb 2015 09:47:32 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t1J9lVGG029485 for ; Thu, 19 Feb 2015 02:47:32 -0700 In-Reply-To: <1424089001-13876-1-git-send-email-thuth@linux.vnet.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: 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?