LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 16/21] mm: remove early_pfn_in_nid() and CONFIG_NODES_SPAN_OTHER_NODES
From: Mike Rapoport @ 2020-04-23  5:50 UTC (permalink / raw)
  To: Baoquan He
  Cc: Rich Felker, linux-ia64, linux-doc, Catalin Marinas,
	Heiko Carstens, Michal Hocko, James E.J. Bottomley, Max Filippov,
	Guo Ren, linux-csky, linux-parisc, sparclinux, linux-hexagon,
	linux-riscv, Greg Ungerer, linux-arch, linux-s390, linux-snps-arc,
	linux-c6x-dev, Brian Cain, Jonathan Corbet, linux-sh,
	Helge Deller, x86, Russell King, Ley Foon Tan, Mike Rapoport,
	Geert Uytterhoeven, linux-arm-kernel, Mark Salter, Matt Turner,
	linux-mips, uclinux-h8-devel, linux-xtensa, linux-alpha, linux-um,
	linux-m68k, Tony Luck, Greentime Hu, Paul Walmsley,
	Stafford Horne, Guan Xuetao, Hoan Tran, Michal Simek,
	Thomas Bogendoerfer, Yoshinori Sato, Nick Hu, linux-mm,
	Vineet Gupta, linux-kernel, openrisc, Richard Weinberger,
	Andrew Morton, linuxppc-dev, David S. Miller
In-Reply-To: <20200423011312.GY4247@MiWiFi-R3L-srv>

On Thu, Apr 23, 2020 at 09:13:12AM +0800, Baoquan He wrote:
> On 04/12/20 at 10:48pm, Mike Rapoport wrote:
> > From: Mike Rapoport <rppt@linux.ibm.com>
> > 
> > The commit f47ac088c406 ("mm: memmap_init: iterate over memblock regions
> 
> This commit id should be a temporary one, will be changed when merged
> into maintainer's tree and linus's tree. Only saying last patch plus the
> patch subject is OK?

Right, the commit id here is not stable. I'll update the changelog.
 
> > rather that check each PFN") made early_pfn_in_nid() obsolete and since
> > CONFIG_NODES_SPAN_OTHER_NODES is only used to pick a stub or a real
> > implementation of early_pfn_in_nid() it is also not needed anymore.
> > 
> > Remove both early_pfn_in_nid() and the CONFIG_NODES_SPAN_OTHER_NODES.
> > 
> > Co-developed-by: Hoan Tran <Hoan@os.amperecomputing.com>
> > Signed-off-by: Hoan Tran <Hoan@os.amperecomputing.com>
> > Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> > ---
> >  arch/powerpc/Kconfig |  9 ---------
> >  arch/sparc/Kconfig   |  9 ---------
> >  arch/x86/Kconfig     |  9 ---------
> >  mm/page_alloc.c      | 20 --------------------
> >  4 files changed, 47 deletions(-)
> > 
> > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> > index 5f86b22b7d2c..74f316deeae1 100644
> > --- a/arch/powerpc/Kconfig
> > +++ b/arch/powerpc/Kconfig
> > @@ -685,15 +685,6 @@ config ARCH_MEMORY_PROBE
> >  	def_bool y
> >  	depends on MEMORY_HOTPLUG
> >  
> > -# Some NUMA nodes have memory ranges that span
> > -# other nodes.  Even though a pfn is valid and
> > -# between a node's start and end pfns, it may not
> > -# reside on that node.  See memmap_init_zone()
> > -# for details.
> > -config NODES_SPAN_OTHER_NODES
> > -	def_bool y
> > -	depends on NEED_MULTIPLE_NODES
> > -
> >  config STDBINUTILS
> >  	bool "Using standard binutils settings"
> >  	depends on 44x
> > diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
> > index 795206b7b552..0e4f3891b904 100644
> > --- a/arch/sparc/Kconfig
> > +++ b/arch/sparc/Kconfig
> > @@ -286,15 +286,6 @@ config NODES_SHIFT
> >  	  Specify the maximum number of NUMA Nodes available on the target
> >  	  system.  Increases memory reserved to accommodate various tables.
> >  
> > -# Some NUMA nodes have memory ranges that span
> > -# other nodes.  Even though a pfn is valid and
> > -# between a node's start and end pfns, it may not
> > -# reside on that node.  See memmap_init_zone()
> > -# for details.
> > -config NODES_SPAN_OTHER_NODES
> > -	def_bool y
> > -	depends on NEED_MULTIPLE_NODES
> > -
> >  config ARCH_SPARSEMEM_ENABLE
> >  	def_bool y if SPARC64
> >  	select SPARSEMEM_VMEMMAP_ENABLE
> > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> > index 9d3e95b4fb85..37dac095659e 100644
> > --- a/arch/x86/Kconfig
> > +++ b/arch/x86/Kconfig
> > @@ -1581,15 +1581,6 @@ config X86_64_ACPI_NUMA
> >  	---help---
> >  	  Enable ACPI SRAT based node topology detection.
> >  
> > -# Some NUMA nodes have memory ranges that span
> > -# other nodes.  Even though a pfn is valid and
> > -# between a node's start and end pfns, it may not
> > -# reside on that node.  See memmap_init_zone()
> > -# for details.
> > -config NODES_SPAN_OTHER_NODES
> > -	def_bool y
> > -	depends on X86_64_ACPI_NUMA
> > -
> >  config NUMA_EMU
> >  	bool "NUMA emulation"
> >  	depends on NUMA
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index c43ce8709457..343d87b8697d 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -1541,26 +1541,6 @@ int __meminit early_pfn_to_nid(unsigned long pfn)
> >  }
> >  #endif /* CONFIG_NEED_MULTIPLE_NODES */
> >  
> > -#ifdef CONFIG_NODES_SPAN_OTHER_NODES
> > -/* Only safe to use early in boot when initialisation is single-threaded */
> > -static inline bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
> > -{
> > -	int nid;
> > -
> > -	nid = __early_pfn_to_nid(pfn, &early_pfnnid_cache);
> > -	if (nid >= 0 && nid != node)
> > -		return false;
> > -	return true;
> > -}
> > -
> > -#else
> > -static inline bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
> > -{
> > -	return true;
> > -}
> > -#endif
> 
> And macro early_pfn_valid() is not needed either, we may need remove it
> too. 

Ok.

> Otherwise, removing NODES_SPAN_OTHER_NODES in this patch looks good.
> 
> Reviewed-by: Baoquan He <bhe@redhat.com>
> 
> > -
> > -
> >  void __init memblock_free_pages(struct page *page, unsigned long pfn,
> >  							unsigned int order)
> >  {
> > -- 
> > 2.25.1
> > 
> 

-- 
Sincerely yours,
Mike.

^ permalink raw reply

* Re: [PATCH, RESEND, 2/3] selftests/powerpc: enable performance alerts when freezing counters on cycles_with_freeze_test selftest
From: Rashmica Gupta @ 2020-04-23  5:47 UTC (permalink / raw)
  To: Desnes A. Nunes do Rosario, linuxppc-dev; +Cc: shuah, gromero
In-Reply-To: <20200408223543.21168-3-desnesn@linux.ibm.com>

On Wed, 2020-04-08 at 19:35 -0300, Desnes A. Nunes do Rosario wrote:
> From: Gustavo Romero <gromero@linux.ibm.com>
> 
> When disabling freezing counters by setting MMCR0 FC bit to 0, the
> MMCR0
> PMAE bit must also be enabled if a Performance Monitor Alert (and the
> cor-
> responding Performance Monitor Interrupt) is still desired to be
> received
> when an enabled condition or event occurs.
> 
> This is the case of the cycles_with_freeze_test selftest, since the
> test
> disables the MMCR0 PMAE due to the usage of PMU to trigger EBBs. This
> can
> make the test loop up to the point of being killed by the test
> harness
> timeout (2500 ms), since no other ebb event will happen because the
> MMCR0
> PMAE bit is disabled, and thus, no more increments to ebb_count
> occur.
> 
> Fixes: 3752e453f6bafd7 ("selftests/powerpc: Add tests of PMU EBBs")
> Signed-off-by: Gustavo Romero <gromero@linux.ibm.com>
> [desnesn: Only set MMCR0_PMAE when disabling MMCR0_FC, reflow
> comment]
> Signed-off-by: Desnes A. Nunes do Rosario <desnesn@linux.ibm.com>

Reviewed and Tested-by: Rashmica Gupta <rashmica.g@gmail.com>

> ---
>  .../testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c | 2
> +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git
> a/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c
> b/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c
> index 0f2089f6f82c..d368199144fb 100644
> ---
> a/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c
> +++
> b/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c
> @@ -81,7 +81,7 @@ int cycles_with_freeze(void)
>  	{
>  		counters_frozen = false;
>  		mb();
> -		mtspr(SPRN_MMCR0, mfspr(SPRN_MMCR0) & ~MMCR0_FC);
> +		mtspr(SPRN_MMCR0, (mfspr(SPRN_MMCR0) & ~MMCR0_FC) |
> MMCR0_PMAE);
>  
>  		FAIL_IF(core_busy_loop());
>  


^ permalink raw reply

* Re: [PATCH, RESEND, 1/3] selftests/powerpc: Use write_pmc instead of count_pmc to reset PMCs on ebb tests
From: Rashmica Gupta @ 2020-04-23  5:45 UTC (permalink / raw)
  To: Desnes A. Nunes do Rosario, linuxppc-dev; +Cc: shuah, gromero
In-Reply-To: <20200408223543.21168-2-desnesn@linux.ibm.com>

On Wed, 2020-04-08 at 19:35 -0300, Desnes A. Nunes do Rosario wrote:
> By using count_pmc() to reset PMCs instead of write_pmc(), an extra
> count
> is performed on ebb_state.stats.pmc_count[PMC_INDEX(pmc)]. This extra
> pmc_count can occasionally invalidate results, such as the ones from
> cycles_test shown hereafter. The ebb_check_count() failed with an
> above
> the upper limit error due to the extra ebb_state.stats.pmc_count.
> 
> Furthermore, this extra count is also indicated by extra PMC1
> trace_log on
> the output of the cycle test (as well as on pmc56_overflow_test):
> 
> ==========
>    ...
>    [21]: counter = 8
>    [22]: register SPRN_MMCR0 = 0x0000000080000080
>    [23]: register SPRN_PMC1  = 0x0000000080000004
>    [24]: counter = 9
>    [25]: register SPRN_MMCR0 = 0x0000000080000080
>    [26]: register SPRN_PMC1  = 0x0000000080000004
>    [27]: counter = 10
>    [28]: register SPRN_MMCR0 = 0x0000000080000080
>    [29]: register SPRN_PMC1  = 0x0000000080000004
> > > [30]: register SPRN_PMC1  = 0x000000004000051e
> PMC1 count (0x280000546) above upper limit 0x2800003e8 (+0x15e)
> [FAIL] Test FAILED on line 52
> failure: cycles
> ==========
> 
> [desnesn: reflow of original comment]
> Signed-off-by: Desnes A. Nunes do Rosario <desnesn@linux.ibm.com>

Reviewed and Tested-by: Rashmica Gupta <rashmica.g@gmail.com>

> ---
>  .../powerpc/pmu/ebb/back_to_back_ebbs_test.c         |  2 +-
>  .../testing/selftests/powerpc/pmu/ebb/cycles_test.c  |  2 +-
>  .../powerpc/pmu/ebb/cycles_with_freeze_test.c        |  2 +-
>  .../powerpc/pmu/ebb/cycles_with_mmcr2_test.c         |  2 +-
>  tools/testing/selftests/powerpc/pmu/ebb/ebb.c        |  2 +-
>  .../powerpc/pmu/ebb/ebb_on_willing_child_test.c      |  2 +-
>  .../selftests/powerpc/pmu/ebb/lost_exception_test.c  |  2 +-
>  .../selftests/powerpc/pmu/ebb/multi_counter_test.c   | 12 ++++++--
> ----
>  .../selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c |  2 +-
>  .../selftests/powerpc/pmu/ebb/pmae_handling_test.c   |  2 +-
>  .../selftests/powerpc/pmu/ebb/pmc56_overflow_test.c  |  2 +-
>  11 files changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git
> a/tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c
> b/tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c
> index a2d7b0e3dca9..f133ab425f10 100644
> ---
> a/tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c
> +++
> b/tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c
> @@ -91,7 +91,7 @@ int back_to_back_ebbs(void)
>  	ebb_global_disable();
>  	ebb_freeze_pmcs();
>  
> -	count_pmc(1, sample_period);
> +	write_pmc(1, pmc_sample_period(sample_period));
>  
>  	dump_ebb_state();
>  
> diff --git a/tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c
> b/tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c
> index bc893813483e..14a399a64729 100644
> --- a/tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c
> +++ b/tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c
> @@ -42,7 +42,7 @@ int cycles(void)
>  	ebb_global_disable();
>  	ebb_freeze_pmcs();
>  
> -	count_pmc(1, sample_period);
> +	write_pmc(1, pmc_sample_period(sample_period));
>  
>  	dump_ebb_state();
>  
> diff --git
> a/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c
> b/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c
> index dcd351d20328..0f2089f6f82c 100644
> ---
> a/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c
> +++
> b/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c
> @@ -99,7 +99,7 @@ int cycles_with_freeze(void)
>  	ebb_global_disable();
>  	ebb_freeze_pmcs();
>  
> -	count_pmc(1, sample_period);
> +	write_pmc(1, pmc_sample_period(sample_period));
>  
>  	dump_ebb_state();
>  
> diff --git
> a/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c
> b/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c
> index 94c99c12c0f2..a8f3bee04cd8 100644
> ---
> a/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c
> +++
> b/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c
> @@ -71,7 +71,7 @@ int cycles_with_mmcr2(void)
>  	ebb_global_disable();
>  	ebb_freeze_pmcs();
>  
> -	count_pmc(1, sample_period);
> +	write_pmc(1, pmc_sample_period(sample_period));
>  
>  	dump_ebb_state();
>  
> diff --git a/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
> b/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
> index dfbc5c3ad52d..bf6f25dfcf7b 100644
> --- a/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
> +++ b/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
> @@ -396,7 +396,7 @@ int ebb_child(union pipe read_pipe, union pipe
> write_pipe)
>  	ebb_global_disable();
>  	ebb_freeze_pmcs();
>  
> -	count_pmc(1, sample_period);
> +	write_pmc(1, pmc_sample_period(sample_period));
>  
>  	dump_ebb_state();
>  
> diff --git
> a/tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c
> b/tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c
> index ca2f7d729155..513812cdcca1 100644
> ---
> a/tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c
> +++
> b/tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c
> @@ -38,7 +38,7 @@ static int victim_child(union pipe read_pipe, union
> pipe write_pipe)
>  	ebb_global_disable();
>  	ebb_freeze_pmcs();
>  
> -	count_pmc(1, sample_period);
> +	write_pmc(1, pmc_sample_period(sample_period));
>  
>  	dump_ebb_state();
>  
> diff --git
> a/tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c
> b/tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c
> index ac3e6e182614..5979606c41dc 100644
> --- a/tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c
> +++ b/tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c
> @@ -75,7 +75,7 @@ static int test_body(void)
>  	ebb_freeze_pmcs();
>  	ebb_global_disable();
>  
> -	count_pmc(4, sample_period);
> +	write_pmc(4, pmc_sample_period(sample_period));
>  	mtspr(SPRN_PMC4, 0xdead);
>  
>  	dump_summary_ebb_state();
> diff --git
> a/tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c
> b/tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c
> index b8242e9d97d2..227827b665d5 100644
> --- a/tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c
> +++ b/tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c
> @@ -70,12 +70,12 @@ int multi_counter(void)
>  	ebb_global_disable();
>  	ebb_freeze_pmcs();
>  
> -	count_pmc(1, sample_period);
> -	count_pmc(2, sample_period);
> -	count_pmc(3, sample_period);
> -	count_pmc(4, sample_period);
> -	count_pmc(5, sample_period);
> -	count_pmc(6, sample_period);
> +	write_pmc(1, pmc_sample_period(sample_period));
> +	write_pmc(2, pmc_sample_period(sample_period));
> +	write_pmc(3, pmc_sample_period(sample_period));
> +	write_pmc(4, pmc_sample_period(sample_period));
> +	write_pmc(5, pmc_sample_period(sample_period));
> +	write_pmc(6, pmc_sample_period(sample_period));
>  
>  	dump_ebb_state();
>  
> diff --git
> a/tools/testing/selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c
> b/tools/testing/selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c
> index a05c0e18ded6..ade70bed0499 100644
> --- a/tools/testing/selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c
> +++ b/tools/testing/selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c
> @@ -61,7 +61,7 @@ static int cycles_child(void)
>  	ebb_global_disable();
>  	ebb_freeze_pmcs();
>  
> -	count_pmc(1, sample_period);
> +	write_pmc(1, pmc_sample_period(sample_period));
>  
>  	dump_summary_ebb_state();
>  
> diff --git
> a/tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c
> b/tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c
> index 153ebc92234f..7b4bf4ed12cb 100644
> --- a/tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c
> +++ b/tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c
> @@ -82,7 +82,7 @@ static int test_body(void)
>  	ebb_global_disable();
>  	ebb_freeze_pmcs();
>  
> -	count_pmc(1, sample_period);
> +	write_pmc(1, pmc_sample_period(sample_period));
>  
>  	dump_ebb_state();
>  
> diff --git
> a/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c
> b/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c
> index eadad75ed7e6..bb55af71404d 100644
> --- a/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c
> +++ b/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c
> @@ -76,7 +76,7 @@ int pmc56_overflow(void)
>  	ebb_global_disable();
>  	ebb_freeze_pmcs();
>  
> -	count_pmc(2, sample_period);
> +	write_pmc(2, pmc_sample_period(sample_period));
>  
>  	dump_ebb_state();
>  


^ permalink raw reply

* Re: [PATCH V3 0/3] arm64: Enable vmemmap mapping from device memory
From: Anshuman Khandual @ 2020-04-23  5:10 UTC (permalink / raw)
  To: linux-mm
  Cc: Mark Rutland, Michal Hocko, Thomas Gleixner, David Hildenbrand,
	Peter Zijlstra, Catalin Marinas, Dave Hansen, Paul Mackerras,
	linux-ia64, linux-riscv, Will Deacon, jgg, aneesh.kumar, x86,
	Matthew Wilcox (Oracle), Mike Rapoport, Ingo Molnar, Fenghua Yu,
	rcampbell, Pavel Tatashin, jglisse, Andy Lutomirski,
	Paul Walmsley, dan.j.williams, linux-arm-kernel, Tony Luck,
	linuxppc-dev, linux-kernel, Palmer Dabbelt, Andrew Morton,
	robin.murphy, Kirill A. Shutemov
In-Reply-To: <1585631387-18819-1-git-send-email-anshuman.khandual@arm.com>


On 03/31/2020 10:39 AM, Anshuman Khandual wrote:
> This series enables vmemmap backing memory allocation from device memory
> ranges on arm64. But before that, it enables vmemmap_populate_basepages()
> and vmemmap_alloc_block_buf() to accommodate struct vmem_altmap based
> alocation requests.
> 
> This series applies after latest (v14) arm64 memory hot remove series
> (https://lkml.org/lkml/2020/3/3/1746) on Linux 5.6.
> 
> Pending Question:
> 
> altmap_alloc_block_buf() does not have any other remaining users in the
> tree after this change. Should it be converted into a static function and
> it's declaration be dropped from the header (include/linux/mm.h). Avoided
> doing so because I was not sure if there are any off-tree users or not.
> 
> Changes in V3:
> 
> - Dropped comment from free_hotplug_page_range() per Robin
> - Modified comment in unmap_hotplug_range() per Robin
> - Enabled altmap support in vmemmap_alloc_block_buf() per Robin

Just a gentle ping. Any updates on this series ? In particular, is there
any comments or suggestions or concerns with respect to the first two
patches here that change the core MM and relevant call sites on some
platforms. Thank you.

- Anshuman

^ permalink raw reply

* [PATCH 2/2] powerpc: Enable Prefixed Instructions
From: Alistair Popple @ 2020-04-23  4:40 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: mikey, oohall, npiggin, Alistair Popple
In-Reply-To: <20200423044057.5517-1-alistair@popple.id.au>

Prefix instructions have their own FSCR bit which needs to enabled via
a CPU feature. The kernel will save the FSCR for problem state but it
needs to be enabled initially.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
---
 arch/powerpc/kernel/dt_cpu_ftrs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c
index dede8f0b678f..e4caa4456869 100644
--- a/arch/powerpc/kernel/dt_cpu_ftrs.c
+++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
@@ -627,6 +627,7 @@ static struct dt_cpu_feature_match __initdata
 	{"vector-binary128", feat_enable, 0},
 	{"vector-binary16", feat_enable, 0},
 	{"wait-v3", feat_enable, 0},
+	{"prefix-instructions", feat_enable, 0},
 };
 
 static bool __initdata using_dt_cpu_ftrs;
-- 
2.20.1


^ permalink raw reply related

* [PATCH 1/2] powerpc: dt_cpu_ftrs: Set current thread fscr bits
From: Alistair Popple @ 2020-04-23  4:40 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: mikey, oohall, npiggin, Alistair Popple

Setting the FSCR bit directly in the SPR only sets it for the initial
boot and early init of the kernel. When the init process is started it
gets copied from the current thread_struct which does not reflect any
changes made during CPU feature detection. This patch ensures the
current thread_struct state is updated to match FSCR after feature
detection is complete.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
---
 arch/powerpc/kernel/dt_cpu_ftrs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c
index 36bc0d5c4f3a..dede8f0b678f 100644
--- a/arch/powerpc/kernel/dt_cpu_ftrs.c
+++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
@@ -169,6 +169,7 @@ static int __init feat_try_enable_unknown(struct dt_cpu_feature *f)
 		u64 fscr = mfspr(SPRN_FSCR);
 		fscr |= 1UL << f->fscr_bit_nr;
 		mtspr(SPRN_FSCR, fscr);
+		current->thread.fscr |= 1UL << f->fscr_bit_nr;
 	} else {
 		/* Does not have a known recipe */
 		return 0;
@@ -204,6 +205,7 @@ static int __init feat_enable(struct dt_cpu_feature *f)
 			u64 fscr = mfspr(SPRN_FSCR);
 			fscr |= 1UL << f->fscr_bit_nr;
 			mtspr(SPRN_FSCR, fscr);
+			current->thread.fscr |= 1UL << f->fscr_bit_nr;
 		}
 	}
 
