[PATCH v3 1/2] powerpc/mm: Cleanup memory block size probing

kernel test robot lkp at intel.com
Sat Jul 29 19:55:56 AEST 2023


Hi Aneesh,

kernel test robot noticed the following build errors:

[auto build test ERROR on powerpc/next]
[also build test ERROR on powerpc/fixes linus/master v6.5-rc3 next-20230728]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Aneesh-Kumar-K-V/powerpc-mm-Add-memory_block_size-as-a-kernel-parameter/20230728-184256
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link:    https://lore.kernel.org/r/20230728103556.745681-1-aneesh.kumar%40linux.ibm.com
patch subject: [PATCH v3 1/2] powerpc/mm: Cleanup memory block size probing
config: powerpc-powernv_defconfig (https://download.01.org/0day-ci/archive/20230729/202307291753.opRf3JsB-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce: (https://download.01.org/0day-ci/archive/20230729/202307291753.opRf3JsB-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202307291753.opRf3JsB-lkp@intel.com/

All errors (new ones prefixed by >>):

>> arch/powerpc/mm/init_64.c:558:7: error: variable 'base' set but not used [-Werror,-Wunused-but-set-variable]
     558 |                 u64 base, size;
         |                     ^
   1 error generated.


vim +/base +558 arch/powerpc/mm/init_64.c

   485	
   486	static int __init probe_memory_block_size(unsigned long node, const char *uname, int
   487						  depth, void *data)
   488	{
   489		const char *type;
   490		const char *compatible;
   491		unsigned long *block_size = (unsigned long *)data;
   492		const __be32 *reg, *endp;
   493		int l;
   494	
   495		if (depth != 1)
   496			return 0;
   497		/*
   498		 * If we have dynamic-reconfiguration-memory node, use the
   499		 * lmb value.
   500		 */
   501		if (strcmp(uname, "ibm,dynamic-reconfiguration-memory") == 0) {
   502	
   503			const __be32 *prop;
   504	
   505			prop = of_get_flat_dt_prop(node, "ibm,lmb-size", &l);
   506	
   507			if (!prop || l < dt_root_size_cells * sizeof(__be32))
   508				/*
   509				 * Nothing in the device tree
   510				 */
   511				*block_size = MIN_MEMORY_BLOCK_SIZE;
   512			else
   513				*block_size = of_read_number(prop, dt_root_size_cells);
   514			/*
   515			 * We have found the final value. Don't probe further.
   516			 */
   517			return 1;
   518		}
   519		/*
   520		 * Find all the device tree nodes of memory type and make sure
   521		 * the area can be mapped using the memory block size value
   522		 * we end up using. We start with 1G value and keep reducing
   523		 * it such that we can map the entire area using memory_block_size.
   524		 * This will be used on powernv and older pseries that don't
   525		 * have ibm,lmb-size node.
   526		 * For ex: with P5 we can end up with
   527		 * memory at 0 -> 128MB
   528		 * memory at 128M -> 64M
   529		 * This will end up using 64MB  memory block size value.
   530		 */
   531		type = of_get_flat_dt_prop(node, "device_type", NULL);
   532		if (type == NULL || strcmp(type, "memory") != 0)
   533			return 0;
   534	
   535		/*
   536		 * "ibm,coherent-device-memory with linux,usable-memory = 0
   537		 * Force 256MiB block size. Work around for GPUs on P9 PowerNV
   538		 * linux,usable-memory == 0 implies driver managed memory and
   539		 * we can't use large memory block size due to hotplug/unplug
   540		 * limitations.
   541		 */
   542		compatible = of_get_flat_dt_prop(node, "compatible", NULL);
   543		if (compatible && !strcmp(compatible, "ibm,coherent-device-memory")) {
   544			int len = 0;
   545			const __be32 *usm;
   546	
   547			usm = of_get_flat_dt_prop(node, "linux,drconf-usable-memory", &len);
   548			if (usm && !len) {
   549				*block_size = SZ_256M;
   550				return 1;
   551			}
   552		}
   553	
   554		reg = of_get_flat_dt_prop(node, "reg", &l);
   555		endp = reg + (l / sizeof(__be32));
   556	
   557		while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
 > 558			u64 base, size;
   559	
   560			base = dt_mem_next_cell(dt_root_addr_cells, &reg);
   561			size = dt_mem_next_cell(dt_root_size_cells, &reg);
   562	
   563			if (size == 0)
   564				continue;
   565	
   566			update_memory_block_size(block_size, size);
   567		}
   568		/* continue looking for other memory device types */
   569		return 0;
   570	}
   571	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


More information about the Linuxppc-dev mailing list