[PATCH v9 8/8] KVM: arm64: Add support for creating PUD hugepages at stage 2

2018-10-31 Thread Punit Agrawal
KVM only supports PMD hugepages at stage 2. Now that the various page handling routines are updated, extend the stage 2 fault handling to map in PUD hugepages. Addition of PUD hugepage support enables additional page sizes (e.g., 1G with 4K granule) which can be useful on cores that support mappin

[PATCH v9 5/8] KVM: arm64: Support PUD hugepage in stage2_is_exec()

2018-10-31 Thread Punit Agrawal
In preparation for creating PUD hugepages at stage 2, add support for detecting execute permissions on PUD page table entries. Faults due to lack of execute permissions on page table entries is used to perform i-cache invalidation on first execute. Provide trivial implementations of arm32 helpers

[PATCH v9 4/8] KVM: arm64: Support dirty page tracking for PUD hugepages

2018-10-31 Thread Punit Agrawal
In preparation for creating PUD hugepages at stage 2, add support for write protecting PUD hugepages when they are encountered. Write protecting guest tables is used to track dirty pages when migrating VMs. Also, provide trivial implementations of required kvm_s2pud_* helpers to allow sharing of c

[PATCH v9 7/8] KVM: arm64: Update age handlers to support PUD hugepages

2018-10-31 Thread Punit Agrawal
In preparation for creating larger hugepages at Stage 2, add support to the age handling notifiers for PUD hugepages when encountered. Provide trivial helpers for arm32 to allow sharing code. Signed-off-by: Punit Agrawal Reviewed-by: Suzuki K Poulose Cc: Christoffer Dall Cc: Marc Zyngier Cc:

[PATCH v9 6/8] KVM: arm64: Support handling access faults for PUD hugepages

2018-10-31 Thread Punit Agrawal
In preparation for creating larger hugepages at Stage 2, extend the access fault handling at Stage 2 to support PUD hugepages when encountered. Provide trivial helpers for arm32 to allow sharing of code. Signed-off-by: Punit Agrawal Reviewed-by: Suzuki K Poulose Cc: Christoffer Dall Cc: Marc Z

[PATCH v9 2/8] KVM: arm/arm64: Re-factor setting the Stage 2 entry to exec on fault

2018-10-31 Thread Punit Agrawal
Stage 2 fault handler marks a page as executable if it is handling an execution fault or if it was a permission fault in which case the executable bit needs to be preserved. The logic to decide if the page should be marked executable is duplicated for PMD and PTE entries. To avoid creating another

[PATCH v9 0/8] KVM: Support PUD hugepage at stage 2

2018-10-31 Thread Punit Agrawal
This series is an update to the PUD hugepage support previously posted at [0]. This patchset adds support for PUD hugepages at stage 2 a feature that is useful on cores that have support for large sized TLB mappings (e.g., 1GB for 4K granule). The patches are based on the latest upstream kernel.

[PATCH v9 1/8] KVM: arm/arm64: Share common code in user_mem_abort()

2018-10-31 Thread Punit Agrawal
The code for operations such as marking the pfn as dirty, and dcache/icache maintenance during stage 2 fault handling is duplicated between normal pages and PMD hugepages. Instead of creating another copy of the operations when we introduce PUD hugepages, let's share them across the different page

[PATCH v9 3/8] KVM: arm/arm64: Introduce helpers to manipulate page table entries

2018-10-31 Thread Punit Agrawal
Introduce helpers to abstract architectural handling of the conversion of pfn to page table entries and marking a PMD page table entry as a block entry. The helpers are introduced in preparation for supporting PUD hugepages at stage 2 - which are supported on arm64 but do not exist on arm. Signed

Re: [PATCH v6 18/18] kvm: arm64: Allow tuning the physical address size for VM

2018-10-31 Thread Suzuki K Poulose
Hi Christoffer, On 31/10/18 14:22, Christoffer Dall wrote: On Wed, Sep 26, 2018 at 05:32:54PM +0100, Suzuki K Poulose wrote: Allow specifying the physical address size limit for a new VM via the kvm_type argument for the KVM_CREATE_VM ioctl. This allows us to finalise the stage2 page table as e

Re: [PATCH v8 1/9] KVM: arm/arm64: Ensure only THP is candidate for adjustment

2018-10-31 Thread Punit Agrawal
Punit Agrawal writes: > Christoffer Dall writes: > >> On Mon, Oct 01, 2018 at 04:54:35PM +0100, Punit Agrawal wrote: >>> PageTransCompoundMap() returns true for hugetlbfs and THP >>> hugepages. This behaviour incorrectly leads to stage 2 faults for >>> unsupported hugepage sizes (e.g., 64K hugep

Re: Timekeeping on ARM guests/hosts

2018-10-31 Thread Steven Price
On 11/10/2018 19:40, Miriam Zimmerman wrote: > On Thu, Oct 11, 2018 at 8:21 AM Laszlo Ersek wrote: >> >> On 10/11/18 09:54, Marc Zyngier wrote: >>> Hi Miriam, >>> >>> On Wed, 10 Oct 2018 19:38:47 +0100, >>> Miriam Zimmerman wrote: (oops, sorry for lack of plaintext in the first email. m

Re: [PATCH v2] KVM: arm/arm64: Check memslot bounds before mapping hugepages

2018-10-31 Thread Christoffer Dall
On Wed, Sep 26, 2018 at 05:11:35PM +0200, Lukas Braun wrote: > Userspace can create a memslot with memory backed by (transparent) > hugepages, but with bounds that do not align with hugepages. > In that case, we cannot map the entire region in the guest as hugepages > without exposing additional ho

Re: [PATCH v8 1/9] KVM: arm/arm64: Ensure only THP is candidate for adjustment

2018-10-31 Thread Punit Agrawal
Christoffer Dall writes: > On Mon, Oct 01, 2018 at 04:54:35PM +0100, Punit Agrawal wrote: >> PageTransCompoundMap() returns true for hugetlbfs and THP >> hugepages. This behaviour incorrectly leads to stage 2 faults for >> unsupported hugepage sizes (e.g., 64K hugepage with 4K pages) to be >> tre

Re: [PATCH v8 1/9] KVM: arm/arm64: Ensure only THP is candidate for adjustment

2018-10-31 Thread Christoffer Dall
On Mon, Oct 01, 2018 at 04:54:35PM +0100, Punit Agrawal wrote: > PageTransCompoundMap() returns true for hugetlbfs and THP > hugepages. This behaviour incorrectly leads to stage 2 faults for > unsupported hugepage sizes (e.g., 64K hugepage with 4K pages) to be > treated as THP faults. > > Tighten

Re: [PATCH v6 18/18] kvm: arm64: Allow tuning the physical address size for VM

2018-10-31 Thread Christoffer Dall
On Wed, Sep 26, 2018 at 05:32:54PM +0100, Suzuki K Poulose wrote: > Allow specifying the physical address size limit for a new > VM via the kvm_type argument for the KVM_CREATE_VM ioctl. This > allows us to finalise the stage2 page table as early as possible > and hence perform the right checks on