From patchwork Wed Apr 20 01:40:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 8884821 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A21279F36E for ; Wed, 20 Apr 2016 01:43:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BE6D9202A1 for ; Wed, 20 Apr 2016 01:43:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D30A920260 for ; Wed, 20 Apr 2016 01:43:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932753AbcDTBmv (ORCPT ); Tue, 19 Apr 2016 21:42:51 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:35931 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932437AbcDTBk7 (ORCPT ); Tue, 19 Apr 2016 21:40:59 -0400 Received: by mail-pf0-f181.google.com with SMTP id e128so12363513pfe.3; Tue, 19 Apr 2016 18:40:59 -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=EQgSEgJfK/DZXrzD9x6kxmDm0X7j7N/KiWiMmOHVgcw=; b=0NoX1y2fui3DEu0mQGqoS/IAq0JTg5E/AZqNeneIiwkDN8SVDGpSTrrG88H1pyU8gC rPO1C1AoOSqE4UZjORIKGl0y4tK0CJE133Yuy9I+MEgxp+vbJYEkNzyTe73QDmVlbXrv 5piW5YT9a5JL/81XFbNGlvS1LFFbw//NWJX9lYpF+tCZ6FDnOerxVOyWtg8j+dbeGbQJ QLEHKiZZ/n4xkKfG2CtR456L+doXGZ1LqLOn2/43RHzH1gjbqb4LiD+lbwMQPegVNsiO bmtG4d7C/+ioENzBIi943jdU1+JkwBZ7Wd4CD8FMNaSyZe4GEsIetexRXbYiJw232jKv RdCg== 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=EQgSEgJfK/DZXrzD9x6kxmDm0X7j7N/KiWiMmOHVgcw=; b=CIMXMwxlB79q+hMmjxJU/YxZ3NJspDCowyd2DnRSaN1Fl8G2OEihd05vs+openm7+k q1doIkLi8hGrhTaNayOLzoswQQ1+aHlj0SqyZQQ1DD8RllqVKkbyOMOzvJiiP3qIdLfb QqznSRWVhWfdVJnIEPSri9TkIh5aQdhycX3hvyt56zcizaN/J3dv6ov0hR2ecMLTPLVA ZJ+N6+tjl1SyNcfAdM8ENobXSskw8egTYSM1j6cUHzP8xuLxqRzL4tuUwAZUUGQ2ymtc 3arRVN7xhiVG4AR5G4sdm72cMwvApdLwsmDFX6UoGAulUw55ONAn/Q8DysS89b0ECFTr 7MMg== X-Gm-Message-State: AOPr4FXTcP0bn58vO8e+XAzCtPB1eItnt0w4JRC9d3nC0nAZ+NoXVf9ZGwzbiFy08Z7Tpw== X-Received: by 10.98.88.68 with SMTP id m65mr8575126pfb.4.1461116458896; Tue, 19 Apr 2016 18:40:58 -0700 (PDT) Received: from dl.caveonetworks.com ([64.2.3.194]) by smtp.gmail.com with ESMTPSA id o16sm6095460pfi.5.2016.04.19.18.40.49 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 19 Apr 2016 18:40:52 -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 u3K1em3K023084; Tue, 19 Apr 2016 18:40:48 -0700 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id u3K1emUf023083; Tue, 19 Apr 2016 18:40:48 -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 v5 11/14] acpi, numa, srat: Improve SRAT error detection and add messages. Date: Tue, 19 Apr 2016 18:40:36 -0700 Message-Id: <1461116439-22991-12-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1461116439-22991-1-git-send-email-ddaney.cavm@gmail.com> References: <1461116439-22991-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=unavailable 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 8ba90ad..d244018 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);