diff mbox series

[2/3] Remove 256MB limit restriction for boot cpu paca allocation

Message ID 20211004151142.256251-3-sourabhjain@linux.ibm.com (mailing list archive)
State Superseded
Headers show
Series Update crashkernel offset to allow kernel to boot on large config LPARs | expand
Related show

Commit Message

Sourabh Jain Oct. 4, 2021, 3:11 p.m. UTC
From: Mahesh Salgaonkar <mahesh@linux.ibm.com>

At the time when we detect and allocate paca for boot cpu, we havn't yet
detected mmu feature of 1T segments support (not until
mmu_early_init_devtree() call). This causes ppc64_bolted_size() to return
256MB as limit forcing boot cpu paca allocation below 256MB always.

This works fine for kdump kernel boot as long as crashkernel reservation is
at offset below 256MB. But when we move kdump offset to 256MB or above,
kdump kernel fails to allocate paca for boot cpu below 256MB and crashes in
allocate_paca().

Moving the detection of segment sizes just before paca allocation for boot
cpu removes this restriction of 256MB limit. This allows kdump kernel to
successfully boot and capture vmcore.

Signed-off-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>
Signed-off-by: Sourabh Jain <sourabhjain@linu.ibm.com>
Reported-and-tested-by: Abdul haleem <abdhalee@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/book3s/64/mmu.h | 1 +
 arch/powerpc/kernel/prom.c               | 4 ++++
 arch/powerpc/mm/book3s64/hash_utils.c    | 5 ++++-
 3 files changed, 9 insertions(+), 1 deletion(-)

Comments

