From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/5] ARM: KVM: be more thorough when invalidating TLBs
Date: Wed, 08 May 2013 11:46:25 +0100 [thread overview]
Message-ID: <518A2D01.1070904@arm.com> (raw)
In-Reply-To: <20130502151302.GG20730@arm.com>
On 02/05/13 16:13, Catalin Marinas wrote:
> On Thu, May 02, 2013 at 03:38:58PM +0100, Marc Zyngier wrote:
>> diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S
>> index f7793df..9e2d906c 100644
>> --- a/arch/arm/kvm/interrupts.S
>> +++ b/arch/arm/kvm/interrupts.S
> ...
>> -static void clear_pte_entry(pte_t *pte)
>> +static void clear_pte_entry(struct kvm *kvm, pte_t *pte, phys_addr_t addr)
>> {
>> if (pte_present(*pte)) {
>> kvm_set_pte(pte, __pte(0));
>> put_page(virt_to_page(pte));
>> + kvm_tlb_flush_vmid_ipa(kvm, addr);
>> }
>> }
> ...
>> static void unmap_stage2_range(struct kvm *kvm, phys_addr_t start, u64 size)
>> {
>> - unmap_range(kvm->arch.pgd, start, size);
>> + unmap_range(kvm, kvm->arch.pgd, start, size);
>> }
>>
>> /**
>> @@ -413,6 +425,7 @@ void kvm_free_stage2_pgd(struct kvm *kvm)
>> return;
>>
>> unmap_stage2_range(kvm, 0, KVM_PHYS_SIZE);
>> + kvm_tlb_flush_vmid_ipa(kvm, 0); /* Invalidate TLB ALL */
>
> Do you still need this here if you invalidated each individual pte in
> clear_pte_entry()? I think you can remove it from clear_pte_entry() and
> just leave it here (more efficient probably) since you wouldn't free the
> actual pages pointed at by the pte before unmapping.
There is two cases we're trying to cater for:
- unmapping a single page from stage2 (page being swapped out, for example)
- unmapping the whole of stage2 (VM exiting)
We cannot loose the "local" operations, but the last one can indeed go.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <marc.zyngier@arm.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: "linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"cdall@cs.columbia.edu" <cdall@cs.columbia.edu>
Subject: Re: [PATCH v2 1/5] ARM: KVM: be more thorough when invalidating TLBs
Date: Wed, 08 May 2013 11:46:25 +0100 [thread overview]
Message-ID: <518A2D01.1070904@arm.com> (raw)
In-Reply-To: <20130502151302.GG20730@arm.com>
On 02/05/13 16:13, Catalin Marinas wrote:
> On Thu, May 02, 2013 at 03:38:58PM +0100, Marc Zyngier wrote:
>> diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S
>> index f7793df..9e2d906c 100644
>> --- a/arch/arm/kvm/interrupts.S
>> +++ b/arch/arm/kvm/interrupts.S
> ...
>> -static void clear_pte_entry(pte_t *pte)
>> +static void clear_pte_entry(struct kvm *kvm, pte_t *pte, phys_addr_t addr)
>> {
>> if (pte_present(*pte)) {
>> kvm_set_pte(pte, __pte(0));
>> put_page(virt_to_page(pte));
>> + kvm_tlb_flush_vmid_ipa(kvm, addr);
>> }
>> }
> ...
>> static void unmap_stage2_range(struct kvm *kvm, phys_addr_t start, u64 size)
>> {
>> - unmap_range(kvm->arch.pgd, start, size);
>> + unmap_range(kvm, kvm->arch.pgd, start, size);
>> }
>>
>> /**
>> @@ -413,6 +425,7 @@ void kvm_free_stage2_pgd(struct kvm *kvm)
>> return;
>>
>> unmap_stage2_range(kvm, 0, KVM_PHYS_SIZE);
>> + kvm_tlb_flush_vmid_ipa(kvm, 0); /* Invalidate TLB ALL */
>
> Do you still need this here if you invalidated each individual pte in
> clear_pte_entry()? I think you can remove it from clear_pte_entry() and
> just leave it here (more efficient probably) since you wouldn't free the
> actual pages pointed at by the pte before unmapping.
There is two cases we're trying to cater for:
- unmapping a single page from stage2 (page being swapped out, for example)
- unmapping the whole of stage2 (VM exiting)
We cannot loose the "local" operations, but the last one can indeed go.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
next prev parent reply other threads:[~2013-05-08 10:46 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-02 14:38 [PATCH v2 0/5] ARM: KVM: various mmu related fixes for 3.10 Marc Zyngier
2013-05-02 14:38 ` Marc Zyngier
2013-05-02 14:38 ` [PATCH v2 1/5] ARM: KVM: be more thorough when invalidating TLBs Marc Zyngier
2013-05-02 14:38 ` Marc Zyngier
2013-05-02 15:13 ` Catalin Marinas
2013-05-02 15:13 ` Catalin Marinas
2013-05-08 10:46 ` Marc Zyngier [this message]
2013-05-08 10:46 ` Marc Zyngier
2013-05-02 14:38 ` [PATCH v2 2/5] ARM: KVM: remove dead prototype for __kvm_tlb_flush_vmid Marc Zyngier
2013-05-02 14:38 ` Marc Zyngier
2013-05-02 14:39 ` [PATCH v2 3/5] ARM: KVM: relax cache maintainance when building page tables Marc Zyngier
2013-05-02 14:39 ` Marc Zyngier
2013-05-02 15:00 ` Catalin Marinas
2013-05-02 15:00 ` Catalin Marinas
2013-05-02 15:03 ` Will Deacon
2013-05-02 15:03 ` Will Deacon
2013-05-02 15:15 ` Christoffer Dall
2013-05-02 15:15 ` Christoffer Dall
2013-05-02 15:17 ` Will Deacon
2013-05-02 15:17 ` Will Deacon
2013-05-13 5:17 ` Christoffer Dall
2013-05-13 5:17 ` Christoffer Dall
2013-05-13 8:58 ` Will Deacon
2013-05-13 8:58 ` Will Deacon
2013-05-14 17:05 ` Christoffer Dall
2013-05-14 17:05 ` Christoffer Dall
2013-05-02 14:39 ` [PATCH v2 4/5] ARM: KVM: get rid of S2_PGD_SIZE Marc Zyngier
2013-05-02 14:39 ` Marc Zyngier
2013-05-02 14:39 ` [PATCH v2 5/5] ARM: KVM: use phys_addr_t instead of unsigned long long for HYP PGDs Marc Zyngier
2013-05-02 14:39 ` 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=518A2D01.1070904@arm.com \
--to=marc.zyngier@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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.