-- 
2.20.1


^ permalink raw reply related

* Re: [PATCH v2 1/7] KVM: s390: clean up redundant 'kvm_run' parameters
From: Tianjia Zhang @ 2020-04-23  3:14 UTC (permalink / raw)
  To: Christian Borntraeger, Cornelia Huck
  Cc: wanpengli, kvm, david, heiko.carstens, peterx, linux-mips, hpa,
	kvmarm, linux-s390, frankja, maz, joro, x86, mingo,
	julien.thierry.kdev, thuth, gor, suzuki.poulose, kvm-ppc, bp,
	tglx, linux-arm-kernel, jmattson, tsbogend, christoffer.dall,
	sean.j.christopherson, linux-kernel, james.morse, pbonzini,
	vkuznets, linuxppc-dev
In-Reply-To: <dc5e0fa3-558b-d606-bda9-ed281cf9e9ae@de.ibm.com>



On 2020/4/22 23:58, Christian Borntraeger wrote:
> 
> 
> On 22.04.20 15:45, Cornelia Huck wrote:
>> On Wed, 22 Apr 2020 20:58:04 +0800
>> Tianjia Zhang <tianjia.zhang@linux.alibaba.com> wrote:
>>
>>> In the current kvm version, 'kvm_run' has been included in the 'kvm_vcpu'
>>> structure. Earlier than historical reasons, many kvm-related function
>>
>> s/Earlier than/For/ ?
>>
>>> parameters retain the 'kvm_run' and 'kvm_vcpu' parameters at the same time.
>>> This patch does a unified cleanup of these remaining redundant parameters.
>>>
>>> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
>>> ---
>>>   arch/s390/kvm/kvm-s390.c | 37 ++++++++++++++++++++++---------------
>>>   1 file changed, 22 insertions(+), 15 deletions(-)
>>>
>>> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
>>> index e335a7e5ead7..d7bb2e7a07ff 100644
>>> --- a/arch/s390/kvm/kvm-s390.c
>>> +++ b/arch/s390/kvm/kvm-s390.c
>>> @@ -4176,8 +4176,9 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
>>>   	return rc;
>>>   }
>>>   
>>> -static void sync_regs_fmt2(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>>> +static void sync_regs_fmt2(struct kvm_vcpu *vcpu)
>>>   {
>>> +	struct kvm_run *kvm_run = vcpu->run;
>>>   	struct runtime_instr_cb *riccb;
>>>   	struct gs_cb *gscb;
>>>   
>>> @@ -4235,7 +4236,7 @@ static void sync_regs_fmt2(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>>>   		}
>>>   		if (vcpu->arch.gs_enabled) {
>>>   			current->thread.gs_cb = (struct gs_cb *)
>>> -						&vcpu->run->s.regs.gscb;
>>> +						&kvm_run->s.regs.gscb;
>>
>> Not sure if these changes (vcpu->run-> => kvm_run->) are really worth
>> it. (It seems they amount to at least as much as the changes advertised
>> in the patch description.)
>>
>> Other opinions?
> 
> Agreed. It feels kind of random. Maybe just do the first line (move kvm_run from the
> function parameter list into the variable declaration)? Not sure if this is better.
> 

Why not, `kvm_run` is equivalent to `vcpu->run`, which is also part of 
the cleanup, or do you mean to put this change in another patch?

Thanks,
Tianjia

^ permalink raw reply

* Re: [PATCH 18/21] mm: rename free_area_init_node() to free_area_init_memoryless_node()
From: Baoquan He @ 2020-04-23  3:14 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: Rich Felker, linux-ia64, linux-doc, Catalin Marinas,
	Heiko Carstens, Michal Hocko, James E.J. Bottomley, Max Filippov,
	Guo Ren, linux-csky, linux-parisc, sparclinux, linux-hexagon,
	linux-riscv, Greg Ungerer, linux-arch, linux-s390, linux-snps-arc,
	linux-c6x-dev, Brian Cain, Jonathan Corbet, linux-sh,
	Helge Deller, x86, Russell King, Ley Foon Tan, Mike Rapoport,
	Geert Uytterhoeven, linux-arm-kernel, Mark Salter, Matt Turner,
	linux-mips, uclinux-h8-devel, linux-xtensa, linux-alpha, linux-um,
	linux-m68k, Tony Luck, Greentime Hu, Paul Walmsley,
	Stafford Horne, Guan Xuetao, Hoan Tran, Michal Simek,
	Thomas Bogendoerfer, Yoshinori Sato, Nick Hu, linux-mm,
	Vineet Gupta, linux-kernel, openrisc, Richard Weinberger,
	Andrew Morton, linuxppc-dev, David S. Miller
In-Reply-To: <20200412194859.12663-19-rppt@kernel.org>

On 04/12/20 at 10:48pm, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
> 
> The free_area_init_node() is only used by x86 to initialize a memory-less
> nodes.
> Make its name reflect this and drop all the function parameters except node
> ID as they are anyway zero.
> 
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
>  arch/x86/mm/numa.c | 5 +----
>  include/linux/mm.h | 9 +++------
>  mm/page_alloc.c    | 7 ++-----
>  3 files changed, 6 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
> index fe024b2ac796..8ee952038c80 100644
> --- a/arch/x86/mm/numa.c
> +++ b/arch/x86/mm/numa.c
> @@ -737,12 +737,9 @@ void __init x86_numa_init(void)
>  
>  static void __init init_memory_less_node(int nid)
>  {
> -	unsigned long zones_size[MAX_NR_ZONES] = {0};
> -	unsigned long zholes_size[MAX_NR_ZONES] = {0};
> -
>  	/* Allocate and initialize node data. Memory-less node is now online.*/
>  	alloc_node_data(nid);
> -	free_area_init_node(nid, zones_size, 0, zholes_size);
> +	free_area_init_memoryless_node(nid);
>  
>  	/*
>  	 * All zonelists will be built later in start_kernel() after per cpu
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 1c2ecb42e043..27660f6cf26e 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -2272,8 +2272,7 @@ static inline spinlock_t *pud_lock(struct mm_struct *mm, pud_t *pud)
>  }
>  
>  extern void __init pagecache_init(void);
> -extern void __init free_area_init_node(int nid, unsigned long * zones_size,
> -		unsigned long zone_start_pfn, unsigned long *zholes_size);
> +extern void __init free_area_init_memoryless_node(int nid);
>  extern void free_initmem(void);
>  
>  /*
> @@ -2345,10 +2344,8 @@ static inline unsigned long get_num_physpages(void)
>  
>  /*
>   * Using memblock node mappings, an architecture may initialise its
> - * zones, allocate the backing mem_map and account for memory holes in a more
> - * architecture independent manner. This is a substitute for creating the
> - * zone_sizes[] and zholes_size[] arrays and passing them to
> - * free_area_init_node()
> + * zones, allocate the backing mem_map and account for memory holes in an
> + * architecture independent manner.
>   *
>   * An architecture is expected to register range of page frames backed by
>   * physical memory with memblock_add[_node]() before calling
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 376434c7a78b..e46232ec4849 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -6979,12 +6979,9 @@ static void __init __free_area_init_node(int nid, unsigned long *zones_size,
>  	free_area_init_core(pgdat);
>  }
>  
> -void __init free_area_init_node(int nid, unsigned long *zones_size,
> -				unsigned long node_start_pfn,
> -				unsigned long *zholes_size)
> +void __init free_area_init_memoryless_node(int nid)
>  {
> -	__free_area_init_node(nid, zones_size, node_start_pfn, zholes_size,
> -			      true);
> +	__free_area_init_node(nid, NULL, 0, NULL, false);

Can we move free_area_init_memoryless_node() definition into 
arch/x86/mm/numa.c since there's only one caller there?

And I am also wondering if adding a wrapper
free_area_init_memoryless_node() is necessary if it's only called the
function free_area_init_node().

>  }
>  
>  #if !defined(CONFIG_FLAT_NODE_MEM_MAP)
> -- 
> 2.25.1
> 


^ permalink raw reply

* Re: [PATCH v2 1/7] KVM: s390: clean up redundant 'kvm_run' parameters
From: Tianjia Zhang @ 2020-04-23  3:01 UTC (permalink / raw)
  To: Cornelia Huck, Christian Borntraeger
  Cc: wanpengli, kvm, david, heiko.carstens, peterx, linux-mips, hpa,
	kvmarm, linux-s390, frankja, maz, joro, x86, mingo,
	julien.thierry.kdev, thuth, gor, suzuki.poulose, kvm-ppc, bp,
	tglx, linux-arm-kernel, jmattson, tsbogend, christoffer.dall,
	sean.j.christopherson, linux-kernel, james.morse, pbonzini,
	vkuznets, linuxppc-dev
In-Reply-To: <20200422180403.03f60b0c.cohuck@redhat.com>



On 2020/4/23 0:04, Cornelia Huck wrote:
> On Wed, 22 Apr 2020 17:58:04 +0200
> Christian Borntraeger <borntraeger@de.ibm.com> wrote:
> 
>> On 22.04.20 15:45, Cornelia Huck wrote:
>>> On Wed, 22 Apr 2020 20:58:04 +0800
>>> Tianjia Zhang <tianjia.zhang@linux.alibaba.com> wrote:
>>>    
>>>> In the current kvm version, 'kvm_run' has been included in the 'kvm_vcpu'
>>>> structure. Earlier than historical reasons, many kvm-related function
>>>
>>> s/Earlier than/For/ ?
>>>    
>>>> parameters retain the 'kvm_run' and 'kvm_vcpu' parameters at the same time.
>>>> This patch does a unified cleanup of these remaining redundant parameters.
>>>>
>>>> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
>>>> ---
>>>>   arch/s390/kvm/kvm-s390.c | 37 ++++++++++++++++++++++---------------
>>>>   1 file changed, 22 insertions(+), 15 deletions(-)
>>>>
>>>> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
>>>> index e335a7e5ead7..d7bb2e7a07ff 100644
>>>> --- a/arch/s390/kvm/kvm-s390.c
>>>> +++ b/arch/s390/kvm/kvm-s390.c
>>>> @@ -4176,8 +4176,9 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
>>>>   	return rc;
>>>>   }
>>>>   
>>>> -static void sync_regs_fmt2(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>>>> +static void sync_regs_fmt2(struct kvm_vcpu *vcpu)
>>>>   {
>>>> +	struct kvm_run *kvm_run = vcpu->run;
>>>>   	struct runtime_instr_cb *riccb;
>>>>   	struct gs_cb *gscb;
>>>>   
>>>> @@ -4235,7 +4236,7 @@ static void sync_regs_fmt2(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>>>>   		}
>>>>   		if (vcpu->arch.gs_enabled) {
>>>>   			current->thread.gs_cb = (struct gs_cb *)
>>>> -						&vcpu->run->s.regs.gscb;
>>>> +						&kvm_run->s.regs.gscb;
>>>
>>> Not sure if these changes (vcpu->run-> => kvm_run->) are really worth
>>> it. (It seems they amount to at least as much as the changes advertised
>>> in the patch description.)
>>>
>>> Other opinions?
>>
>> Agreed. It feels kind of random. Maybe just do the first line (move kvm_run from the
>> function parameter list into the variable declaration)? Not sure if this is better.
>>
> 
> There's more in this patch that I cut... but I think just moving
> kvm_run from the parameter list would be much less disruptive.
> 

I think there are two kinds of code(`vcpu->run->` and `kvm_run->`), but 
there will be more disruptive, not less.

Thanks,
Tianjia

^ permalink raw reply

* Re: [PATCH 17/21] mm: free_area_init: allow defining max_zone_pfn in descending order
From: Baoquan He @ 2020-04-23  2:57 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: Rich Felker, linux-ia64, linux-doc, Catalin Marinas,
	Heiko Carstens, Michal Hocko, James E.J. Bottomley, Max Filippov,
	Guo Ren, linux-csky, linux-parisc, sparclinux, linux-hexagon,
	linux-riscv, Greg Ungerer, linux-arch, linux-s390, linux-snps-arc,
	linux-c6x-dev, Brian Cain, Jonathan Corbet, linux-sh,
	Helge Deller, x86, Russell King, Ley Foon Tan, Mike Rapoport,
	Geert Uytterhoeven, linux-arm-kernel, Mark Salter, Matt Turner,
	linux-mips, uclinux-h8-devel, linux-xtensa, linux-alpha, linux-um,
	linux-m68k, Tony Luck, Greentime Hu, Paul Walmsley,
	Stafford Horne, Guan Xuetao, Hoan Tran, Michal Simek,
	Thomas Bogendoerfer, Yoshinori Sato, Nick Hu, linux-mm,
	Vineet Gupta, linux-kernel, openrisc, Richard Weinberger,
	Andrew Morton, linuxppc-dev, David S. Miller
In-Reply-To: <20200423025311.GZ4247@MiWiFi-R3L-srv>

On 04/23/20 at 10:53am, Baoquan He wrote:
> On 04/12/20 at 10:48pm, Mike Rapoport wrote:
> > From: Mike Rapoport <rppt@linux.ibm.com>
> > 
> > Some architectures (e.g. ARC) have the ZONE_HIGHMEM zone below the
> > ZONE_NORMAL. Allowing free_area_init() parse max_zone_pfn array even it is
> > sorted in descending order allows using free_area_init() on such
> > architectures.
> > 
> > Add top -> down traversal of max_zone_pfn array in free_area_init() and use
> > the latter in ARC node/zone initialization.
> 
> Or maybe leave ARC as is. The change in this patchset doesn't impact
> ARC's handling about zone initialization, leaving it as is can reduce
> the complication in implementation of free_area_init(), which is a
> common function. So I personally don't see a strong motivation to have
> this patch.

OK, seems this patch is prepared to simplify free_area_init_node(), so
take back what I said at above.

Then this looks necessary, even though it introduces special case into
common function free_area_init().

Reviewed-by: Baoquan He <bhe@redhat.com>

> 
> > 
> > Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> > ---
> >  arch/arc/mm/init.c | 36 +++++++-----------------------------
> >  mm/page_alloc.c    | 24 +++++++++++++++++++-----
> >  2 files changed, 26 insertions(+), 34 deletions(-)
> > 
> > diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
> > index 0920c969c466..41eb9be1653c 100644
> > --- a/arch/arc/mm/init.c
> > +++ b/arch/arc/mm/init.c
> > @@ -63,11 +63,13 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
> >  
> >  		low_mem_sz = size;
> >  		in_use = 1;
> > +		memblock_add_node(base, size, 0);
> >  	} else {
> >  #ifdef CONFIG_HIGHMEM
> >  		high_mem_start = base;
> >  		high_mem_sz = size;
> >  		in_use = 1;
> > +		memblock_add_node(base, size, 1);
> >  #endif
> >  	}
> >  
> > @@ -83,8 +85,7 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
> >   */
> >  void __init setup_arch_memory(void)
> >  {
> > -	unsigned long zones_size[MAX_NR_ZONES];
> > -	unsigned long zones_holes[MAX_NR_ZONES];
> > +	unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0 };
> >  
> >  	init_mm.start_code = (unsigned long)_text;
> >  	init_mm.end_code = (unsigned long)_etext;
> > @@ -115,7 +116,6 @@ void __init setup_arch_memory(void)
> >  	 * the crash
> >  	 */
> >  
> > -	memblock_add_node(low_mem_start, low_mem_sz, 0);
> >  	memblock_reserve(CONFIG_LINUX_LINK_BASE,
> >  			 __pa(_end) - CONFIG_LINUX_LINK_BASE);
> >  
> > @@ -133,22 +133,7 @@ void __init setup_arch_memory(void)
> >  	memblock_dump_all();
> >  
> >  	/*----------------- node/zones setup --------------------------*/
> > -	memset(zones_size, 0, sizeof(zones_size));
> > -	memset(zones_holes, 0, sizeof(zones_holes));
> > -
> > -	zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
> > -	zones_holes[ZONE_NORMAL] = 0;
> > -
> > -	/*
> > -	 * We can't use the helper free_area_init(zones[]) because it uses
> > -	 * PAGE_OFFSET to compute the @min_low_pfn which would be wrong
> > -	 * when our kernel doesn't start at PAGE_OFFSET, i.e.
> > -	 * PAGE_OFFSET != CONFIG_LINUX_RAM_BASE
> > -	 */
> > -	free_area_init_node(0,			/* node-id */
> > -			    zones_size,		/* num pages per zone */
> > -			    min_low_pfn,	/* first pfn of node */
> > -			    zones_holes);	/* holes */
> > +	max_zone_pfn[ZONE_NORMAL] = max_low_pfn;
> >  
> >  #ifdef CONFIG_HIGHMEM
> >  	/*
> > @@ -168,20 +153,13 @@ void __init setup_arch_memory(void)
> >  	min_high_pfn = PFN_DOWN(high_mem_start);
> >  	max_high_pfn = PFN_DOWN(high_mem_start + high_mem_sz);
> >  
> > -	zones_size[ZONE_NORMAL] = 0;
> > -	zones_holes[ZONE_NORMAL] = 0;
> > -
> > -	zones_size[ZONE_HIGHMEM] = max_high_pfn - min_high_pfn;
> > -	zones_holes[ZONE_HIGHMEM] = 0;
> > -
> > -	free_area_init_node(1,			/* node-id */
> > -			    zones_size,		/* num pages per zone */
> > -			    min_high_pfn,	/* first pfn of node */
> > -			    zones_holes);	/* holes */
> > +	max_zone_pfn[ZONE_HIGHMEM] = max_high_pfn;
> >  
> >  	high_memory = (void *)(min_high_pfn << PAGE_SHIFT);
> >  	kmap_init();
> >  #endif
> > +
> > +	free_area_init(max_zone_pfn);
> >  }
> >  
> >  /*
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index 343d87b8697d..376434c7a78b 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -7429,7 +7429,8 @@ static void check_for_memory(pg_data_t *pgdat, int nid)
> >  void __init free_area_init(unsigned long *max_zone_pfn)
> >  {
> >  	unsigned long start_pfn, end_pfn;
> > -	int i, nid;
> > +	int i, nid, zone;
> > +	bool descending = false;
> >  
> >  	/* Record where the zone boundaries are */
> >  	memset(arch_zone_lowest_possible_pfn, 0,
> > @@ -7439,13 +7440,26 @@ void __init free_area_init(unsigned long *max_zone_pfn)
> >  
> >  	start_pfn = find_min_pfn_with_active_regions();
> >  
> > +	/*
> > +	 * Some architecturs, e.g. ARC may have ZONE_HIGHMEM below
> > +	 * ZONE_NORMAL. For such cases we allow max_zone_pfn sorted in the
> > +	 * descending order
> > +	 */
> > +	if (MAX_NR_ZONES > 1 && max_zone_pfn[0] > max_zone_pfn[1])
> > +		descending = true;
> > +
> >  	for (i = 0; i < MAX_NR_ZONES; i++) {
> > -		if (i == ZONE_MOVABLE)
> > +		if (descending)
> > +			zone = MAX_NR_ZONES - i - 1;
> > +		else
> > +			zone = i;
> > +
> > +		if (zone == ZONE_MOVABLE)
> >  			continue;
> >  
> > -		end_pfn = max(max_zone_pfn[i], start_pfn);
> > -		arch_zone_lowest_possible_pfn[i] = start_pfn;
> > -		arch_zone_highest_possible_pfn[i] = end_pfn;
> > +		end_pfn = max(max_zone_pfn[zone], start_pfn);
> > +		arch_zone_lowest_possible_pfn[zone] = start_pfn;
> > +		arch_zone_highest_possible_pfn[zone] = end_pfn;
> >  
> >  		start_pfn = end_pfn;
> >  	}
> > -- 
> > 2.25.1
> > 


^ permalink raw reply

* Re: [PATCH v2 1/7] KVM: s390: clean up redundant 'kvm_run' parameters
From: Tianjia Zhang @ 2020-04-23  2:54 UTC (permalink / raw)
  To: Cornelia Huck
  Cc: wanpengli, kvm, david, heiko.carstens, peterx, linux-mips, hpa,
	kvmarm, linux-s390, frankja, maz, joro, x86, borntraeger, mingo,
	julien.thierry.kdev, thuth, gor, suzuki.poulose, kvm-ppc, bp,
	tglx, linux-arm-kernel, jmattson, tsbogend, christoffer.dall,
	sean.j.christopherson, linux-kernel, james.morse, pbonzini,
	vkuznets, linuxppc-dev
In-Reply-To: <20200422154543.2efba3dd.cohuck@redhat.com>



On 2020/4/22 21:45, Cornelia Huck wrote:
> On Wed, 22 Apr 2020 20:58:04 +0800
> Tianjia Zhang <tianjia.zhang@linux.alibaba.com> wrote:
> 
>> In the current kvm version, 'kvm_run' has been included in the 'kvm_vcpu'
>> structure. Earlier than historical reasons, many kvm-related function
> 
> s/Earlier than/For/ ?
> 

Yes, it should be replaced like this.

>> parameters retain the 'kvm_run' and 'kvm_vcpu' parameters at the same time.
>> This patch does a unified cleanup of these remaining redundant parameters.
>>
>> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
>> ---
>>   arch/s390/kvm/kvm-s390.c | 37 ++++++++++++++++++++++---------------
>>   1 file changed, 22 insertions(+), 15 deletions(-)
>>
>> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
>> index e335a7e5ead7..d7bb2e7a07ff 100644
>> --- a/arch/s390/kvm/kvm-s390.c
>> +++ b/arch/s390/kvm/kvm-s390.c
>> @@ -4176,8 +4176,9 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
>>   	return rc;
>>   }
>>   
>> -static void sync_regs_fmt2(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>> +static void sync_regs_fmt2(struct kvm_vcpu *vcpu)
>>   {
>> +	struct kvm_run *kvm_run = vcpu->run;
>>   	struct runtime_instr_cb *riccb;
>>   	struct gs_cb *gscb;
>>   
>> @@ -4235,7 +4236,7 @@ static void sync_regs_fmt2(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>>   		}
>>   		if (vcpu->arch.gs_enabled) {
>>   			current->thread.gs_cb = (struct gs_cb *)
>> -						&vcpu->run->s.regs.gscb;
>> +						&kvm_run->s.regs.gscb;
> 
> Not sure if these changes (vcpu->run-> => kvm_run->) are really worth
> it. (It seems they amount to at least as much as the changes advertised
> in the patch description.)
> 
> Other opinions?
> 

Why not replace `vcpu->run->` to `kvm_run->` ? If not, there will be 
both styles of code, which is confusing. I will be confused and think 
that this is something different.

Thanks,
Tianjia

>>   			restore_gs_cb(current->thread.gs_cb);
>>   		}
>>   		preempt_enable();

^ permalink raw reply

* Re: [PATCH 17/21] mm: free_area_init: allow defining max_zone_pfn in descending order
From: Baoquan He @ 2020-04-23  2:53 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: Rich Felker, linux-ia64, linux-doc, Catalin Marinas,
	Heiko Carstens, Michal Hocko, James E.J. Bottomley, Max Filippov,
	Guo Ren, linux-csky, linux-parisc, sparclinux, linux-hexagon,
	linux-riscv, Greg Ungerer, linux-arch, linux-s390, linux-snps-arc,
	linux-c6x-dev, Brian Cain, Jonathan Corbet, linux-sh,
	Helge Deller, x86, Russell King, Ley Foon Tan, Mike Rapoport,
	Geert Uytterhoeven, linux-arm-kernel, Mark Salter, Matt Turner,
	linux-mips, uclinux-h8-devel, linux-xtensa, linux-alpha, linux-um,
	linux-m68k, Tony Luck, Greentime Hu, Paul Walmsley,
	Stafford Horne, Guan Xuetao, Hoan Tran, Michal Simek,
	Thomas Bogendoerfer, Yoshinori Sato, Nick Hu, linux-mm,
	Vineet Gupta, linux-kernel, openrisc, Richard Weinberger,
	Andrew Morton, linuxppc-dev, David S. Miller
In-Reply-To: <20200412194859.12663-18-rppt@kernel.org>

On 04/12/20 at 10:48pm, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
> 
> Some architectures (e.g. ARC) have the ZONE_HIGHMEM zone below the
> ZONE_NORMAL. Allowing free_area_init() parse max_zone_pfn array even it is
> sorted in descending order allows using free_area_init() on such
> architectures.
> 
> Add top -> down traversal of max_zone_pfn array in free_area_init() and use
> the latter in ARC node/zone initialization.

Or maybe leave ARC as is. The change in this patchset doesn't impact
ARC's handling about zone initialization, leaving it as is can reduce
the complication in implementation of free_area_init(), which is a
common function. So I personally don't see a strong motivation to have
this patch.

> 
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
>  arch/arc/mm/init.c | 36 +++++++-----------------------------
>  mm/page_alloc.c    | 24 +++++++++++++++++++-----
>  2 files changed, 26 insertions(+), 34 deletions(-)
> 
> diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
> index 0920c969c466..41eb9be1653c 100644
> --- a/arch/arc/mm/init.c
> +++ b/arch/arc/mm/init.c
> @@ -63,11 +63,13 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
>  
>  		low_mem_sz = size;
>  		in_use = 1;
> +		memblock_add_node(base, size, 0);
>  	} else {
>  #ifdef CONFIG_HIGHMEM
>  		high_mem_start = base;
>  		high_mem_sz = size;
>  		in_use = 1;
> +		memblock_add_node(base, size, 1);
>  #endif
>  	}
>  
> @@ -83,8 +85,7 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
>   */
>  void __init setup_arch_memory(void)
>  {
> -	unsigned long zones_size[MAX_NR_ZONES];
> -	unsigned long zones_holes[MAX_NR_ZONES];
> +	unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0 };
>  
>  	init_mm.start_code = (unsigned long)_text;
>  	init_mm.end_code = (unsigned long)_etext;
> @@ -115,7 +116,6 @@ void __init setup_arch_memory(void)
>  	 * the crash
>  	 */
>  
> -	memblock_add_node(low_mem_start, low_mem_sz, 0);
>  	memblock_reserve(CONFIG_LINUX_LINK_BASE,
>  			 __pa(_end) - CONFIG_LINUX_LINK_BASE);
>  
> @@ -133,22 +133,7 @@ void __init setup_arch_memory(void)
>  	memblock_dump_all();
>  
>  	/*----------------- node/zones setup --------------------------*/
> -	memset(zones_size, 0, sizeof(zones_size));
> -	memset(zones_holes, 0, sizeof(zones_holes));
> -
> -	zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
> -	zones_holes[ZONE_NORMAL] = 0;
> -
> -	/*
> -	 * We can't use the helper free_area_init(zones[]) because it uses
> -	 * PAGE_OFFSET to compute the @min_low_pfn which would be wrong
> -	 * when our kernel doesn't start at PAGE_OFFSET, i.e.
> -	 * PAGE_OFFSET != CONFIG_LINUX_RAM_BASE
> -	 */
> -	free_area_init_node(0,			/* node-id */
> -			    zones_size,		/* num pages per zone */
> -			    min_low_pfn,	/* first pfn of node */
> -			    zones_holes);	/* holes */
> +	max_zone_pfn[ZONE_NORMAL] = max_low_pfn;
>  
>  #ifdef CONFIG_HIGHMEM
>  	/*
> @@ -168,20 +153,13 @@ void __init setup_arch_memory(void)
>  	min_high_pfn = PFN_DOWN(high_mem_start);
>  	max_high_pfn = PFN_DOWN(high_mem_start + high_mem_sz);
>  
> -	zones_size[ZONE_NORMAL] = 0;
> -	zones_holes[ZONE_NORMAL] = 0;
> -
> -	zones_size[ZONE_HIGHMEM] = max_high_pfn - min_high_pfn;
> -	zones_holes[ZONE_HIGHMEM] = 0;
> -
> -	free_area_init_node(1,			/* node-id */
> -			    zones_size,		/* num pages per zone */
> -			    min_high_pfn,	/* first pfn of node */
> -			    zones_holes);	/* holes */
> +	max_zone_pfn[ZONE_HIGHMEM] = max_high_pfn;
>  
>  	high_memory = (void *)(min_high_pfn << PAGE_SHIFT);
>  	kmap_init();
>  #endif
> +
> +	free_area_init(max_zone_pfn);
>  }
>  
>  /*
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 343d87b8697d..376434c7a78b 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -7429,7 +7429,8 @@ static void check_for_memory(pg_data_t *pgdat, int nid)
>  void __init free_area_init(unsigned long *max_zone_pfn)
>  {
>  	unsigned long start_pfn, end_pfn;
> -	int i, nid;
> +	int i, nid, zone;
> +	bool descending = false;
>  
>  	/* Record where the zone boundaries are */
>  	memset(arch_zone_lowest_possible_pfn, 0,
> @@ -7439,13 +7440,26 @@ void __init free_area_init(unsigned long *max_zone_pfn)
>  
>  	start_pfn = find_min_pfn_with_active_regions();
>  
> +	/*
> +	 * Some architecturs, e.g. ARC may have ZONE_HIGHMEM below
> +	 * ZONE_NORMAL. For such cases we allow max_zone_pfn sorted in the
> +	 * descending order
> +	 */
> +	if (MAX_NR_ZONES > 1 && max_zone_pfn[0] > max_zone_pfn[1])
> +		descending = true;
> +
>  	for (i = 0; i < MAX_NR_ZONES; i++) {
> -		if (i == ZONE_MOVABLE)
> +		if (descending)
> +			zone = MAX_NR_ZONES - i - 1;
> +		else
> +			zone = i;
> +
> +		if (zone == ZONE_MOVABLE)
>  			continue;
>  
> -		end_pfn = max(max_zone_pfn[i], start_pfn);
> -		arch_zone_lowest_possible_pfn[i] = start_pfn;
> -		arch_zone_highest_possible_pfn[i] = end_pfn;
> +		end_pfn = max(max_zone_pfn[zone], start_pfn);
> +		arch_zone_lowest_possible_pfn[zone] = start_pfn;
> +		arch_zone_highest_possible_pfn[zone] = end_pfn;
>  
>  		start_pfn = end_pfn;
>  	}
> -- 
> 2.25.1
> 


^ permalink raw reply

* Re: [musl] Powerpc Linux 'scv' system call ABI proposal take 2
From: Rich Felker @ 2020-04-23  2:36 UTC (permalink / raw)
  To: Nicholas Piggin
  Cc: libc-dev, libc-alpha, linuxppc-dev, Adhemerval Zanella, musl
In-Reply-To: <1587531042.1qvc287tsc.astroid@bobo.none>

On Wed, Apr 22, 2020 at 04:18:36PM +1000, Nicholas Piggin wrote:
> Yeah I had a bit of a play around with musl (which is very nice code I
> must say). The powerpc64 syscall asm is missing ctr clobber by the way.  
> Fortunately adding it doesn't change code generation for me, but it 
> should be fixed. glibc had the same bug at one point I think (probably 
> due to syscall ABI documentation not existing -- something now lives in 
> linux/Documentation/powerpc/syscall64-abi.rst).

Do you know anywhere I can read about the ctr issue, possibly the
relevant glibc bug report? I'm not particularly familiar with ppc
register file (at least I have to refamiliarize myself every time I
work on this stuff) so it'd be nice to understand what's
potentially-wrong now.

Rich

^ permalink raw reply

* Re:Re: [PATCH v2,RESEND] misc: new driver sram_uapi for user level SRAM access
From: 王文虎 @ 2020-04-23  2:26 UTC (permalink / raw)
  To: 王文虎
  Cc: robh, arnd, gregkh, Randy Dunlap, linux-kernel, Scott Wood,
	kernel, linuxppc-dev
In-Reply-To: <AEcAyQCMCDKzrJl2z8MdhKp5.3.1587602127200.Hmail.wenhu.wang@vivo.com>

>Hi, Scott, Greg,
>
>Thank you for your helpful comments.
>For that Greg mentioned that the patch (or patch series) via UIO should worked through,
>so I want to make it clear that if it would go upstream?(And if so, when? No push, just ask)
>
>Also I have been wondering how the patches with components in different subsystems
>go get upstream to the mainline? Like patch 1-3 are of linuxppc-dev, and patch 4 is of
>subsystem UIO, and if acceptable, how would you deal with them?
>
>Back to the devicetree thing, I make it detached from hardware compatibilities which belong
>to the hardware level driver and also used module parameter for of_id definition as dt-binding
>is not allowed for UIO now. So as I can see, things may go well and there is no harm to anything,
>I hope you(Scott) please take a re-consideration. 
>

I mean I have get some new work done based on the comments of Arnd, Scott and Greg. Also a lot of tests done.
So it would be better to make it clear whether I shoud keep the work going or the UIO version is to be accepted
to go upstream recently in the future.

Thanks & regards,
Wenhu
>
>>On Sun, 2020-04-19 at 20:05 -0700, Wang Wenhu wrote:
>>> +static void sram_uapi_res_insert(struct sram_uapi *uapi,
>>> +				 struct sram_resource *res)
>>> +{
>>> +	struct sram_resource *cur, *tmp;
>>> +	struct list_head *head = &uapi->res_list;
>>> +
>>> +	list_for_each_entry_safe(cur, tmp, head, list) {
>>> +		if (&tmp->list != head &&
>>> +		    (cur->info.offset + cur->info.size + res->info.size <=
>>> +		    tmp->info.offset)) {
>>> +			res->info.offset = cur->info.offset + cur->info.size;
>>> +			res->parent = uapi;
>>> +			list_add(&res->list, &cur->list);
>>> +			return;
>>> +		}
>>> +	}
>>
>>We don't need yet another open coded allocator.  If you really need to do this
>>then use include/linux/genalloc.h, but maybe keep it simple and just have one
>>allocaton per file descriptor so you don't need to manage fd offsets?
>>
>>> +static struct sram_resource *sram_uapi_find_res(struct sram_uapi *uapi,
>>> +						__u32 offset)
>>> +{
>>> +	struct sram_resource *res;
>>> +
>>> +	list_for_each_entry(res, &uapi->res_list, list) {
>>> +		if (res->info.offset == offset)
>>> +			return res;
>>> +	}
>>> +
>>> +	return NULL;
>>> +}
>>
>>What if the allocation is more than one page, and the user mmaps starting
>>somewhere other than the first page?
>>
>>> +	switch (cmd) {
>>> +	case SRAM_UAPI_IOC_SET_SRAM_TYPE:
>>> +		if (uapi->sa)
>>> +			return -EEXIST;
>>> +
>>> +		get_user(type, (const __u32 __user *)arg);
>>> +		uapi->sa = get_sram_api_from_type(type);
>>> +		if (uapi->sa)
>>> +			ret = 0;
>>> +		else
>>> +			ret = -ENODEV;
>>> +
>>> +		break;
>>> +
>>
>>Just expose one device per backing SRAM, especially if the user has any reason
>>to care about where the SRAM is coming from (correlating sysfs nodes is much
>>more expressive than some vague notion of "type").
>>
>>> +	case SRAM_UAPI_IOC_ALLOC:
>>> +		if (!uapi->sa)
>>> +			return -EINVAL;
>>> +
>>> +		res = kzalloc(sizeof(*res), GFP_KERNEL);
>>> +		if (!res)
>>> +			return -ENOMEM;
>>> +
>>> +		size = copy_from_user((void *)&res->info,
>>> +				      (const void __user *)arg,
>>> +				      sizeof(res->info));
>>> +		if (!PAGE_ALIGNED(res->info.size) || !res->info.size)
>>> +			return -EINVAL;
>>
>>Missing EFAULT test (here and elsewhere), and res leaks on error.
>>
>>> +
>>> +		res->virt = (void *)uapi->sa->sram_alloc(res->info.size,
>>> +							 &res->phys,
>>> +							 PAGE_SIZE);
>>
>>Do we really need multiple allocators, or could the backend be limited to just
>>adding regions to a generic allocator (with that allocator also serving in-
>>kernel users)?
>>
>>If sram_alloc is supposed to return a virtual address, why isn't that the
>>return type?
>>
>>> +		if (!res->virt) {
>>> +			kfree(res);
>>> +			return -ENOMEM;
>>> +		}
>>
>>ENOSPC might be more appropriate, as this isn't general-purpose RAM.
>>
>>> +
>>> +		sram_uapi_res_insert(uapi, res);
>>> +		size = copy_to_user((void __user *)arg,
>>> +				    (const void *)&res->info,
>>> +				    sizeof(res->info));
>>> +
>>> +		ret = 0;
>>> +		break;
>>> +
>>> +	case SRAM_UAPI_IOC_FREE:
>>> +		if (!uapi->sa)
>>> +			return -EINVAL;
>>> +
>>> +		size = copy_from_user((void *)&info, (const void __user *)arg,
>>> +				      sizeof(info));
>>> +
>>> +		res = sram_uapi_res_delete(uapi, &info);
>>> +		if (!res) {
>>> +			pr_err("error no sram resource found\n");
>>> +			return -EINVAL;
>>> +		}
>>> +
>>> +		uapi->sa->sram_free(res->virt);
>>> +		kfree(res);
>>> +
>>> +		ret = 0;
>>> +		break;
>>
>>So you can just delete any arbitrary offset, even if you weren't the one that
>>allocated it?  Even if this isn't meant for unprivileged use it seems error-
>>prone.  
>>
>>> +
>>> +	default:
>>> +		pr_err("error no cmd not supported\n");
>>> +		break;
>>> +	}
>>> +
>>> +	return ret;
>>> +}
>>> +
>>> +static int sram_uapi_mmap(struct file *filp, struct vm_area_struct *vma)
>>> +{
>>> +	struct sram_uapi *uapi = filp->private_data;
>>> +	struct sram_resource *res;
>>> +
>>> +	res = sram_uapi_find_res(uapi, vma->vm_pgoff);
>>> +	if (!res)
>>> +		return -EINVAL;
>>> +
>>> +	if (vma->vm_end - vma->vm_start > res->info.size)
>>> +		return -EINVAL;
>>> +
>>> +	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
>>> +
>>> +	return remap_pfn_range(vma, vma->vm_start,
>>> +			       res->phys >> PAGE_SHIFT,
>>> +			       vma->vm_end - vma->vm_start,
>>> +			       vma->vm_page_prot);
>>> +}
>>
>>Will noncached always be what's wanted here?
>>
>>-Scott
>>
>>
>
>



^ permalink raw reply

* Re: [PATCH] i2c: powermac: Simplify reading the "reg" and "i2c-address" property
From: Erhard F. @ 2020-04-22 21:07 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Kate Stewart, linux-kernel, Richard Fontana, Paul Mackerras,
	linux-i2c, Greg Kroah-Hartman, Thomas Gleixner, linuxppc-dev,
	Aishwarya R
In-Reply-To: <20200421093712.GA1241@ninjato>

On Tue, 21 Apr 2020 11:37:13 +0200
Wolfram Sang <wsa@the-dreams.de> wrote:

> On Wed, Apr 15, 2020 at 06:49:14PM +0530, Aishwarya R wrote:
> > >> Use of_property_read_u32 to read the "reg" and "i2c-address" property
> > >> instead of using of_get_property to check the return values.
> > >>
> > >> Signed-off-by: Aishwarya R <aishwaryarj100@gmail.com>  
> >   
> > > This is quite a fragile driver. Have you tested it on HW?  
> > 
> > This change is not tested with the Hardware.
> > But of_property_read_u32 is better here than generic of_get_property.
> > This make sure that value read properly independent of system endianess.  
> 
> This driver is only used on PPC_BE. And it is *very* fragile. The gain
> is not enough for me to accept it without testing. Maybe Erhard (CCed)
> is interested. If not, you may find someone on the ppc lists.
> 

I applied the patch on top of kernel 5.6.6 and tested it on a PowerMac G4 3,6 DP and a PowerMac G5 11,2. Both machines run without anything suspicious going on. dmesg | grep i2c looks the same with patch and without patch.

Tested-by: Erhard Furtner <erhard_f@mailbox.org>

^ permalink raw reply

* [Bug 199471] [Bisected][Regression] windfarm_pm* no longer gets automatically loaded when CONFIG_I2C_POWERMAC=y is set
From: bugzilla-daemon @ 2020-04-23  1:36 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <bug-199471-206035@https.bugzilla.kernel.org/>

https://bugzilla.kernel.org/show_bug.cgi?id=199471

--- Comment #21 from Erhard F. (erhard_f@mailbox.org) ---
(In reply to Dennis Clarke from comment #20)
> 
> Possibly unrelated but there appears to be a small memory leak within
> windfarm_* somewhere given that I see traffic in kmemleak :
> 
> [...]
> 
> I will take a look into it and see what I can see.

Thanks, but probably there's no need to. ;)

There is already a patch floating around in the bug where I reported the
memleak originally: https://bugzilla.kernel.org/show_bug.cgi?id=206695

The patch just didn't went upstream yet.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply

* [Bug 199471] [Bisected][Regression] windfarm_pm* no longer gets automatically loaded when CONFIG_I2C_POWERMAC=y is set
From: bugzilla-daemon @ 2020-04-23  1:21 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <bug-199471-206035@https.bugzilla.kernel.org/>

https://bugzilla.kernel.org/show_bug.cgi?id=199471

--- Comment #20 from Dennis Clarke (dclarke@blastwave.org) ---


Possibly unrelated but there appears to be a small memory leak within
windfarm_* somewhere given that I see traffic in kmemleak :


enceladus# 
enceladus# uname -a 
Linux enceladus 5.7.0-rc2 #1 SMP Tue Apr 21 23:32:43 UTC 2020 ppc64 GNU/Linux

enceladus# lsmod | grep 'farm' 
windfarm_cpufreq_clamp     4640  1
windfarm_smu_sensors     9548  1
windfarm_smu_controls     9078  8
windfarm_pm112         15935  0
windfarm_pid            4378  1 windfarm_pm112
windfarm_smu_sat        9802  9 windfarm_pm112
windfarm_max6690_sensor     5434  1
windfarm_lm75_sensor     6148  1
windfarm_core          16619  7
windfarm_cpufreq_clamp,windfarm_smu_controls,windfarm_max6690_sensor,windfarm_smu_sat,windfarm_smu_sensors,windfarm_lm75_sensor,windfarm_pm112
enceladus# 

enceladus# cat /sys/kernel/debug/kmemleak
unreferenced object 0xc00000000867a6a0 (size 32):
  comm "kwindfarm", pid 175, jiffies 4294894706 (age 1843.540s)
  hex dump (first 32 bytes):
    c8 06 02 7f ff 02 ff 01 fb bf 00 59 00 20 00 00  ...........Y. ..
    00 07 89 37 00 a0 00 00 6b 6b 6b 6b 6b 6b 6b a5  ...7....kkkkkkk.
  backtrace:
    [<00000000fce2b937>] .smu_sat_get_sdb_partition+0x150/0x2f0
[windfarm_smu_sat]
    [<00000000e6cc23fc>] .pm112_wf_notify+0x624/0x1460 [windfarm_pm112]
    [<000000008cdab940>] .notifier_call_chain+0x88/0xf0
    [<000000008f026422>] .__blocking_notifier_call_chain+0x6c/0xc0
    [<0000000045480c67>] .wf_thread_func+0xe4/0x1e0 [windfarm_core]
    [<0000000079c8bd6f>] .kthread+0x1b8/0x1d0
    [<0000000073e2b812>] .ret_from_kernel_thread+0x58/0x74
unreferenced object 0xc0000002612a15a0 (size 16):
  comm "kwindfarm", pid 175, jiffies 4294894926 (age 1842.660s)
  hex dump (first 16 bytes):
    c4 04 01 7f a0 12 20 5f ff 55 b8 14 7b 12 00 00  ...... _.U..{...
  backtrace:
    [<00000000fce2b937>] .smu_sat_get_sdb_partition+0x150/0x2f0
[windfarm_smu_sat]
    [<0000000050e586af>] .pm112_wf_notify+0x66c/0x1460 [windfarm_pm112]
    [<000000008cdab940>] .notifier_call_chain+0x88/0xf0
    [<000000008f026422>] .__blocking_notifier_call_chain+0x6c/0xc0
    [<0000000045480c67>] .wf_thread_func+0xe4/0x1e0 [windfarm_core]
    [<0000000079c8bd6f>] .kthread+0x1b8/0x1d0
    [<0000000073e2b812>] .ret_from_kernel_thread+0x58/0x74
unreferenced object 0xc00000000867ba20 (size 32):
  comm "kwindfarm", pid 175, jiffies 4294895089 (age 1842.008s)
  hex dump (first 32 bytes):
    c9 06 02 7f ff 02 ff 01 fb bf 00 59 00 20 00 00  ...........Y. ..
    00 07 89 37 00 a0 00 00 6b 6b 6b 6b 6b 6b 6b a5  ...7....kkkkkkk.
  backtrace:
    [<00000000fce2b937>] .smu_sat_get_sdb_partition+0x150/0x2f0
[windfarm_smu_sat]
    [<00000000e6cc23fc>] .pm112_wf_notify+0x624/0x1460 [windfarm_pm112]
    [<000000008cdab940>] .notifier_call_chain+0x88/0xf0
    [<000000008f026422>] .__blocking_notifier_call_chain+0x6c/0xc0
    [<0000000045480c67>] .wf_thread_func+0xe4/0x1e0 [windfarm_core]
    [<0000000079c8bd6f>] .kthread+0x1b8/0x1d0
    [<0000000073e2b812>] .ret_from_kernel_thread+0x58/0x74
unreferenced object 0xc0000000061a8740 (size 16):
  comm "kwindfarm", pid 175, jiffies 4294895309 (age 1841.128s)
  hex dump (first 16 bytes):
    c5 04 01 7f a0 12 20 5f ff 55 29 14 7b 12 00 00  ...... _.U).{...
  backtrace:
    [<00000000fce2b937>] .smu_sat_get_sdb_partition+0x150/0x2f0
[windfarm_smu_sat]
    [<0000000050e586af>] .pm112_wf_notify+0x66c/0x1460 [windfarm_pm112]
    [<000000008cdab940>] .notifier_call_chain+0x88/0xf0
    [<000000008f026422>] .__blocking_notifier_call_chain+0x6c/0xc0
    [<0000000045480c67>] .wf_thread_func+0xe4/0x1e0 [windfarm_core]
    [<0000000079c8bd6f>] .kthread+0x1b8/0x1d0
    [<0000000073e2b812>] .ret_from_kernel_thread+0x58/0x74
unreferenced object 0xc0000000061ab6e0 (size 32):
  comm "kwindfarm", pid 175, jiffies 4294895473 (age 1840.472s)
  hex dump (first 32 bytes):
    c8 06 02 7f ff 02 ff 01 fb bf 00 59 00 20 00 00  ...........Y. ..
    00 07 89 37 00 a0 00 00 6b 6b 6b 6b 6b 6b 6b a5  ...7....kkkkkkk.
  backtrace:
    [<00000000fce2b937>] .smu_sat_get_sdb_partition+0x150/0x2f0
[windfarm_smu_sat]
    [<00000000e6cc23fc>] .pm112_wf_notify+0x624/0x1460 [windfarm_pm112]
    [<000000008cdab940>] .notifier_call_chain+0x88/0xf0
    [<000000008f026422>] .__blocking_notifier_call_chain+0x6c/0xc0
    [<0000000045480c67>] .wf_thread_func+0xe4/0x1e0 [windfarm_core]
    [<0000000079c8bd6f>] .kthread+0x1b8/0x1d0
    [<0000000073e2b812>] .ret_from_kernel_thread+0x58/0x74
unreferenced object 0xc0000000061a8b90 (size 16):
  comm "kwindfarm", pid 175, jiffies 4294895693 (age 1839.600s)
  hex dump (first 16 bytes):
    c4 04 01 7f a0 12 20 5f ff 55 b8 14 7b 12 00 00  ...... _.U..{...
  backtrace:
    [<00000000fce2b937>] .smu_sat_get_sdb_partition+0x150/0x2f0
[windfarm_smu_sat]
    [<0000000050e586af>] .pm112_wf_notify+0x66c/0x1460 [windfarm_pm112]
    [<000000008cdab940>] .notifier_call_chain+0x88/0xf0
    [<000000008f026422>] .__blocking_notifier_call_chain+0x6c/0xc0
    [<0000000045480c67>] .wf_thread_func+0xe4/0x1e0 [windfarm_core]
    [<0000000079c8bd6f>] .kthread+0x1b8/0x1d0
    [<0000000073e2b812>] .ret_from_kernel_thread+0x58/0x74
unreferenced object 0xc0000000061aa9e0 (size 32):
  comm "kwindfarm", pid 175, jiffies 4294895857 (age 1838.944s)
  hex dump (first 32 bytes):
    c9 06 02 7f ff 02 ff 01 fb bf 00 59 00 20 00 00  ...........Y. ..
    00 07 89 37 00 a0 00 00 6b 6b 6b 6b 6b 6b 6b a5  ...7....kkkkkkk.
  backtrace:
    [<00000000fce2b937>] .smu_sat_get_sdb_partition+0x150/0x2f0
[windfarm_smu_sat]
    [<00000000e6cc23fc>] .pm112_wf_notify+0x624/0x1460 [windfarm_pm112]
    [<000000008cdab940>] .notifier_call_chain+0x88/0xf0
    [<000000008f026422>] .__blocking_notifier_call_chain+0x6c/0xc0
    [<0000000045480c67>] .wf_thread_func+0xe4/0x1e0 [windfarm_core]
    [<0000000079c8bd6f>] .kthread+0x1b8/0x1d0
    [<0000000073e2b812>] .ret_from_kernel_thread+0x58/0x74
unreferenced object 0xc00000025aacd2c0 (size 16):
  comm "kwindfarm", pid 175, jiffies 4294896076 (age 1838.068s)
  hex dump (first 16 bytes):
    c5 04 01 7f a0 12 20 5f ff 55 d7 15 7b 12 00 00  ...... _.U..{...
  backtrace:
    [<00000000fce2b937>] .smu_sat_get_sdb_partition+0x150/0x2f0
[windfarm_smu_sat]
    [<0000000050e586af>] .pm112_wf_notify+0x66c/0x1460 [windfarm_pm112]
    [<000000008cdab940>] .notifier_call_chain+0x88/0xf0
    [<000000008f026422>] .__blocking_notifier_call_chain+0x6c/0xc0
    [<0000000045480c67>] .wf_thread_func+0xe4/0x1e0 [windfarm_core]
    [<0000000079c8bd6f>] .kthread+0x1b8/0x1d0
    [<0000000073e2b812>] .ret_from_kernel_thread+0x58/0x74
enceladus# 
enceladus# cat /sys/kernel/debug/kmemleak
unreferenced object 0xc00000000867a6a0 (size 32):
  comm "kwindfarm", pid 175, jiffies 4294894706 (age 4736.636s)
  hex dump (first 32 bytes):
    c8 06 02 7f ff 02 ff 01 fb bf 00 59 00 20 00 00  ...........Y. ..
    00 07 89 37 00 a0 00 00 6b 6b 6b 6b 6b 6b 6b a5  ...7....kkkkkkk.
  backtrace:
    [<00000000fce2b937>] .smu_sat_get_sdb_partition+0x150/0x2f0
[windfarm_smu_sat]
    [<00000000e6cc23fc>] .pm112_wf_notify+0x624/0x1460 [windfarm_pm112]
    [<000000008cdab940>] .notifier_call_chain+0x88/0xf0
    [<000000008f026422>] .__blocking_notifier_call_chain+0x6c/0xc0
    [<0000000045480c67>] .wf_thread_func+0xe4/0x1e0 [windfarm_core]
    [<0000000079c8bd6f>] .kthread+0x1b8/0x1d0
    [<0000000073e2b812>] .ret_from_kernel_thread+0x58/0x74
unreferenced object 0xc0000002612a15a0 (size 16):
  comm "kwindfarm", pid 175, jiffies 4294894926 (age 4735.756s)
  hex dump (first 16 bytes):
    c4 04 01 7f a0 12 20 5f ff 55 b8 14 7b 12 00 00  ...... _.U..{...
  backtrace:
    [<00000000fce2b937>] .smu_sat_get_sdb_partition+0x150/0x2f0
[windfarm_smu_sat]
    [<0000000050e586af>] .pm112_wf_notify+0x66c/0x1460 [windfarm_pm112]
    [<000000008cdab940>] .notifier_call_chain+0x88/0xf0
    [<000000008f026422>] .__blocking_notifier_call_chain+0x6c/0xc0
    [<0000000045480c67>] .wf_thread_func+0xe4/0x1e0 [windfarm_core]
    [<0000000079c8bd6f>] .kthread+0x1b8/0x1d0
    [<0000000073e2b812>] .ret_from_kernel_thread+0x58/0x74
unreferenced object 0xc00000000867ba20 (size 32):
  comm "kwindfarm", pid 175, jiffies 4294895089 (age 4735.104s)
  hex dump (first 32 bytes):
    c9 06 02 7f ff 02 ff 01 fb bf 00 59 00 20 00 00  ...........Y. ..
    00 07 89 37 00 a0 00 00 6b 6b 6b 6b 6b 6b 6b a5  ...7....kkkkkkk.
  backtrace:
    [<00000000fce2b937>] .smu_sat_get_sdb_partition+0x150/0x2f0
[windfarm_smu_sat]
    [<00000000e6cc23fc>] .pm112_wf_notify+0x624/0x1460 [windfarm_pm112]
    [<000000008cdab940>] .notifier_call_chain+0x88/0xf0
    [<000000008f026422>] .__blocking_notifier_call_chain+0x6c/0xc0
    [<0000000045480c67>] .wf_thread_func+0xe4/0x1e0 [windfarm_core]
    [<0000000079c8bd6f>] .kthread+0x1b8/0x1d0
    [<0000000073e2b812>] .ret_from_kernel_thread+0x58/0x74
unreferenced object 0xc0000000061a8740 (size 16):
  comm "kwindfarm", pid 175, jiffies 4294895309 (age 4734.224s)
  hex dump (first 16 bytes):
    c5 04 01 7f a0 12 20 5f ff 55 29 14 7b 12 00 00  ...... _.U).{...
  backtrace:
    [<00000000fce2b937>] .smu_sat_get_sdb_partition+0x150/0x2f0
[windfarm_smu_sat]
    [<0000000050e586af>] .pm112_wf_notify+0x66c/0x1460 [windfarm_pm112]
    [<000000008cdab940>] .notifier_call_chain+0x88/0xf0
    [<000000008f026422>] .__blocking_notifier_call_chain+0x6c/0xc0
    [<0000000045480c67>] .wf_thread_func+0xe4/0x1e0 [windfarm_core]
    [<0000000079c8bd6f>] .kthread+0x1b8/0x1d0
    [<0000000073e2b812>] .ret_from_kernel_thread+0x58/0x74
unreferenced object 0xc0000000061ab6e0 (size 32):
  comm "kwindfarm", pid 175, jiffies 4294895473 (age 4733.568s)
  hex dump (first 32 bytes):
    c8 06 02 7f ff 02 ff 01 fb bf 00 59 00 20 00 00  ...........Y. ..
    00 07 89 37 00 a0 00 00 6b 6b 6b 6b 6b 6b 6b a5  ...7....kkkkkkk.
  backtrace:
    [<00000000fce2b937>] .smu_sat_get_sdb_partition+0x150/0x2f0
[windfarm_smu_sat]
    [<00000000e6cc23fc>] .pm112_wf_notify+0x624/0x1460 [windfarm_pm112]
    [<000000008cdab940>] .notifier_call_chain+0x88/0xf0
    [<000000008f026422>] .__blocking_notifier_call_chain+0x6c/0xc0
    [<0000000045480c67>] .wf_thread_func+0xe4/0x1e0 [windfarm_core]
    [<0000000079c8bd6f>] .kthread+0x1b8/0x1d0
    [<0000000073e2b812>] .ret_from_kernel_thread+0x58/0x74
unreferenced object 0xc0000000061a8b90 (size 16):
  comm "kwindfarm", pid 175, jiffies 4294895693 (age 4732.696s)
  hex dump (first 16 bytes):
    c4 04 01 7f a0 12 20 5f ff 55 b8 14 7b 12 00 00  ...... _.U..{...
  backtrace:
    [<00000000fce2b937>] .smu_sat_get_sdb_partition+0x150/0x2f0
[windfarm_smu_sat]
    [<0000000050e586af>] .pm112_wf_notify+0x66c/0x1460 [windfarm_pm112]
    [<000000008cdab940>] .notifier_call_chain+0x88/0xf0
    [<000000008f026422>] .__blocking_notifier_call_chain+0x6c/0xc0
    [<0000000045480c67>] .wf_thread_func+0xe4/0x1e0 [windfarm_core]
    [<0000000079c8bd6f>] .kthread+0x1b8/0x1d0
    [<0000000073e2b812>] .ret_from_kernel_thread+0x58/0x74
unreferenced object 0xc0000000061aa9e0 (size 32):
  comm "kwindfarm", pid 175, jiffies 4294895857 (age 4732.040s)
  hex dump (first 32 bytes):
    c9 06 02 7f ff 02 ff 01 fb bf 00 59 00 20 00 00  ...........Y. ..
    00 07 89 37 00 a0 00 00 6b 6b 6b 6b 6b 6b 6b a5  ...7....kkkkkkk.
  backtrace:
    [<00000000fce2b937>] .smu_sat_get_sdb_partition+0x150/0x2f0
[windfarm_smu_sat]
    [<00000000e6cc23fc>] .pm112_wf_notify+0x624/0x1460 [windfarm_pm112]
    [<000000008cdab940>] .notifier_call_chain+0x88/0xf0
    [<000000008f026422>] .__blocking_notifier_call_chain+0x6c/0xc0
    [<0000000045480c67>] .wf_thread_func+0xe4/0x1e0 [windfarm_core]
    [<0000000079c8bd6f>] .kthread+0x1b8/0x1d0
    [<0000000073e2b812>] .ret_from_kernel_thread+0x58/0x74
unreferenced object 0xc00000025aacd2c0 (size 16):
  comm "kwindfarm", pid 175, jiffies 4294896076 (age 4731.164s)
  hex dump (first 16 bytes):
    c5 04 01 7f a0 12 20 5f ff 55 d7 15 7b 12 00 00  ...... _.U..{...
  backtrace:
    [<00000000fce2b937>] .smu_sat_get_sdb_partition+0x150/0x2f0
[windfarm_smu_sat]
    [<0000000050e586af>] .pm112_wf_notify+0x66c/0x1460 [windfarm_pm112]
    [<000000008cdab940>] .notifier_call_chain+0x88/0xf0
    [<000000008f026422>] .__blocking_notifier_call_chain+0x6c/0xc0
    [<0000000045480c67>] .wf_thread_func+0xe4/0x1e0 [windfarm_core]
    [<0000000079c8bd6f>] .kthread+0x1b8/0x1d0
    [<0000000073e2b812>] .ret_from_kernel_thread+0x58/0x74
enceladus# 

I will take a look into it and see what I can see.

-- 
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply

* Re: [PATCH 16/21] mm: remove early_pfn_in_nid() and CONFIG_NODES_SPAN_OTHER_NODES
From: Baoquan He @ 2020-04-23  1:13 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: Rich Felker, linux-ia64, linux-doc, Catalin Marinas,
	Heiko Carstens, Michal Hocko, James E.J. Bottomley, Max Filippov,
	Guo Ren, linux-csky, linux-parisc, sparclinux, linux-hexagon,
	linux-riscv, Greg Ungerer, linux-arch, linux-s390, linux-snps-arc,
	linux-c6x-dev, Brian Cain, Jonathan Corbet, linux-sh,
	Helge Deller, x86, Russell King, Ley Foon Tan, Mike Rapoport,
	Geert Uytterhoeven, linux-arm-kernel, Mark Salter, Matt Turner,
	linux-mips, uclinux-h8-devel, linux-xtensa, linux-alpha, linux-um,
	linux-m68k, Tony Luck, Greentime Hu, Paul Walmsley,
	Stafford Horne, Guan Xuetao, Hoan Tran, Michal Simek,
	Thomas Bogendoerfer, Yoshinori Sato, Nick Hu, linux-mm,
	Vineet Gupta, linux-kernel, openrisc, Richard Weinberger,
	Andrew Morton, linuxppc-dev, David S. Miller
In-Reply-To: <20200412194859.12663-17-rppt@kernel.org>

On 04/12/20 at 10:48pm, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
> 
> The commit f47ac088c406 ("mm: memmap_init: iterate over memblock regions

This commit id should be a temporary one, will be changed when merged
into maintainer's tree and linus's tree. Only saying last patch plus the
patch subject is OK?

> rather that check each PFN") made early_pfn_in_nid() obsolete and since
> CONFIG_NODES_SPAN_OTHER_NODES is only used to pick a stub or a real
> implementation of early_pfn_in_nid() it is also not needed anymore.
> 
> Remove both early_pfn_in_nid() and the CONFIG_NODES_SPAN_OTHER_NODES.
> 
> Co-developed-by: Hoan Tran <Hoan@os.amperecomputing.com>
> Signed-off-by: Hoan Tran <Hoan@os.amperecomputing.com>
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
>  arch/powerpc/Kconfig |  9 ---------
>  arch/sparc/Kconfig   |  9 ---------
>  arch/x86/Kconfig     |  9 ---------
>  mm/page_alloc.c      | 20 --------------------
>  4 files changed, 47 deletions(-)
> 
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 5f86b22b7d2c..74f316deeae1 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -685,15 +685,6 @@ config ARCH_MEMORY_PROBE
>  	def_bool y
>  	depends on MEMORY_HOTPLUG
>  
> -# Some NUMA nodes have memory ranges that span
> -# other nodes.  Even though a pfn is valid and
> -# between a node's start and end pfns, it may not
> -# reside on that node.  See memmap_init_zone()
> -# for details.
> -config NODES_SPAN_OTHER_NODES
> -	def_bool y
> -	depends on NEED_MULTIPLE_NODES
> -
>  config STDBINUTILS
>  	bool "Using standard binutils settings"
>  	depends on 44x
> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
> index 795206b7b552..0e4f3891b904 100644
> --- a/arch/sparc/Kconfig
> +++ b/arch/sparc/Kconfig
> @@ -286,15 +286,6 @@ config NODES_SHIFT
>  	  Specify the maximum number of NUMA Nodes available on the target
>  	  system.  Increases memory reserved to accommodate various tables.
>  
> -# Some NUMA nodes have memory ranges that span
> -# other nodes.  Even though a pfn is valid and
> -# between a node's start and end pfns, it may not
> -# reside on that node.  See memmap_init_zone()
> -# for details.
> -config NODES_SPAN_OTHER_NODES
> -	def_bool y
> -	depends on NEED_MULTIPLE_NODES
> -
>  config ARCH_SPARSEMEM_ENABLE
>  	def_bool y if SPARC64
>  	select SPARSEMEM_VMEMMAP_ENABLE
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 9d3e95b4fb85..37dac095659e 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -1581,15 +1581,6 @@ config X86_64_ACPI_NUMA
>  	---help---
>  	  Enable ACPI SRAT based node topology detection.
>  
> -# Some NUMA nodes have memory ranges that span
> -# other nodes.  Even though a pfn is valid and
> -# between a node's start and end pfns, it may not
> -# reside on that node.  See memmap_init_zone()
> -# for details.
> -config NODES_SPAN_OTHER_NODES
> -	def_bool y
> -	depends on X86_64_ACPI_NUMA
> -
>  config NUMA_EMU
>  	bool "NUMA emulation"
>  	depends on NUMA
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index c43ce8709457..343d87b8697d 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1541,26 +1541,6 @@ int __meminit early_pfn_to_nid(unsigned long pfn)
>  }
>  #endif /* CONFIG_NEED_MULTIPLE_NODES */
>  
> -#ifdef CONFIG_NODES_SPAN_OTHER_NODES
> -/* Only safe to use early in boot when initialisation is single-threaded */
> -static inline bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
> -{
> -	int nid;
> -
> -	nid = __early_pfn_to_nid(pfn, &early_pfnnid_cache);
> -	if (nid >= 0 && nid != node)
> -		return false;
> -	return true;
> -}
> -
> -#else
> -static inline bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
> -{
> -	return true;
> -}
> -#endif

And macro early_pfn_valid() is not needed either, we may need remove it
too. 

Otherwise, removing NODES_SPAN_OTHER_NODES in this patch looks good.

Reviewed-by: Baoquan He <bhe@redhat.com>

> -
> -
>  void __init memblock_free_pages(struct page *page, unsigned long pfn,
>  							unsigned int order)
>  {
> -- 
> 2.25.1
> 


^ permalink raw reply

* Re: [PATCH v5 0/6] implement KASLR for powerpc/fsl_booke/64
From: Jason Yan @ 2020-04-23  1:11 UTC (permalink / raw)
  To: mpe, linuxppc-dev, diana.craciun, christophe.leroy, benh, paulus,
	npiggin, keescook, kernel-hardening, oss
  Cc: dja, linux-kernel, zhaohongjiang
In-Reply-To: <20200330022023.3691-1-yanaijie@huawei.com>

Hi Michael,

What's the status of this series?

Thanks,
Jason

在 2020/3/30 10:20, Jason Yan 写道:
> This is a try to implement KASLR for Freescale BookE64 which is based on
> my earlier implementation for Freescale BookE32:
> https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=131718&state=*
> 
> The implementation for Freescale BookE64 is similar as BookE32. One
> difference is that Freescale BookE64 set up a TLB mapping of 1G during
> booting. Another difference is that ppc64 needs the kernel to be
> 64K-aligned. So we can randomize the kernel in this 1G mapping and make
> it 64K-aligned. This can save some code to creat another TLB map at
> early boot. The disadvantage is that we only have about 1G/64K = 16384
> slots to put the kernel in.
> 
>      KERNELBASE
> 
>            64K                     |--> kernel <--|
>             |                      |              |
>          +--+--+--+    +--+--+--+--+--+--+--+--+--+    +--+--+
>          |  |  |  |....|  |  |  |  |  |  |  |  |  |....|  |  |
>          +--+--+--+    +--+--+--+--+--+--+--+--+--+    +--+--+
>          |                         |                        1G
>          |----->   offset    <-----|
> 
>                                kernstart_virt_addr
> 
> I'm not sure if the slot numbers is enough or the design has any
> defects. If you have some better ideas, I would be happy to hear that.
> 
> Thank you all.
> 
> v4->v5:
>    Fix "-Werror=maybe-uninitialized" compile error.
>    Fix typo "similar as" -> "similar to".
> v3->v4:
>    Do not define __kaslr_offset as a fixed symbol. Reference __run_at_load and
>      __kaslr_offset by symbol instead of magic offsets.
>    Use IS_ENABLED(CONFIG_PPC32) instead of #ifdef CONFIG_PPC32.
>    Change kaslr-booke32 to kaslr-booke in index.rst
>    Switch some instructions to 64-bit.
> v2->v3:
>    Fix build error when KASLR is disabled.
> v1->v2:
>    Add __kaslr_offset for the secondary cpu boot up.
> 
> Jason Yan (6):
>    powerpc/fsl_booke/kaslr: refactor kaslr_legal_offset() and
>      kaslr_early_init()
>    powerpc/fsl_booke/64: introduce reloc_kernel_entry() helper
>    powerpc/fsl_booke/64: implement KASLR for fsl_booke64
>    powerpc/fsl_booke/64: do not clear the BSS for the second pass
>    powerpc/fsl_booke/64: clear the original kernel if randomized
>    powerpc/fsl_booke/kaslr: rename kaslr-booke32.rst to kaslr-booke.rst
>      and add 64bit part
> 
>   Documentation/powerpc/index.rst               |  2 +-
>   .../{kaslr-booke32.rst => kaslr-booke.rst}    | 35 ++++++-
>   arch/powerpc/Kconfig                          |  2 +-
>   arch/powerpc/kernel/exceptions-64e.S          | 23 +++++
>   arch/powerpc/kernel/head_64.S                 | 13 +++
>   arch/powerpc/kernel/setup_64.c                |  3 +
>   arch/powerpc/mm/mmu_decl.h                    | 23 +++--
>   arch/powerpc/mm/nohash/kaslr_booke.c          | 91 +++++++++++++------
>   8 files changed, 147 insertions(+), 45 deletions(-)
>   rename Documentation/powerpc/{kaslr-booke32.rst => kaslr-booke.rst} (59%)
> 


^ permalink raw reply

* Re: [PATCH v2,RESEND] misc: new driver sram_uapi for user level SRAM access
From: 王文虎 @ 2020-04-23  0:35 UTC (permalink / raw)
  To: Scott Wood
  Cc: robh, arnd, gregkh, Randy Dunlap, linux-kernel, kernel,
	linuxppc-dev
In-Reply-To: <876d477d6d8db20c41be3eb59850c51e6badbfcf.camel@buserror.net>

Hi, Scott, Greg,

Thank you for your helpful comments.
For that Greg mentioned that the patch (or patch series) via UIO should worked through,
so I want to make it clear that if it would go upstream?(And if so, when? No push, just ask)

Also I have been wondering how the patches with components in different subsystems
go get upstream to the mainline? Like patch 1-3 are of linuxppc-dev, and patch 4 is of
subsystem UIO, and if acceptable, how would you deal with them?

Back to the devicetree thing, I make it detached from hardware compatibilities which belong
to the hardware level driver and also used module parameter for of_id definition as dt-binding
is not allowed for UIO now. So as I can see, things may go well and there is no harm to anything,
I hope you(Scott) please take a re-consideration. 

Thanks & regards,
Wenhu

>On Sun, 2020-04-19 at 20:05 -0700, Wang Wenhu wrote:
>> +static void sram_uapi_res_insert(struct sram_uapi *uapi,
>> +				 struct sram_resource *res)
>> +{
>> +	struct sram_resource *cur, *tmp;
>> +	struct list_head *head = &uapi->res_list;
>> +
>> +	list_for_each_entry_safe(cur, tmp, head, list) {
>> +		if (&tmp->list != head &&
>> +		    (cur->info.offset + cur->info.size + res->info.size <=
>> +		    tmp->info.offset)) {
>> +			res->info.offset = cur->info.offset + cur->info.size;
>> +			res->parent = uapi;
>> +			list_add(&res->list, &cur->list);
>> +			return;
>> +		}
>> +	}
>
>We don't need yet another open coded allocator.  If you really need to do this
>then use include/linux/genalloc.h, but maybe keep it simple and just have one
>allocaton per file descriptor so you don't need to manage fd offsets?
>
>> +static struct sram_resource *sram_uapi_find_res(struct sram_uapi *uapi,
>> +						__u32 offset)
>> +{
>> +	struct sram_resource *res;
>> +
>> +	list_for_each_entry(res, &uapi->res_list, list) {
>> +		if (res->info.offset == offset)
>> +			return res;
>> +	}
>> +
>> +	return NULL;
>> +}
>
>What if the allocation is more than one page, and the user mmaps starting
>somewhere other than the first page?
>
>> +	switch (cmd) {
>> +	case SRAM_UAPI_IOC_SET_SRAM_TYPE:
>> +		if (uapi->sa)
>> +			return -EEXIST;
>> +
>> +		get_user(type, (const __u32 __user *)arg);
>> +		uapi->sa = get_sram_api_from_type(type);
>> +		if (uapi->sa)
>> +			ret = 0;
>> +		else
>> +			ret = -ENODEV;
>> +
>> +		break;
>> +
>
>Just expose one device per backing SRAM, especially if the user has any reason
>to care about where the SRAM is coming from (correlating sysfs nodes is much
>more expressive than some vague notion of "type").
>
>> +	case SRAM_UAPI_IOC_ALLOC:
>> +		if (!uapi->sa)
>> +			return -EINVAL;
>> +
>> +		res = kzalloc(sizeof(*res), GFP_KERNEL);
>> +		if (!res)
>> +			return -ENOMEM;
>> +
>> +		size = copy_from_user((void *)&res->info,
>> +				      (const void __user *)arg,
>> +				      sizeof(res->info));
>> +		if (!PAGE_ALIGNED(res->info.size) || !res->info.size)
>> +			return -EINVAL;
>
>Missing EFAULT test (here and elsewhere), and res leaks on error.
>
>> +
>> +		res->virt = (void *)uapi->sa->sram_alloc(res->info.size,
>> +							 &res->phys,
>> +							 PAGE_SIZE);
>
>Do we really need multiple allocators, or could the backend be limited to just
>adding regions to a generic allocator (with that allocator also serving in-
>kernel users)?
>
>If sram_alloc is supposed to return a virtual address, why isn't that the
>return type?
>
>> +		if (!res->virt) {
>> +			kfree(res);
>> +			return -ENOMEM;
>> +		}
>
>ENOSPC might be more appropriate, as this isn't general-purpose RAM.
>
>> +
>> +		sram_uapi_res_insert(uapi, res);
>> +		size = copy_to_user((void __user *)arg,
>> +				    (const void *)&res->info,
>> +				    sizeof(res->info));
>> +
>> +		ret = 0;
>> +		break;
>> +
>> +	case SRAM_UAPI_IOC_FREE:
>> +		if (!uapi->sa)
>> +			return -EINVAL;
>> +
>> +		size = copy_from_user((void *)&info, (const void __user *)arg,
>> +				      sizeof(info));
>> +
>> +		res = sram_uapi_res_delete(uapi, &info);
>> +		if (!res) {
>> +			pr_err("error no sram resource found\n");
>> +			return -EINVAL;
>> +		}
>> +
>> +		uapi->sa->sram_free(res->virt);
>> +		kfree(res);
>> +
>> +		ret = 0;
>> +		break;
>
>So you can just delete any arbitrary offset, even if you weren't the one that
>allocated it?  Even if this isn't meant for unprivileged use it seems error-
>prone.  
>
>> +
>> +	default:
>> +		pr_err("error no cmd not supported\n");
>> +		break;
>> +	}
>> +
>> +	return ret;
>> +}
>> +
>> +static int sram_uapi_mmap(struct file *filp, struct vm_area_struct *vma)
>> +{
>> +	struct sram_uapi *uapi = filp->private_data;
>> +	struct sram_resource *res;
>> +
>> +	res = sram_uapi_find_res(uapi, vma->vm_pgoff);
>> +	if (!res)
>> +		return -EINVAL;
>> +
>> +	if (vma->vm_end - vma->vm_start > res->info.size)
>> +		return -EINVAL;
>> +
>> +	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
>> +
>> +	return remap_pfn_range(vma, vma->vm_start,
>> +			       res->phys >> PAGE_SHIFT,
>> +			       vma->vm_end - vma->vm_start,
>> +			       vma->vm_page_prot);
>> +}
>
>Will noncached always be what's wanted here?
>
>-Scott
>
>



^ permalink raw reply

* Re: [PATCH 05/21] mm: use free_area_init() instead of free_area_init_nodes()
From: Baoquan He @ 2020-04-23  0:02 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: Rich Felker, linux-ia64, linux-doc, Catalin Marinas,
	Heiko Carstens, Michal Hocko, James E.J. Bottomley, Max Filippov,
	Guo Ren, linux-csky, linux-parisc, sparclinux, linux-hexagon,
	linux-riscv, Greg Ungerer, linux-arch, linux-s390, linux-snps-arc,
	linux-c6x-dev, Brian Cain, Jonathan Corbet, linux-sh,
	Helge Deller, x86, Russell King, Ley Foon Tan, Mike Rapoport,
	Geert Uytterhoeven, linux-arm-kernel, Mark Salter, Matt Turner,
	linux-mips, uclinux-h8-devel, linux-xtensa, linux-alpha, linux-um,
	linux-m68k, Tony Luck, Greentime Hu, Paul Walmsley,
	Stafford Horne, Guan Xuetao, Hoan Tran, Michal Simek,
	Thomas Bogendoerfer, Yoshinori Sato, Nick Hu, linux-mm,
	Vineet Gupta, linux-kernel, openrisc, Richard Weinberger,
	Andrew Morton, linuxppc-dev, David S. Miller
In-Reply-To: <20200412194859.12663-6-rppt@kernel.org>

On 04/12/20 at 10:48pm, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
> 
> The free_area_init() has effectively became a wrapper for
> free_area_init_nodes() and there is no point of keeping it. Still
> free_area_init() name is shorter and more general as it does not imply
> necessity to initialize multiple nodes.
> 
> Rename free_area_init_nodes() to free_area_init(), update the callers and
> drop old version of free_area_init().
> 
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
>  arch/arm64/mm/init.c             |  2 +-
>  arch/ia64/mm/contig.c            |  2 +-
>  arch/ia64/mm/discontig.c         |  2 +-
>  arch/microblaze/mm/init.c        |  2 +-
>  arch/mips/loongson64/numa.c      |  2 +-
>  arch/mips/mm/init.c              |  2 +-
>  arch/mips/sgi-ip27/ip27-memory.c |  2 +-
>  arch/powerpc/mm/mem.c            |  2 +-
>  arch/riscv/mm/init.c             |  2 +-
>  arch/s390/mm/init.c              |  2 +-
>  arch/sh/mm/init.c                |  2 +-
>  arch/sparc/mm/init_64.c          |  2 +-
>  arch/x86/mm/init.c               |  2 +-
>  include/linux/mm.h               |  7 +++----
>  mm/page_alloc.c                  | 10 ++--------
>  15 files changed, 18 insertions(+), 25 deletions(-)
> 
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index e42727e3568e..a650adb358ee 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -206,7 +206,7 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max)
>  #endif
>  	max_zone_pfns[ZONE_NORMAL] = max;
>  
> -	free_area_init_nodes(max_zone_pfns);
> +	free_area_init(max_zone_pfns);
>  }
>  
>  #else
> diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
> index 5b00dc3898e1..8786fa5c7612 100644
> --- a/arch/ia64/mm/contig.c
> +++ b/arch/ia64/mm/contig.c
> @@ -210,6 +210,6 @@ paging_init (void)
>  		printk("Virtual mem_map starts at 0x%p\n", mem_map);
>  	}
>  #endif /* !CONFIG_VIRTUAL_MEM_MAP */
> -	free_area_init_nodes(max_zone_pfns);
> +	free_area_init(max_zone_pfns);
>  	zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
>  }
> diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
> index 4f33f6e7e206..dd8284bcbf16 100644
> --- a/arch/ia64/mm/discontig.c
> +++ b/arch/ia64/mm/discontig.c
> @@ -627,7 +627,7 @@ void __init paging_init(void)
>  	max_zone_pfns[ZONE_DMA32] = max_dma;
>  #endif
>  	max_zone_pfns[ZONE_NORMAL] = max_pfn;
> -	free_area_init_nodes(max_zone_pfns);
> +	free_area_init(max_zone_pfns);
>  
>  	zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
>  }
> diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
> index 1ffbfa96b9b8..dcaa53d11339 100644
> --- a/arch/microblaze/mm/init.c
> +++ b/arch/microblaze/mm/init.c
> @@ -112,7 +112,7 @@ static void __init paging_init(void)
>  #endif
>  
>  	/* We don't have holes in memory map */
> -	free_area_init_nodes(zones_size);
> +	free_area_init(zones_size);
>  }
>  
>  void __init setup_memory(void)
> diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c
> index 1ae072df4831..901f5be5ee76 100644
> --- a/arch/mips/loongson64/numa.c
> +++ b/arch/mips/loongson64/numa.c
> @@ -247,7 +247,7 @@ void __init paging_init(void)
>  	zones_size[ZONE_DMA32] = MAX_DMA32_PFN;
>  #endif
>  	zones_size[ZONE_NORMAL] = max_low_pfn;
> -	free_area_init_nodes(zones_size);
> +	free_area_init(zones_size);
>  }
>  
>  void __init mem_init(void)
> diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
> index 79684000de0e..19719e8b41a5 100644
> --- a/arch/mips/mm/init.c
> +++ b/arch/mips/mm/init.c
> @@ -418,7 +418,7 @@ void __init paging_init(void)
>  	}
>  #endif
>  
> -	free_area_init_nodes(max_zone_pfns);
> +	free_area_init(max_zone_pfns);
>  }
>  
>  #ifdef CONFIG_64BIT
> diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
> index a45691e6ab90..1213215ea965 100644
> --- a/arch/mips/sgi-ip27/ip27-memory.c
> +++ b/arch/mips/sgi-ip27/ip27-memory.c
> @@ -419,7 +419,7 @@ void __init paging_init(void)
>  
>  	pagetable_init();
>  	zones_size[ZONE_NORMAL] = max_low_pfn;
> -	free_area_init_nodes(zones_size);
> +	free_area_init(zones_size);
>  }
>  
>  void __init mem_init(void)
> diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
> index 041ed7cfd341..0fcea21f26b4 100644
> --- a/arch/powerpc/mm/mem.c
> +++ b/arch/powerpc/mm/mem.c
> @@ -271,7 +271,7 @@ void __init paging_init(void)
>  	max_zone_pfns[ZONE_HIGHMEM] = max_pfn;
>  #endif
>  
> -	free_area_init_nodes(max_zone_pfns);
> +	free_area_init(max_zone_pfns);
>  
>  	mark_nonram_nosave();
>  }
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index b55be44ff9bd..f2ceab77b8e6 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -39,7 +39,7 @@ static void __init zone_sizes_init(void)
>  #endif
>  	max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
>  
> -	free_area_init_nodes(max_zone_pfns);
> +	free_area_init(max_zone_pfns);
>  }
>  
>  static void setup_zero_page(void)
> diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
> index 87b2d024e75a..b11bcf4da531 100644
> --- a/arch/s390/mm/init.c
> +++ b/arch/s390/mm/init.c
> @@ -122,7 +122,7 @@ void __init paging_init(void)
>  	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
>  	max_zone_pfns[ZONE_DMA] = PFN_DOWN(MAX_DMA_ADDRESS);
>  	max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
> -	free_area_init_nodes(max_zone_pfns);
> +	free_area_init(max_zone_pfns);
>  }
>  
>  void mark_rodata_ro(void)
> diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
> index b9de2d4fa57e..2573b163b3ab 100644
> --- a/arch/sh/mm/init.c
> +++ b/arch/sh/mm/init.c
> @@ -334,7 +334,7 @@ void __init paging_init(void)
>  
>  	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
>  	max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
> -	free_area_init_nodes(max_zone_pfns);
> +	free_area_init(max_zone_pfns);
>  }
>  
>  unsigned int mem_init_done = 0;
> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
> index 1cf0d666dea3..79d3c5e0802e 100644
> --- a/arch/sparc/mm/init_64.c
> +++ b/arch/sparc/mm/init_64.c
> @@ -2488,7 +2488,7 @@ void __init paging_init(void)
>  
>  		max_zone_pfns[ZONE_NORMAL] = end_pfn;
>  
> -		free_area_init_nodes(max_zone_pfns);
> +		free_area_init(max_zone_pfns);
>  	}
>  
>  	printk("Booting Linux...\n");
> diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> index 1bba16c5742b..4016f2bf5d87 100644
> --- a/arch/x86/mm/init.c
> +++ b/arch/x86/mm/init.c
> @@ -949,7 +949,7 @@ void __init zone_sizes_init(void)
>  	max_zone_pfns[ZONE_HIGHMEM]	= max_pfn;
>  #endif
>  
> -	free_area_init_nodes(max_zone_pfns);
> +	free_area_init(max_zone_pfns);
>  }
>  
>  __visible DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate) = {
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index d9a256a97ac5..1c2ecb42e043 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -2272,7 +2272,6 @@ static inline spinlock_t *pud_lock(struct mm_struct *mm, pud_t *pud)
>  }
>  
>  extern void __init pagecache_init(void);
> -extern void free_area_init(unsigned long * max_zone_pfn);
>  extern void __init free_area_init_node(int nid, unsigned long * zones_size,
>  		unsigned long zone_start_pfn, unsigned long *zholes_size);
>  extern void free_initmem(void);
> @@ -2353,21 +2352,21 @@ static inline unsigned long get_num_physpages(void)
>   *
>   * An architecture is expected to register range of page frames backed by
>   * physical memory with memblock_add[_node]() before calling
> - * free_area_init_nodes() passing in the PFN each zone ends at. At a basic
> + * free_area_init() passing in the PFN each zone ends at. At a basic
>   * usage, an architecture is expected to do something like
>   *
>   * unsigned long max_zone_pfns[MAX_NR_ZONES] = {max_dma, max_normal_pfn,
>   * 							 max_highmem_pfn};
>   * for_each_valid_physical_page_range()
>   * 	memblock_add_node(base, size, nid)
> - * free_area_init_nodes(max_zone_pfns);
> + * free_area_init(max_zone_pfns);
>   *
>   * free_bootmem_with_active_regions() calls free_bootmem_node() for each
>   * registered physical page range.  Similarly
>   * sparse_memory_present_with_active_regions() calls memory_present() for
>   * each range when SPARSEMEM is enabled.
>   */
> -extern void free_area_init_nodes(unsigned long *max_zone_pfn);
> +void free_area_init(unsigned long *max_zone_pfn);
>  unsigned long node_map_pfn_alignment(void);
>  unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn,
>  						unsigned long end_pfn);
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 530701b38bc7..7f6a3081edb8 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -7428,7 +7428,7 @@ static void check_for_memory(pg_data_t *pgdat, int nid)
>  }
>  
>  /**
> - * free_area_init_nodes - Initialise all pg_data_t and zone data
> + * free_area_init - Initialise all pg_data_t and zone data
>   * @max_zone_pfn: an array of max PFNs for each zone
>   *
>   * This will call free_area_init_node() for each active node in the system.
               It's __free_area_init_node() here being called, while
it dosn't matter much because it's updated in later patch.
> @@ -7440,7 +7440,7 @@ static void check_for_memory(pg_data_t *pgdat, int nid)
>   * starts where the previous one ended. For example, ZONE_DMA32 starts
>   * at arch_max_dma_pfn.
>   */
> -void __init free_area_init_nodes(unsigned long *max_zone_pfn)
> +void __init free_area_init(unsigned long *max_zone_pfn)
>  {
>  	unsigned long start_pfn, end_pfn;
>  	int i, nid;
> @@ -7700,12 +7700,6 @@ void __init set_dma_reserve(unsigned long new_dma_reserve)
>  	dma_reserve = new_dma_reserve;
>  }
>  
> -void __init free_area_init(unsigned long *max_zone_pfn)
> -{
> -	init_unavailable_mem();
> -	free_area_init_nodes(max_zone_pfn);
> -}
> -
>  static int page_alloc_cpu_dead(unsigned int cpu)
>  {

Reviewed-by: Baoquan He <bhe@redhat.com>

>  
> -- 
> 2.25.1
> 


^ permalink raw reply

* Re: [PATCH 04/21] mm: free_area_init: use maximal zone PFNs rather than zone sizes
From: Baoquan He @ 2020-04-22 23:41 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: Rich Felker, linux-ia64, linux-doc, Catalin Marinas,
	Heiko Carstens, Michal Hocko, James E.J. Bottomley, Max Filippov,
	Guo Ren, linux-csky, linux-parisc, sparclinux, linux-hexagon,
	linux-riscv, Greg Ungerer, linux-arch, linux-s390, linux-snps-arc,
	linux-c6x-dev, Brian Cain, Jonathan Corbet, linux-sh,
	Helge Deller, x86, Russell King, Ley Foon Tan, Mike Rapoport,
	Geert Uytterhoeven, linux-arm-kernel, Mark Salter, Matt Turner,
	linux-mips, uclinux-h8-devel, linux-xtensa, linux-alpha, linux-um,
	linux-m68k, Tony Luck, Greentime Hu, Paul Walmsley,
	Stafford Horne, Guan Xuetao, Hoan Tran, Michal Simek,
	Thomas Bogendoerfer, Yoshinori Sato, Nick Hu, linux-mm,
	Vineet Gupta, linux-kernel, openrisc, Richard Weinberger,
	Andrew Morton, linuxppc-dev, David S. Miller
In-Reply-To: <20200412194859.12663-5-rppt@kernel.org>

On 04/12/20 at 10:48pm, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
> 
> Currently, architectures that use free_area_init() to initialize memory map
> and node and zone structures need to calculate zone and hole sizes. We can
> use free_area_init_nodes() instead and let it detect the zone boundaries
> while the architectures will only have to supply the possible limits for
> the zones.
> 
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
>  arch/alpha/mm/init.c    | 16 ++++++----------
>  arch/c6x/mm/init.c      |  8 +++-----
>  arch/h8300/mm/init.c    |  6 +++---
>  arch/hexagon/mm/init.c  |  6 +++---
>  arch/m68k/mm/init.c     |  6 +++---
>  arch/m68k/mm/mcfmmu.c   |  9 +++------
>  arch/nds32/mm/init.c    | 11 ++++-------
>  arch/nios2/mm/init.c    |  8 +++-----
>  arch/openrisc/mm/init.c |  9 +++------
>  arch/um/kernel/mem.c    | 12 ++++--------
>  include/linux/mm.h      |  2 +-
>  mm/page_alloc.c         |  5 ++---
>  12 files changed, 38 insertions(+), 60 deletions(-)
> 
> diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
> index 12e218d3792a..667cd21393b5 100644
> --- a/arch/alpha/mm/init.c
> +++ b/arch/alpha/mm/init.c
> @@ -243,21 +243,17 @@ callback_init(void * kernel_end)
>   */
>  void __init paging_init(void)
>  {
> -	unsigned long zones_size[MAX_NR_ZONES] = {0, };
> -	unsigned long dma_pfn, high_pfn;
> +	unsigned long max_zone_pfn[MAX_NR_ZONES] = {0, };
> +	unsigned long dma_pfn;
>  
>  	dma_pfn = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
> -	high_pfn = max_pfn = max_low_pfn;
> +	max_pfn = max_low_pfn;
>  
> -	if (dma_pfn >= high_pfn)
> -		zones_size[ZONE_DMA] = high_pfn;
> -	else {
> -		zones_size[ZONE_DMA] = dma_pfn;
> -		zones_size[ZONE_NORMAL] = high_pfn - dma_pfn;
> -	}
> +	max_zone_pfn[ZONE_DMA] = dma_pfn;
> +	max_zone_pfn[ZONE_NORMAL] = max_pfn;
>  
>  	/* Initialize mem_map[].  */
> -	free_area_init(zones_size);
> +	free_area_init(max_zone_pfn);
>  
>  	/* Initialize the kernel's ZERO_PGE. */
>  	memset((void *)ZERO_PGE, 0, PAGE_SIZE);
> diff --git a/arch/c6x/mm/init.c b/arch/c6x/mm/init.c
> index 9b374393a8f4..a97e51a3e26d 100644
> --- a/arch/c6x/mm/init.c
> +++ b/arch/c6x/mm/init.c
> @@ -33,7 +33,7 @@ EXPORT_SYMBOL(empty_zero_page);
>  void __init paging_init(void)
>  {
>  	struct pglist_data *pgdat = NODE_DATA(0);
> -	unsigned long zones_size[MAX_NR_ZONES] = {0, };
> +	unsigned long max_zone_pfn[MAX_NR_ZONES] = {0, };
>  
>  	empty_zero_page      = (unsigned long) memblock_alloc(PAGE_SIZE,
>  							      PAGE_SIZE);
> @@ -49,11 +49,9 @@ void __init paging_init(void)
>  	/*
>  	 * Define zones
>  	 */
> -	zones_size[ZONE_NORMAL] = (memory_end - PAGE_OFFSET) >> PAGE_SHIFT;
> -	pgdat->node_zones[ZONE_NORMAL].zone_start_pfn =
> -		__pa(PAGE_OFFSET) >> PAGE_SHIFT;
> +	max_zone_pfn[ZONE_NORMAL] = memory_end >> PAGE_SHIFT;
>  
> -	free_area_init(zones_size);
> +	free_area_init(max_zone_pfn);
>  }
>  
>  void __init mem_init(void)
> diff --git a/arch/h8300/mm/init.c b/arch/h8300/mm/init.c
> index 1eab16b1a0bc..27a0020e3771 100644
> --- a/arch/h8300/mm/init.c
> +++ b/arch/h8300/mm/init.c
> @@ -83,10 +83,10 @@ void __init paging_init(void)
>  		 start_mem, end_mem);
>  
>  	{
> -		unsigned long zones_size[MAX_NR_ZONES] = {0, };
> +		unsigned long max_zone_pfn[MAX_NR_ZONES] = {0, };
>  
> -		zones_size[ZONE_NORMAL] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT;
> -		free_area_init(zones_size);
> +		max_zone_pfn[ZONE_NORMAL] = end_mem >> PAGE_SHIFT;
> +		free_area_init(max_zone_pfn);
>  	}
>  }
>  
> diff --git a/arch/hexagon/mm/init.c b/arch/hexagon/mm/init.c
> index c961773a6fff..f2e6c868e477 100644
> --- a/arch/hexagon/mm/init.c
> +++ b/arch/hexagon/mm/init.c
> @@ -91,7 +91,7 @@ void sync_icache_dcache(pte_t pte)
>   */
>  void __init paging_init(void)
>  {
> -	unsigned long zones_sizes[MAX_NR_ZONES] = {0, };
> +	unsigned long max_zone_pfn[MAX_NR_ZONES] = {0, };
>  
>  	/*
>  	 *  This is not particularly well documented anywhere, but
> @@ -101,9 +101,9 @@ void __init paging_init(void)
>  	 *  adjust accordingly.
>  	 */
>  
> -	zones_sizes[ZONE_NORMAL] = max_low_pfn;
> +	max_zone_pfn[ZONE_NORMAL] = max_low_pfn;
>  
> -	free_area_init(zones_sizes);  /*  sets up the zonelists and mem_map  */
> +	free_area_init(max_zone_pfn);  /*  sets up the zonelists and mem_map  */
>  
>  	/*
>  	 * Start of high memory area.  Will probably need something more
> diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
> index b88d510d4fe3..6d3147662ff2 100644
> --- a/arch/m68k/mm/init.c
> +++ b/arch/m68k/mm/init.c
> @@ -84,7 +84,7 @@ void __init paging_init(void)
>  	 * page_alloc get different views of the world.
>  	 */
>  	unsigned long end_mem = memory_end & PAGE_MASK;
> -	unsigned long zones_size[MAX_NR_ZONES] = { 0, };
> +	unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0, };
>  
>  	high_memory = (void *) end_mem;
>  
> @@ -98,8 +98,8 @@ void __init paging_init(void)
>  	 */
>  	set_fs (USER_DS);
>  
> -	zones_size[ZONE_DMA] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT;
> -	free_area_init(zones_size);
> +	max_zone_pfn[ZONE_DMA] = end_mem >> PAGE_SHIFT;
> +	free_area_init(max_zone_pfn);
>  }
>  
>  #endif /* CONFIG_MMU */
> diff --git a/arch/m68k/mm/mcfmmu.c b/arch/m68k/mm/mcfmmu.c
> index 0ea375607767..80064e6d064f 100644
> --- a/arch/m68k/mm/mcfmmu.c
> +++ b/arch/m68k/mm/mcfmmu.c
> @@ -39,7 +39,7 @@ void __init paging_init(void)
>  	pte_t *pg_table;
>  	unsigned long address, size;
>  	unsigned long next_pgtable, bootmem_end;
> -	unsigned long zones_size[MAX_NR_ZONES];
> +	unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0 };
>  	enum zone_type zone;
>  	int i;
>  
> @@ -80,11 +80,8 @@ void __init paging_init(void)
>  	}
>  
>  	current->mm = NULL;
> -
> -	for (zone = 0; zone < MAX_NR_ZONES; zone++)
> -		zones_size[zone] = 0x0;
> -	zones_size[ZONE_DMA] = num_pages;
> -	free_area_init(zones_size);
> +	max_zone_pfn[ZONE_DMA] = PFN_DOWN(_ramend);
> +	free_area_init(max_zone_pfn);
>  }
>  
>  int cf_tlb_miss(struct pt_regs *regs, int write, int dtlb, int extension_word)
> diff --git a/arch/nds32/mm/init.c b/arch/nds32/mm/init.c
> index 0be3833f6814..91147cca4b64 100644
> --- a/arch/nds32/mm/init.c
> +++ b/arch/nds32/mm/init.c
> @@ -31,16 +31,13 @@ EXPORT_SYMBOL(empty_zero_page);
>  
>  static void __init zone_sizes_init(void)
>  {
> -	unsigned long zones_size[MAX_NR_ZONES];
> +	unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0 };
>  
> -	/* Clear the zone sizes */
> -	memset(zones_size, 0, sizeof(zones_size));
> -
> -	zones_size[ZONE_NORMAL] = max_low_pfn;
> +	max_zone_pfn[ZONE_NORMAL] = max_low_pfn;
>  #ifdef CONFIG_HIGHMEM
> -	zones_size[ZONE_HIGHMEM] = max_pfn;
> +	max_zone_pfn[ZONE_HIGHMEM] = max_pfn;
>  #endif
> -	free_area_init(zones_size);
> +	free_area_init(max_zone_pfn);
>  
>  }
>  
> diff --git a/arch/nios2/mm/init.c b/arch/nios2/mm/init.c
> index 2c609c2516b2..9afca77d10b1 100644
> --- a/arch/nios2/mm/init.c
> +++ b/arch/nios2/mm/init.c
> @@ -46,17 +46,15 @@ pgd_t *pgd_current;
>   */
>  void __init paging_init(void)
>  {
> -	unsigned long zones_size[MAX_NR_ZONES];
> -
> -	memset(zones_size, 0, sizeof(zones_size));
> +	unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0 };
>  
>  	pagetable_init();
>  	pgd_current = swapper_pg_dir;
>  
> -	zones_size[ZONE_NORMAL] = max_mapnr;
> +	max_zone_pfn[ZONE_NORMAL] = max_mapnr;
>  
>  	/* pass the memory from the bootmem allocator to the main allocator */
> -	free_area_init(zones_size);
> +	free_area_init(max_zone_pfn);
>  
>  	flush_dcache_range((unsigned long)empty_zero_page,
>  			(unsigned long)empty_zero_page + PAGE_SIZE);
> diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c
> index 1f87b524db78..f94fe6d3f499 100644
> --- a/arch/openrisc/mm/init.c
> +++ b/arch/openrisc/mm/init.c
> @@ -45,17 +45,14 @@ DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
>  
>  static void __init zone_sizes_init(void)
>  {
> -	unsigned long zones_size[MAX_NR_ZONES];
> -
> -	/* Clear the zone sizes */
> -	memset(zones_size, 0, sizeof(zones_size));
> +	unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0 };
>  
>  	/*
>  	 * We use only ZONE_NORMAL
>  	 */
> -	zones_size[ZONE_NORMAL] = max_low_pfn;
> +	max_zone_pfn[ZONE_NORMAL] = max_low_pfn;
>  
> -	free_area_init(zones_size);
> +	free_area_init(max_zone_pfn);
>  }
>  
>  extern const char _s_kernel_ro[], _e_kernel_ro[];
> diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
> index 30885d0b94ac..401b22f14743 100644
> --- a/arch/um/kernel/mem.c
> +++ b/arch/um/kernel/mem.c
> @@ -158,8 +158,8 @@ static void __init fixaddr_user_init( void)
>  
>  void __init paging_init(void)
>  {
> -	unsigned long zones_size[MAX_NR_ZONES], vaddr;
> -	int i;
> +	unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0 };
> +	unsigned long vaddr;
>  
>  	empty_zero_page = (unsigned long *) memblock_alloc_low(PAGE_SIZE,
>  							       PAGE_SIZE);
> @@ -167,12 +167,8 @@ void __init paging_init(void)
>  		panic("%s: Failed to allocate %lu bytes align=%lx\n",
>  		      __func__, PAGE_SIZE, PAGE_SIZE);
>  
> -	for (i = 0; i < ARRAY_SIZE(zones_size); i++)
> -		zones_size[i] = 0;
> -
> -	zones_size[ZONE_NORMAL] = (end_iomem >> PAGE_SHIFT) -
> -		(uml_physmem >> PAGE_SHIFT);
> -	free_area_init(zones_size);
> +	max_zone_pfn[ZONE_NORMAL] = end_iomem >> PAGE_SHIFT;
> +	free_area_init(max_zone_pfn);
>  
>  	/*
>  	 * Fixed mappings, only the page table structure has to be
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 5903bbbdb336..d9a256a97ac5 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -2272,7 +2272,7 @@ static inline spinlock_t *pud_lock(struct mm_struct *mm, pud_t *pud)
>  }
>  
>  extern void __init pagecache_init(void);
> -extern void free_area_init(unsigned long * zones_size);
> +extern void free_area_init(unsigned long * max_zone_pfn);
>  extern void __init free_area_init_node(int nid, unsigned long * zones_size,
>  		unsigned long zone_start_pfn, unsigned long *zholes_size);
>  extern void free_initmem(void);
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 4530e9cfd9f7..530701b38bc7 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -7700,11 +7700,10 @@ void __init set_dma_reserve(unsigned long new_dma_reserve)
>  	dma_reserve = new_dma_reserve;
>  }
>  
> -void __init free_area_init(unsigned long *zones_size)
> +void __init free_area_init(unsigned long *max_zone_pfn)
>  {
>  	init_unavailable_mem();
> -	free_area_init_node(0, zones_size,
> -			__pa(PAGE_OFFSET) >> PAGE_SHIFT, NULL);
> +	free_area_init_nodes(max_zone_pfn);

Reviewed-by: Baoquan He <bhe@redhat.com>

>  }
>  
>  static int page_alloc_cpu_dead(unsigned int cpu)
> -- 
> 2.25.1
> 


^ permalink raw reply

* Re: [PATCH v2 2/2] PCI/DPC: Allow Native DPC Host Bridges to use DPC
From: Kuppuswamy, Sathyanarayanan @ 2020-04-22 22:50 UTC (permalink / raw)
  To: Jon Derrick, Bjorn Helgaas
  Cc: Rajat Jain, Rafael J. Wysocki, Frederick Lawler, Sam Bobroff,
	linux-pci, Olof Johansson, linuxppc-dev, linux-kernel,
	Bjorn Helgaas, Alex Williamson, Patel, Mayurkumar,
	Oliver O'Halloran, Keith Busch, Andy Shevchenko,
	Mika Westerberg
In-Reply-To: <1587418630-13562-3-git-send-email-jonathan.derrick@intel.com>



On 4/20/20 2:37 PM, Jon Derrick wrote:
> The existing portdrv model prevents DPC services without either OS
> control (_OSC) granted to AER services, a Host Bridge requesting Native
> AER, or using one of the 'pcie_ports=' parameters of 'native' or
> 'dpc-native'.
> 
> The DPC port service driver itself will also fail to probe if the kernel
> assumes the port is using Firmware-First AER. It's a reasonable
> expectation that a port using Firmware-First AER will also be using
> Firmware-First DPC, however if a Host Bridge requests Native DPC, the
> DPC driver should allow it and not fail to bind due to AER capability
> settings.
> 
> Host Bridges which request Native DPC port services will also likely
> request Native AER, however it shouldn't be a requirement. This patch
> allows ports on those Host Bridges to have DPC port services.
> 
> This will avoid the unlikely situation where the port is Firmware-First
> AER and Native DPC, and a BIOS or switch firmware preconfiguration of
> the DPC trigger could result in unhandled DPC events.
> 
> Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
> ---
>   drivers/pci/pcie/dpc.c          | 3 ++-
>   drivers/pci/pcie/portdrv_core.c | 3 ++-
>   2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/pcie/dpc.c b/drivers/pci/pcie/dpc.c
> index 7621704..3f3106f 100644
> --- a/drivers/pci/pcie/dpc.c
> +++ b/drivers/pci/pcie/dpc.c
> @@ -284,7 +284,8 @@ static int dpc_probe(struct pcie_device *dev)
>   	int status;
>   	u16 ctl, cap;
>   
> -	if (pcie_aer_get_firmware_first(pdev) && !pcie_ports_dpc_native)
> +	if (pcie_aer_get_firmware_first(pdev) && !pcie_ports_dpc_native &&
> +	    !pci_find_host_bridge(pdev->bus)->native_dpc)
Why do it in probe as well ? if host->native_dpc is not set then the
device DPC probe it self won't happen right ?
>   		return -ENOTSUPP;
>   
>   	status = devm_request_threaded_irq(device, dev->irq, dpc_irq,
> diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
> index 50a9522..f2139a1 100644
> --- a/drivers/pci/pcie/portdrv_core.c
> +++ b/drivers/pci/pcie/portdrv_core.c
> @@ -256,7 +256,8 @@ static int get_port_device_capability(struct pci_dev *dev)
>   	 */
>   	if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC) &&
>   	    pci_aer_available() &&
> -	    (pcie_ports_dpc_native || (services & PCIE_PORT_SERVICE_AER)))
> +	    (pcie_ports_dpc_native || host->native_dpc ||
> +	     (services & PCIE_PORT_SERVICE_AER)))
>   		services |= PCIE_PORT_SERVICE_DPC;
>   
>   	if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM ||
> 

