RE: [PATCH] toolchain,glibc: Allow ARC big endian glibc builds
Hi Vineet, > -Original Message- > From: Vineet Gupta > Sent: Friday, November 1, 2019 10:04 PM > To: buildr...@busybox.net > Cc: linux-snps-arc@lists.infradead.org; Alexey Brodkin > ; Evgeniy Didin > ; Vineet Gupta > Subject: [PATCH] toolchain,glibc: Allow ARC big endian glibc builds > > Apparently big endian glibc builds just work, if we let the endian > header allow that (which prev was #error). > > So this patch bumps glibc to version which fixes the header (this > hopefully will become arc-2019.09-release) and then enables arceb > in glibc toolchain builds > > Signed-off-by: Vineet Gupta > --- > package/glibc/glibc.mk | 2 +- > toolchain/toolchain-buildroot/Config.in | 3 ++- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/package/glibc/glibc.mk b/package/glibc/glibc.mk > index d46063c5d111..754408881397 100644 > --- a/package/glibc/glibc.mk > +++ b/package/glibc/glibc.mk > @@ -5,7 +5,7 @@ > > > > ifeq ($(BR2_arc),y) > -GLIBC_VERSION = arc-2019.03-release > +GLIBC_VERSION = ec681dddfa99894513c85da7d5d257b60d04f915 > GLIBC_SITE = $(call > github,foss-for-synopsys-dwc-arc-processors,glibc,$(GLIBC_VERSION)) > else ifeq ($(BR2_RISCV_32),y) > GLIBC_VERSION = 06983fe52cfe8e4779035c27e8cc5d2caab31531 > diff --git a/toolchain/toolchain-buildroot/Config.in > b/toolchain/toolchain-buildroot/Config.in > index c0612bf04176..587e097a9c92 100644 > --- a/toolchain/toolchain-buildroot/Config.in > +++ b/toolchain/toolchain-buildroot/Config.in > @@ -48,7 +48,8 @@ config BR2_TOOLCHAIN_BUILDROOT_GLIBC > BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le || \ > BR2_riscv || BR2_sh || BR2_sparc64 || \ > BR2_x86_64 || BR2_microblaze || BR2_nios2 || \ > -(BR2_arcle && BR2_ARC_ATOMIC_EXT) || BR2_csky > +((BR2_arcle || BR2_arceb) && BR2_ARC_ATOMIC_EXT) || \ > +BR2_csky I guess here we may just use "BR2_arc" which is set for both BR2_arcle && BR2_arceb, see https://git.buildroot.org/buildroot/tree/arch/Config.in.arc#n54 -Alexey ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH 07/21] parisc: remove __ioremap
On 29.10.19 07:48, Christoph Hellwig wrote: > __ioremap is always called with the _PAGE_NO_CACHE, so fold the whole > thing and rename it to ioremap. This also allows to remove the special > EISA quirk to force _PAGE_NO_CACHE. > > Signed-off-by: Christoph Hellwig Acked-by: Helge Deller Helge > --- > arch/parisc/include/asm/io.h | 11 +-- > arch/parisc/mm/ioremap.c | 10 -- > 2 files changed, 5 insertions(+), 16 deletions(-) > > diff --git a/arch/parisc/include/asm/io.h b/arch/parisc/include/asm/io.h > index 93d37010b375..46212b52c23e 100644 > --- a/arch/parisc/include/asm/io.h > +++ b/arch/parisc/include/asm/io.h > @@ -127,16 +127,7 @@ static inline void gsc_writeq(unsigned long long val, > unsigned long addr) > /* > * The standard PCI ioremap interfaces > */ > - > -extern void __iomem * __ioremap(unsigned long offset, unsigned long size, > unsigned long flags); > - > -/* Most machines react poorly to I/O-space being cacheable... Instead let's > - * define ioremap() in terms of ioremap_nocache(). > - */ > -static inline void __iomem * ioremap(unsigned long offset, unsigned long > size) > -{ > - return __ioremap(offset, size, _PAGE_NO_CACHE); > -} > +void __iomem *ioremap(unsigned long offset, unsigned long size); > #define ioremap_nocache(off, sz) ioremap((off), (sz)) > #define ioremap_wc ioremap_nocache > #define ioremap_uc ioremap_nocache > diff --git a/arch/parisc/mm/ioremap.c b/arch/parisc/mm/ioremap.c > index f29f682352f0..6e7c005aa09b 100644 > --- a/arch/parisc/mm/ioremap.c > +++ b/arch/parisc/mm/ioremap.c > @@ -25,7 +25,7 @@ > * have to convert them into an offset in a page-aligned mapping, but the > * caller shouldn't need to know that small detail. > */ > -void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, > unsigned long flags) > +void __iomem *ioremap(unsigned long phys_addr, unsigned long size) > { > void __iomem *addr; > struct vm_struct *area; > @@ -36,10 +36,8 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned > long size, unsigned l > unsigned long end = phys_addr + size - 1; > /* Support EISA addresses */ > if ((phys_addr >= 0x0008 && end < 0x000f) || > - (phys_addr >= 0x0050 && end < 0x03bf)) { > + (phys_addr >= 0x0050 && end < 0x03bf)) > phys_addr |= F_EXTEND(0xfc00); > - flags |= _PAGE_NO_CACHE; > - } > #endif > > /* Don't allow wraparound or zero size */ > @@ -65,7 +63,7 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned > long size, unsigned l > } > > pgprot = __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | > - _PAGE_ACCESSED | flags); > + _PAGE_ACCESSED | _PAGE_NO_CACHE); > > /* >* Mappings have to be page-aligned > @@ -90,7 +88,7 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned > long size, unsigned l > > return (void __iomem *) (offset + (char __iomem *)addr); > } > -EXPORT_SYMBOL(__ioremap); > +EXPORT_SYMBOL(ioremap); > > void iounmap(const volatile void __iomem *io_addr) > { > ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH v2] toolchain,glibc: Allow ARC big endian glibc builds
Apparently big endian glibc builds just work, if we let the endian header allow that (which prev was #error). So this patch bumps glibc to version which fixes the header (this hopefully will become arc-2019.09-release) and then enables arceb in glibc toolchain builds Signed-off-by: Vineet Gupta --- Changes since v1 - Use BR2_arc iso BR2_arcle && BR2_arcbe --- package/glibc/glibc.mk | 2 +- toolchain/toolchain-buildroot/Config.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/glibc/glibc.mk b/package/glibc/glibc.mk index d46063c5d111..754408881397 100644 --- a/package/glibc/glibc.mk +++ b/package/glibc/glibc.mk @@ -5,7 +5,7 @@ ifeq ($(BR2_arc),y) -GLIBC_VERSION = arc-2019.03-release +GLIBC_VERSION = ec681dddfa99894513c85da7d5d257b60d04f915 GLIBC_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,glibc,$(GLIBC_VERSION)) else ifeq ($(BR2_RISCV_32),y) GLIBC_VERSION = 06983fe52cfe8e4779035c27e8cc5d2caab31531 diff --git a/toolchain/toolchain-buildroot/Config.in b/toolchain/toolchain-buildroot/Config.in index c0612bf04176..327314585b8e 100644 --- a/toolchain/toolchain-buildroot/Config.in +++ b/toolchain/toolchain-buildroot/Config.in @@ -48,7 +48,7 @@ config BR2_TOOLCHAIN_BUILDROOT_GLIBC BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le || \ BR2_riscv || BR2_sh || BR2_sparc64 || \ BR2_x86_64 || BR2_microblaze || BR2_nios2 || \ - (BR2_arcle && BR2_ARC_ATOMIC_EXT) || BR2_csky + (BR2_arc && BR2_ARC_ATOMIC_EXT) || BR2_csky depends on BR2_USE_MMU depends on !BR2_STATIC_LIBS depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_2 -- 2.20.1 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH] [ARC] Add builtins for identifying floating point support
Currently for hard float we need to check for __ARC_FPU_SP__ || __ARC_FPU_DP__ and for soft float inverse of that. So define single convenience macros for either cases gcc/ -xx-xx Vineet Gupta * config/arc/arc-c.c (arc_cpu_cpp_builtins): Add __arc_hard_float__, __ARC_HARD_FLOAT__, __arc_soft_float__, __ARC_SOFT_FLOAT__ Signed-off-by: Vineet Gupta --- gcc/ChangeLog | 6 ++ gcc/config/arc/arc-c.c | 10 ++ 2 files changed, 16 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f3deffc701ff..9237e81aa011 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-11-05 Vineet Gupta + + * config/arc/arc-c.c (arc_cpu_cpp_builtins) : Add + __arc_hard_float__, __ARC_HARD_FLOAT__, + __arc_soft_float__, __ARC_SOFT_FLOAT__ + 2019-11-05 Martin Sebor PR middle-end/92333 diff --git a/gcc/config/arc/arc-c.c b/gcc/config/arc/arc-c.c index cf3340d29c27..1a5ff3e88a67 100644 --- a/gcc/config/arc/arc-c.c +++ b/gcc/config/arc/arc-c.c @@ -71,4 +71,14 @@ arc_cpu_cpp_builtins (cpp_reader * pfile) if (TARGET_BIG_ENDIAN) builtin_define ("__big_endian__"); + if (TARGET_HARD_FLOAT) +{ + builtin_define ("__arc_hard_float__"); + builtin_define ("__ARC_HARD_FLOAT__"); +} + else +{ + builtin_define ("__arc_soft_float__"); + builtin_define ("__ARC_SOFT_FLOAT__"); +} } -- 2.20.1 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH V8] mm/debug: Add tests validating architecture page table helpers
On Mon, 28 Oct 2019 10:59:22 +0530 Anshuman Khandual wrote: > This adds tests which will validate architecture page table helpers and > other accessors in their compliance with expected generic MM semantics. > This will help various architectures in validating changes to existing > page table helpers or addition of new ones. > > This test covers basic page table entry transformations including but not > limited to old, young, dirty, clean, write, write protect etc at various > level along with populating intermediate entries with next page table page > and validating them. > > Test page table pages are allocated from system memory with required size > and alignments. The mapped pfns at page table levels are derived from a > real pfn representing a valid kernel text symbol. This test gets called > right after page_alloc_init_late(). > > This gets build and run when CONFIG_DEBUG_VM_PGTABLE is selected along with > CONFIG_VM_DEBUG. Architectures willing to subscribe this test also need to > select CONFIG_ARCH_HAS_DEBUG_VM_PGTABLE which for now is limited to x86 and > arm64. Going forward, other architectures too can enable this after fixing > build or runtime problems (if any) with their page table helpers. I've prepared a couple of commits to our arch code to make this work on s390, they will go upstream in the next merge window. After that, we can add s390 to the supported architectures. We had some issues, e.g. because we do not report large entries as bad in pxd_bad(), do not check for folded page tables in pxd_free(), or assume that primitives like pmd_mkdirty() will only be called after pmd_mkhuge(). None of those should have any impact on current code, but your test module revealed that we do not behave like other architectures in some aspects, and it's good to find and fix such things to prevent possible future issues. Thanks a lot for the effort! Regards, Gerald ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
RE: [PATCH] ARC: perf: Accommodate big-endian CPU
Hi Sasha, Greg, > -Original Message- > From: Sasha Levin > Sent: Saturday, October 26, 2019 4:11 PM > To: Sasha Levin ; Alexey Brodkin ; > linux-snps- > a...@lists.infradead.org > Cc: linux-ker...@vger.kernel.org; sta...@vger.kernel.org; > sta...@vger.kernel.org > Subject: Re: [PATCH] ARC: perf: Accommodate big-endian CPU > > Hi, > > [This is an automated email] > > This commit has been processed because it contains a -stable tag. > The stable tag indicates that it's relevant for the following trees: all > > The bot has tested the following trees: v5.3.7, v4.19.80, v4.14.150, > v4.9.197, v4.4.197. > > v5.3.7: Build OK! > v4.19.80: Failed to apply! Possible dependencies: > 0e956150fe09f ("ARC: perf: introduce Kernel PMU events support") > 14f81a91ad29a ("ARC: perf: trivial code cleanup") > baf9cc85ba01f ("ARC: perf: move HW events mapping to separate function") > v4.14.150: Failed to apply! Possible dependencies: > v4.9.197: Failed to apply! Possible dependencies: > v4.4.197: Failed to apply! Possible dependencies: Indeed the clash is due to commit baf9cc85ba01f ("ARC: perf: move HW events mapping to separate function") as tmp variable "j" was changed on "i". So that's a fixed hunk: >8-- diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c index 8aec462d90fb..30f66b123541 100644 --- a/arch/arc/kernel/perf_event.c +++ b/arch/arc/kernel/perf_event.c @@ -490,8 +490,8 @@ static int arc_pmu_device_probe(struct platform_device *pdev) /* loop thru all available h/w condition indexes */ for (j = 0; j < cc_bcr.c; j++) { write_aux_reg(ARC_REG_CC_INDEX, j); - cc_name.indiv.word0 = read_aux_reg(ARC_REG_CC_NAME0); - cc_name.indiv.word1 = read_aux_reg(ARC_REG_CC_NAME1); + cc_name.indiv.word0 = le32_to_cpu(read_aux_reg(ARC_REG_CC_NAME0)); + cc_name.indiv.word1 = le32_to_cpu(read_aux_reg(ARC_REG_CC_NAME1)); /* See if it has been mapped to a perf event_id */ for (i = 0; i < ARRAY_SIZE(arc_pmu_ev_hw_map); i++) { >8-- Should I send a formal patch with it or it's OK for now? -Alexey ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH V8] mm/debug: Add tests validating architecture page table helpers
On 10/28/2019 10:59 AM, Anshuman Khandual wrote: > This adds tests which will validate architecture page table helpers and > other accessors in their compliance with expected generic MM semantics. > This will help various architectures in validating changes to existing > page table helpers or addition of new ones. > > This test covers basic page table entry transformations including but not > limited to old, young, dirty, clean, write, write protect etc at various > level along with populating intermediate entries with next page table page > and validating them. > > Test page table pages are allocated from system memory with required size > and alignments. The mapped pfns at page table levels are derived from a > real pfn representing a valid kernel text symbol. This test gets called > right after page_alloc_init_late(). > > This gets build and run when CONFIG_DEBUG_VM_PGTABLE is selected along with > CONFIG_VM_DEBUG. Architectures willing to subscribe this test also need to > select CONFIG_ARCH_HAS_DEBUG_VM_PGTABLE which for now is limited to x86 and > arm64. Going forward, other architectures too can enable this after fixing > build or runtime problems (if any) with their page table helpers. > > Folks interested in making sure that a given platform's page table helpers > conform to expected generic MM semantics should enable the above config > which will just trigger this test during boot. Any non conformity here will > be reported as an warning which would need to be fixed. This test will help > catch any changes to the agreed upon semantics expected from generic MM and > enable platforms to accommodate it thereafter. > > Cc: Andrew Morton > Cc: Vlastimil Babka > Cc: Greg Kroah-Hartman > Cc: Thomas Gleixner > Cc: Mike Rapoport > Cc: Jason Gunthorpe > Cc: Dan Williams > Cc: Peter Zijlstra > Cc: Michal Hocko > Cc: Mark Rutland > Cc: Mark Brown > Cc: Steven Price > Cc: Ard Biesheuvel > Cc: Masahiro Yamada > Cc: Kees Cook > Cc: Tetsuo Handa > Cc: Matthew Wilcox > Cc: Sri Krishna chowdary > Cc: Dave Hansen > Cc: Russell King - ARM Linux > Cc: Michael Ellerman > Cc: Paul Mackerras > Cc: Martin Schwidefsky > Cc: Heiko Carstens > Cc: "David S. Miller" > Cc: Vineet Gupta > Cc: James Hogan > Cc: Paul Burton > Cc: Ralf Baechle > Cc: Kirill A. Shutemov > Cc: Gerald Schaefer > Cc: Christophe Leroy > Cc: Ingo Molnar > Cc: linux-snps-arc@lists.infradead.org > Cc: linux-m...@vger.kernel.org > Cc: linux-arm-ker...@lists.infradead.org > Cc: linux-i...@vger.kernel.org > Cc: linuxppc-...@lists.ozlabs.org > Cc: linux-s...@vger.kernel.org > Cc: linux...@vger.kernel.org > Cc: sparcli...@vger.kernel.org > Cc: x...@kernel.org > Cc: linux-ker...@vger.kernel.org > > Tested-by: Christophe Leroy #PPC32 > Suggested-by: Catalin Marinas > Signed-off-by: Andrew Morton > Signed-off-by: Christophe Leroy > Signed-off-by: Anshuman Khandual > --- > > This adds a test validation for architecture exported page table helpers. > Patch adds basic transformation tests at various levels of the page table. > > This test was originally suggested by Catalin during arm64 THP migration > RFC discussion earlier. Going forward it can include more specific tests > with respect to various generic MM functions like THP, HugeTLB etc and > platform specific tests. > > https://lore.kernel.org/linux-mm/20190628102003.ga56...@arrakis.emea.arm.com/ > > Needs to be applied on linux-next (next-20191025). > > Changes in V8: > > - Enabled ARCH_HAS_DEBUG_VM_PGTABLE on PPC32 platform per Christophe > - Updated feature documentation as DEBUG_VM_PGTABLE is now enabled on PPC32 > platform > - Moved ARCH_HAS_DEBUG_VM_PGTABLE earlier to indent it with DEBUG_VM per > Christophe > - Added an information message in debug_vm_pgtable() per Christophe > - Dropped random_vaddr boundary condition checks per Christophe and Qian > - Replaced virt_addr_valid() check with pfn_valid() check in > debug_vm_pgtable() > - Slightly changed pr_fmt(fmt) information Hello Andrew, Just wondering if this version looks okay or is there anything else which still needs to be accommodated here first, before this test can be considered for merging ? Thank you. - Anshuman ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH V8] mm/debug: Add tests validating architecture page table helpers
On 10/28/2019 10:59 AM, Anshuman Khandual wrote: > This adds tests which will validate architecture page table helpers and > other accessors in their compliance with expected generic MM semantics. > This will help various architectures in validating changes to existing > page table helpers or addition of new ones. > > This test covers basic page table entry transformations including but not > limited to old, young, dirty, clean, write, write protect etc at various > level along with populating intermediate entries with next page table page > and validating them. > > Test page table pages are allocated from system memory with required size > and alignments. The mapped pfns at page table levels are derived from a > real pfn representing a valid kernel text symbol. This test gets called > right after page_alloc_init_late(). > > This gets build and run when CONFIG_DEBUG_VM_PGTABLE is selected along with > CONFIG_VM_DEBUG. Architectures willing to subscribe this test also need to > select CONFIG_ARCH_HAS_DEBUG_VM_PGTABLE which for now is limited to x86 and > arm64. Going forward, other architectures too can enable this after fixing > build or runtime problems (if any) with their page table helpers. > > Folks interested in making sure that a given platform's page table helpers > conform to expected generic MM semantics should enable the above config > which will just trigger this test during boot. Any non conformity here will > be reported as an warning which would need to be fixed. This test will help > catch any changes to the agreed upon semantics expected from generic MM and > enable platforms to accommodate it thereafter. > > Cc: Andrew Morton > Cc: Vlastimil Babka > Cc: Greg Kroah-Hartman > Cc: Thomas Gleixner > Cc: Mike Rapoport > Cc: Jason Gunthorpe > Cc: Dan Williams > Cc: Peter Zijlstra > Cc: Michal Hocko > Cc: Mark Rutland > Cc: Mark Brown > Cc: Steven Price > Cc: Ard Biesheuvel > Cc: Masahiro Yamada > Cc: Kees Cook > Cc: Tetsuo Handa > Cc: Matthew Wilcox > Cc: Sri Krishna chowdary > Cc: Dave Hansen > Cc: Russell King - ARM Linux > Cc: Michael Ellerman > Cc: Paul Mackerras > Cc: Martin Schwidefsky > Cc: Heiko Carstens > Cc: "David S. Miller" > Cc: Vineet Gupta > Cc: James Hogan > Cc: Paul Burton > Cc: Ralf Baechle > Cc: Kirill A. Shutemov > Cc: Gerald Schaefer > Cc: Christophe Leroy > Cc: Ingo Molnar > Cc: linux-snps-arc@lists.infradead.org > Cc: linux-m...@vger.kernel.org > Cc: linux-arm-ker...@lists.infradead.org > Cc: linux-i...@vger.kernel.org > Cc: linuxppc-...@lists.ozlabs.org > Cc: linux-s...@vger.kernel.org > Cc: linux...@vger.kernel.org > Cc: sparcli...@vger.kernel.org > Cc: x...@kernel.org > Cc: linux-ker...@vger.kernel.org > > Tested-by: Christophe Leroy #PPC32 > Suggested-by: Catalin Marinas > Signed-off-by: Andrew Morton > Signed-off-by: Christophe Leroy > Signed-off-by: Anshuman Khandual > --- > > This adds a test validation for architecture exported page table helpers. > Patch adds basic transformation tests at various levels of the page table. > > This test was originally suggested by Catalin during arm64 THP migration > RFC discussion earlier. Going forward it can include more specific tests > with respect to various generic MM functions like THP, HugeTLB etc and > platform specific tests. > > https://lore.kernel.org/linux-mm/20190628102003.ga56...@arrakis.emea.arm.com/ > > Needs to be applied on linux-next (next-20191025). > > Changes in V8: > > - Enabled ARCH_HAS_DEBUG_VM_PGTABLE on PPC32 platform per Christophe > - Updated feature documentation as DEBUG_VM_PGTABLE is now enabled on PPC32 > platform > - Moved ARCH_HAS_DEBUG_VM_PGTABLE earlier to indent it with DEBUG_VM per > Christophe > - Added an information message in debug_vm_pgtable() per Christophe > - Dropped random_vaddr boundary condition checks per Christophe and Qian > - Replaced virt_addr_valid() check with pfn_valid() check in > debug_vm_pgtable() Hello Andrew, Just wondering if this version looks okay or is there anything else which still needs to be accommodated here first, before this test can be considered for merging ? Thank you. - Anshuman ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH V8] mm/debug: Add tests validating architecture page table helpers
Hi Anshuman, On 11/4/19 4:00 PM, Anshuman Khandual wrote: > On 10/28/2019 10:59 AM, Anshuman Khandual wrote: >> This adds tests which will validate architecture page table helpers and >> other accessors in their compliance with expected generic MM semantics. >> This will help various architectures in validating changes to existing >> page table helpers or addition of new ones. >> >> This test covers basic page table entry transformations including but not >> limited to old, young, dirty, clean, write, write protect etc at various >> level along with populating intermediate entries with next page table page >> and validating them. >> >> Test page table pages are allocated from system memory with required size >> and alignments. The mapped pfns at page table levels are derived from a >> real pfn representing a valid kernel text symbol. This test gets called >> right after page_alloc_init_late(). >> >> This gets build and run when CONFIG_DEBUG_VM_PGTABLE is selected along with >> CONFIG_VM_DEBUG. Architectures willing to subscribe this test also need to >> select CONFIG_ARCH_HAS_DEBUG_VM_PGTABLE which for now is limited to x86 and >> arm64. Going forward, other architectures too can enable this after fixing >> build or runtime problems (if any) with their page table helpers. >> >> Folks interested in making sure that a given platform's page table helpers >> conform to expected generic MM semantics should enable the above config >> which will just trigger this test during boot. Any non conformity here will >> be reported as an warning which would need to be fixed. This test will help >> catch any changes to the agreed upon semantics expected from generic MM and >> enable platforms to accommodate it thereafter. >> I tried enabling this on ARC and ran into a build issue ../mm/debug_vm_pgtable.c: In function ‘pmd_basic_tests’: ../mm/debug_vm_pgtable.c:73:14: error: implicit declaration of function ‘pfn_pmd’; did you mean ‘pfn_pte’? [-Werror=implicit-function-declaration] pmd_t pmd = pfn_pmd(pfn, prot); ^~~ The reason being THP was not enabled (although ARC supports THP) - for the combination below CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y # CONFIG_TRANSPARENT_HUGEPAGE is not set I think you need to use latter for guarding pmd_basic_tests() Other than that the tests pass for !THP and THP too. So once fixed, you could enable that for ARC as well Thx for doing this. -Vineet ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH V8] mm/debug: Add tests validating architecture page table helpers
On 11/06/2019 04:00 AM, Vineet Gupta wrote: > Hi Anshuman, Hello Vineet, > > On 11/4/19 4:00 PM, Anshuman Khandual wrote: >> On 10/28/2019 10:59 AM, Anshuman Khandual wrote: >>> This adds tests which will validate architecture page table helpers and >>> other accessors in their compliance with expected generic MM semantics. >>> This will help various architectures in validating changes to existing >>> page table helpers or addition of new ones. >>> >>> This test covers basic page table entry transformations including but not >>> limited to old, young, dirty, clean, write, write protect etc at various >>> level along with populating intermediate entries with next page table page >>> and validating them. >>> >>> Test page table pages are allocated from system memory with required size >>> and alignments. The mapped pfns at page table levels are derived from a >>> real pfn representing a valid kernel text symbol. This test gets called >>> right after page_alloc_init_late(). >>> >>> This gets build and run when CONFIG_DEBUG_VM_PGTABLE is selected along with >>> CONFIG_VM_DEBUG. Architectures willing to subscribe this test also need to >>> select CONFIG_ARCH_HAS_DEBUG_VM_PGTABLE which for now is limited to x86 and >>> arm64. Going forward, other architectures too can enable this after fixing >>> build or runtime problems (if any) with their page table helpers. >>> >>> Folks interested in making sure that a given platform's page table helpers >>> conform to expected generic MM semantics should enable the above config >>> which will just trigger this test during boot. Any non conformity here will >>> be reported as an warning which would need to be fixed. This test will help >>> catch any changes to the agreed upon semantics expected from generic MM and >>> enable platforms to accommodate it thereafter. >>> > > I tried enabling this on ARC and ran into a build issue > > ../mm/debug_vm_pgtable.c: In function ‘pmd_basic_tests’: > ../mm/debug_vm_pgtable.c:73:14: error: implicit declaration of function > ‘pfn_pmd’; > did you mean ‘pfn_pte’? [-Werror=implicit-function-declaration] > pmd_t pmd = pfn_pmd(pfn, prot); > ^~~ > > The reason being THP was not enabled (although ARC supports THP) - for the > combination below > CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y > # CONFIG_TRANSPARENT_HUGEPAGE is not set > > I think you need to use latter for guarding pmd_basic_tests() So the build complains that pfn_pmd() is not defined when the following config combination is in place. CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y CONFIG_TRANSPARENT_HUGEPAGE=n But should not pfn_pmd() be encapsulated inside HAVE_ARCH_TRANSPARENT_HUGEPAGE at the minimum (but I would say it should be available always, nonetheless) when the platform subscribes to THP irrespective of whether THP is enabled or not. I could see in the file (arch/arc/include/asm/pgtable.h) that fetching pfn_pmd() and all other basic PMD definitions is conditional on CONFIG_TRANSPARENT_HUGEPAGE. #ifdef CONFIG_TRANSPARENT_HUGEPAGE #include #endif IIUC, CONFIG_TRANSPARENT_HUGEPAGE should only encapsulate PMD page table helpers which are expected from generic THP code (pmd_trans_huge, pmdp_set_access_flags etc) but not the basic PMD helpers like pmd_pfn, pmd_mkyoung, pmd_mkdirty, pmd_mkclean etc. Hence wondering will it be possible to accommodate following code change on arc platform (not even compiled) in order to fix the problem ? diff --git a/arch/arc/include/asm/hugepage.h b/arch/arc/include/asm/hugepage.h index 9a74ce7..2ae15a8 100644 --- a/arch/arc/include/asm/hugepage.h +++ b/arch/arc/include/asm/hugepage.h @@ -36,11 +36,11 @@ static inline pmd_t pte_pmd(pte_t pte) #define pmd_dirty(pmd) pte_dirty(pmd_pte(pmd)) #define mk_pmd(page, prot) pte_pmd(mk_pte(page, prot)) +#define pfn_pmd(pfn, prot) (__pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))) +#ifdef CONFIG_TRANSPARENT_HUGEPAGE #define pmd_trans_huge(pmd)(pmd_val(pmd) & _PAGE_HW_SZ) -#define pfn_pmd(pfn, prot) (__pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))) - static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot) { /* @@ -73,5 +73,6 @@ extern void flush_pmd_tlb_range(struct vm_area_struct *vma, unsigned long start, /* We don't have hardware dirty/accessed bits, generic_pmdp_establish is fine.*/ #define pmdp_establish generic_pmdp_establish +#endif #endif diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h index 9019ed9..20395f1 100644 --- a/arch/arc/include/asm/pgtable.h +++ b/arch/arc/include/asm/pgtable.h @@ -385,7 +385,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, * remap a physical page `pfn' of size `size' with page protection `prot' * into virtual address `from' */ -#ifdef CONFIG_TRANSPARENT_HUGEPAGE +#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE #include #endif > > Other than that the tests pass for !THP and THP too. So once fixed, you could Glad that it wo
[PATCH 00/50] Add log level to show_stack()
Add log level argument to show_stack(). Done in three stages: 1. Introducing show_stack_loglvl() for every architecture 2. Migrating old users with an explicit log level 3. Renaming show_stack_loglvl() into show_stack() Justification: o It's a design mistake to move a business-logic decision into platform realization detail. o I have currently two patches sets that would benefit from this work: Removing console_loglevel jumps in sysrq driver [1] Hung task warning before panic [2] - suggested by Tetsuo (but he probably didn't realise what it would involve). o While doing (1), (2) the backtraces were adjusted to headers and other messages for each situation - so there won't be a situation when the backtrace is printed, but the headers are missing because they have lesser log level (or the reverse). o As the result in (2) plays with console_loglevel for kdb are removed. The least important for upstream, but maybe still worth to note that every company I've worked in so far had an off-list patch to print backtrace with the needed log level (but only for the architecture they cared about). If you have other ideas how you will benefit from show_stack() with a log level - please, reply to this cover letter. Ok, to the scary part: I've tested it on x86_64 and build tested on a couple of architectures. Though, I can't cover all platforms so I hope I'll have a couple of reports and than it'll soak in linux-next for some time. In my opinion the variety of architectures shouldn't stop general improvements. Cc: Andrew Morton Cc: Greg Kroah-Hartman Cc: Ingo Molnar Cc: Jiri Slaby Cc: Petr Mladek Cc: Sergey Senozhatsky Cc: Steven Rostedt Cc: Tetsuo Handa Thanks, Dmitry [1]: https://lore.kernel.org/lkml/20190528002412.1625-1-d...@arista.com/T/#u [2]: https://lkml.kernel.org/r/41fd7652-df1f-26f6-aba0-b87ebae07...@i-love.sakura.ne.jp Dmitry Safonov (50): kallsyms/printk: Add loglvl to print_ip_sym() alpha: Add show_stack_loglvl() arc: Add show_stack_loglvl() arm/asm: Add loglvl to c_backtrace() arm: Add loglvl to unwind_backtrace() arm: Add loglvl to dump_backtrace() arm: Wire up dump_backtrace_{entry,stm} arm: Add show_stack_loglvl() arm64: Add loglvl to dump_backtrace() arm64: Add show_stack_loglvl() c6x: Add show_stack_loglvl() csky: Add show_stack_loglvl() h8300: Add show_stack_loglvl() hexagon: Add show_stack_loglvl() ia64: Pass log level as arg into ia64_do_show_stack() ia64: Add show_stack_loglvl() m68k: Add show_stack_loglvl() microblaze: Add loglvl to microblaze_unwind_inner() microblaze: Add loglvl to microblaze_unwind() microblaze: Add show_stack_loglvl() mips: Add show_stack_loglvl() nds32: Add show_stack_loglvl() nios2: Add show_stack_loglvl() openrisc: Add show_stack_loglvl() parisc: Add show_stack_loglvl() powerpc: Add show_stack_loglvl() riscv: Add show_stack_loglvl() s390: Add show_stack_loglvl() sh: Add loglvl to dump_mem() sh: Remove needless printk() sh: Add loglvl to printk_address() sh: Add loglvl to show_trace() sh: Add show_stack_loglvl() sparc: Add show_stack_loglvl() um/sysrq: Remove needless variable sp um: Add show_stack_loglvl() unicore32: Remove unused pmode argument in c_backtrace() unicore32: Add loglvl to c_backtrace() unicore32: Add show_stack_loglvl() x86: Add missing const qualifiers for log_lvl x86: Add show_stack_loglvl() xtensa: Add loglvl to show_trace() xtensa: Add show_stack_loglvl() sysrq: Use show_stack_loglvl() x86/amd_gart: Print stacktrace for a leak with KERN_ERR power: Use show_stack_loglvl() kdb: Don't play with console_loglevel sched: Print stack trace with KERN_INFO kernel: Use show_stack_loglvl() kernel: Rename show_stack_loglvl() => show_stack() arch/alpha/kernel/traps.c| 22 +++ arch/arc/include/asm/bug.h | 3 ++- arch/arc/kernel/stacktrace.c | 17 +++- arch/arc/kernel/troubleshoot.c | 2 +- arch/arm/include/asm/bug.h | 3 ++- arch/arm/include/asm/traps.h | 3 ++- arch/arm/include/asm/unwind.h| 3 ++- arch/arm/kernel/traps.c | 40 arch/arm/kernel/unwind.c | 7 ++--- arch/arm/lib/backtrace-clang.S | 9 +-- arch/arm/lib/backtrace.S | 14 +++--- arch/arm64/include/asm/stacktrace.h | 3 ++- arch/arm64/kernel/process.c | 2 +- arch/arm64/kernel/traps.c| 19 ++--- arch/c6x/kernel/traps.c | 18 +++-- arch/csky/kernel/dumpstack.c | 9 --- arch/csky/kernel/ptrace.c| 4 +-- arch/h8300/kernel/traps.c| 12 - arch/hexagon/kernel/traps.c | 25 - arch/ia64/include/asm/ptrace.h | 1 - arch/ia64/kernel/mca.c | 2 +- arch/ia64/kernel/process.c | 17 ++-- arch/m68k/kernel/traps.c | 13 - arch/microblaze/include/as
[PATCH 03/50] arc: Add show_stack_loglvl()
Currently, the log-level of show_stack() depends on a platform realization. It creates situations where the headers are printed with lower log level or higher than the stacktrace (depending on a platform or user). Furthermore, it forces the logic decision from user to an architecture side. In result, some users as sysrq/kdb/etc are doing tricks with temporary rising console_loglevel while printing their messages. And in result it not only may print unwanted messages from other CPUs, but also omit printing at all in the unlucky case where the printk() was deferred. Introducing log-level parameter and KERN_UNSUPPRESSED [1] seems an easier approach than introducing more printk buffers. Also, it will consolidate printings with headers. Introduce show_stack_loglvl(), that eventually will substitute show_stack(). As a good side-effect header "Stack Trace:" is now printed with the same log level as the rest of backtrace. Cc: Vineet Gupta Cc: linux-snps-arc@lists.infradead.org [1]: https://lore.kernel.org/lkml/20190528002412.1625-1-d...@arista.com/T/#u Signed-off-by: Dmitry Safonov --- arch/arc/include/asm/bug.h | 3 ++- arch/arc/kernel/stacktrace.c | 21 +++-- arch/arc/kernel/troubleshoot.c | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/arch/arc/include/asm/bug.h b/arch/arc/include/asm/bug.h index 0be19fd1a412..4c453ba96c51 100644 --- a/arch/arc/include/asm/bug.h +++ b/arch/arc/include/asm/bug.h @@ -13,7 +13,8 @@ struct task_struct; void show_regs(struct pt_regs *regs); -void show_stacktrace(struct task_struct *tsk, struct pt_regs *regs); +void show_stacktrace(struct task_struct *tsk, struct pt_regs *regs, +const char *loglvl); void show_kernel_fault_diag(const char *str, struct pt_regs *regs, unsigned long address); void die(const char *str, struct pt_regs *regs, unsigned long address); diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c index 1e440bbfa876..24f9cd8a12c9 100644 --- a/arch/arc/kernel/stacktrace.c +++ b/arch/arc/kernel/stacktrace.c @@ -158,9 +158,11 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs, /* Call-back which plugs into unwinding core to dump the stack in * case of panic/OOPs/BUG etc */ -static int __print_sym(unsigned int address, void *unused) +static int __print_sym(unsigned int address, void *arg) { - printk(" %pS\n", (void *)address); + const char *loglvl = arg; + + printk("%s %pS\n", loglvl, (void *)address); return 0; } @@ -217,17 +219,24 @@ static int __get_first_nonsched(unsigned int address, void *unused) *- */ -noinline void show_stacktrace(struct task_struct *tsk, struct pt_regs *regs) +noinline void show_stacktrace(struct task_struct *tsk, struct pt_regs *regs, + const char *loglvl) { - pr_info("\nStack Trace:\n"); - arc_unwind_core(tsk, regs, __print_sym, NULL); + printk("%s\nStack Trace:\n", loglvl); + arc_unwind_core(tsk, regs, __print_sym, (void *)loglvl); } EXPORT_SYMBOL(show_stacktrace); /* Expected by sched Code */ +void show_stack_loglvl(struct task_struct *tsk, unsigned long *sp, + const char *loglvl) +{ + show_stacktrace(tsk, NULL, loglvl); +} + void show_stack(struct task_struct *tsk, unsigned long *sp) { - show_stacktrace(tsk, NULL); + show_stack_loglvl(tsk, sp, KERN_DEFAULT); } /* Another API expected by schedular, shows up in "ps" as Wait Channel diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c index b79886a6cec8..3f8fc1efcb60 100644 --- a/arch/arc/kernel/troubleshoot.c +++ b/arch/arc/kernel/troubleshoot.c @@ -245,5 +245,5 @@ void show_kernel_fault_diag(const char *str, struct pt_regs *regs, /* Show stack trace if this Fatality happened in kernel mode */ if (!user_mode(regs)) - show_stacktrace(current, regs); + show_stacktrace(current, regs, KERN_DEFAULT); } -- 2.23.0 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH V8] mm/debug: Add tests validating architecture page table helpers
On 11/06/2019 01:06 AM, Gerald Schaefer wrote: > On Mon, 28 Oct 2019 10:59:22 +0530 > Anshuman Khandual wrote: > >> This adds tests which will validate architecture page table helpers and >> other accessors in their compliance with expected generic MM semantics. >> This will help various architectures in validating changes to existing >> page table helpers or addition of new ones. >> >> This test covers basic page table entry transformations including but not >> limited to old, young, dirty, clean, write, write protect etc at various >> level along with populating intermediate entries with next page table page >> and validating them. >> >> Test page table pages are allocated from system memory with required size >> and alignments. The mapped pfns at page table levels are derived from a >> real pfn representing a valid kernel text symbol. This test gets called >> right after page_alloc_init_late(). >> >> This gets build and run when CONFIG_DEBUG_VM_PGTABLE is selected along with >> CONFIG_VM_DEBUG. Architectures willing to subscribe this test also need to >> select CONFIG_ARCH_HAS_DEBUG_VM_PGTABLE which for now is limited to x86 and >> arm64. Going forward, other architectures too can enable this after fixing >> build or runtime problems (if any) with their page table helpers. > > I've prepared a couple of commits to our arch code to make this work on s390, > they will go upstream in the next merge window. After that, we can add s390 > to the supported architectures. Thats good. > > We had some issues, e.g. because we do not report large entries as bad in > pxd_bad(), do not check for folded page tables in pxd_free(), or assume > that primitives like pmd_mkdirty() will only be called after pmd_mkhuge(). > None of those should have any impact on current code, but your test module > revealed that we do not behave like other architectures in some aspects, > and it's good to find and fix such things to prevent possible future issues. Right and those s390 fixes are the testimony for the usefulness of this test. > > Thanks a lot for the effort! > > Regards, > Gerald > > ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH V8] mm/debug: Add tests validating architecture page table helpers
On 10/28/2019 10:59 AM, Anshuman Khandual wrote: > +--- > +| arch |status| > +--- > +| alpha: | TODO | > +| arc: | TODO | > +| arm: | TODO | > +| arm64: | ok | > +| c6x: | TODO | > +|csky: | TODO | > +| h8300: | TODO | > +| hexagon: | TODO | > +|ia64: | TODO | > +|m68k: | TODO | > +| microblaze: | TODO | > +|mips: | TODO | > +| nds32: | TODO | > +| nios2: | TODO | > +|openrisc: | TODO | > +| parisc: | TODO | > +| powerpc: | TODO | > +| ppc32: | ok | > +| riscv: | TODO | > +|s390: | TODO | > +| sh: | TODO | > +| sparc: | TODO | > +| um: | TODO | > +| unicore32: | TODO | > +| x86: | ok | > +| xtensa: | TODO | > +--- While here, are there some volunteers to test this on any of the 'yet to be tested and supported' platforms ? - Anshuman ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH V8] mm/debug: Add tests validating architecture page table helpers
Le 06/11/2019 à 04:22, Anshuman Khandual a écrit : On 10/28/2019 10:59 AM, Anshuman Khandual wrote: +--- +| arch |status| +--- +| alpha: | TODO | +| arc: | TODO | +| arm: | TODO | +| arm64: | ok | +| c6x: | TODO | +|csky: | TODO | +| h8300: | TODO | +| hexagon: | TODO | +|ia64: | TODO | +|m68k: | TODO | +| microblaze: | TODO | +|mips: | TODO | +| nds32: | TODO | +| nios2: | TODO | +|openrisc: | TODO | +| parisc: | TODO | +| powerpc: | TODO | +| ppc32: | ok | Note that ppc32 is a part of powerpc, not a standalone arch. Maybe something like the following would be more correct: | powerpc/32: | ok | | powerpc/64: | TODO | Christophe +| riscv: | TODO | +|s390: | TODO | +| sh: | TODO | +| sparc: | TODO | +| um: | TODO | +| unicore32: | TODO | +| x86: | ok | +| xtensa: | TODO | +--- While here, are there some volunteers to test this on any of the 'yet to be tested and supported' platforms ? - Anshuman ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH V8] mm/debug: Add tests validating architecture page table helpers
On 11/06/2019 12:11 PM, Christophe Leroy wrote: > > > Le 06/11/2019 à 04:22, Anshuman Khandual a écrit : >> >> >> On 10/28/2019 10:59 AM, Anshuman Khandual wrote: >>> + --- >>> + | arch |status| >>> + --- >>> + | alpha: | TODO | >>> + | arc: | TODO | >>> + | arm: | TODO | >>> + | arm64: | ok | >>> + | c6x: | TODO | >>> + | csky: | TODO | >>> + | h8300: | TODO | >>> + | hexagon: | TODO | >>> + | ia64: | TODO | >>> + | m68k: | TODO | >>> + | microblaze: | TODO | >>> + | mips: | TODO | >>> + | nds32: | TODO | >>> + | nios2: | TODO | >>> + | openrisc: | TODO | >>> + | parisc: | TODO | >>> + | powerpc: | TODO | >>> + | ppc32: | ok | > > Note that ppc32 is a part of powerpc, not a standalone arch. Right, I understand. But we are yet to hear about how this test came about on powerpc server platforms. Will update 'powerpc' arch listing above once we get some confirmation. May be once this works on all relevant powerpc platforms, we can just merge 'powerpc' and 'ppc32' entries here as just 'powerpc'. > > Maybe something like the following would be more correct: > | powerpc/32: | ok | > | powerpc/64: | TODO | > > Christophe > >>> + | riscv: | TODO | >>> + | s390: | TODO | >>> + | sh: | TODO | >>> + | sparc: | TODO | >>> + | um: | TODO | >>> + | unicore32: | TODO | >>> + | x86: | ok | >>> + | xtensa: | TODO | >>> + --- >> >> While here, are there some volunteers to test this on any of the >> 'yet to be tested and supported' platforms ? >> >> - Anshuman >> > ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc