From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] kvm-s390: userspace access to guest storage keys Date: Mon, 09 May 2011 11:43:04 +0300 Message-ID: <4DC7A918.6050807@redhat.com> References: <4DC3CC83.4080405@de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: KVM list , Christian Borntraeger , Martin Schwidefsky , Jens Freimann To: Carsten Otte Return-path: Received: from mx1.redhat.com ([209.132.183.28]:22362 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752740Ab1EIInK (ORCPT ); Mon, 9 May 2011 04:43:10 -0400 In-Reply-To: <4DC3CC83.4080405@de.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 05/06/2011 01:25 PM, Carsten Otte wrote: > From: Carsten Otte > > This patch gives userspace access to the guest visible storage keys. Three > operations are supported: > KVM_S390_KEYOP_SSKE for setting storage keys, similar to the set storage key > extended (SSKE) instruction. > KVM_S390_KEYOP_ISKE for reading storage key content, similar to the insert > storage key extended (ISKE) instruction. > KVM_s390_KEYOP_RRBE for reading and resetting the page reference bit, similar > to the reset reference bit extended (RRBE) instruction. > Note that all functions take userspace addresses as input, which typically > differ from guest addresses. > > This work was requested by Alex Graf for guest live migration: Different from > x86 the guest's view of dirty and reference information is not stored in the > page table entrys that are part of the guest address space but are stored in > the storage key instead. Thus, the storage key needs to be read, transfered, > and written back on the migration target side. > And not in main memory, either? > Signed-off-by: Carsten Otte > --- > arch/s390/include/asm/kvm_host.h | 4 + > arch/s390/kvm/kvm-s390.c | 149 ++++++++++++++++++++++++++++++++++++++- > include/linux/kvm.h | 7 + Documentation/kvm/api.txt ++++++++++++ > 3 files changed, 157 insertions(+), 3 deletions(-) > > Index: linux-2.6/arch/s390/include/asm/kvm_host.h > =================================================================== > --- linux-2.6.orig/arch/s390/include/asm/kvm_host.h > +++ linux-2.6/arch/s390/include/asm/kvm_host.h > @@ -47,6 +47,10 @@ struct sca_block { > #define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1)) > #define KVM_PAGES_PER_HPAGE(x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE) > > +#define KVM_S390_KEYOP_SSKE 0x01 > +#define KVM_S390_KEYOP_ISKE 0x02 > +#define KVM_S390_KEYOP_RRBE 0x03 kvm_host.h is not exported to userspace. Use asm/kvm.h instead. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.