^ permalink raw reply

* Re: [PATCH v2 1/2] PCI/AER: Allow Native AER Host Bridges to use AER
From: Kuppuswamy, Sathyanarayanan @ 2020-04-22 22:48 UTC (permalink / raw)
  To: Jon Derrick, Bjorn Helgaas
  Cc: Rajat Jain, Rafael J. Wysocki, Frederick Lawler, Sam Bobroff,
	linux-pci, Olof Johansson, linuxppc-dev, linux-kernel,
	Bjorn Helgaas, Alex Williamson, Patel, Mayurkumar,
	Oliver O'Halloran, Keith Busch, Andy Shevchenko,
	Mika Westerberg
In-Reply-To: <1587418630-13562-2-git-send-email-jonathan.derrick@intel.com>



On 4/20/20 2:37 PM, Jon Derrick wrote:
> Some platforms have a mix of ports whose capabilities can be negotiated
> by _OSC, and some ports which are not described by ACPI and instead
> managed by Native drivers. The existing Firmware-First HEST model can
> incorrectly tag these Native, Non-ACPI ports as Firmware-First managed
> ports by advertising the HEST Global Flag and matching the type and
> class of the port (aer_hest_parse).
Is there a real use case for mixed mode (one host bridge in FF mode and
another in native)?
> 
> If the port requests Native AER through the Host Bridge's capability
> settings, the AER driver should honor those settings and allow the port
> to bind. This patch changes the definition of Firmware-First to exclude
> ports whose Host Bridges request Native AER.
> 
> Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
> ---
>   drivers/pci/pcie/aer.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index f4274d3..30fbd1f 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -314,6 +314,9 @@ int pcie_aer_get_firmware_first(struct pci_dev *dev)
>   	if (pcie_ports_native)
>   		return 0;
>   
> +	if (pci_find_host_bridge(dev->bus)->native_aer)
> +		return 0;
> +
>   	if (!dev->__aer_firmware_first_valid)
>   		aer_set_firmware_first(dev);
>   	return dev->__aer_firmware_first;
> 

