1. 06 10月, 2014 2 次提交
    • D
      sparc64: Fix physical memory management regressions with large max_phys_bits. · 0dd5b7b0
      David S. Miller 提交于
      If max_phys_bits needs to be > 43 (f.e. for T4 chips), things like
      DEBUG_PAGEALLOC stop working because the 3-level page tables only
      can cover up to 43 bits.
      
      Another problem is that when we increased MAX_PHYS_ADDRESS_BITS up to
      47, several statically allocated tables became enormous.
      
      Compounding this is that we will need to support up to 49 bits of
      physical addressing for M7 chips.
      
      The two tables in question are sparc64_valid_addr_bitmap and
      kpte_linear_bitmap.
      
      The first holds a bitmap, with 1 bit for each 4MB chunk of physical
      memory, indicating whether that chunk actually exists in the machine
      and is valid.
      
      The second table is a set of 2-bit values which tell how large of a
      mapping (4MB, 256MB, 2GB, 16GB, respectively) we can use at each 256MB
      chunk of ram in the system.
      
      These tables are huge and take up an enormous amount of the BSS
      section of the sparc64 kernel image.  Specifically, the
      sparc64_valid_addr_bitmap is 4MB, and the kpte_linear_bitmap is 128K.
      
      So let's solve the space wastage and the DEBUG_PAGEALLOC problem
      at the same time, by using the kernel page tables (as designed) to
      manage this information.
      
      We have to keep using large mappings when DEBUG_PAGEALLOC is disabled,
      and we do this by encoding huge PMDs and PUDs.
      
      On a T4-2 with 256GB of ram the kernel page table takes up 16K with
      DEBUG_PAGEALLOC disabled and 256MB with it enabled.  Furthermore, this
      memory is dynamically allocated at run time rather than coded
      statically into the kernel image.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Acked-by: NBob Picco <bob.picco@oracle.com>
      0dd5b7b0
    • D
      sparc64: Switch to 4-level page tables. · ac55c768
      David S. Miller 提交于
      This has become necessary with chips that support more than 43-bits
      of physical addressing.
      
      Based almost entirely upon a patch by Bob Picco.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Acked-by: NBob Picco <bob.picco@oracle.com>
      ac55c768
  2. 01 10月, 2014 2 次提交
  3. 17 9月, 2014 4 次提交
    • S
      sparc64: Move request_irq() from ldc_bind() to ldc_alloc() · c21c4ab0
      Sowmini Varadhan 提交于
      The request_irq() needs to be done from ldc_alloc()
      to avoid the following (caught by lockdep)
      
       [00000000004a0738] __might_sleep+0xf8/0x120
       [000000000058bea4] kmem_cache_alloc_trace+0x184/0x2c0
       [00000000004faf80] request_threaded_irq+0x80/0x160
       [000000000044f71c] ldc_bind+0x7c/0x220
       [0000000000452454] vio_port_up+0x54/0xe0
       [00000000101f6778] probe_disk+0x38/0x220 [sunvdc]
       [00000000101f6b8c] vdc_port_probe+0x22c/0x300 [sunvdc]
       [0000000000451a88] vio_device_probe+0x48/0x60
       [000000000074c56c] really_probe+0x6c/0x300
       [000000000074c83c] driver_probe_device+0x3c/0xa0
       [000000000074c92c] __driver_attach+0x8c/0xa0
       [000000000074a6ec] bus_for_each_dev+0x6c/0xa0
       [000000000074c1dc] driver_attach+0x1c/0x40
       [000000000074b0fc] bus_add_driver+0xbc/0x280
      Signed-off-by: NSowmini Varadhan <sowmini.varadhan@oracle.com>
      Acked-by: NDwight Engen <dwight.engen@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c21c4ab0
    • B
      sparc64: T5 PMU · 05aa1651
      bob picco 提交于
      The T5 (niagara5) has different PCR related HV fast trap values and a new
      HV API Group. This patch utilizes these and shares when possible with niagara4.
      
      We use the same sparc_pmu niagara4_pmu. Should there be new effort to
      obtain the MCU perf statistics then this would have to be changed.
      
      Cc: sparclinux@vger.kernel.org
      Signed-off-by: NBob Picco <bob.picco@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      05aa1651
    • B
      sparc64: mem boot option correction · 7c21d533
      bob picco 提交于
      The "mem" boot option can result in many unexpected consequences. This patch
      attempts to prevent boot hangs which have been experienced on T4-4 and T5-8.
      Basically the boot loader allocates vmlinuz and initrd higher in available
      OBP physical memory. For example, on a 2Tb T5-8 it isn't possible to boot
      with mem=20G.
      
      The patch utilizes memblock to avoid reserved regions and trim memory which
      is only free. Other improvements are possible for a multi-node machine.
      
      This is a snippet of the boot log with mem=20G on T5-8 with the patch applied:
      MEMBLOCK configuration:	<- before memory reduction
       memory size = 0x1ffad6ce000 reserved size = 0xa1adf44
       memory.cnt  = 0xb
       memory[0x0]    [0x00000030400000-0x00003fdde47fff], 0x3fada48000 bytes
       memory[0x1]    [0x00003fdde4e000-0x00003fdde4ffff], 0x2000 bytes
       memory[0x2]    [0x00080000000000-0x00083fffffffff], 0x4000000000 bytes
       memory[0x3]    [0x00100000000000-0x00103fffffffff], 0x4000000000 bytes
       memory[0x4]    [0x00180000000000-0x00183fffffffff], 0x4000000000 bytes
       memory[0x5]    [0x00200000000000-0x00203fffffffff], 0x4000000000 bytes
       memory[0x6]    [0x00280000000000-0x00283fffffffff], 0x4000000000 bytes
       memory[0x7]    [0x00300000000000-0x00303fffffffff], 0x4000000000 bytes
       memory[0x8]    [0x00380000000000-0x00383fffc71fff], 0x3fffc72000 bytes
       memory[0x9]    [0x00383fffc92000-0x00383fffca1fff], 0x10000 bytes
       memory[0xa]    [0x00383fffcb4000-0x00383fffcb5fff], 0x2000 bytes
       reserved.cnt  = 0x2
       reserved[0x0]  [0x00380000000000-0x0038000117e7f8], 0x117e7f9 bytes
       reserved[0x1]  [0x00380004000000-0x0038000d02f74a], 0x902f74b bytes
      ...
      MEMBLOCK configuration:	<- after reduction of memory
       memory size = 0x50a1adf44 reserved size = 0xa1adf44
       memory.cnt  = 0x4
       memory[0x0]    [0x00380000000000-0x0038000117e7f8], 0x117e7f9 bytes
       memory[0x1]    [0x00380004000000-0x0038050d01d74a], 0x50901d74b bytes
       memory[0x2]    [0x00383fffc92000-0x00383fffca1fff], 0x10000 bytes
       memory[0x3]    [0x00383fffcb4000-0x00383fffcb5fff], 0x2000 bytes
       reserved.cnt  = 0x2
       reserved[0x0]  [0x00380000000000-0x0038000117e7f8], 0x117e7f9 bytes
       reserved[0x1]  [0x00380004000000-0x0038000d02f74a], 0x902f74b bytes
      ...
      Early memory node ranges
        node   7: [mem 0x380000000000-0x38000117dfff]
        node   7: [mem 0x380004000000-0x380f0d01bfff]
        node   7: [mem 0x383fffc92000-0x383fffca1fff]
        node   7: [mem 0x383fffcb4000-0x383fffcb5fff]
      Could not find start_pfn for node 0
      Could not find start_pfn for node 1
      Could not find start_pfn for node 2
      Could not find start_pfn for node 3
      Could not find start_pfn for node 4
      Could not find start_pfn for node 5
      Could not find start_pfn for node 6
      .
      
      The patch was tested on T4-1, T5-8 and Jalap?no.
      
      Cc: sparclinux@vger.kernel.org
      Signed-off-by: NBob Picco <bob.picco@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7c21d533
    • B
      sparc64: sun4v TLB error power off events · 4ccb9272
      bob picco 提交于
      We've witnessed a few TLB events causing the machine to power off because
      of prom_halt. In one case it was some nfs related area during rmmod. Another
      was an mmapper of /dev/mem. A more recent one is an ITLB issue with
      a bad pagesize which could be a hardware bug. Bugs happen but we should
      attempt to not power off the machine and/or hang it when possible.
      
      This is a DTLB error from an mmapper of /dev/mem:
      [root@sparcie ~]# SUN4V-DTLB: Error at TPC[fffff80100903e6c], tl 1
      SUN4V-DTLB: TPC<0xfffff80100903e6c>
      SUN4V-DTLB: O7[fffff801081979d0]
      SUN4V-DTLB: O7<0xfffff801081979d0>
      SUN4V-DTLB: vaddr[fffff80100000000] ctx[1250] pte[98000000000f0610] error[2]
      .
      
      This is recent mainline for ITLB:
      [ 3708.179864] SUN4V-ITLB: TPC<0xfffffc010071cefc>
      [ 3708.188866] SUN4V-ITLB: O7[fffffc010071cee8]
      [ 3708.197377] SUN4V-ITLB: O7<0xfffffc010071cee8>
      [ 3708.206539] SUN4V-ITLB: vaddr[e0003] ctx[1a3c] pte[2900000dcc800eeb] error[4]
      .
      
      Normally sun4v_itlb_error_report() and sun4v_dtlb_error_report() would call
      prom_halt() and drop us to OF command prompt "ok". This isn't the case for
      LDOMs and the machine powers off.
      
      For the HV reported error of HV_ENORADDR for HV HV_MMU_MAP_ADDR_TRAP we cause
      a SIGBUS error by qualifying it within do_sparc64_fault() for fault code mask
      of FAULT_CODE_BAD_RA. This is done when trap level (%tl) is less or equal
      one("1"). Otherwise, for %tl > 1,  we proceed eventually to die_if_kernel().
      
      The logic of this patch was partially inspired by David Miller's feedback.
      
      Power off of large sparc64 machines is painful. Plus die_if_kernel provides
      more context. A reset sequence isn't a brief period on large sparc64 but
      better than power-off/power-on sequence.
      
      Cc: sparclinux@vger.kernel.org
      Signed-off-by: NBob Picco <bob.picco@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4ccb9272
  4. 11 9月, 2014 1 次提交
  5. 10 9月, 2014 4 次提交
  6. 14 8月, 2014 4 次提交
  7. 12 8月, 2014 2 次提交
    • D
      sparc64: Fix pcr_ops initialization and usage bugs. · 8bccf5b3
      David S. Miller 提交于
      Christopher reports that perf_event_print_debug() can crash in uniprocessor
      builds.  The crash is due to pcr_ops being NULL.
      
      This happens because pcr_arch_init() is only invoked by smp_cpus_done() which
      only executes in SMP builds.
      
      init_hw_perf_events() is closely intertwined with pcr_ops being setup properly,
      therefore:
      
      1) Call pcr_arch_init() early on from init_hw_perf_events(), instead of
         from smp_cpus_done().
      
      2) Do not hook up a PMU type if pcr_ops is NULL after pcr_arch_init().
      
      3) Move init_hw_perf_events to a later initcall so that it we will be
         sure to invoke pcr_arch_init() after all cpus are brought up.
      
      Finally, guard the one naked sequence of pcr_ops dereferences in
      __global_pmu_self() with an appropriate NULL check.
      Reported-by: NChristopher Alexander Tobias Schulze <cat.schulze@alice-dsl.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8bccf5b3
    • D
      sparc64: Do not disable interrupts in nmi_cpu_busy() · 58556104
      David S. Miller 提交于
      nmi_cpu_busy() is a SMP function call that just makes sure that all of the
      cpus are spinning using cpu cycles while the NMI test runs.
      
      It does not need to disable IRQs because we just care about NMIs executing
      which will even with 'normal' IRQs disabled.
      
      It is not legal to enable hard IRQs in a SMP cross call, in fact this bug
      triggers the BUG check in irq_work_run_list():
      
      	BUG_ON(!irqs_disabled());
      
      Because now irq_work_run() is invoked from the tail of
      generic_smp_call_function_single_interrupt().
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      58556104
  8. 07 8月, 2014 2 次提交
  9. 05 8月, 2014 1 次提交
  10. 22 7月, 2014 3 次提交
  11. 24 6月, 2014 1 次提交
  12. 28 5月, 2014 1 次提交
  13. 22 5月, 2014 1 次提交
  14. 19 5月, 2014 12 次提交
    • S
      sparc64: fix sparse warning in kgdb_64.c · 48c7eca5
      Sam Ravnborg 提交于
      Fix following warnings:
      kgdb_64.c:114:18: warning: symbol 'smp_kgdb_capture_client' was not declared. Should it be static?
      kgdb_64.c:161:17: warning: symbol 'kgdb_trap' was not declared. Should it be static?
      
      Add proper prototypes
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      48c7eca5
    • S
      sparc64: fix sparse warnings in compat_audit.c · a1ca187e
      Sam Ravnborg 提交于
      Fix following warnings:
      compat_audit.c:4:10: warning: symbol 'sparc32_dir_class' was not declared. Should it be static?
      compat_audit.c:9:10: warning: symbol 'sparc32_chattr_class' was not declared. Should it be static?
      compat_audit.c:14:10: warning: symbol 'sparc32_write_class' was not declared. Should it be static?
      compat_audit.c:19:10: warning: symbol 'sparc32_read_class' was not declared. Should it be static?
      compat_audit.c:24:10: warning: symbol 'sparc32_signal_class' was not declared. Should it be static?
      compat_audit.c:29:5: warning: symbol 'sparc32_classify_syscall' was not declared. Should it be static?
      
      Add declarations to kernel.h
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a1ca187e
    • S
      sparc64: fix sparse warnings in init_64.c · 59dec13b
      Sam Ravnborg 提交于
      Fix following warnings:
      init_64.c:191:10: warning: symbol 'dcpage_flushes' was not declared. Should it be static?
      init_64.c:193:10: warning: symbol 'dcpage_flushes_xcall' was not declared. Should it be static?
      
      Add extern declaration to asm/setup.h and drop local declaration in smp_64.h
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      59dec13b
    • S
      sparc: fix sparse warnings in smp_32.c + smp_64.c · d3091298
      Sam Ravnborg 提交于
      Fix following warnings:
      smp_32.c:177:5: warning: symbol 'setup_profiling_timer' was not declared. Should it be static?
      smp_64.c:1202:5: warning: symbol 'setup_profiling_timer' was not declared. Should it be static?
      smp_64.c:989:6: warning: symbol 'kgdb_roundup_cpus' was not declared. Should it be static?
      
      Add prototype to include/linux/profile.h of setup_profiling_timer
      Add missing include to smp_64.c
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d3091298
    • S
      sparc64: fix sparse warnings in perf_event.c · 265c1ffa
      Sam Ravnborg 提交于
      Fix following sparse warnings:
      kernel/perf_event.c:113:1: warning: symbol 'cpu_hw_events' was not declared. Should it be static?
      kernel/perf_event.c:1156:6: warning: symbol 'perf_event_grab_pmc' was not declared. Should it be static?
      kernel/perf_event.c:1172:6: warning: symbol 'perf_event_release_pmc' was not declared. Should it be static?
      kernel/perf_event.c:1672:12: warning: symbol 'init_hw_perf_events' was not declared. Should it be static?
      kernel/perf_event.c:1749:52: warning: incorrect type in argument 2 (different address spaces)
      kernel/perf_event.c:1772:60: warning: incorrect type in argument 2 (different address spaces)
      kernel/perf_event.c:1779:60: warning: incorrect type in argument 2 (different address spaces)
      
      Define the functions static as they are not used outside this file.
      Fix it so copy_from_user are supplied with pointers annotated _user
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      265c1ffa
    • S
      sparc64: fix sparse warnings in kprobes.c · 2f827ea7
      Sam Ravnborg 提交于
      Fix following warnings:
      kprobes.c:515:15: warning: symbol 'trampoline_probe_handler' was not declared. Should it be static?
      kprobes.c:579:6: warning: symbol 'kretprobe_trampoline_holder' was not declared. Should it be static?
      
      Declare the functions static.
      kretprobe_trampoline_holder is magically used without any real
      reference so mark is __used, like other arch's do too.
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2f827ea7
    • S
      sparc64: clean up compat_sigset_t.seta handling · c19ac326
      Sam Ravnborg 提交于
      Use compat_sigset_t rather than opencode the array
      Drop "switch (_NSIG_WORDS)" as we know this is always 1
      Introduce BUILD_BUG_ON() to catch if this changes
      
      As a side-effect of this fix following sparse warnings:
      signal32.c:220:60: warning: invalid access past the end of 'seta' (12 8)
      signal32.c:220:42: warning: invalid access past the end of 'seta' (8 8)
      signal32.c:219:60: warning: invalid access past the end of 'seta' (20 8)
      signal32.c:219:42: warning: invalid access past the end of 'seta' (16 8)
      signal32.c:218:60: warning: invalid access past the end of 'seta' (28 8)
      signal32.c:218:42: warning: invalid access past the end of 'seta' (24 8)
      signal32.c:309:68: warning: invalid access past the end of 'seta' (12 8)
      signal32.c:309:46: warning: invalid access past the end of 'seta' (8 8)
      signal32.c:308:68: warning: invalid access past the end of 'seta' (20 8)
      signal32.c:308:46: warning: invalid access past the end of 'seta' (16 8)
      signal32.c:307:68: warning: invalid access past the end of 'seta' (28 8)
      signal32.c:307:46: warning: invalid access past the end of 'seta' (24 8)
      
      They all pointed to code that was never executed - so no bugs fixed.
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c19ac326
    • S
      sparc64: fix sparse "Should it be static?" warnings in signal32.c · abaff455
      Sam Ravnborg 提交于
      Fix following warnings:
      signal32.c:140:6: warning: symbol 'do_sigreturn32' was not declared. Should it be static?
      signal32.c:230:17: warning: symbol 'do_rt_sigreturn32' was not declared. Should it be static?
      signal32.c:729:6: warning: symbol 'do_signal32' was not declared. Should it be static?
      signal32.c:773:16: warning: symbol 'do_sys32_sigstack' was not declared. Should it be static?
      
      Add proper prototypes and drop local prototype
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      abaff455
    • S
      sparc64: fix sparse warnings in sys_sparc32.c · ed8eb755
      Sam Ravnborg 提交于
      Fix following warnings:
      sys_sparc32.c:52:17: warning: symbol 'sys32_truncate64' was not declared. Should it be static?
      sys_sparc32.c:60:17: warning: symbol 'sys32_ftruncate64' was not declared. Should it be static?
      sys_sparc32.c:98:17: warning: symbol 'compat_sys_stat64' was not declared. Should it be static?
      sys_sparc32.c:109:17: warning: symbol 'compat_sys_lstat64' was not declared. Should it be static?
      sys_sparc32.c:120:17: warning: symbol 'compat_sys_fstat64' was not declared. Should it be static?
      sys_sparc32.c:131:17: warning: symbol 'compat_sys_fstatat64' was not declared. Should it be static?
      sys_sparc32.c:196:27: warning: symbol 'sys32_pread64' was not declared. Should it be static?
      sys_sparc32.c:205:27: warning: symbol 'sys32_pwrite64' was not declared. Should it be static?
      sys_sparc32.c:214:17: warning: symbol 'compat_sys_readahead' was not declared. Should it be static?
      sys_sparc32.c:222:6: warning: symbol 'compat_sys_fadvise64' was not declared. Should it be static?
      sys_sparc32.c:230:6: warning: symbol 'compat_sys_fadvise64_64' was not declared. Should it be static?
      sys_sparc32.c:241:6: warning: symbol 'sys32_sync_file_range' was not declared. Should it be static?
      sys_sparc32.c:249:17: warning: symbol 'compat_sys_fallocate' was not declared. Should it be static?
      
      Add proper prototypes in systbls.h
      Include linux/compat.h to get access to necessary types
      Use inverse christmas tree order in includes
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ed8eb755
    • S
      sparc64: fix sparse warning in pci.c · 4ac7b826
      Sam Ravnborg 提交于
      Fix following warning:
      pci.c:886:5: warning: symbol 'pci64_dma_supported' was not declared. Should it be static?
      
      Add proper prototype in kernel.h and delete local prototype in iommu.c
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4ac7b826
    • S
      sparc64: fix sparse warnings in smp_64.c · a0c54a21
      Sam Ravnborg 提交于
      Fix following warnings:
      smp_64.c:88:6: warning: symbol 'smp_callin' was not declared. Should it be static?
      smp_64.c:133:6: warning: symbol 'cpu_panic' was not declared. Should it be static?
      smp_64.c:187:6: warning: symbol 'smp_synchronize_tick_client' was not declared. Should it be static?
      smp_64.c:821:18: warning: symbol 'smp_call_function_client' was not declared. Should it be static?
      smp_64.c:827:18: warning: symbol 'smp_call_function_single_client' was not declared. Should it be static?
      smp_64.c:964:18: warning: symbol 'smp_new_mmu_context_version_client' was not declared. Should it be static?
      smp_64.c:1149:6: warning: symbol 'smp_capture' was not declared. Should it be static?
      smp_64.c:1171:6: warning: symbol 'smp_release' was not declared. Should it be static?
      smp_64.c:1190:18: warning: symbol 'smp_penguin_jailcell' was not declared. Should it be static?
      smp_64.c:1410:18: warning: symbol 'smp_receive_signal_client' was not declared. Should it be static?
      
      Add prototypes in kernel.h or asm/smp_64.h as appropriate.
      Delete duplicate function kimage_addr_to_ra(), and
      adapt parameter to const void * to match the broader use.
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a0c54a21
    • S
      sparc64: fix sparse warning in prom_64.c · cfbddd0d
      Sam Ravnborg 提交于
      Fix following warning:
      prom_64.c:376:6: warning: symbol 'arch_find_n_match_cpu_physical_id' was not declared. Should it be static?
      
      Add missing include to pick up prototype.
      Rearrange includes to use the inverse christmas tree structure.
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cfbddd0d