linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: anshuman.khandual@arm.com, catalin.marinas@arm.com,
	will.deacon@arm.com, mark.rutland@arm.com, yuzhao@google.com
Cc: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] KVM: ARM: Remove pgtable page standard functions from stage-2 page tables
Date: Tue, 12 Mar 2019 11:43:02 +0000	[thread overview]
Message-ID: <3be0b7e0-2ef8-babb-88c9-d229e0fdd220@arm.com> (raw)
In-Reply-To: <2d00c35d-ae10-ba4a-9b34-939fcf2b2f49@arm.com>



On 12/03/2019 11:31, Anshuman Khandual wrote:
> 
> 
> On 03/12/2019 04:07 PM, Suzuki K Poulose wrote:
>> Hi Anshuman,
>>
>> On 12/03/2019 02:19, Anshuman Khandual wrote:
>>> ARM64 standard pgtable functions are going to use pgtable_page_[ctor|dtor]
>>> or pgtable_pmd_page_[ctor|dtor] constructs. At present KVM guest stage-2
>>> PUD|PMD|PTE level page tabe pages are allocated with __get_free_page()
>>> via mmu_memory_cache_alloc() but released with standard pud|pmd_free() or
>>> pte_free_kernel(). These will fail once they start calling into pgtable_
>>> [pmd]_page_dtor() for pages which never originally went through respective
>>> constructor functions. Hence convert all stage-2 page table page release
>>> functions to call buddy directly while freeing pages.
>>>
>>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>>> ---
>>>    arch/arm/include/asm/stage2_pgtable.h   | 4 ++--
>>>    arch/arm64/include/asm/stage2_pgtable.h | 4 ++--
>>>    virt/kvm/arm/mmu.c                      | 2 +-
>>>    3 files changed, 5 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/arch/arm/include/asm/stage2_pgtable.h b/arch/arm/include/asm/stage2_pgtable.h
>>> index de2089501b8b..417a3be00718 100644
>>> --- a/arch/arm/include/asm/stage2_pgtable.h
>>> +++ b/arch/arm/include/asm/stage2_pgtable.h
>>> @@ -32,14 +32,14 @@
>>>    #define stage2_pgd_present(kvm, pgd)        pgd_present(pgd)
>>>    #define stage2_pgd_populate(kvm, pgd, pud)    pgd_populate(NULL, pgd, pud)
>>>    #define stage2_pud_offset(kvm, pgd, address)    pud_offset(pgd, address)
>>> -#define stage2_pud_free(kvm, pud)        pud_free(NULL, pud)
>>> +#define stage2_pud_free(kvm, pud)        free_page((unsigned long)pud)
>>
>> That must be a NOP, as we don't have pud on arm32 (we have 3 level table).
>> The pud_* helpers here all fallback to the generic no-pud helpers.
> Which is the following here for pud_free()
> 
> #define pud_free(mm, x)                         do { } while (0)
> 
> On arm64 its protected by kvm_stage2_has_pud() helper before calling into pud_free().
> In this case even though applicable pud_free() is NOP, it is still misleading. If we
> are sure about page table level will always remain three it can directly have a NOP
> (do/while) in there.
> 

Yes, it is fixed for arm32 and you could have it as do {} while (0), which is
what I meant by NOP. On arm64, we had varied number of levels depending on the
PAGE_SIZE and now due to the dynamic IPA, hence the check.

Cheers
Suzuki


  reply	other threads:[~2019-03-12 11:43 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-14 21:16 [PATCH] arm64: mm: enable per pmd page table lock Yu Zhao
2019-02-18 15:12 ` Will Deacon
2019-02-18 19:49   ` Yu Zhao
2019-02-18 20:48     ` Yu Zhao
2019-02-19  4:09     ` Anshuman Khandual
2019-02-18 23:13 ` [PATCH v2 1/3] arm64: mm: use appropriate ctors for page tables Yu Zhao
2019-02-18 23:13   ` [PATCH v2 2/3] arm64: mm: don't call page table ctors for init_mm Yu Zhao
2019-02-26 15:13     ` Mark Rutland
2019-03-09  3:52       ` Yu Zhao
2019-02-18 23:13   ` [PATCH v2 3/3] arm64: mm: enable per pmd page table lock Yu Zhao
2019-02-19  4:21   ` [PATCH v2 1/3] arm64: mm: use appropriate ctors for page tables Anshuman Khandual
2019-02-19  5:32     ` Yu Zhao
2019-02-19  6:17       ` Anshuman Khandual
2019-02-19 22:28         ` Yu Zhao
2019-02-20 10:27           ` Anshuman Khandual
2019-02-20 12:24             ` Matthew Wilcox
2019-02-20 20:22             ` Yu Zhao
2019-02-20 20:59               ` Matthew Wilcox
2019-02-20  1:34         ` Matthew Wilcox
2019-02-20  3:20           ` Anshuman Khandual
2019-02-20 21:03       ` Matthew Wilcox
2019-02-26 15:12   ` Mark Rutland
2019-03-09  4:01     ` Yu Zhao
2019-03-10  1:19   ` [PATCH v3 " Yu Zhao
2019-03-10  1:19     ` [PATCH v3 2/3] arm64: mm: don't call page table ctors for init_mm Yu Zhao
2019-03-10  1:19     ` [PATCH v3 3/3] arm64: mm: enable per pmd page table lock Yu Zhao
2019-03-11  8:28       ` Anshuman Khandual
2019-03-11 23:10         ` Yu Zhao
2019-03-11 12:12       ` Mark Rutland
2019-03-11 12:57         ` Anshuman Khandual
2019-03-11 23:11         ` Yu Zhao
2019-03-11  7:45     ` [PATCH v3 1/3] arm64: mm: use appropriate ctors for page tables Anshuman Khandual
2019-03-11 23:23       ` Yu Zhao
2019-03-12  0:57     ` [PATCH v4 1/4] " Yu Zhao
2019-03-12  0:57       ` [PATCH v4 2/4] arm64: mm: don't call page table ctors for init_mm Yu Zhao
2019-03-12  0:57       ` [PATCH v4 3/4] arm64: mm: call ctor for stage2 pmd page Yu Zhao
2019-03-12  2:19         ` [PATCH] KVM: ARM: Remove pgtable page standard functions from stage-2 page tables Anshuman Khandual
2019-03-12  2:40           ` Yu Zhao
2019-03-12 10:37           ` Suzuki K Poulose
2019-03-12 11:31             ` Anshuman Khandual
2019-03-12 11:43               ` Suzuki K Poulose [this message]
2019-03-12 13:25                 ` [PATCH V2] " Anshuman Khandual
2019-04-01 16:16                   ` Will Deacon
2019-04-01 18:34                     ` Yu Zhao
2019-04-02  9:03                       ` Will Deacon
2019-04-08 14:22                         ` Will Deacon
2019-04-08 17:18                           ` Yu Zhao
2019-04-08  9:09                     ` Marc Zyngier
2019-03-12  0:57       ` [PATCH v4 4/4] arm64: mm: enable per pmd page table lock Yu Zhao
2019-02-19  3:08 ` [PATCH] " Anshuman Khandual

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=3be0b7e0-2ef8-babb-88c9-d229e0fdd220@arm.com \
    --to=suzuki.poulose@arm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=mark.rutland@arm.com \
    --cc=will.deacon@arm.com \
    --cc=yuzhao@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox