From patchwork Tue May 24 22:35:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 9134431 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5EECE607D3 for ; Tue, 24 May 2016 22:41:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54380281E3 for ; Tue, 24 May 2016 22:41:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 481B52822B; Tue, 24 May 2016 22:41:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 071BE281E3 for ; Tue, 24 May 2016 22:41:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b5KyR-0000cv-EE; Tue, 24 May 2016 22:38:51 +0000 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b5KwD-0006nw-J9 for linux-arm-kernel@lists.infradead.org; Tue, 24 May 2016 22:36:36 +0000 Received: by mail-pf0-x243.google.com with SMTP id b124so2929580pfb.0 for ; Tue, 24 May 2016 15:36:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Bo0wX1dtRm2ixXBJg1dz5iTjgopqkE/95z96VQ1+V34=; b=08EWTlvXQYcF1/2SN/P71Hpgy2WHw56LuZDwecPnoJ+6nI09E/eDDfBxpfYPffMO5q WMQb+rgEqpK2y8zFu0SgVfNtpqNugMKUfTsS0WAVc0nZIDsYKAv4Sr/1fSgBnnqwlNG8 NxgBIpgBhOFRjLKDVchimkRz7LzAyKEY9ddBftQgVP7FLvaXU+U0MSDDbIRk8p7PTmAx MRHL71wCsUF4LwuocZ+ZhUbssVaol9RlIt+6MtbF8RHSuoiESGBLKKrur2yVYa/s7wcm Nb3AZYLNgxpHZOy47mIYmmDF3hTM7M8cBHmtjEgkUyD7XtlhGgDrSg7mW6Ej7jAwMrAv bUKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Bo0wX1dtRm2ixXBJg1dz5iTjgopqkE/95z96VQ1+V34=; b=QrRGQplaGznPY2W3XLgqgVLOtAFNA1prGuTqdQZ7J1s+5j3GrDIXLDcc9qIH5kzLiF eR+Gpc2qLtxL1kmOlgoNoGLTcDepA3ipphNL2qVvGq6NiPhV0/w6IRjN82nVYyFH4Xga umfby9XkabtuQanw7DT+QLhtaA+P8+3cVyNfHMJ6SS14jFe9kqPkKQXjlunHLs+DTW0U 6cRjzP+CgYV6dn8MQTqlEvYvfzWODWT7wtEhgJrJs+fMw3xM+tJH0dyBfv446IcqCwKr ZLsXcJp4kZPrdYEZczHfpXidUQQgv8zbkErKESyi9swgB/W6wovmLuEiWDU0FdYEPl6D +ggg== X-Gm-Message-State: ALyK8tKKkPNOR7qwyObaYlyQI3e5+ZWBy8A87yAbIatTm+hC6lUnVhVK6QkJJqoP+O7fCw== X-Received: by 10.98.93.129 with SMTP id n1mr943518pfj.16.1464129373877; Tue, 24 May 2016 15:36:13 -0700 (PDT) Received: from dl.caveonetworks.com ([50.233.148.158]) by smtp.gmail.com with ESMTPSA id tn7sm7583811pac.29.2016.05.24.15.36.04 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 24 May 2016 15:36:09 -0700 (PDT) Received: from dl.caveonetworks.com (localhost.localdomain [127.0.0.1]) by dl.caveonetworks.com (8.14.5/8.14.5) with ESMTP id u4OMa3tJ019084; Tue, 24 May 2016 15:36:03 -0700 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id u4OMa3Bd019083; Tue, 24 May 2016 15:36:03 -0700 From: David Daney To: Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Catalin Marinas , Tony Luck , Fenghua Yu , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, "Rafael J. Wysocki" , Len Brown , Rob Herring , Frank Rowand , Grant Likely , Robert Moore , Lv Zheng , Hanjun Guo , Marc Zyngier , linux-ia64@vger.kernel.org, linux-acpi@vger.kernel.org, devel@acpica.org Subject: [PATCH v7 12/15] acpi, numa, srat: Improve SRAT error detection and add messages. Date: Tue, 24 May 2016 15:35:42 -0700 Message-Id: <1464129345-18985-13-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1464129345-18985-1-git-send-email-ddaney.cavm@gmail.com> References: <1464129345-18985-1-git-send-email-ddaney.cavm@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160524_153633_827172_B877F77C X-CRM114-Status: GOOD ( 13.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robert Richter , linux-kernel@vger.kernel.org, David Daney MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: David Daney Loosely based on code from Robert Richter and Hanjun Guo. Improve out of range node detection as well as allow for Larger SRAT entities. Add printing of nice messages. Signed-off-by: David Daney --- drivers/acpi/numa.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index 811f90a..fad6d28 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c @@ -252,8 +252,11 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) if (srat_disabled()) goto out_err; - 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); goto out_err_bad_srat; + } if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0) goto out_err; hotpluggable = ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE; @@ -267,13 +270,17 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) pxm &= 0xff; node = acpi_map_pxm_to_node(pxm); - if (node < 0) { - printk(KERN_ERR "SRAT: Too many proximity domains.\n"); + if (node == NUMA_NO_NODE || node >= MAX_NUMNODES) { + pr_err("SRAT: Too many proximity domains.\n"); goto out_err_bad_srat; } - if (numa_add_memblk(node, start, end) < 0) + if (numa_add_memblk(node, start, end) < 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); goto out_err_bad_srat; + } node_set(node, numa_nodes_parsed);