From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757157AbcHWHss (ORCPT ); Tue, 23 Aug 2016 03:48:48 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:31271 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751621AbcHWHsq (ORCPT ); Tue, 23 Aug 2016 03:48:46 -0400 Message-ID: <57BBFF8B.80801@huawei.com> Date: Tue, 23 Aug 2016 15:47:23 +0800 From: zhong jiang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Catalin Marinas CC: Ganapatrao Kulkarni , Mark Rutland , Will Deacon , "linux-kernel@vger.kernel.org" , Rob Herring , Ganapatrao Kulkarni , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH] mm, numa: boot cpu should bound to the node0 when node_off enable References: <1471525766-12803-1-git-send-email-zhongjiang@huawei.com> <20160818160437.GA21343@e104818-lin.cambridge.arm.com> <57B667CA.5060905@huawei.com> <57B82533.9010507@huawei.com> <20160822142833.GE26494@e104818-lin.cambridge.arm.com> In-Reply-To: <20160822142833.GE26494@e104818-lin.cambridge.arm.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.68] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.57BBFF9D.002A,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: bd449304e84fb2666ee1b0cbb0b4f1b6 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/8/22 22:28, Catalin Marinas wrote: > On Sat, Aug 20, 2016 at 05:38:59PM +0800, zhong jiang wrote: >> On 2016/8/19 12:11, Ganapatrao Kulkarni wrote: >>> On Fri, Aug 19, 2016 at 9:30 AM, Ganapatrao Kulkarni >>> wrote: >>>> On Fri, Aug 19, 2016 at 7:28 AM, zhong jiang wrote: >>>>> On 2016/8/19 1:45, Ganapatrao Kulkarni wrote: >>>>>> On Thu, Aug 18, 2016 at 9:34 PM, Catalin Marinas >>>>>> wrote: >>>>>>> On Thu, Aug 18, 2016 at 09:09:26PM +0800, zhongjiang wrote: >>>>>>>> At present, boot cpu will bound to a node from device tree when node_off enable. >>>>>>>> if the node is not initialization, it will lead to a following problem. > [...] >>>>>>>> --- a/arch/arm64/mm/numa.c >>>>>>>> +++ b/arch/arm64/mm/numa.c >>>>>>>> @@ -119,7 +119,7 @@ void numa_store_cpu_info(unsigned int cpu) >>>>>>>> void __init early_map_cpu_to_node(unsigned int cpu, int nid) >>>>>>>> { >>>>>>>> /* fallback to node 0 */ >>>>>>>> - if (nid < 0 || nid >= MAX_NUMNODES) >>>>>>>> + if (nid < 0 || nid >= MAX_NUMNODES || numa_off) >>>>>> i did not understood how this line change fixes the issue that you >>>>>> have mentioned (i too not understood fully the issue description) >>>>>> this array used while mapping node id when secondary cores comes up >>>>>> when numa_off is set the cpu_to_node_map[cpu] is not used and set to >>>>>> node0 always( refer function numa_store_cpu_info).. >>>>>> please provide more details to understand the issue you are facing. >>>>>> /* >>>>>> * Set the cpu to node and mem mapping >>>>>> */ >>>>>> void numa_store_cpu_info(unsigned int cpu) >>>>>> { >>>>>> map_cpu_to_node(cpu, numa_off ? 0 : cpu_to_node_map[cpu]); >>>>>> } >>>>> The issue comes up when we test the kdump. it will leads to kernel crash. >>>>> when I debug the issue, I find boot cpu actually bound to the node1. while >>>>> node1 is not real existence when numa_off enable. >>>> boot cpu is default mapped to node0 >>>> are you running with any other patches? >>> if you added any patch to change this code >>> /* init boot processor */ >>> cpu_to_node_map[0] = 0; >>> map_cpu_to_node(0, 0); >>> >>> then adding code to take-care numa_off here might solve your issue. >> but in of_smp_init_cpus, boot cpu will call early_map_cpu_to_node[] to get >> the relation node. and the node is from devicetree. >> >> you points to the code will be covered with another node. therefore, it is >> possible that cpu_to_node[cpu] will leads to the incorrect results. therefore, >> The crash will come up. > I think I get Ganapat's point. The cpu_to_node_map[0] may be incorrectly > set by early_map_cpu_to_node() when called from smp_init_cpus() -> > of_parse_and_init_cpus(). However, the cpu_to_node_map[] array is *only* > read by numa_store_cpu_info(). This latter function calls > map_cpu_to_node() and, if numa_off, will only ever pass 0 as the nid. > > Given that the cpu_to_node_map[] array is static, I don't see how any > non-zero value could leak outside the arch/arm64/mm/numa.c file. > > So please give more details of any additional patches you have on top of > mainline or whether you reproduced this issue with the vanilla kernel > (since you mentioned kdump, that's not in mainline yet). > Thanks for Catalin and Ganapatral. I am sorry for that. The mainline have solved. The mainline changes is too much, I did not notice.