From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Matthew Wilcox <willy@infradead.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
x86@kernel.org, Kees Cook <keescook@chromium.org>,
Sri Krishna chowdary <schowdary@nvidia.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
Anshuman Khandual <anshuman.khandual@arm.com>,
Dave Hansen <dave.hansen@intel.com>,
linux-kernel@vger.kernel.org, Steven Price <Steven.Price@arm.com>,
linux-mm@kvack.org,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Mark Brown <Mark.Brown@arm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@kernel.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC] mm/pgtable/debug: Add test validating architecture page table helpers
Date: Thu, 25 Jul 2019 22:38:58 +0100 [thread overview]
Message-ID: <20190725213858.GK1330@shell.armlinux.org.uk> (raw)
In-Reply-To: <20190725143920.GW363@bombadil.infradead.org>
On Thu, Jul 25, 2019 at 07:39:21AM -0700, Matthew Wilcox wrote:
> On Thu, Jul 25, 2019 at 12:25:23PM +0530, Anshuman Khandual wrote:
> > This adds a test module which will validate architecture page table helpers
> > and accessors regarding compliance with generic MM semantics expectations.
> > This will help various architectures in validating changes to the existing
> > page table helpers or addition of new ones.
>
> I think this is a really good idea.
>
> > lib/Kconfig.debug | 14 +++
> > lib/Makefile | 1 +
> > lib/test_arch_pgtable.c | 290 ++++++++++++++++++++++++++++++++++++++++++++++++
>
> Is this the right place for it? I worry that lib/ is going to get overloaded
> with test code, and this feels more like mm/ test code.
>
> > +#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE
> > +static void pmd_basic_tests(void)
> > +{
> > + pmd_t pmd;
> > +
> > + pmd = mk_pmd(page, prot);
>
> But 'page' isn't necessarily PMD-aligned. I don't think we can rely on
> architectures doing the right thing if asked to make a PMD for a randomly
> aligned page.
>
> How about finding the physical address of something like kernel_init(),
> and using the corresponding pte/pmd/pud/p4d/pgd that encompasses that
> address? It's also better to pass in the pfn/page rather than using global
> variables to communicate to the test functions.
There are architectures (32-bit ARM) where the kernel is mapped using
section mappings, and we don't expect the Linux page table walking to
work for section mappings.
> > + /*
> > + * A huge page does not point to next level page table
> > + * entry. Hence this must qualify as pmd_bad().
> > + */
> > + WARN_ON(!pmd_bad(pmd_mkhuge(pmd)));
>
> I didn't know that rule. This is helpful because it gives us somewhere
> to document all these tricksy little rules.
>
> > +#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
> > +static void pud_basic_tests(void)
>
> Is this the right ifdef?
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Matthew Wilcox <willy@infradead.org>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Kees Cook <keescook@chromium.org>,
Sri Krishna chowdary <schowdary@nvidia.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
x86@kernel.org, Dave Hansen <dave.hansen@intel.com>,
linux-kernel@vger.kernel.org, Steven Price <Steven.Price@arm.com>,
linux-mm@kvack.org, Mark Brown <Mark.Brown@arm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@kernel.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC] mm/pgtable/debug: Add test validating architecture page table helpers
Date: Thu, 25 Jul 2019 22:38:58 +0100 [thread overview]
Message-ID: <20190725213858.GK1330@shell.armlinux.org.uk> (raw)
In-Reply-To: <20190725143920.GW363@bombadil.infradead.org>
On Thu, Jul 25, 2019 at 07:39:21AM -0700, Matthew Wilcox wrote:
> On Thu, Jul 25, 2019 at 12:25:23PM +0530, Anshuman Khandual wrote:
> > This adds a test module which will validate architecture page table helpers
> > and accessors regarding compliance with generic MM semantics expectations.
> > This will help various architectures in validating changes to the existing
> > page table helpers or addition of new ones.
>
> I think this is a really good idea.
>
> > lib/Kconfig.debug | 14 +++
> > lib/Makefile | 1 +
> > lib/test_arch_pgtable.c | 290 ++++++++++++++++++++++++++++++++++++++++++++++++
>
> Is this the right place for it? I worry that lib/ is going to get overloaded
> with test code, and this feels more like mm/ test code.
>
> > +#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE
> > +static void pmd_basic_tests(void)
> > +{
> > + pmd_t pmd;
> > +
> > + pmd = mk_pmd(page, prot);
>
> But 'page' isn't necessarily PMD-aligned. I don't think we can rely on
> architectures doing the right thing if asked to make a PMD for a randomly
> aligned page.
>
> How about finding the physical address of something like kernel_init(),
> and using the corresponding pte/pmd/pud/p4d/pgd that encompasses that
> address? It's also better to pass in the pfn/page rather than using global
> variables to communicate to the test functions.
There are architectures (32-bit ARM) where the kernel is mapped using
section mappings, and we don't expect the Linux page table walking to
work for section mappings.
> > + /*
> > + * A huge page does not point to next level page table
> > + * entry. Hence this must qualify as pmd_bad().
> > + */
> > + WARN_ON(!pmd_bad(pmd_mkhuge(pmd)));
>
> I didn't know that rule. This is helpful because it gives us somewhere
> to document all these tricksy little rules.
>
> > +#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
> > +static void pud_basic_tests(void)
>
> Is this the right ifdef?
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
next prev parent reply other threads:[~2019-07-25 21:39 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-25 6:55 [RFC] mm/debug: Add tests for architecture exported page table helpers Anshuman Khandual
2019-07-25 6:55 ` Anshuman Khandual
2019-07-25 6:55 ` [RFC] mm/pgtable/debug: Add test validating architecture " Anshuman Khandual
2019-07-25 6:55 ` Anshuman Khandual
2019-07-25 14:39 ` Matthew Wilcox
2019-07-25 14:39 ` Matthew Wilcox
2019-07-25 21:38 ` Russell King - ARM Linux admin [this message]
2019-07-25 21:38 ` Russell King - ARM Linux admin
2019-07-25 21:42 ` Matthew Wilcox
2019-07-25 21:42 ` Matthew Wilcox
2019-07-25 21:58 ` Russell King - ARM Linux admin
2019-07-25 21:58 ` Russell King - ARM Linux admin
2019-07-25 22:56 ` Matthew Wilcox
2019-07-25 22:56 ` Matthew Wilcox
2019-07-26 4:47 ` Anshuman Khandual
2019-07-26 4:47 ` Anshuman Khandual
2019-07-26 19:54 ` Matthew Wilcox
2019-07-26 19:54 ` Matthew Wilcox
2019-07-29 8:32 ` Anshuman Khandual
2019-07-29 8:32 ` Anshuman Khandual
2019-07-30 17:03 ` Matthew Wilcox
2019-07-30 17:03 ` Matthew Wilcox
2019-08-05 4:35 ` Anshuman Khandual
2019-08-05 4:35 ` Anshuman Khandual
2019-07-25 17:07 ` Catalin Marinas
2019-07-25 17:07 ` Catalin Marinas
2019-07-26 4:28 ` Anshuman Khandual
2019-07-26 4:28 ` Anshuman Khandual
2019-07-25 21:54 ` Russell King - ARM Linux admin
2019-07-25 21:54 ` Russell King - ARM Linux admin
2019-07-26 5:10 ` Anshuman Khandual
2019-07-26 5:10 ` 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=20190725213858.GK1330@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=Mark.Brown@arm.com \
--cc=Steven.Price@arm.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=ard.biesheuvel@linaro.org \
--cc=dave.hansen@intel.com \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mark.rutland@arm.com \
--cc=mhocko@kernel.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=schowdary@nvidia.com \
--cc=willy@infradead.org \
--cc=x86@kernel.org \
--cc=yamada.masahiro@socionext.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.