^ permalink raw reply

* Re: [PATCH v3 0/4] Clean up hugetlb boot command line processing
From: Casey Cairn @ 2020-04-22 21:54 UTC (permalink / raw)
  To: Mike Kravetz, derpyderpderp, jsasphalt12@yahoo.com
  Cc: linux-doc, Dave Hansen, Heiko Carstens, Peter Xu, Linux-MM,
	Paul Mackerras, sparclinux, linux-riscv, Will Deacon,
	Mina Almasry, linux-s390, Jonathan Corbet, Christian Borntraeger,
	Ingo Molnar, Catalin Marinas, Longpeng, Albert Ou, Vasily Gorbik,
	Qian Cai, Paul Walmsley, Thomas Gleixner, Linux ARM,
	Nitesh Narayan Lal, Randy Dunlap, LKML, Palmer Dabbelt,
	Andrew Morton, linuxppc-dev, David S.Miller
In-Reply-To: <CADYN=9JbXi=rvBAvhwPh8aFu2ne4Hbu4T+PW3NP3Rv2is+x77w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 5633 bytes --]

 

    On Wednesday, April 22, 2020, 05:52:05 PM EDT, Anders Roxell <anders.roxell@linaro.org> wrote:  
 
 On Mon, 20 Apr 2020 at 23:43, Mike Kravetz <mike.kravetz@oracle.com> wrote:
