linux-snps-arc.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: kirill@shutemov.name (Kirill A. Shutemov)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH] mm/pgtable/debug: Fix test validating architecture page table helpers
Date: Fri, 13 Sep 2019 11:51:35 +0300	[thread overview]
Message-ID: <20190913085135.rfr3zrabghi2qo2t@box> (raw)
In-Reply-To: <bdf7f152-d093-1691-4e96-77da7eb9e20a@arm.com>

On Fri, Sep 13, 2019@02:12:45PM +0530, Anshuman Khandual wrote:
> 
> 
> On 09/13/2019 12:41 PM, Christophe Leroy wrote:
> > 
> > 
> > Le 13/09/2019 ? 09:03, Christophe Leroy a ?crit?:
> >>
> >>
> >> Le 13/09/2019 ? 08:58, Anshuman Khandual a ?crit?:
> >>> On 09/13/2019 11:53 AM, Christophe Leroy wrote:
> >>>> Fix build failure on powerpc.
> >>>>
> >>>> Fix preemption imbalance.
> >>>>
> >>>> Signed-off-by: Christophe Leroy <christophe.leroy at c-s.fr>
> >>>> ---
> >>>> ? mm/arch_pgtable_test.c | 3 +++
> >>>> ? 1 file changed, 3 insertions(+)
> >>>>
> >>>> diff --git a/mm/arch_pgtable_test.c b/mm/arch_pgtable_test.c
> >>>> index 8b4a92756ad8..f2b3c9ec35fa 100644
> >>>> --- a/mm/arch_pgtable_test.c
> >>>> +++ b/mm/arch_pgtable_test.c
> >>>> @@ -24,6 +24,7 @@
> >>>> ? #include <linux/swap.h>
> >>>> ? #include <linux/swapops.h>
> >>>> ? #include <linux/sched/mm.h>
> >>>> +#include <linux/highmem.h>
> >>>
> >>> This is okay.
> >>>
> >>>> ? #include <asm/pgalloc.h>
> >>>> ? #include <asm/pgtable.h>
> >>>> @@ -400,6 +401,8 @@ static int __init arch_pgtable_tests_init(void)
> >>>> ????? p4d_clear_tests(p4dp);
> >>>> ????? pgd_clear_tests(mm, pgdp);
> >>>> +??? pte_unmap(ptep);
> >>>> +
> >>>
> >>> Now the preemption imbalance via pte_alloc_map() path i.e
> >>>
> >>> pte_alloc_map() -> pte_offset_map() -> kmap_atomic()
> >>>
> >>> Is not this very much powerpc 32 specific or this will be applicable
> >>> for all platform which uses kmap_XXX() to map high memory ?
> >>>
> >>
> >> See https://elixir.bootlin.com/linux/v5.3-rc8/source/include/linux/highmem.h#L91
> >>
> >> I think it applies at least to all arches using the generic implementation.
> >>
> >> Applies also to arm:
> >> https://elixir.bootlin.com/linux/v5.3-rc8/source/arch/arm/mm/highmem.c#L52
> >>
> >> Applies also to mips:
> >> https://elixir.bootlin.com/linux/v5.3-rc8/source/arch/mips/mm/highmem.c#L47
> >>
> >> Same on sparc:
> >> https://elixir.bootlin.com/linux/v5.3-rc8/source/arch/sparc/mm/highmem.c#L52
> >>
> >> Same on x86:
> >> https://elixir.bootlin.com/linux/v5.3-rc8/source/arch/x86/mm/highmem_32.c#L34
> >>
> >> I have not checked others, but I guess it is like that for all.
> >>
> > 
> > 
> > Seems like I answered too quickly. All kmap_atomic() do preempt_disable(), but not all pte_alloc_map() call kmap_atomic().
> > 
> > However, for instance ARM does:
> > 
> > https://elixir.bootlin.com/linux/v5.3-rc8/source/arch/arm/include/asm/pgtable.h#L200
> > 
> > And X86 as well:
> > 
> > https://elixir.bootlin.com/linux/v5.3-rc8/source/arch/x86/include/asm/pgtable_32.h#L51
> > 
> > Microblaze also:
> > 
> > https://elixir.bootlin.com/linux/v5.3-rc8/source/arch/microblaze/include/asm/pgtable.h#L495
> 
> All the above platforms checks out to be using k[un]map_atomic(). I am wondering whether
> any of the intermediate levels will have similar problems on any these 32 bit platforms
> or any other platforms which might be using generic k[un]map_atomic().

No. Kernel only allocates pte page table from highmem. All other page
tables are always visible in kernel address space.

-- 
 Kirill A. Shutemov

  reply	other threads:[~2019-09-13  8:51 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-12  6:02 [PATCH V2 0/2] mm/debug: Add tests for architecture exported page table helpers Anshuman Khandual
2019-09-12  6:02 ` [PATCH V2 2/2] mm/pgtable/debug: Add test validating architecture " Anshuman Khandual
2019-09-12 11:00   ` Kirill A. Shutemov
2019-09-12 12:09     ` Anshuman Khandual
2019-09-12 15:00   ` Christophe Leroy
2019-09-12 15:36     ` Christophe Leroy
2019-09-12 15:52       ` Christophe Leroy
2019-09-13  6:30         ` Christophe Leroy
2019-09-12 17:14   ` Christophe Leroy
2019-09-13  6:23     ` [PATCH] mm/pgtable/debug: Fix " Christophe Leroy
2019-09-13  6:58       ` Anshuman Khandual
2019-09-13  7:03         ` Christophe Leroy
2019-09-13  7:11           ` Christophe Leroy
2019-09-13  8:42             ` Anshuman Khandual
2019-09-13  8:51               ` Kirill A. Shutemov [this message]
2019-09-18  7:32       ` Anshuman Khandual
2019-09-19  5:44         ` Christophe Leroy
2019-09-13  9:02     ` [PATCH V2 2/2] mm/pgtable/debug: Add " Anshuman Khandual
2019-09-13  9:13       ` Kirill A. Shutemov
2019-09-13 10:01       ` Christophe Leroy
2019-09-18  5:04         ` Anshuman Khandual
2019-09-18 16:26           ` Christophe Leroy
2019-09-18 18:22             ` Gerald Schaefer
2019-09-20  4:06               ` Anshuman Khandual
2019-09-19  4:56             ` Anshuman Khandual
2019-09-19  5:41               ` Christophe Leroy
2019-09-12 14:42 ` [PATCH V2 0/2] mm/debug: Add tests for architecture exported " Christophe Leroy
2019-09-13  6:24   ` Anshuman Khandual
2019-09-13  6:32     ` Christophe Leroy

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=20190913085135.rfr3zrabghi2qo2t@box \
    --to=kirill@shutemov.name \
    --cc=linux-snps-arc@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).