From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Aneesh Kumar K.V" Date: Tue, 06 May 2014 16:20:30 +0000 Subject: Re: [RFC PATCH] KVM: PPC: BOOK3S: HV: THP support for guest Message-Id: <87ha52ritd.fsf@linux.vnet.ibm.com> List-Id: References: <1399224616-25142-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <5368A78D.4070509@suse.de> <1399368400.18906.9.camel@pasglop> <5368ADE3.1050503@suse.de> <87oazbq73t.fsf@linux.vnet.ibm.com> <5368FE66.5040809@suse.de> In-Reply-To: <5368FE66.5040809@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Alexander Graf Cc: paulus@samba.org, linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org Alexander Graf writes: > On 05/06/2014 05:06 PM, Aneesh Kumar K.V wrote: >> Alexander Graf writes: >> >>> On 05/06/2014 11:26 AM, Benjamin Herrenschmidt wrote: >>>> On Tue, 2014-05-06 at 11:12 +0200, Alexander Graf wrote: >>>> >> ..... >> >> >> I updated the commit message as below. Let me know if this is ok. >> >> KVM: PPC: BOOK3S: HV: THP support for guest > > This has nothing to do with THP. THP support in guest depend on KVM advertising MPSS feature. We already have rest of the changes needed to support transparent huge pages upstream. (We do support THP with PowerVM LPAR already). The primary motivation of this patch is to enable THP in powerkvm guest. > >> >> On recent IBM Power CPUs, while the hashed page table is looked up using >> the page size from the segmentation hardware (i.e. the SLB), it is >> possible to have the HPT entry indicate a larger page size. Thus for >> example it is possible to put a 16MB page in a 64kB segment, but since >> the hash lookup is done using a 64kB page size, it may be necessary to >> put multiple entries in the HPT for a single 16MB page. This >> capability is called mixed page-size segment (MPSS). With MPSS, >> there are two relevant page sizes: the base page size, which is the >> size used in searching the HPT, and the actual page size, which is the >> size indicated in the HPT entry. [ Note that the actual page size is >> always >= base page size ]. >> >> We advertise MPSS feature to guest only if the host CPU supports the >> same. We use "ibm,segment-page-sizes" device tree node to advertise >> the MPSS support. The penc encoding indicate whether we support >> a specific combination of base page size and actual page size >> in the same segment. It is also the value used in the L|LP encoding >> of HPTE entry. >> >> In-order to support MPSS in guest, KVM need to handle the below details >> * advertise MPSS via ibm,segment-page-sizes >> * Decode the base and actual page size correctly from the HPTE entry >> so that we know what we are dealing with in H_ENTER and and can do > > Which code path exactly changes for H_ENTER? There is no real code path changes. Any code path that use hpte_page_size() is impacted. We return actual page size there. > >> the appropriate TLB invalidation in H_REMOVE and evictions. > > Apart from the grammar (which is pretty broken for the part that is not > copied from Paul) and the subject line this sounds quite reasonable. > Wll try to fix. -aneesh From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e28smtp05.in.ibm.com (e28smtp05.in.ibm.com [122.248.162.5]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 840541413EA for ; Wed, 7 May 2014 02:08:39 +1000 (EST) Received: from /spool/local by e28smtp05.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 6 May 2014 21:38:36 +0530 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id B463C3940049 for ; Tue, 6 May 2014 21:38:31 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s46G8d7W61735014 for ; Tue, 6 May 2014 21:38:40 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s46G8VlS010837 for ; Tue, 6 May 2014 21:38:31 +0530 From: "Aneesh Kumar K.V" To: Alexander Graf Subject: Re: [RFC PATCH] KVM: PPC: BOOK3S: HV: THP support for guest In-Reply-To: <5368FE66.5040809@suse.de> References: <1399224616-25142-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <5368A78D.4070509@suse.de> <1399368400.18906.9.camel@pasglop> <5368ADE3.1050503@suse.de> <87oazbq73t.fsf@linux.vnet.ibm.com> <5368FE66.5040809@suse.de> Date: Tue, 06 May 2014 21:38:30 +0530 Message-ID: <87ha52ritd.fsf@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain Cc: paulus@samba.org, linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Alexander Graf writes: > On 05/06/2014 05:06 PM, Aneesh Kumar K.V wrote: >> Alexander Graf writes: >> >>> On 05/06/2014 11:26 AM, Benjamin Herrenschmidt wrote: >>>> On Tue, 2014-05-06 at 11:12 +0200, Alexander Graf wrote: >>>> >> ..... >> >> >> I updated the commit message as below. Let me know if this is ok. >> >> KVM: PPC: BOOK3S: HV: THP support for guest > > This has nothing to do with THP. THP support in guest depend on KVM advertising MPSS feature. We already have rest of the changes needed to support transparent huge pages upstream. (We do support THP with PowerVM LPAR already). The primary motivation of this patch is to enable THP in powerkvm guest. > >> >> On recent IBM Power CPUs, while the hashed page table is looked up using >> the page size from the segmentation hardware (i.e. the SLB), it is >> possible to have the HPT entry indicate a larger page size. Thus for >> example it is possible to put a 16MB page in a 64kB segment, but since >> the hash lookup is done using a 64kB page size, it may be necessary to >> put multiple entries in the HPT for a single 16MB page. This >> capability is called mixed page-size segment (MPSS). With MPSS, >> there are two relevant page sizes: the base page size, which is the >> size used in searching the HPT, and the actual page size, which is the >> size indicated in the HPT entry. [ Note that the actual page size is >> always >= base page size ]. >> >> We advertise MPSS feature to guest only if the host CPU supports the >> same. We use "ibm,segment-page-sizes" device tree node to advertise >> the MPSS support. The penc encoding indicate whether we support >> a specific combination of base page size and actual page size >> in the same segment. It is also the value used in the L|LP encoding >> of HPTE entry. >> >> In-order to support MPSS in guest, KVM need to handle the below details >> * advertise MPSS via ibm,segment-page-sizes >> * Decode the base and actual page size correctly from the HPTE entry >> so that we know what we are dealing with in H_ENTER and and can do > > Which code path exactly changes for H_ENTER? There is no real code path changes. Any code path that use hpte_page_size() is impacted. We return actual page size there. > >> the appropriate TLB invalidation in H_REMOVE and evictions. > > Apart from the grammar (which is pretty broken for the part that is not > copied from Paul) and the subject line this sounds quite reasonable. > Wll try to fix. -aneesh From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Aneesh Kumar K.V" Subject: Re: [RFC PATCH] KVM: PPC: BOOK3S: HV: THP support for guest Date: Tue, 06 May 2014 21:38:30 +0530 Message-ID: <87ha52ritd.fsf@linux.vnet.ibm.com> References: <1399224616-25142-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <5368A78D.4070509@suse.de> <1399368400.18906.9.camel@pasglop> <5368ADE3.1050503@suse.de> <87oazbq73t.fsf@linux.vnet.ibm.com> <5368FE66.5040809@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Cc: paulus@samba.org, linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org To: Alexander Graf Return-path: In-Reply-To: <5368FE66.5040809@suse.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+glppd-linuxppc64-dev=m.gmane.org@lists.ozlabs.org Sender: "Linuxppc-dev" List-Id: kvm.vger.kernel.org QWxleGFuZGVyIEdyYWYgPGFncmFmQHN1c2UuZGU+IHdyaXRlczoKCj4gT24gMDUvMDYvMjAxNCAw NTowNiBQTSwgQW5lZXNoIEt1bWFyIEsuViB3cm90ZToKPj4gQWxleGFuZGVyIEdyYWYgPGFncmFm QHN1c2UuZGU+IHdyaXRlczoKPj4KPj4+IE9uIDA1LzA2LzIwMTQgMTE6MjYgQU0sIEJlbmphbWlu IEhlcnJlbnNjaG1pZHQgd3JvdGU6Cj4+Pj4gT24gVHVlL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