>
> On 4/20/20 1:29 PM, Anders Roxell wrote:
> > On Mon, 20 Apr 2020 at 20:23, Mike Kravetz <mike.kravetz@oracle.com> wrote:
> >> On 4/20/20 8:34 AM, Qian Cai wrote:
> >>>
> >>> Reverted this series fixed many undefined behaviors on arm64 with the config,
> >> While rearranging the code (patch 3 in series), I made the incorrect
> >> assumption that CONT_XXX_SIZE == (1UL << CONT_XXX_SHIFT).  However,
> >> this is not the case.  Does the following patch fix these issues?
> >>
> >> From b75cb4a0852e208bee8c4eb347dc076fcaa88859 Mon Sep 17 00:00:00 2001
> >> From: Mike Kravetz <mike.kravetz@oracle.com>
> >> Date: Mon, 20 Apr 2020 10:41:18 -0700
> >> Subject: [PATCH] arm64/hugetlb: fix hugetlb initialization
> >>
> >> When calling hugetlb_add_hstate() to initialize a new hugetlb size,
> >> be sure to use correct huge pages size order.
> >>
> >> Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
> >> ---
> >>  arch/arm64/mm/hugetlbpage.c | 8 ++++----
> >>  1 file changed, 4 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
> >> index 9ca840527296..a02411a1f19a 100644
> >> --- a/arch/arm64/mm/hugetlbpage.c
> >> +++ b/arch/arm64/mm/hugetlbpage.c
> >> @@ -453,11 +453,11 @@ void huge_ptep_clear_flush(struct vm_area_struct *vma,
> >>  static int __init hugetlbpage_init(void)
> >>  {
> >>  #ifdef CONFIG_ARM64_4K_PAGES
> >> -      hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
> >> +      hugetlb_add_hstate(ilog2(PUD_SIZE) - PAGE_SHIFT);
> >>  #endif
> >> -      hugetlb_add_hstate(CONT_PMD_SHIFT - PAGE_SHIFT);
> >> -      hugetlb_add_hstate(PMD_SHIFT - PAGE_SHIFT);
> >> -      hugetlb_add_hstate(CONT_PTE_SHIFT - PAGE_SHIFT);
> >> +      hugetlb_add_hstate(ilog2(CONT_PMD_SIZE) - PAGE_SHIFT);
> >> +      hugetlb_add_hstate(ilog2(PMD_SIZE) - PAGE_SHIFT);
> >> +      hugetlb_add_hstate(ilog2(CONT_PTE_SIZE) - PAGE_SHIFT);
> >>
> >>        return 0;
> >>  }
> >
> > I build this for an arm64 kernel and ran it in qemu and it worked.
>
> Thanks for testing Anders!
>
> Will, here is an updated version of the patch based on your suggestion.
> I added the () for emphasis but that may just be noise for some.  Also,
> the naming differences and values for CONT_PTE may make some people
> look twice.  Not sure if being consistent here helps?
>
> I have only built this.  No testing.
>
> From daf833ab6b806ecc0816d84d45dcbacc052a7eec Mon Sep 17 00:00:00 2001
> From: Mike Kravetz <mike.kravetz@oracle.com>
> Date: Mon, 20 Apr 2020 13:56:15 -0700
> Subject: [PATCH] arm64/hugetlb: fix hugetlb initialization
>
> When calling hugetlb_add_hstate() to initialize a new hugetlb size,
> be sure to use correct huge pages size order.
>
> Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>

Tested-by: Anders Roxell <anders.roxell@linaro.org>

I tested this patch on qemu-aarch64.

Cheers,
Anders

> ---
>  arch/arm64/mm/hugetlbpage.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
> index 9ca840527296..bed6dc7c4276 100644
> --- a/arch/arm64/mm/hugetlbpage.c
> +++ b/arch/arm64/mm/hugetlbpage.c
> @@ -455,9 +455,9 @@ static int __init hugetlbpage_init(void)
>  #ifdef CONFIG_ARM64_4K_PAGES
>        hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
>  #endif
> -      hugetlb_add_hstate(CONT_PMD_SHIFT - PAGE_SHIFT);
> +      hugetlb_add_hstate((CONT_PMD_SHIFT + PMD_SHIFT) - PAGE_SHIFT);
>        hugetlb_add_hstate(PMD_SHIFT - PAGE_SHIFT);
> -      hugetlb_add_hstate(CONT_PTE_SHIFT - PAGE_SHIFT);
> +      hugetlb_add_hstate((CONT_PTE_SHIFT + PAGE_SHIFT) - PAGE_SHIFT);
>
>        return 0;
>  }
> --
> 2.25.2
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp
derp 
derp
derp
derp
derp
derp
derp
derp
--- 
You received this message because you are subscribed to the Google Groups "derpyderpderp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to derpyderpderp+unsubscribe@googlegroups.com.
  

[-- Attachment #2: Type: text/html, Size: 15023 bytes --]

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox