From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hanjun Guo Subject: Re: [PATCH v3 05/12] arm64, acpi, numa: NUMA support based on SRAT and SLIT Date: Wed, 27 Jan 2016 15:12:15 +0800 Message-ID: <56A86DCF.1020205@huawei.com> References: <1453541967-3744-1-git-send-email-guohanjun@huawei.com> <1453541967-3744-6-git-send-email-guohanjun@huawei.com> <20160125102148.GE24726@rric.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Return-path: Received: from szxga02-in.huawei.com ([119.145.14.65]:31284 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751386AbcA0HMp (ORCPT ); Wed, 27 Jan 2016 02:12:45 -0500 In-Reply-To: <20160125102148.GE24726@rric.localdomain> Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: Robert Richter Cc: "Rafael J. Wysocki" , Will Deacon , Catalin Marinas , linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Ganapatrao Kulkarni , Lorenzo Pieralisi , Shannon Zhao , Steve Capper , Mark Rutland , Hanjun Guo On 2016/1/25 18:21, Robert Richter wrote: > On 23.01.16 17:39:20, Hanjun Guo wrote: >> diff --git a/arch/arm64/kernel/acpi_numa.c b/arch/arm64/kernel/acpi_numa.c >> new file mode 100644 >> index 0000000..f7f7533 >> --- /dev/null >> +++ b/arch/arm64/kernel/acpi_numa.c >> +/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ >> +int __init acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) >> +{ >> + u64 start, end; >> + int node, pxm; >> + >> + if (srat_disabled()) >> + return -EINVAL; >> + >> + if (ma->header.length != sizeof(struct acpi_srat_mem_affinity)) { > Must be: > > ma->header.length < sizeof(struct acpi_srat_mem_affinity)) { > > Allow extensions to struct acpi_srat_mem_affinity in newer versions. Hmm, I think we need to remove the check here now. There are three cases: - firmware ACPI version is consistent with the ACPICA one, then ma->header.length == sizeof(struct acpi_srat_mem_affinity ) - firmware ACPI version is not consistent with the ACPICA one, for example, struct acpi_srat_mem_affinity is extended in new ACI version, but the formware is using the older one, then it's ok to use ma->header.length < sizeof(struct acpi_srat_mem_affinity ) - but if we use the older kernel + updated new firmware, then ma->header.length > sizeof(struct acpi_srat_mem_affinity ) will be the case, right? > >> + bad_srat(); >> + return -EINVAL; > We need a pr_err() here to avoid that numa setup fails silently due to > bad fw. This applies to all error paths. > > See my delta patch below. You can merge it with your patch. Thanks! I wil merge it into next version. Hanjun From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753831AbcA0HMt (ORCPT ); Wed, 27 Jan 2016 02:12:49 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:31284 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751386AbcA0HMp (ORCPT ); Wed, 27 Jan 2016 02:12:45 -0500 Subject: Re: [PATCH v3 05/12] arm64, acpi, numa: NUMA support based on SRAT and SLIT To: Robert Richter References: <1453541967-3744-1-git-send-email-guohanjun@huawei.com> <1453541967-3744-6-git-send-email-guohanjun@huawei.com> <20160125102148.GE24726@rric.localdomain> CC: "Rafael J. Wysocki" , Will Deacon , Catalin Marinas , , , , Ganapatrao Kulkarni , Lorenzo Pieralisi , Shannon Zhao , "Steve Capper" , Mark Rutland , "Hanjun Guo" From: Hanjun Guo Message-ID: <56A86DCF.1020205@huawei.com> Date: Wed, 27 Jan 2016 15:12:15 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160125102148.GE24726@rric.localdomain> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.17.188] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.56A86DE3.0026,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: 32d0183df454178a9be83ecba18d93b6 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/1/25 18:21, Robert Richter wrote: > On 23.01.16 17:39:20, Hanjun Guo wrote: >> diff --git a/arch/arm64/kernel/acpi_numa.c b/arch/arm64/kernel/acpi_numa.c >> new file mode 100644 >> index 0000000..f7f7533 >> --- /dev/null >> +++ b/arch/arm64/kernel/acpi_numa.c >> +/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ >> +int __init acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) >> +{ >> + u64 start, end; >> + int node, pxm; >> + >> + if (srat_disabled()) >> + return -EINVAL; >> + >> + if (ma->header.length != sizeof(struct acpi_srat_mem_affinity)) { > Must be: > > ma->header.length < sizeof(struct acpi_srat_mem_affinity)) { > > Allow extensions to struct acpi_srat_mem_affinity in newer versions. Hmm, I think we need to remove the check here now. There are three cases: - firmware ACPI version is consistent with the ACPICA one, then ma->header.length == sizeof(struct acpi_srat_mem_affinity ) - firmware ACPI version is not consistent with the ACPICA one, for example, struct acpi_srat_mem_affinity is extended in new ACI version, but the formware is using the older one, then it's ok to use ma->header.length < sizeof(struct acpi_srat_mem_affinity ) - but if we use the older kernel + updated new firmware, then ma->header.length > sizeof(struct acpi_srat_mem_affinity ) will be the case, right? > >> + bad_srat(); >> + return -EINVAL; > We need a pr_err() here to avoid that numa setup fails silently due to > bad fw. This applies to all error paths. > > See my delta patch below. You can merge it with your patch. Thanks! I wil merge it into next version. Hanjun From mboxrd@z Thu Jan 1 00:00:00 1970 From: guohanjun@huawei.com (Hanjun Guo) Date: Wed, 27 Jan 2016 15:12:15 +0800 Subject: [PATCH v3 05/12] arm64, acpi, numa: NUMA support based on SRAT and SLIT In-Reply-To: <20160125102148.GE24726@rric.localdomain> References: <1453541967-3744-1-git-send-email-guohanjun@huawei.com> <1453541967-3744-6-git-send-email-guohanjun@huawei.com> <20160125102148.GE24726@rric.localdomain> Message-ID: <56A86DCF.1020205@huawei.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 2016/1/25 18:21, Robert Richter wrote: > On 23.01.16 17:39:20, Hanjun Guo wrote: >> diff --git a/arch/arm64/kernel/acpi_numa.c b/arch/arm64/kernel/acpi_numa.c >> new file mode 100644 >> index 0000000..f7f7533 >> --- /dev/null >> +++ b/arch/arm64/kernel/acpi_numa.c >> +/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ >> +int __init acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) >> +{ >> + u64 start, end; >> + int node, pxm; >> + >> + if (srat_disabled()) >> + return -EINVAL; >> + >> + if (ma->header.length != sizeof(struct acpi_srat_mem_affinity)) { > Must be: > > ma->header.length < sizeof(struct acpi_srat_mem_affinity)) { > > Allow extensions to struct acpi_srat_mem_affinity in newer versions. Hmm, I think we need to remove the check here now. There are three cases: - firmware ACPI version is consistent with the ACPICA one, then ma->header.length == sizeof(struct acpi_srat_mem_affinity ) - firmware ACPI version is not consistent with the ACPICA one, for example, struct acpi_srat_mem_affinity is extended in new ACI version, but the formware is using the older one, then it's ok to use ma->header.length < sizeof(struct acpi_srat_mem_affinity ) - but if we use the older kernel + updated new firmware, then ma->header.length > sizeof(struct acpi_srat_mem_affinity ) will be the case, right? > >> + bad_srat(); >> + return -EINVAL; > We need a pr_err() here to avoid that numa setup fails silently due to > bad fw. This applies to all error paths. > > See my delta patch below. You can merge it with your patch. Thanks! I wil merge it into next version. Hanjun