From patchwork Wed Apr 27 18:07:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 8961301 Return-Path: X-Original-To: patchwork-linux-arm@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 35D51BF29F for ; Wed, 27 Apr 2016 18:11:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 544CB2015A for ; Wed, 27 Apr 2016 18:11:40 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 7211A20138 for ; Wed, 27 Apr 2016 18:11:39 +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 1avTun-00035s-FE; Wed, 27 Apr 2016 18:10:21 +0000 Received: from mail-pa0-x241.google.com ([2607:f8b0:400e:c03::241]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1avTsa-0007bi-79 for linux-arm-kernel@lists.infradead.org; Wed, 27 Apr 2016 18:08:05 +0000 Received: by mail-pa0-x241.google.com with SMTP id vv3so6523910pab.0 for ; Wed, 27 Apr 2016 11:07:48 -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=nVp3xEiZCWHtnBjcvGD5mAOhPUsckrWSSqHEo5uvT5U=; b=cWtodZ7ZPCKuTCRiFsEsuU9gOfgi+VmZ/7g+jyk29wrvo64mpEnfIG1f8USdIX4w9i eViPaUkURcC7wMpVS2YKHDAtPBl7s1TWzu4Jqej4tA5sfu2K+11equ53qjFdhHngblMQ 5cfN/WJiULcyD7GVtRNUay6rVshNF/+TFUx1SnE3V257WONS8IlGPcQopmQbzOHSLd+U s0gOfgHiYw4hXF1BgJY5ty0A7YPXJihNACl2lbfSeGOmjJlv8gSF2Z3GXSFfggYSgmaM 5lDlhdO5eHaERUbfQYoihsCv3hSCSttEymaGCSnT9Xu+S+kHEMFpEzovebCgAGrsYoIV xquw== 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=nVp3xEiZCWHtnBjcvGD5mAOhPUsckrWSSqHEo5uvT5U=; b=DO3BfSucCw119bz3G4fOGZuP7TWgKuQu89CK4quKHRmh9FVWNfcRQjt25kug+kjK46 934Et2j1WoDK9DGnT3EtEoP0gYhUGYsHR2By95CpLm4fBvBl+MOfHUXVWx2yDuXO44g7 8LUT8t39eBAyL3X1oZb30WVSOiHmCPRP3bzToV+eDyOuIFrHD2LojY4cm6BuVhqu6nTv VofkZdgbiJWgAqPP7thxiEYbnj/Opn++2U39ENqGlZstCLIOdwikaxlMaALeh2zkYW/D B0sqhLXpQL301+f2fsGr6pCuz0r0Y1KGsblc1dVJwdMPT6u3zt//V3nFAwTM3SKhz/Da VJTQ== X-Gm-Message-State: AOPr4FXT00NDWohgvvtW20HFV5JZLuLWtbP+wqJEPdCA1tQbD5I6hNl31dbdXVnBrKpkjw== X-Received: by 10.66.118.70 with SMTP id kk6mr14035889pab.74.1461780468399; Wed, 27 Apr 2016 11:07:48 -0700 (PDT) Received: from dl.caveonetworks.com ([64.2.3.194]) by smtp.gmail.com with ESMTPSA id o81sm8233079pfj.50.2016.04.27.11.07.34 (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 27 Apr 2016 11:07:40 -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 u3RI7Ya4027279; Wed, 27 Apr 2016 11:07:34 -0700 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id u3RI7XcH027278; Wed, 27 Apr 2016 11:07:33 -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 v6 12/14] acpi, numa, srat: Improve SRAT error detection and add messages. Date: Wed, 27 Apr 2016 11:07:14 -0700 Message-Id: <1461780436-27182-13-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1461780436-27182-1-git-send-email-ddaney.cavm@gmail.com> References: <1461780436-27182-1-git-send-email-ddaney.cavm@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160427_110804_420413_FA91D801 X-CRM114-Status: GOOD ( 13.38 ) X-Spam-Score: -2.7 (--) 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-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, 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 d7d0499..50c8f42 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);