kernel test robot Oct. 5, 2021, 5:58 a.m. UTC | #1
Hi Sourabh,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on linux/master linus/master v5.15-rc3 next-20210922]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Sourabh-Jain/Update-crashkernel-offset-to-allow-kernel-to-boot-on-large-config-LPARs/20211004-233345
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-buildonly-randconfig-r004-20211004 (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/563e715d022b3fab0f1791f64c3944aa34d20f04
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Sourabh-Jain/Update-crashkernel-offset-to-allow-kernel-to-boot-on-large-config-LPARs/20211004-233345
        git checkout 563e715d022b3fab0f1791f64c3944aa34d20f04
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   arch/powerpc/kernel/prom.c: In function 'early_init_dt_scan_cpus':
>> arch/powerpc/kernel/prom.c:389:17: error: implicit declaration of function 'hash__early_detect_seg_size' [-Werror=implicit-function-declaration]
     389 |                 hash__early_detect_seg_size();
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/hash__early_detect_seg_size +389 arch/powerpc/kernel/prom.c

   307	
   308	static int __init early_init_dt_scan_cpus(unsigned long node,
   309						  const char *uname, int depth,
   310						  void *data)
   311	{
   312		const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
   313		const __be32 *prop;
   314		const __be32 *intserv;
   315		int i, nthreads;
   316		int len;
   317		int found = -1;
   318		int found_thread = 0;
   319	
   320		/* We are scanning "cpu" nodes only */
   321		if (type == NULL || strcmp(type, "cpu") != 0)
   322			return 0;
   323	
   324		/* Get physical cpuid */
   325		intserv = of_get_flat_dt_prop(node, "ibm,ppc-interrupt-server#s", &len);
   326		if (!intserv)
   327			intserv = of_get_flat_dt_prop(node, "reg", &len);
   328	
   329		nthreads = len / sizeof(int);
   330	
   331		/*
   332		 * Now see if any of these threads match our boot cpu.
   333		 * NOTE: This must match the parsing done in smp_setup_cpu_maps.
   334		 */
   335		for (i = 0; i < nthreads; i++) {
   336			if (be32_to_cpu(intserv[i]) ==
   337				fdt_boot_cpuid_phys(initial_boot_params)) {
   338				found = boot_cpu_count;
   339				found_thread = i;
   340			}
   341	#ifdef CONFIG_SMP
   342			/* logical cpu id is always 0 on UP kernels */
   343			boot_cpu_count++;
   344	#endif
   345		}
   346	
   347		/* Not the boot CPU */
   348		if (found < 0)
   349			return 0;
   350	
   351		DBG("boot cpu: logical %d physical %d\n", found,
   352		    be32_to_cpu(intserv[found_thread]));
   353		boot_cpuid = found;
   354	
   355		/*
   356		 * PAPR defines "logical" PVR values for cpus that
   357		 * meet various levels of the architecture:
   358		 * 0x0f000001	Architecture version 2.04
   359		 * 0x0f000002	Architecture version 2.05
   360		 * If the cpu-version property in the cpu node contains
   361		 * such a value, we call identify_cpu again with the
   362		 * logical PVR value in order to use the cpu feature
   363		 * bits appropriate for the architecture level.
   364		 *
   365		 * A POWER6 partition in "POWER6 architected" mode
   366		 * uses the 0x0f000002 PVR value; in POWER5+ mode
   367		 * it uses 0x0f000001.
   368		 *
   369		 * If we're using device tree CPU feature discovery then we don't
   370		 * support the cpu-version property, and it's the responsibility of the
   371		 * firmware/hypervisor to provide the correct feature set for the
   372		 * architecture level via the ibm,powerpc-cpu-features binding.
   373		 */
   374		if (!dt_cpu_ftrs_in_use()) {
   375			prop = of_get_flat_dt_prop(node, "cpu-version", NULL);
   376			if (prop && (be32_to_cpup(prop) & 0xff000000) == 0x0f000000)
   377				identify_cpu(0, be32_to_cpup(prop));
   378	
   379			check_cpu_feature_properties(node);
   380			check_cpu_pa_features(node);
   381		}
   382	
   383		mmu_cpu_feature_fixup();
   384		identical_pvr_fixup(node);
   385		init_mmu_slb_size(node);
   386	
   387		/* Initialize segment sizes */
   388		if (!early_radix_enabled())
 > 389			hash__early_detect_seg_size();
   390	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/arch/powerpc/include/asm/book3s/64/mmu.h b/arch/powerpc/include/asm/book3s/64/mmu.h
index 69a89fa1330d..f43070581f11 100644
--- a/arch/powerpc/include/asm/book3s/64/mmu.h
+++ b/arch/powerpc/include/asm/book3s/64/mmu.h
@@ -199,6 +199,7 @@  extern int mmu_io_psize;
 /* MMU initialization */
 void mmu_cpu_feature_fixup(void);
 void mmu_early_init_devtree(void);
+void hash__early_detect_seg_size(void);
 void hash__early_init_devtree(void);
 void radix__early_init_devtree(void);
 #ifdef CONFIG_PPC_PKEY
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 1727a3abe6c1..68397f335caf 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -384,6 +384,10 @@  static int __init early_init_dt_scan_cpus(unsigned long node,
 	identical_pvr_fixup(node);
 	init_mmu_slb_size(node);
 
+	/* Initialize segment sizes */
+	if (!early_radix_enabled())
+		hash__early_detect_seg_size();
+
 #ifdef CONFIG_PPC64
 	if (nthreads == 1)
 		cur_cpu_spec->cpu_features &= ~CPU_FTR_SMT;
diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c
index c145776d3ae5..ef4fc6bb1b30 100644
--- a/arch/powerpc/mm/book3s64/hash_utils.c
+++ b/arch/powerpc/mm/book3s64/hash_utils.c
@@ -1020,11 +1020,14 @@  static void __init htab_initialize(void)
 #undef KB
 #undef MB
 
-void __init hash__early_init_devtree(void)
+void __init hash__early_detect_seg_size(void)
 {
 	/* Initialize segment sizes */
 	of_scan_flat_dt(htab_dt_scan_seg_sizes, NULL);
+}
 
+void __init hash__early_init_devtree(void)
+{
 	/* Initialize page sizes */
 	htab_scan_page_sizes();
 }