Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3019325imm; Sun, 1 Jul 2018 10:25:17 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdro56I+PwO6du8ZOobX/Y8Av1oFzQKWzW5QUohubhq9+BIt20ScheCEO60QdX4GaAvdVjY X-Received: by 2002:a62:b90f:: with SMTP id z15-v6mr22594205pfe.254.1530465917343; Sun, 01 Jul 2018 10:25:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530465917; cv=none; d=google.com; s=arc-20160816; b=qlIddCg9V75RQyqlGo+DZv1BWSdDLXTA7iMci+qaUkAMVeAz3w3r4x4Im91JAWkJ+B wqNCewo76nmRv0Q6rjfKWYxAtJCu8jdHpQgDhEqX3gyrTzxKvN/VfYTHUcTbU8nDSNMp ljE6pFNAiWuQPK8mvAGbV/tVaH7fkgPLNoibXCrmkwNSV9DjbD6AHDelvqrvPCquXemc fgvOnklh4uFHq6rPBkXYJJRIiX3/ni/+9Gz91UFg/nXbOKzPKS37t/UIiGT1RUaYYr7D IJdp0QOrqdeA5BugCyrzIxbhBtxpUIOrnep6YgJOMOxnsmG01ZAnzg/g+xikE/p++MPC oprg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=KuCU0tqGudA2I2bs554IYOxFFVsk46YTYXwlD73eCSM=; b=mtj2QgDOgyFldMG2450D5HLnlbKJnnF+8qHpM23dEKRYSQ/VmzGdHE8Hdal28Io0PH 9YGRQHlOe/TF+LVPJJdNoW/qu96eY20KOvH/VxEINffESf3TPJfOnap5iULFsWBir/WN EpkdkcIIHTpJwuBOKOD+3qrKfqt0eCM+ZXThk5iJaK0Z7wfznwS9e7Q1seweCEr1iYbn QKu/5+NP57o4IjGhQ1Uz4zkTGKVbIlWWcUQ9JS+K8Dp2UQCYmpv/8Ev8bTtJfGoFX5yo mA1loRVjiBGmHyrsqe5ohDWGeDLdYwvQmLZrqhyJVLJmRvdPGZRi19kVbUJiQ8Nfrp2I Qldw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f66-v6si13949362plb.103.2018.07.01.10.25.02; Sun, 01 Jul 2018 10:25:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753722AbeGARWn (ORCPT + 99 others); Sun, 1 Jul 2018 13:22:43 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36596 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031513AbeGAQiA (ORCPT ); Sun, 1 Jul 2018 12:38:00 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 42D43ACC; Sun, 1 Jul 2018 16:37:59 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Travis , Andrew Banman , Andrew Morton , Dimitri Sivanich , Linus Torvalds , Peter Zijlstra , Russ Anderson , Thomas Gleixner , dan.j.williams@intel.com, jgross@suse.com, kirill.shutemov@linux.intel.com, mhocko@suse.com, Ingo Molnar Subject: [PATCH 4.17 004/220] x86/platform/UV: Use new set memory block size function Date: Sun, 1 Jul 2018 18:20:28 +0200 Message-Id: <20180701160908.466151825@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160908.272447118@linuxfoundation.org> References: <20180701160908.272447118@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: mike.travis@hpe.com commit bbbd2b51a2aa0d76b3676271e216cf3647773397 upstream. Add a call to the new function to "adjust" the current fixed UV memory block size of 2GB so it can be changed to a different physical boundary. This accommodates changes in the Intel BIOS, and therefore UV BIOS, which now can align boundaries different than the previous UV standard of 2GB. It also flags any UV Global Address boundaries from BIOS that cause a change in the mem block size (boundary). The current boundary of 2GB has been used on UV since the first system release in 2009 with Linux 2.6 and has worked fine. But the new NVDIMM persistent memory modules (PMEM), along with the Intel BIOS changes to support these modules caused the memory block size boundary to be set to a lower limit. Intel only guarantees that this minimum boundary at 64MB though the current Linux limit is 128MB. Note that the default remains 2GB if no changes occur. Signed-off-by: Mike Travis Reviewed-by: Andrew Banman Cc: Andrew Morton Cc: Dimitri Sivanich Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Russ Anderson Cc: Thomas Gleixner Cc: dan.j.williams@intel.com Cc: jgross@suse.com Cc: kirill.shutemov@linux.intel.com Cc: mhocko@suse.com Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/lkml/20180524201711.732785782@stormcage.americas.sgi.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/apic/x2apic_uv_x.c | 49 ++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -392,6 +393,40 @@ extern int uv_hub_info_version(void) } EXPORT_SYMBOL(uv_hub_info_version); +/* Default UV memory block size is 2GB */ +static unsigned long mem_block_size = (2UL << 30); + +static __init int adj_blksize(u32 lgre) +{ + unsigned long base = (unsigned long)lgre << UV_GAM_RANGE_SHFT; + unsigned long size; + + for (size = mem_block_size; size > MIN_MEMORY_BLOCK_SIZE; size >>= 1) + if (IS_ALIGNED(base, size)) + break; + + if (size >= mem_block_size) + return 0; + + mem_block_size = size; + return 1; +} + +static __init void set_block_size(void) +{ + unsigned int order = ffs(mem_block_size); + + if (order) { + /* adjust for ffs return of 1..64 */ + set_memory_block_size_order(order - 1); + pr_info("UV: mem_block_size set to 0x%lx\n", mem_block_size); + } else { + /* bad or zero value, default to 1UL << 31 (2GB) */ + pr_err("UV: mem_block_size error with 0x%lx\n", mem_block_size); + set_memory_block_size_order(31); + } +} + /* Build GAM range lookup table: */ static __init void build_uv_gr_table(void) { @@ -1180,23 +1215,30 @@ static void __init decode_gam_rng_tbl(un << UV_GAM_RANGE_SHFT); int order = 0; char suffix[] = " KMGTPE"; + int flag = ' '; while (size > 9999 && order < sizeof(suffix)) { size /= 1024; order++; } + /* adjust max block size to current range start */ + if (gre->type == 1 || gre->type == 2) + if (adj_blksize(lgre)) + flag = '*'; + if (!index) { pr_info("UV: GAM Range Table...\n"); - pr_info("UV: # %20s %14s %5s %4s %5s %3s %2s\n", "Range", "", "Size", "Type", "NASID", "SID", "PN"); + pr_info("UV: # %20s %14s %6s %4s %5s %3s %2s\n", "Range", "", "Size", "Type", "NASID", "SID", "PN"); } - pr_info("UV: %2d: 0x%014lx-0x%014lx %5lu%c %3d %04x %02x %02x\n", + pr_info("UV: %2d: 0x%014lx-0x%014lx%c %5lu%c %3d %04x %02x %02x\n", index++, (unsigned long)lgre << UV_GAM_RANGE_SHFT, (unsigned long)gre->limit << UV_GAM_RANGE_SHFT, - size, suffix[order], + flag, size, suffix[order], gre->type, gre->nasid, gre->sockid, gre->pnode); + /* update to next range start */ lgre = gre->limit; if (sock_min > gre->sockid) sock_min = gre->sockid; @@ -1427,6 +1469,7 @@ static void __init uv_system_init_hub(vo build_socket_tables(); build_uv_gr_table(); + set_block_size(); uv_init_hub_info(&hub_info); uv_possible_blades = num_possible_nodes(); if (!_node_to_pnode)