From patchwork Mon Apr 18 21:14:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 8875131 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 94B6FBF29F for ; Mon, 18 Apr 2016 21:16:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B384220121 for ; Mon, 18 Apr 2016 21:16:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA7AD2010F for ; Mon, 18 Apr 2016 21:16:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751957AbcDRVQE (ORCPT ); Mon, 18 Apr 2016 17:16:04 -0400 Received: from mail-pf0-f180.google.com ([209.85.192.180]:33729 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752751AbcDRVOi (ORCPT ); Mon, 18 Apr 2016 17:14:38 -0400 Received: by mail-pf0-f180.google.com with SMTP id 184so84947749pff.0; Mon, 18 Apr 2016 14:14:38 -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=TI+2GJ0nY4sdGhgPHpSlcYyqpBZaCrBC1+NaePSumUA=; b=Ucjzk5YOqurHlfIFQbPHJrTaeP8pEdEwj1NBgJcIblX3LXvxAwFDjYTEMlPYqxRo37 CyXbX+5aFLBQ/vYqAkwB/7KVgYx4ueom1pb784dsygOz6RZ63hP8sSlpqPEzBGmWPB4W b4NUPlmY4KH9mJUTqPTUwATuUNpO1C0IH3pTPH5s8tEI+Mj7xGqmUu/vx3AoHl9D6191 Uy4i44ZUX0IGZ/pUzT0tsnqFFXTkpcOeGdTYZVwKvBvmnq7IOeoloSD5wO7x9H8c7wfP TBknuqoSQmzOKhZMGLYgVqV/nN7/ud5tFA/kuxHf7dSd8xcSR+c2fxQxIWvKxFxZh2yN JHAQ== 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=TI+2GJ0nY4sdGhgPHpSlcYyqpBZaCrBC1+NaePSumUA=; b=drYq3itnQxODQPZuzq/1upfjs/5wjXxHQ8T0Xv33GJBIZCQzohRktUHNOOzwfHPPUm doiXdEm8yqfFXKW+gQC+889aZI9f1tNKB7MGozSKo/LSEGQRBsgeO3jlEXUOlRp9AxfW /UmHE0iDhMB6GV7aGAxL5NDBSbiFjfNgpyyErF/dzL7KW1u6L5/FOT5V8RCMc7WpEGbV ZWZbtaaipPTmC6eXVwqtuyPoO4cEZ8YLWExG50AEzS5EgletGts0O7X2zWEePw8o4Y60 9koA343e0Lp9YbiblmDCobVtvPWzUJfPZ8KEaLpyl+CJKujQAPkW+qQuusg+UOCAJmUS aWWQ== X-Gm-Message-State: AOPr4FV4Jzf7MvxJal5iQeu7NyO7+6pOSw3I7ZlnCeCIKZPc6q8HkhVzl4K0RWgm/3H4rw== X-Received: by 10.98.52.1 with SMTP id b1mr34925477pfa.54.1461014077999; Mon, 18 Apr 2016 14:14:37 -0700 (PDT) Received: from dl.caveonetworks.com ([64.2.3.194]) by smtp.gmail.com with ESMTPSA id r191sm85811363pfr.36.2016.04.18.14.14.30 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Apr 2016 14:14:34 -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 u3ILETkr030881; Mon, 18 Apr 2016 14:14:29 -0700 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id u3ILET2U030880; Mon, 18 Apr 2016 14:14:29 -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 Cc: linux-kernel@vger.kernel.org, Robert Richter , David Daney Subject: [PATCH v4 11/14] acpi, numa, srat: Improve SRAT error detection and add messages. Date: Mon, 18 Apr 2016 14:14:09 -0700 Message-Id: <1461014052-30788-12-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1461014052-30788-1-git-send-email-ddaney.cavm@gmail.com> References: <1461014052-30788-1-git-send-email-ddaney.cavm@gmail.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.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 c4ea877..6133eb1 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c @@ -240,8 +240,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; @@ -255,13 +258,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);