[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180315133157.ucbdg25jo5ew3t2h@lakrids.cambridge.arm.com>
Date: Thu, 15 Mar 2018 13:31:58 +0000
From: Mark Rutland <mark.rutland@....com>
To: Chintan Pandya <cpandya@...eaurora.org>
Cc: catalin.marinas@....com, will.deacon@....com, arnd@...db.de,
ard.biesheuvel@...aro.org, marc.zyngier@....com,
james.morse@....com, kristina.martsenko@....com,
takahiro.akashi@...aro.org, gregkh@...uxfoundation.org,
tglx@...utronix.de, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
akpm@...ux-foundation.org, toshi.kani@....com
Subject: Re: [PATCH v2 2/4] ioremap: Implement TLB_INV before huge mapping
On Thu, Mar 15, 2018 at 06:15:04PM +0530, Chintan Pandya wrote:
> @@ -91,10 +93,15 @@ static inline int ioremap_pmd_range(pud_t *pud, unsigned long addr,
>
> if (ioremap_pmd_enabled() &&
> ((next - addr) == PMD_SIZE) &&
> - IS_ALIGNED(phys_addr + addr, PMD_SIZE) &&
> - pmd_free_pte_page(pmd)) {
> - if (pmd_set_huge(pmd, phys_addr + addr, prot))
> + IS_ALIGNED(phys_addr + addr, PMD_SIZE)) {
> + old_pmd = *pmd;
> + pmd_clear(pmd);
> + flush_tlb_pgtable(&init_mm, addr);
> + if (pmd_set_huge(pmd, phys_addr + addr, prot)) {
> + pmd_free_pte_page(&old_pmd);
> continue;
> + } else
> + set_pmd(pmd, old_pmd);
> }
>
Can we have something like a pmd_can_set_huge() helper? Then we could
avoid pointless modification and TLB invalidation work when
pmd_set_huge() will fail.
if (ioremap_pmd_enabled() &&
((next - addr) == PMD_SIZE) &&
IS_ALIGNED(phys_addr + addr, PMD_SIZE) &&
pmd_can_set_huge(pmd, phys_addr + addr, prot)) {
// clear entries, invalidate TLBs, and free tables
...
continue;
}
Thanks,
MArk.
Powered by blists - more mailing lists