All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoffer Dall <christoffer.dall@linaro.org>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH 00/15] arm/arm64: KVM: Merge boot and runtime page tables
Date: Mon, 27 Jun 2016 15:29:23 +0200	[thread overview]
Message-ID: <20160627132923.GH26498@cbox> (raw)
In-Reply-To: <1465297115-13091-1-git-send-email-marc.zyngier@arm.com>

On Tue, Jun 07, 2016 at 11:58:20AM +0100, Marc Zyngier wrote:
> Until now, we've been setting up KVM using two sets of page tables:
> one for the "boot" where we perform the basic MMU setup, and one for
> the runtime.
> 
> Switching between the two was though to be safe, but we've recently
> realized that it is not: it is not enough to ensure that the VA->PA
> mapping is consistent when switching TTBR0_EL2, but we also have to
> ensure that the intermediate translations are the same as well. If the
> TLB can return two different values for intermediate translations,
> we're screwed (TLB conflicts).

Just a clarification: Intermediate Translations here means the
page table levels of translations for a single stage of translation?

Is there a valid reference to the arhictecture specification for this?

Thanks,
-Christoffer


> 
> At that point, the only safe thing to do is to never change TTBR0_EL2,
> which means that we need to make the idmap page part of the runtime
> page tables.
> 
> The series starts with a bit of brain dumping explaining what we're
> trying to do. This might not be useful as a merge candidate, but it
> was useful for me to put this somewhere. It goes on revamping the
> whole notion of HYP VA range, making it runtime patchable. It then
> always merge idmap and runtime page table into one set, leading to
> quite a lot of simplification in the init/teardown code. In the
> process, 32bit KVM gains the ability to teardown the HYP page-tables
> and vectors, which makes kexec a bit closer.
> 
> This has been tested on Seattle, Juno, the FVP model (both v8.0 and
> v8.1), Cubietruck and Midway, and is based on 4.7-rc2.
> 
> Thanks,
> 
> 	M.
> 
> Marc Zyngier (15):
>   arm64: KVM: Merged page tables documentation
>   arm64: KVM: Kill HYP_PAGE_OFFSET
>   arm64: Add ARM64_HYP_OFFSET_LOW capability
>   arm64: KVM: Define HYP offset masks
>   arm64: KVM: Refactor kern_hyp_va/hyp_kern_va to deal with multiple
>     offsets
>   arm/arm64: KVM: Export __hyp_text_start/end symbols
>   arm64: KVM: Runtime detection of lower HYP offset
>   arm/arm64: KVM: Always have merged page tables
>   arm64: KVM: Simplify HYP init/teardown
>   arm/arm64: KVM: Drop boot_pgd
>   arm/arm64: KVM: Kill free_boot_hyp_pgd
>   arm: KVM: Simplify HYP init
>   arm: KVM: Allow hyp teardown
>   arm/arm64: KVM: Prune unused #defines
>   arm/arm64: KVM: Check that IDMAP doesn't intersect with VA range
> 
>  arch/arm/include/asm/kvm_asm.h      |   2 +
>  arch/arm/include/asm/kvm_host.h     |  25 +++-----
>  arch/arm/include/asm/kvm_mmu.h      |  11 ----
>  arch/arm/include/asm/virt.h         |   4 ++
>  arch/arm/kvm/arm.c                  |  20 ++----
>  arch/arm/kvm/init.S                 |  56 ++++++----------
>  arch/arm/kvm/mmu.c                  | 125 ++++++++++++++++--------------------
>  arch/arm64/include/asm/cpufeature.h |   3 +-
>  arch/arm64/include/asm/kvm_host.h   |  17 ++---
>  arch/arm64/include/asm/kvm_hyp.h    |  28 ++++----
>  arch/arm64/include/asm/kvm_mmu.h    | 100 ++++++++++++++++++++++++-----
>  arch/arm64/include/asm/virt.h       |   4 ++
>  arch/arm64/kernel/cpufeature.c      |  19 ++++++
>  arch/arm64/kvm/hyp-init.S           |  61 +++---------------
>  arch/arm64/kvm/hyp/entry.S          |  19 ------
>  arch/arm64/kvm/hyp/hyp-entry.S      |  15 +++++
>  arch/arm64/kvm/reset.c              |  28 --------
>  17 files changed, 240 insertions(+), 297 deletions(-)
> 
> -- 
> 2.1.4
> 

WARNING: multiple messages have this Message-ID (diff)
From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 00/15] arm/arm64: KVM: Merge boot and runtime page tables
Date: Mon, 27 Jun 2016 15:29:23 +0200	[thread overview]
Message-ID: <20160627132923.GH26498@cbox> (raw)
In-Reply-To: <1465297115-13091-1-git-send-email-marc.zyngier@arm.com>

On Tue, Jun 07, 2016 at 11:58:20AM +0100, Marc Zyngier wrote:
> Until now, we've been setting up KVM using two sets of page tables:
> one for the "boot" where we perform the basic MMU setup, and one for
> the runtime.
> 
> Switching between the two was though to be safe, but we've recently
> realized that it is not: it is not enough to ensure that the VA->PA
> mapping is consistent when switching TTBR0_EL2, but we also have to
> ensure that the intermediate translations are the same as well. If the
> TLB can return two different values for intermediate translations,
> we're screwed (TLB conflicts).

