From patchwork Mon Jan 25 10:21:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 60336 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp1264637lbb; Mon, 25 Jan 2016 02:22:11 -0800 (PST) X-Received: by 10.98.86.221 with SMTP id h90mr24672171pfj.97.1453717331642; Mon, 25 Jan 2016 02:22:11 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fk1si32748585pad.35.2016.01.25.02.22.11; Mon, 25 Jan 2016 02:22:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756202AbcAYKWK (ORCPT + 6 others); Mon, 25 Jan 2016 05:22:10 -0500 Received: from mail-bl2on0053.outbound.protection.outlook.com ([65.55.169.53]:35584 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755630AbcAYKWH (ORCPT ); Mon, 25 Jan 2016 05:22:07 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Robert.Richter@caviumnetworks.com; Received: from rric.localdomain (92.224.194.101) by BLUPR0701MB1602.namprd07.prod.outlook.com (10.163.84.151) with Microsoft SMTP Server (TLS) id 15.1.365.19; Mon, 25 Jan 2016 10:22:01 +0000 Date: Mon, 25 Jan 2016 11:21:48 +0100 From: Robert Richter To: Hanjun Guo CC: "Rafael J. Wysocki" , Will Deacon , Catalin Marinas , , , , Ganapatrao Kulkarni , Lorenzo Pieralisi , Shannon Zhao , Steve Capper , Mark Rutland , Hanjun Guo Subject: Re: [PATCH v3 05/12] arm64, acpi, numa: NUMA support based on SRAT and SLIT Message-ID: <20160125102148.GE24726@rric.localdomain> References: <1453541967-3744-1-git-send-email-guohanjun@huawei.com> <1453541967-3744-6-git-send-email-guohanjun@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1453541967-3744-6-git-send-email-guohanjun@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [92.224.194.101] X-ClientProxiedBy: VI1PR05CA0030.eurprd05.prod.outlook.com (25.162.33.168) To BLUPR0701MB1602.namprd07.prod.outlook.com (25.163.84.151) X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1602; 2:0C13HuMJ3NChAJ0LFUWG4NwBPUHspb7TU04nVWwxw8mq5+oMTiMZ/bixL6OwXUl2LArMMgbNCMOKzS8GUA5zlpU5qTRfQ8jKdWS5MXm7buc3IrPpNpnOePYqPgtcI3pKZTOlUwGVp/4Zsj6FVX6wrA==; 3:3jgVZNvpy0fqiR8nh4skp9hvhvn1bnAxrs21pADhQS254BDYSkcnFZReDk1vMZWf4YYrDvK1hbouvIjrj1M84hJ7ltRzo/WgHGbRp9ioBjJ67Vz5wl5y8H6n28J2IKkE; 25:3oENlAJpRf8EbGRpW3jJROk4KubIdvOqY3QpMr8SNPsGm7sz0ZSEKCnSZuk+xw2wEyAhULspM+NbkD0q3zRgYJQw09bndzSwSBxqza6vhGuB/ATyXnRWOyS8GC+eYqQn30y39Zq48lroXmFploWmlxrtAGhn1TUuOGwhxMUFXaQhywYZGN3dill+BKeFqKoOm03h77vie0hXvccHGK5v6l7Jbn3LAFGf9Bw1m2OZCtccx/Jtpw0aU/lt/sW773M4 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0701MB1602; X-MS-Office365-Filtering-Correlation-Id: b2150da3-3317-4736-b583-08d325715e88 X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1602; 20:sZJhLG4GTxHd4Jgw2MdpVl1CFagjOY++zjlyJzky6yEsGUSXE5zvZYAFlpJmNejLuvaGahdCXa+9VGB8dVVi7KGyiV/TQgmg19Fe5WH9Vy8pyqZJgGYV4AgOssQuIT/uWm4WS6xJinO3lF939q4VT0Tqxc8LoegyR0aFDx+EOwezdQByH1JI+lVnb966zNqstYdnKip4QU572byuL1dtndDSzhrsLr+Ldp/p4EVVv8FAi7vcpcysGVb2qrTdwYtoaWSg4W4ln7RJh6nGV+a+4IYiWIPJYQAqDzMQAcqHzWGXq1oc+i8lpDBLl1GHRyD0wlKYhbHSF0UsMlQXd5t5oo4BhKJSIdi6hh4lvL9DtI2AMQ35g/CA79XuAXSBtAyeTl1JGy+HgYmi0Db/+aHGgxcanOrCBsNialpHzwMNMxe+eD39x97IGtUMh5myiErOA+JvmzyjtbKPBbyDK5iMZYfwrDapL+kLSL21J0CWW6ewAv18Xrq2kLeXMQX7saD3km/edi82cZaZXGyBKQxkhm4jXIuqlgg/67yPlnDAXV2rm40NwpG15KKtuR7TgsS0gQkNUmKujt/zJDo1HOqb3OoqI/fxugigZFFntnd+6wo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(8121501046)(5005006)(3002001)(10201501046); SRVR:BLUPR0701MB1602; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1602; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1602; 4:j4g9GnYcq1VKd3YBkycUCchI5bn1SUE7JphrSG4F5P0SH/0WrSoNgTqDRsAEICPqhuKLcAeceIeTar3gbexDo5+pU+eGkYOdGfDhTMV4iu/GMvzx/ohcBwzjFuDsjsvHfFwzM5oUBTvGe2lnnjj/BZkDDpLtMbcvSF0jrw6xCBQ//hzMvzYp/VidH/eKwhsHzt1QJWNX5ilKZdATcplfiHPQ9mkwuplsEXQ4zOpqlM6nvgfoNN064dw0Cl/03+wlshGVz21U6SqEa9/2/JfjPKBKBq80y56lGhlgNSaQAdzdapn6Yrj1cDNqjSsDlt6MljW/Aua2RQ2hPvpRhvQS2v+DIwFfM/VgGLUnotCaaSIN+xK1Jqhq55iir0u3zETS X-Forefront-PRVS: 083289FD26 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(24454002)(189002)(199003)(77096005)(5001960100002)(54356999)(2950100001)(3846002)(23726003)(110136002)(1096002)(50986999)(105586002)(5008740100001)(76176999)(586003)(106356001)(97736004)(33656002)(4001350100001)(81156007)(66066001)(47776003)(101416001)(1076002)(189998001)(6116002)(87976001)(19580395003)(97756001)(19580405001)(2906002)(50466002)(122386002)(42186005)(83506001)(4326007)(46406003)(5004730100002)(40100003)(86362001)(92566002)(575784001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1602; H:rric.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1602; 23:V6q3LaFnXhnb09nJlNBVsVg3iheSJqzDms272br?= =?us-ascii?Q?p4S2M/YAfJ8UuWHZDAWU9iVD/T9Kt23A1612ZxPUgqgy903oD1gHssk7G22k?= =?us-ascii?Q?Lpr1h+GXtDcGQC7fqKGH605Q3jxbd5E2Y+tN3jF1UioWBR6hPk1uxE9TVUsc?= =?us-ascii?Q?b/0Gvz9VE1FoI2nP8Q5v5IC99XZfIWo5RyD7ycBaf7CRF2jLAhbgH44xQGXW?= =?us-ascii?Q?Fxgi27zMS+xqrnPfUZte491dHw+BiCiam8/K1YNS9ES85aYo8ftnAOVmIAC1?= =?us-ascii?Q?DOEm1LghGSeFVhBv8lcjXyVVcesEcHrpf/zAieP2s0IZM2/s9m5VDJid+IVS?= =?us-ascii?Q?kItzVKAKE0qQzCJBIIlh+U0m9U6Bk7LUuyC8rIZ3bGHlQhs4W8Nv/mS/Jh8m?= =?us-ascii?Q?RHeSJrrag2hrtqfomCd+jIF192jXGm3t4hoTrJ60ccj/qQicC8a16Kb/XXQC?= =?us-ascii?Q?K7WSuj0HnmzIkzQAqZB58kzealNd10X7MFV0p8lPsnO0kyDieH53BBIMRb3p?= =?us-ascii?Q?aPUvbc/ZW5M0wavM7sk3ABpegA8eCjl3ePqGX05bbdN61qMUOpOtzbN5uDIJ?= =?us-ascii?Q?hl5IVIiecquo/WZ+hTb7m2/fPtaPEu8egQIxBU00drFouHYMXq2uc2a9eI3G?= =?us-ascii?Q?xFYb1VfnPvu4Z50BGpckVQB5nAukBuxSNBBDDgAHr9CifSmRmalItiPqcleP?= =?us-ascii?Q?Syme2bUc43v88pgtWkQzYAp9ZmJAl0cYwNZXYjOArJswOgKrVN13NJBooi64?= =?us-ascii?Q?dRpgAnIj3m/PsXGBl9ggbCDPJcjns1Jc5WUE1TIgoOwSEkV724AkcPAOkXrp?= =?us-ascii?Q?xmFdxcxA9izl0sTrjrDAPDVo5YIoGBCJsMwnIq6s+QasHI8yODbambV7nWfY?= =?us-ascii?Q?QaoVw1uHazLhQ0ADZo8BNSQax4DDkagTZL+T/LRQ8Y8woVX7BC2QLuWSnT1r?= =?us-ascii?Q?L8/Q4Z3wiVN3twNkGTUkxLQm2GnlQ0zK6b7FTG6bDvivvYkuhvEWGIah6eF/?= =?us-ascii?Q?MJNgbfO+SkbO0UWhN5VXmGijcRmPXV2IUcUmCPkWTuqTS3FbN+VAjNBeclbu?= =?us-ascii?Q?UWPW8F5elmExBp4basK1gAB0P67Kjnqvr/czbiu8bO+F30hj30h3xA5ElZ1Q?= =?us-ascii?Q?DRCSeQiziTqzBVBd/1RGaVdY/0lQ650GV?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1602; 5:iv3ap/Ov9ViZOJkMyScieOY2cOLu+R7/yaIjCpbCQjgBaFmFu2dbJlNJYjbKG3MzP9XQVLav1D+6XfXY+J5KnMnkMvdH4GG8BiOxKibtDSKlEMc8sZggfgaChes5TwlPcspxlILBhaeDvPcLvwvOiQ==; 24:md3YvTwIklmnV90d/SlhCDVK8WoDQVxHu9ZFvfdCRAUoY+6TpiUY+R4ct/JUuGWfmrKPQzpd2ejXVCuCTJLzoCShrv78puBPhr8cTFQdvdw= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2016 10:22:01.5983 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1602 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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. > + 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. -Robert > + } >From 78945c73e4ec03756a135a75133ed29694a7a0f2 Mon Sep 17 00:00:00 2001 From: Robert Richter Date: Wed, 11 Nov 2015 09:53:39 +0100 Subject: [PATCH] arm64, acpi, numa: Add error messages for bad SRAT tables Signed-off-by: Robert Richter --- arch/arm64/kernel/acpi_numa.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) -- 2.7.0.rc3 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm64/kernel/acpi_numa.c b/arch/arm64/kernel/acpi_numa.c index f7f7533761cd..936ad6c43740 100644 --- a/arch/arm64/kernel/acpi_numa.c +++ b/arch/arm64/kernel/acpi_numa.c @@ -143,6 +143,8 @@ void __init acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa) return; if (pa->header.length < sizeof(struct acpi_srat_gicc_affinity)) { + pr_err("SRAT: Invalid SRAT header length: %d\n", + pa->header.length); bad_srat(); return; } @@ -166,7 +168,7 @@ void __init acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa) } if (get_mpidr_in_madt(pa->acpi_processor_uid, &mpidr)) { - pr_warn("SRAT: PXM %d with ACPI ID %d has no valid MPIDR in MADT\n", + pr_err("SRAT: PXM %d with ACPI ID %d has no valid MPIDR in MADT\n", pxm, pa->acpi_processor_uid); bad_srat(); return; @@ -190,7 +192,9 @@ int __init acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) if (srat_disabled()) return -EINVAL; - if (ma->header.length != sizeof(struct acpi_srat_mem_affinity)) { + if (ma->header.length < sizeof(struct acpi_srat_mem_affinity)) { + pr_err("SRAT: Unexpected header length: %d\n", + ma->header.length); bad_srat(); return -EINVAL; } @@ -216,10 +220,17 @@ int __init acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) (unsigned long long) start, (unsigned long long) end - 1); if (numa_add_memblk(node, start, (end - start)) < 0) { + pr_err("SRAT: Failed to add memblk to node %u [mem %#010Lx-%#010Lx]\n", + node, (unsigned long long) start, + (unsigned long long) end - 1); bad_srat(); return -EINVAL; } + pr_info("SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]\n", + node, pxm, + (unsigned long long) start, (unsigned long long) end - 1); + return 0; }