This is a note to let you know that I've just added the patch titled sparc64: Adjust vmalloc region size based upon available virtual address bits. to the 3.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: sparc64-adjust-vmalloc-region-size-based-upon-available-virtual-address-bits.patch and it can be found in the queue-3.14 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Tue Oct 28 11:13:19 CST 2014 From: "David S. Miller" <davem@xxxxxxxxxxxxx> Date: Sat, 27 Sep 2014 11:05:21 -0700 Subject: sparc64: Adjust vmalloc region size based upon available virtual address bits. From: "David S. Miller" <davem@xxxxxxxxxxxxx> [ Upstream commit bb4e6e85daa52a9f6210fa06a5ec6269598a202b ] In order to accomodate embedded per-cpu allocation with large numbers of cpus and numa nodes, we have to use as much virtual address space as possible for the vmalloc region. Otherwise we can get things like: PERCPU: max_distance=0x380001c10000 too large for vmalloc space 0xff00000000 So, once we select a value for PAGE_OFFSET, derive the size of the vmalloc region based upon that. Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> Acked-by: Bob Picco <bob.picco@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/sparc/include/asm/page_64.h | 1 - arch/sparc/include/asm/pgtable_64.h | 9 +++++---- arch/sparc/kernel/ktlb.S | 8 ++++---- arch/sparc/mm/init_64.c | 30 +++++++++++++++++++----------- 4 files changed, 28 insertions(+), 20 deletions(-) --- a/arch/sparc/include/asm/page_64.h +++ b/arch/sparc/include/asm/page_64.h @@ -117,7 +117,6 @@ extern unsigned long sparc64_va_hole_bot #include <asm-generic/memory_model.h> -#define PAGE_OFFSET_BY_BITS(X) (-(_AC(1,UL) << (X))) extern unsigned long PAGE_OFFSET; #endif /* !(__ASSEMBLY__) */ --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h @@ -40,10 +40,7 @@ #define LOW_OBP_ADDRESS _AC(0x00000000f0000000,UL) #define HI_OBP_ADDRESS _AC(0x0000000100000000,UL) #define VMALLOC_START _AC(0x0000000100000000,UL) -#define VMALLOC_END _AC(0x0000010000000000,UL) -#define VMEMMAP_BASE _AC(0x0000010000000000,UL) - -#define vmemmap ((struct page *)VMEMMAP_BASE) +#define VMEMMAP_BASE VMALLOC_END /* PMD_SHIFT determines the size of the area a second-level page * table can map @@ -81,6 +78,10 @@ #ifndef __ASSEMBLY__ +extern unsigned long VMALLOC_END; + +#define vmemmap ((struct page *)VMEMMAP_BASE) + #include <linux/sched.h> bool kern_addr_valid(unsigned long addr); --- a/arch/sparc/kernel/ktlb.S +++ b/arch/sparc/kernel/ktlb.S @@ -199,8 +199,8 @@ kvmap_dtlb_nonlinear: #ifdef CONFIG_SPARSEMEM_VMEMMAP /* Do not use the TSB for vmemmap. */ - mov (VMEMMAP_BASE >> 40), %g5 - sllx %g5, 40, %g5 + sethi %hi(VMEMMAP_BASE), %g5 + ldx [%g5 + %lo(VMEMMAP_BASE)], %g5 cmp %g4,%g5 bgeu,pn %xcc, kvmap_vmemmap nop @@ -212,8 +212,8 @@ kvmap_dtlb_tsbmiss: sethi %hi(MODULES_VADDR), %g5 cmp %g4, %g5 blu,pn %xcc, kvmap_dtlb_longpath - mov (VMALLOC_END >> 40), %g5 - sllx %g5, 40, %g5 + sethi %hi(VMALLOC_END), %g5 + ldx [%g5 + %lo(VMALLOC_END)], %g5 cmp %g4, %g5 bgeu,pn %xcc, kvmap_dtlb_longpath nop --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c @@ -1363,25 +1363,24 @@ static unsigned long max_phys_bits = 40; bool kern_addr_valid(unsigned long addr) { - unsigned long above = ((long)addr) >> max_phys_bits; pgd_t *pgd; pud_t *pud; pmd_t *pmd; pte_t *pte; - if (above != 0 && above != -1UL) - return false; - - if (addr >= (unsigned long) KERNBASE && - addr < (unsigned long)&_end) - return true; - - if (addr >= PAGE_OFFSET) { + if ((long)addr < 0L) { unsigned long pa = __pa(addr); + if ((addr >> max_phys_bits) != 0UL) + return false; + return pfn_valid(pa >> PAGE_SHIFT); } + if (addr >= (unsigned long) KERNBASE && + addr < (unsigned long)&_end) + return true; + pgd = pgd_offset_k(addr); if (pgd_none(*pgd)) return 0; @@ -1650,6 +1649,9 @@ unsigned long __init find_ecache_flush_s unsigned long PAGE_OFFSET; EXPORT_SYMBOL(PAGE_OFFSET); +unsigned long VMALLOC_END = 0x0000010000000000UL; +EXPORT_SYMBOL(VMALLOC_END); + unsigned long sparc64_va_hole_top = 0xfffff80000000000UL; unsigned long sparc64_va_hole_bottom = 0x0000080000000000UL; @@ -1706,10 +1708,16 @@ static void __init setup_page_offset(voi prom_halt(); } - PAGE_OFFSET = PAGE_OFFSET_BY_BITS(max_phys_bits); + PAGE_OFFSET = sparc64_va_hole_top; + VMALLOC_END = ((sparc64_va_hole_bottom >> 1) + + (sparc64_va_hole_bottom >> 2)); - pr_info("PAGE_OFFSET is 0x%016lx (max_phys_bits == %lu)\n", + pr_info("MM: PAGE_OFFSET is 0x%016lx (max_phys_bits == %lu)\n", PAGE_OFFSET, max_phys_bits); + pr_info("MM: VMALLOC [0x%016lx --> 0x%016lx]\n", + VMALLOC_START, VMALLOC_END); + pr_info("MM: VMEMMAP [0x%016lx --> 0x%016lx]\n", + VMEMMAP_BASE, VMEMMAP_BASE << 1); } static void __init tsb_phys_patch(void) Patches currently in stable-queue which might be from davem@xxxxxxxxxxxxx are queue-3.14/sparc64-adjust-vmalloc-region-size-based-upon-available-virtual-address-bits.patch queue-3.14/sparc64-fix-fpu-register-corruption-with-aes-crypto-offload.patch queue-3.14/sparc64-move-request_irq-from-ldc_bind-to-ldc_alloc.patch queue-3.14/sparc32-dma_alloc_coherent-must-honour-gfp-flags.patch queue-3.14/sparc64-kill-unnecessary-tables-and-increase-max_banks.patch queue-3.14/sparc-let-memset-return-the-address-argument.patch queue-3.14/sparc64-use-kernel-page-tables-for-vmemmap.patch queue-3.14/sparc64-sparse-irq.patch queue-3.14/sparc64-fix-physical-memory-management-regressions-with-large-max_phys_bits.patch queue-3.14/sparc64-fix-lockdep-warnings-on-reboot-on-ultra-5.patch queue-3.14/sparc64-switch-to-4-level-page-tables.patch queue-3.14/sparc64-sun4v-tlb-error-power-off-events.patch queue-3.14/sparc64-increase-size-of-boot-string-to-1024-bytes.patch queue-3.14/sparc64-find_node-adjustment.patch queue-3.14/sparc64-fix-reversed-start-end-in-flush_tlb_kernel_range.patch queue-3.14/sparc64-increase-max_phys_address_bits-to-53.patch queue-3.14/sparc64-define-va-hole-at-run-time-rather-than-at-compile-time.patch queue-3.14/sparc64-fix-register-corruption-in-top-most-kernel-stack-frame-during-boot.patch queue-3.14/sparc64-do-not-disable-interrupts-in-nmi_cpu_busy.patch queue-3.14/sparc64-support-m6-and-m7-for-building-cpu-distribution-map.patch queue-3.14/sparc64-cpu-hardware-caps-support-for-sparc-m6-and-m7.patch queue-3.14/sparc64-do-not-define-thread-fpregs-save-area-as-zero-length-array.patch queue-3.14/sparc64-t5-pmu.patch queue-3.14/sparc64-adjust-ktsb-assembler-to-support-larger-physical-addresses.patch queue-3.14/sparc64-implement-__get_user_pages_fast.patch queue-3.14/sparc64-fix-corrupted-thread-fault-code.patch queue-3.14/sparc64-fix-hibernation-code-refrence-to-page_offset.patch queue-3.14/sparc64-correctly-recognise-m6-and-m7-cpu-type.patch queue-3.14/sparc64-fix-pcr_ops-initialization-and-usage-bugs.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html