Just a clarification: Intermediate Translations here means the
page table levels of translations for a single stage of translation?

Is there a valid reference to the arhictecture specification for this?

Thanks,
-Christoffer


> 
> At that point, the only safe thing to do is to never change TTBR0_EL2,
> which means that we need to make the idmap page part of the runtime
> page tables.
> 
> The series starts with a bit of brain dumping explaining what we're
> trying to do. This might not be useful as a merge candidate, but it
> was useful for me to put this somewhere. It goes on revamping the
> whole notion of HYP VA range, making it runtime patchable. It then
> always merge idmap and runtime page table into one set, leading to
> quite a lot of simplification in the init/teardown code. In the
> process, 32bit KVM gains the ability to teardown the HYP page-tables
> and vectors, which makes kexec a bit closer.
> 
> This has been tested on Seattle, Juno, the FVP model (both v8.0 and
> v8.1), Cubietruck and Midway, and is based on 4.7-rc2.
> 
> Thanks,
> 
> 	M.
> 
> Marc Zyngier (15):
>   arm64: KVM: Merged page tables documentation
>   arm64: KVM: Kill HYP_PAGE_OFFSET
>   arm64: Add ARM64_HYP_OFFSET_LOW capability
>   arm64: KVM: Define HYP offset masks
>   arm64: KVM: Refactor kern_hyp_va/hyp_kern_va to deal with multiple
>     offsets
>   arm/arm64: KVM: Export __hyp_text_start/end symbols
>   arm64: KVM: Runtime detection of lower HYP offset
>   arm/arm64: KVM: Always have merged page tables
>   arm64: KVM: Simplify HYP init/teardown
>   arm/arm64: KVM: Drop boot_pgd
>   arm/arm64: KVM: Kill free_boot_hyp_pgd
>   arm: KVM: Simplify HYP init
>   arm: KVM: Allow hyp teardown
>   arm/arm64: KVM: Prune unused #defines
>   arm/arm64: KVM: Check that IDMAP doesn't intersect with VA range
> 
>  arch/arm/include/asm/kvm_asm.h      |   2 +
>  arch/arm/include/asm/kvm_host.h     |  25 +++-----
>  arch/arm/include/asm/kvm_mmu.h      |  11 ----
>  arch/arm/include/asm/virt.h         |   4 ++
>  arch/arm/kvm/arm.c                  |  20 ++----
>  arch/arm/kvm/init.S                 |  56 ++++++----------
>  arch/arm/kvm/mmu.c                  | 125 ++++++++++++++++--------------------
>  arch/arm64/include/asm/cpufeature.h |   3 +-
>  arch/arm64/include/asm/kvm_host.h   |  17 ++---
>  arch/arm64/include/asm/kvm_hyp.h    |  28 ++++----
>  arch/arm64/include/asm/kvm_mmu.h    | 100 ++++++++++++++++++++++++-----
>  arch/arm64/include/asm/virt.h       |   4 ++
>  arch/arm64/kernel/cpufeature.c      |  19 ++++++
>  arch/arm64/kvm/hyp-init.S           |  61 +++---------------
>  arch/arm64/kvm/hyp/entry.S          |  19 ------
>  arch/arm64/kvm/hyp/hyp-entry.S      |  15 +++++
>  arch/arm64/kvm/reset.c              |  28 --------
>  17 files changed, 240 insertions(+), 297 deletions(-)
> 
> -- 
> 2.1.4
> 

  parent reply	other threads:[~2016-06-27 13:23 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-07 10:58 [PATCH 00/15] arm/arm64: KVM: Merge boot and runtime page tables Marc Zyngier
2016-06-07 10:58 ` Marc Zyngier
2016-06-07 10:58 ` [PATCH 01/15] arm64: KVM: Merged page tables documentation Marc Zyngier
2016-06-07 10:58   ` Marc Zyngier
2016-06-27 13:28   ` Christoffer Dall
2016-06-27 13:28     ` Christoffer Dall
2016-06-27 14:06     ` Marc Zyngier
2016-06-27 14:06       ` Marc Zyngier
2016-06-28 11:46       ` Christoffer Dall
2016-06-28 11:46         ` Christoffer Dall
2016-06-29  9:05         ` Marc Zyngier
2016-06-29  9:05           ` Marc Zyngier
2016-06-07 10:58 ` [PATCH 02/15] arm64: KVM: Kill HYP_PAGE_OFFSET Marc Zyngier
2016-06-07 10:58   ` Marc Zyngier
2016-06-27 13:47   ` Christoffer Dall
2016-06-27 13:47     ` Christoffer Dall
2016-06-27 14:20     ` Marc Zyngier
2016-06-27 14:20       ` Marc Zyngier
2016-06-28 12:03       ` Christoffer Dall
2016-06-28 12:03         ` Christoffer Dall
2016-06-07 10:58 ` [PATCH 03/15] arm64: Add ARM64_HYP_OFFSET_LOW capability Marc Zyngier
2016-06-07 10:58   ` Marc Zyngier
2016-06-07 10:58 ` [PATCH 04/15] arm64: KVM: Define HYP offset masks Marc Zyngier
2016-06-07 10:58   ` Marc Zyngier
2016-06-07 10:58 ` [PATCH 05/15] arm64: KVM: Refactor kern_hyp_va/hyp_kern_va to deal with multiple offsets Marc Zyngier
2016-06-07 10:58   ` Marc Zyngier
2016-06-28 12:42   ` Christoffer Dall
2016-06-28 12:42     ` Christoffer Dall
2016-06-30  9:22     ` Marc Zyngier
2016-06-30  9:22       ` Marc Zyngier
2016-06-30 10:16       ` Marc Zyngier
2016-06-30 10:16         ` Marc Zyngier
2016-06-30 10:26         ` Christoffer Dall
2016-06-30 10:26           ` Christoffer Dall
2016-06-30 10:42         ` Ard Biesheuvel
2016-06-30 10:42           ` Ard Biesheuvel
2016-06-30 11:02           ` Marc Zyngier
2016-06-30 11:02             ` Marc Zyngier
2016-06-30 11:10             ` Ard Biesheuvel
2016-06-30 11:10               ` Ard Biesheuvel
2016-06-30 11:57               ` Marc Zyngier
2016-06-30 11:57                 ` Marc Zyngier
2016-06-07 10:58 ` [PATCH 06/15] arm/arm64: KVM: Export __hyp_text_start/end symbols Marc Zyngier
2016-06-07 10:58   ` Marc Zyngier
2016-06-07 10:58 ` [PATCH 07/15] arm64: KVM: Runtime detection of lower HYP offset Marc Zyngier
2016-06-07 10:58   ` Marc Zyngier
2016-06-07 10:58 ` [PATCH 08/15] arm/arm64: KVM: Always have merged page tables Marc Zyngier
2016-06-07 10:58   ` Marc Zyngier
2016-06-28 21:43   ` Christoffer Dall
2016-06-28 21:43     ` Christoffer Dall
2016-06-30 12:27     ` Marc Zyngier
2016-06-30 12:27       ` Marc Zyngier
2016-06-30 13:28       ` Christoffer Dall
2016-06-30 13:28         ` Christoffer Dall
2016-06-07 10:58 ` [PATCH 09/15] arm64: KVM: Simplify HYP init/teardown Marc Zyngier
2016-06-07 10:58   ` Marc Zyngier
2016-06-28 21:31   ` Christoffer Dall
2016-06-28 21:31     ` Christoffer Dall
2016-06-30 12:10     ` Marc Zyngier
2016-06-30 12:10       ` Marc Zyngier
2016-06-30 13:31       ` Christoffer Dall
2016-06-30 13:31         ` Christoffer Dall
2016-06-07 10:58 ` [PATCH 10/15] arm/arm64: KVM: Drop boot_pgd Marc Zyngier
2016-06-07 10:58   ` Marc Zyngier
2016-06-07 10:58 ` [PATCH 11/15] arm/arm64: KVM: Kill free_boot_hyp_pgd Marc Zyngier
2016-06-07 10:58   ` Marc Zyngier
2016-06-07 10:58 ` [PATCH 12/15] arm: KVM: Simplify HYP init Marc Zyngier
2016-06-07 10:58   ` Marc Zyngier
2016-06-28 21:50   ` Christoffer Dall
2016-06-28 21:50     ` Christoffer Dall
2016-06-30 12:31     ` Marc Zyngier
2016-06-30 12:31       ` Marc Zyngier
2016-06-30 13:32       ` Christoffer Dall
2016-06-30 13:32         ` Christoffer Dall
2016-06-07 10:58 ` [PATCH 13/15] arm: KVM: Allow hyp teardown Marc Zyngier
2016-06-07 10:58   ` Marc Zyngier
2016-06-07 10:58 ` [PATCH 14/15] arm/arm64: KVM: Prune unused #defines Marc Zyngier
2016-06-07 10:58   ` Marc Zyngier
2016-06-07 10:58 ` [PATCH 15/15] arm/arm64: KVM: Check that IDMAP doesn't intersect with VA range Marc Zyngier
2016-06-07 10:58   ` Marc Zyngier
2016-06-28 22:01   ` Christoffer Dall
2016-06-28 22:01     ` Christoffer Dall
2016-06-30 12:51     ` Marc Zyngier
2016-06-30 12:51       ` Marc Zyngier
2016-06-30 13:27       ` Christoffer Dall
2016-06-30 13:27         ` Christoffer Dall
2016-06-27 13:29 ` Christoffer Dall [this message]
2016-06-27 13:29   ` [PATCH 00/15] arm/arm64: KVM: Merge boot and runtime page tables Christoffer Dall
2016-06-27 14:12   ` Marc Zyngier
2016-06-27 14:12     ` Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160627132923.GH26498@cbox \
    --to=christoffer.dall@linaro.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.