Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 18 Dec 2020 18:57:27 +0000 (10:57 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 18 Dec 2020 18:57:27 +0000 (10:57 -0800)
Pull more arm64 updates from Catalin Marinas:
 "These are some some trivial updates that mostly fix/clean-up code
  pushed during the merging window:

   - Work around broken GCC 4.9 handling of "S" asm constraint

   - Suppress W=1 missing prototype warnings

   - Warn the user when a small VA_BITS value cannot map the available
     memory

   - Drop the useless update to per-cpu cycles"

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
  arm64: Work around broken GCC 4.9 handling of "S" constraint
  arm64: Warn the user when a small VA_BITS value wastes memory
  arm64: entry: suppress W=1 prototype warnings
  arm64: topology: Drop the useless update to per-cpu cycles

1  2 
arch/arm64/kernel/topology.c
arch/arm64/mm/init.c

@@@ -223,7 -223,6 +223,7 @@@ static DEFINE_STATIC_KEY_FALSE(amu_fie_
  
  static int __init init_amu_fie(void)
  {
 +      bool invariance_status = topology_scale_freq_invariant();
        cpumask_var_t valid_cpus;
        bool have_policy = false;
        int ret = 0;
        if (!topology_scale_freq_invariant())
                static_branch_disable(&amu_fie_key);
  
 +      /*
 +       * Task scheduler behavior depends on frequency invariance support,
 +       * either cpufreq or counter driven. If the support status changes as
 +       * a result of counter initialisation and use, retrigger the build of
 +       * scheduling domains to ensure the information is propagated properly.
 +       */
 +      if (invariance_status != topology_scale_freq_invariant())
 +              rebuild_sched_domains_energy();
 +
  free_valid_mask:
        free_cpumask_var(valid_cpus);
  
@@@ -314,7 -304,7 +314,7 @@@ void topology_scale_freq_tick(void
  
        if (unlikely(core_cnt <= prev_core_cnt ||
                     const_cnt <= prev_const_cnt))
-               goto store_and_exit;
+               return;
  
        /*
         *          /\core    arch_max_freq_scale
  
        scale = min_t(unsigned long, scale, SCHED_CAPACITY_SCALE);
        this_cpu_write(freq_scale, (unsigned long)scale);
- store_and_exit:
-       this_cpu_write(arch_core_cycles_prev, core_cnt);
-       this_cpu_write(arch_const_cycles_prev, const_cnt);
  }
  
  #ifdef CONFIG_ACPI_CPPC_LIB
diff --combined arch/arm64/mm/init.c
@@@ -295,6 -295,9 +295,9 @@@ void __init arm64_memblock_init(void
        memstart_addr = round_down(memblock_start_of_DRAM(),
                                   ARM64_MEMSTART_ALIGN);
  
+       if ((memblock_end_of_DRAM() - memstart_addr) > linear_region_size)
+               pr_warn("Memory doesn't fit in the linear mapping, VA_BITS too small\n");
        /*
         * Remove the memory that we will not be able to cover with the
         * linear mapping. Take care not to clip the kernel which may be
@@@ -444,6 -447,71 +447,6 @@@ void __init bootmem_init(void
        memblock_dump_all();
  }
  
 -#ifndef CONFIG_SPARSEMEM_VMEMMAP
 -static inline void free_memmap(unsigned long start_pfn, unsigned long end_pfn)
 -{
 -      struct page *start_pg, *end_pg;
 -      unsigned long pg, pgend;
 -
 -      /*
 -       * Convert start_pfn/end_pfn to a struct page pointer.
 -       */
 -      start_pg = pfn_to_page(start_pfn - 1) + 1;
 -      end_pg = pfn_to_page(end_pfn - 1) + 1;
 -
 -      /*
 -       * Convert to physical addresses, and round start upwards and end
 -       * downwards.
 -       */
 -      pg = (unsigned long)PAGE_ALIGN(__pa(start_pg));
 -      pgend = (unsigned long)__pa(end_pg) & PAGE_MASK;
 -
 -      /*
 -       * If there are free pages between these, free the section of the
 -       * memmap array.
 -       */
 -      if (pg < pgend)
 -              memblock_free(pg, pgend - pg);
 -}
 -
 -/*
 - * The mem_map array can get very big. Free the unused area of the memory map.
 - */
 -static void __init free_unused_memmap(void)
 -{
 -      unsigned long start, end, prev_end = 0;
 -      int i;
 -
 -      for_each_mem_pfn_range(i, MAX_NUMNODES, &start, &end, NULL) {
 -#ifdef CONFIG_SPARSEMEM
 -              /*
 -               * Take care not to free memmap entries that don't exist due
 -               * to SPARSEMEM sections which aren't present.
 -               */
 -              start = min(start, ALIGN(prev_end, PAGES_PER_SECTION));
 -#endif
 -              /*
 -               * If we had a previous bank, and there is a space between the
 -               * current bank and the previous, free it.
 -               */
 -              if (prev_end && prev_end < start)
 -                      free_memmap(prev_end, start);
 -
 -              /*
 -               * Align up here since the VM subsystem insists that the
 -               * memmap entries are valid from the bank end aligned to
 -               * MAX_ORDER_NR_PAGES.
 -               */
 -              prev_end = ALIGN(end, MAX_ORDER_NR_PAGES);
 -      }
 -
 -#ifdef CONFIG_SPARSEMEM
 -      if (!IS_ALIGNED(prev_end, PAGES_PER_SECTION))
 -              free_memmap(prev_end, ALIGN(prev_end, PAGES_PER_SECTION));
 -#endif
 -}
 -#endif        /* !CONFIG_SPARSEMEM_VMEMMAP */
 -
  /*
   * mem_init() marks the free areas in the mem_map and tells us how much memory
   * is free.  This is done after various parts of the system have claimed their
@@@ -459,6 -527,9 +462,6 @@@ void __init mem_init(void
  
        set_max_mapnr(max_pfn - PHYS_PFN_OFFSET);
  
 -#ifndef CONFIG_SPARSEMEM_VMEMMAP
 -      free_unused_memmap();
 -#endif
        /* this will put all unused low memory onto the freelists */
        memblock_free_all();