Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3018829imm; Sun, 1 Jul 2018 10:24:40 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJjOrHhaalGFap5I7DPmwuuJStvD4Y+PCiHiamrtdadp0Nz3GBOsU390Cwl6xR0Fb+qnVje X-Received: by 2002:a17:902:5588:: with SMTP id g8-v6mr22315303pli.99.1530465880106; Sun, 01 Jul 2018 10:24:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530465880; cv=none; d=google.com; s=arc-20160816; b=fTsP2w+xL62wbS7V2da46E4ahPbUVrMfeFLd7eal4SSyrKoDrdgdwmGjYHSuSJAGzT yyDjuLwjMFwhiOR+l1gSxtTsYDi7UzHdYrTNdrMv0CZ8ZLQLtTpfKSMepzRMSntv/wdy z6cp7kX0Xx6q+r1vN3zb4PiSR4FIsJTh5Dz65b8v8WKbOH252p47cX84JszXn16FJWUb 9Tdwnn4xYiZZUJyxWY1P1iiIPE17PSs5TExBmaDKqBw6tRTMBM7ff2gOLxot2hRUJV3+ tfS6fQSERIr+mqq+9u89g8StXY/m+KYxzMkojxcuX/S8W8Faqj+FQI3OXBhPnftQ/feD 4Ibg== 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=PKXx/KGsrcvG1DYXKukNn/WlWvjcZZNAAO+Y3i/H/Eg=; b=olzqfnofzXQU4QI9mg9g3v32Ng/I2xG8La8oog3t1Wc+KNe84UfKjJctsFhcaYeExa QLPuvYffcGEWWkq89yk/oJ/PrJuJoZl9xZNjTfZwikgOmouhbgUONGFhANta6TwXlM3l D5HEKJFlsDlTet9WGbv19DU0g4EujXru3fca/0Vzc1LCq/MPt0xq/rjZwqTSR/2hZhV3 tPS5KEbzcxL1wh+4gh/elQ2vicRCeYZSirMLrA3GpKGRTLZjesRzAdE7m+z1V4ABmnau YfrqKnDGR6NhAPIWTgtvdTnd6cv+zQpdJ28HBuXA96iROUjhI/41rtUBx3mUQ/8vp1WT MeFg== 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 d35-v6si15046786pla.116.2018.07.01.10.24.25; Sun, 01 Jul 2018 10:24:40 -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 S1753831AbeGARXO (ORCPT + 99 others); Sun, 1 Jul 2018 13:23:14 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36444 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031485AbeGAQhs (ORCPT ); Sun, 1 Jul 2018 12:37:48 -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 04FAC92B; Sun, 1 Jul 2018 16:37:48 +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 003/220] x86/platform/UV: Add adjustable set memory block size function Date: Sun, 1 Jul 2018 18:20:27 +0200 Message-Id: <20180701160908.421691551@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 f642fb5864a6e3645edce6f85ffe7b44d5e9b990 upstream. Add a new function to "adjust" the current fixed UV memory block size of 2GB so it can be changed to a different physical boundary. This is out of necessity so arch dependent code can accommodate specific BIOS requirements which can align these new PMEM modules at less than the default boundaries. A "set order" type of function was used to insure that the memory block size will be a power of two value without requiring a validity check. 64GB was chosen as the upper limit for memory block size values to accommodate upcoming 4PB systems which have 6 more bits of physical address space (46 becoming 52). 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.609546602@stormcage.americas.sgi.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- arch/x86/mm/init_64.c | 20 ++++++++++++++++---- include/linux/memory.h | 1 + 2 files changed, 17 insertions(+), 4 deletions(-) --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -1350,16 +1350,28 @@ int kern_addr_valid(unsigned long addr) /* Amount of ram needed to start using large blocks */ #define MEM_SIZE_FOR_LARGE_BLOCK (64UL << 30) +/* Adjustable memory block size */ +static unsigned long set_memory_block_size; +int __init set_memory_block_size_order(unsigned int order) +{ + unsigned long size = 1UL << order; + + if (size > MEM_SIZE_FOR_LARGE_BLOCK || size < MIN_MEMORY_BLOCK_SIZE) + return -EINVAL; + + set_memory_block_size = size; + return 0; +} + static unsigned long probe_memory_block_size(void) { unsigned long boot_mem_end = max_pfn << PAGE_SHIFT; unsigned long bz; - /* If this is UV system, always set 2G block size */ - if (is_uv_system()) { - bz = MAX_BLOCK_SIZE; + /* If memory block size has been set, then use it */ + bz = set_memory_block_size; + if (bz) goto done; - } /* Use regular block if RAM is smaller than MEM_SIZE_FOR_LARGE_BLOCK */ if (boot_mem_end < MEM_SIZE_FOR_LARGE_BLOCK) { --- a/include/linux/memory.h +++ b/include/linux/memory.h @@ -38,6 +38,7 @@ struct memory_block { int arch_get_memory_phys_device(unsigned long start_pfn); unsigned long memory_block_size_bytes(void); +int set_memory_block_size_order(unsigned int order); /* These states are exposed to userspace as text strings in sysfs */ #define MEM_ONLINE (1<<0) /* exposed to userspace */