1. 11 6月, 2018 1 次提交
  2. 03 6月, 2018 1 次提交
  3. 17 5月, 2018 1 次提交
    • N
      powerpc: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selected · 4c1d9bb0
      Nicholas Piggin 提交于
      This requires further changes to linker script to KEEP some tables
      and wildcard compiler generated sections into the right place. This
      includes pp32 modifications from Christophe Leroy.
      
      When compiling powernv_defconfig with this option, the resulting
      kernel is almost 400kB smaller (and still boots):
      
          text      data       bss        dec   filename
      11827621   4810490   1341080   17979191   vmlinux
      11752437   4598858   1338776   17690071   vmlinux.dcde
      
      Mathieu's numbers for custom Mac Mini G4 config has almost 200kB
      saving. It also had some increase in vmlinux size for as-yet
      unknown reasons.
      
          text      data       bss        dec   filename
       7461457   2475122   1428064   11364643   vmlinux
       7386425   2364370   1425432   11176227   vmlinux.dcde
      
      Tested-by: Christophe Leroy <christophe.leroy@c-s.fr> [8xx]
      Tested-by: Mathieu Malaterre <malat@debian.org> [32-bit powermac]
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      4c1d9bb0
  4. 10 5月, 2018 1 次提交
    • T
      powerpc/livepatch: Implement reliable stack tracing for the consistency model · df78d3f6
      Torsten Duwe 提交于
      The "Power Architecture 64-Bit ELF V2 ABI" says in section 2.3.2.3:
      
      [...] There are several rules that must be adhered to in order to ensure
      reliable and consistent call chain backtracing:
      
      * Before a function calls any other function, it shall establish its
        own stack frame, whose size shall be a multiple of 16 bytes.
      
       – In instances where a function’s prologue creates a stack frame, the
         back-chain word of the stack frame shall be updated atomically with
         the value of the stack pointer (r1) when a back chain is implemented.
         (This must be supported as default by all ELF V2 ABI-compliant
         environments.)
      [...]
       – The function shall save the link register that contains its return
         address in the LR save doubleword of its caller’s stack frame before
         calling another function.
      
      To me this sounds like the equivalent of HAVE_RELIABLE_STACKTRACE.
      This patch may be unneccessarily limited to ppc64le, but OTOH the only
      user of this flag so far is livepatching, which is only implemented on
      PPCs with 64-LE, a.k.a. ELF ABI v2.
      
      Feel free to add other ppc variants, but so far only ppc64le got tested.
      
      This change also implements save_stack_trace_tsk_reliable() for ppc64le
      that checks for the above conditions, where possible.
      Signed-off-by: NTorsten Duwe <duwe@suse.de>
      Signed-off-by: NNicolai Stange <nstange@suse.de>
      Acked-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      df78d3f6
  5. 09 5月, 2018 6 次提交
  6. 08 5月, 2018 1 次提交
  7. 03 5月, 2018 1 次提交
  8. 17 4月, 2018 1 次提交
  9. 14 4月, 2018 1 次提交
    • A
      kexec_file: make use of purgatory optional · b799a09f
      AKASHI Takahiro 提交于
      Patch series "kexec_file, x86, powerpc: refactoring for other
      architecutres", v2.
      
      This is a preparatory patchset for adding kexec_file support on arm64.
      
      It was originally included in a arm64 patch set[1], but Philipp is also
      working on their kexec_file support on s390[2] and some changes are now
      conflicting.
      
      So these common parts were extracted and put into a separate patch set
      for better integration.  What's more, my original patch#4 was split into
      a few small chunks for easier review after Dave's comment.
      
      As such, the resulting code is basically identical with my original, and
      the only *visible* differences are:
      
       - renaming of _kexec_kernel_image_probe() and  _kimage_file_post_load_cleanup()
      
       - change one of types of arguments at prepare_elf64_headers()
      
      Those, unfortunately, require a couple of trivial changes on the rest
      (#1, #6 to #13) of my arm64 kexec_file patch set[1].
      
      Patch #1 allows making a use of purgatory optional, particularly useful
      for arm64.
      
      Patch #2 commonalizes arch_kexec_kernel_{image_probe, image_load,
      verify_sig}() and arch_kimage_file_post_load_cleanup() across
      architectures.
      
      Patches #3-#7 are also intended to generalize parse_elf64_headers(),
      along with exclude_mem_range(), to be made best re-use of.
      
      [1] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-February/561182.html
      [2] http://lkml.iu.edu//hypermail/linux/kernel/1802.1/02596.html
      
      This patch (of 7):
      
      On arm64, crash dump kernel's usable memory is protected by *unmapping*
      it from kernel virtual space unlike other architectures where the region
      is just made read-only.  It is highly unlikely that the region is
      accidentally corrupted and this observation rationalizes that digest
      check code can also be dropped from purgatory.  The resulting code is so
      simple as it doesn't require a bit ugly re-linking/relocation stuff,
      i.e.  arch_kexec_apply_relocations_add().
      
      Please see:
      
         http://lists.infradead.org/pipermail/linux-arm-kernel/2017-December/545428.html
      
      All that the purgatory does is to shuffle arguments and jump into a new
      kernel, while we still need to have some space for a hash value
      (purgatory_sha256_digest) which is never checked against.
      
      As such, it doesn't make sense to have trampline code between old kernel
      and new kernel on arm64.
      
      This patch introduces a new configuration, ARCH_HAS_KEXEC_PURGATORY, and
      allows related code to be compiled in only if necessary.
      
      [takahiro.akashi@linaro.org: fix trivial screwup]
        Link: http://lkml.kernel.org/r/20180309093346.GF25863@linaro.org
      Link: http://lkml.kernel.org/r/20180306102303.9063-2-takahiro.akashi@linaro.orgSigned-off-by: NAKASHI Takahiro <takahiro.akashi@linaro.org>
      Acked-by: NDave Young <dyoung@redhat.com>
      Tested-by: NDave Young <dyoung@redhat.com>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Cc: Baoquan He <bhe@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b799a09f
  10. 06 2月, 2018 1 次提交
    • M
      powerpc, membarrier: Skip memory barrier in switch_mm() · 3ccfebed
      Mathieu Desnoyers 提交于
      Allow PowerPC to skip the full memory barrier in switch_mm(), and
      only issue the barrier when scheduling into a task belonging to a
      process that has registered to use expedited private.
      
      Threads targeting the same VM but which belong to different thread
      groups is a tricky case. It has a few consequences:
      
      It turns out that we cannot rely on get_nr_threads(p) to count the
      number of threads using a VM. We can use
      (atomic_read(&mm->mm_users) == 1 && get_nr_threads(p) == 1)
      instead to skip the synchronize_sched() for cases where the VM only has
      a single user, and that user only has a single thread.
      
      It also turns out that we cannot use for_each_thread() to set
      thread flags in all threads using a VM, as it only iterates on the
      thread group.
      
      Therefore, test the membarrier state variable directly rather than
      relying on thread flags. This means
      membarrier_register_private_expedited() needs to set the
      MEMBARRIER_STATE_PRIVATE_EXPEDITED flag, issue synchronize_sched(), and
      only then set MEMBARRIER_STATE_PRIVATE_EXPEDITED_READY which allows
      private expedited membarrier commands to succeed.
      membarrier_arch_switch_mm() now tests for the
      MEMBARRIER_STATE_PRIVATE_EXPEDITED flag.
      Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andrea Parri <parri.andrea@gmail.com>
      Cc: Andrew Hunter <ahh@google.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Avi Kivity <avi@scylladb.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Dave Watson <davejwatson@fb.com>
      Cc: David Sehr <sehr@google.com>
      Cc: Greg Hackmann <ghackmann@google.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Maged Michael <maged.michael@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: linux-api@vger.kernel.org
      Cc: linux-arch@vger.kernel.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: http://lkml.kernel.org/r/20180129202020.8515-3-mathieu.desnoyers@efficios.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      3ccfebed
  11. 01 2月, 2018 1 次提交
  12. 21 1月, 2018 1 次提交
  13. 20 1月, 2018 1 次提交
  14. 17 1月, 2018 1 次提交
    • M
      powerpc/64s: Wire up cpu_show_meltdown() · fd6e440f
      Michael Ellerman 提交于
      The recent commit 87590ce6 ("sysfs/cpu: Add vulnerability folder")
      added a generic folder and set of files for reporting information on
      CPU vulnerabilities. One of those was for meltdown:
      
        /sys/devices/system/cpu/vulnerabilities/meltdown
      
      This commit wires up that file for 64-bit Book3S powerpc.
      
      For now we default to "Vulnerable" unless the RFI flush is enabled.
      That may not actually be true on all hardware, further patches will
      refine the reporting based on the CPU/platform etc. But for now we
      default to being pessimists.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      fd6e440f
  15. 10 1月, 2018 1 次提交
    • C
      dma-mapping: move swiotlb arch helpers to a new header · ea8c64ac
      Christoph Hellwig 提交于
      phys_to_dma, dma_to_phys and dma_capable are helpers published by
      architecture code for use of swiotlb and xen-swiotlb only.  Drivers are
      not supposed to use these directly, but use the DMA API instead.
      
      Move these to a new asm/dma-direct.h helper, included by a
      linux/dma-direct.h wrapper that provides the default linear mapping
      unless the architecture wants to override it.
      
      In the MIPS case the existing dma-coherent.h is reused for now as
      untangling it will take a bit of work.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Acked-by: NRobin Murphy <robin.murphy@arm.com>
      ea8c64ac
  16. 13 11月, 2017 2 次提交
  17. 06 11月, 2017 1 次提交
    • M
      powerpc/64s: Replace CONFIG_PPC_STD_MMU_64 with CONFIG_PPC_BOOK3S_64 · 4e003747
      Michael Ellerman 提交于
      CONFIG_PPC_STD_MMU_64 indicates support for the "standard" powerpc MMU
      on 64-bit CPUs. The "standard" MMU refers to the hash page table MMU
      found in "server" processors, from IBM mainly.
      
      Currently CONFIG_PPC_STD_MMU_64 is == CONFIG_PPC_BOOK3S_64. While it's
      annoying to have two symbols that always have the same value, it's not
      quite annoying enough to bother removing one.
      
      However with the arrival of Power9, we now have the situation where
      CONFIG_PPC_STD_MMU_64 is enabled, but the kernel is running using the
      Radix MMU - *not* the "standard" MMU. So it is now actively confusing
      to use it, because it implies that code is disabled or inactive when
      the Radix MMU is in use, however that is not necessarily true.
      
      So s/CONFIG_PPC_STD_MMU_64/CONFIG_PPC_BOOK3S_64/, and do some minor
      formatting updates of some of the affected lines.
      
      This will be a pain for backports, but c'est la vie.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      4e003747
  18. 02 11月, 2017 1 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  19. 01 9月, 2017 1 次提交
    • P
      powerpc: Use instruction emulation infrastructure to handle alignment faults · 31bfdb03
      Paul Mackerras 提交于
      This replaces almost all of the instruction emulation code in
      fix_alignment() with calls to analyse_instr(), emulate_loadstore()
      and emulate_dcbz().  The only emulation code left is the SPE
      emulation code; analyse_instr() etc. do not handle SPE instructions
      at present.
      
      One result of this is that we can now handle alignment faults on
      all the new VSX load and store instructions that were added in POWER9.
      VSX loads/stores will take alignment faults for unaligned accesses
      to cache-inhibited memory.
      
      Another effect is that we no longer rely on the DAR and DSISR values
      set by the processor.
      
      With this, we now need to include the instruction emulation code
      unconditionally.
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      31bfdb03
  20. 19 8月, 2017 1 次提交
  21. 15 8月, 2017 3 次提交
  22. 14 8月, 2017 1 次提交
  23. 10 8月, 2017 3 次提交
  24. 13 7月, 2017 3 次提交
  25. 04 7月, 2017 1 次提交
    • B
      powerpc/Kconfig: Enable STRICT_KERNEL_RWX for some configs · 1e0fc9d1
      Balbir Singh 提交于
      All code that patches kernel text has been moved over to using
      patch_instruction() and patch_instruction() is able to cope with the
      kernel text being read only.
      
      The linker script has been updated to ensure the read only data ends
      on a large page boundary, so it and the preceding kernel text can be
      marked R_X. We also have implementations of mark_rodata_ro() for Hash
      and Radix MMU modes.
      
      There are some corner-cases missing when the kernel is built
      relocatable, so for now make it depend on !RELOCATABLE.
      
      There's also a temporary workaround to depend on !HIBERNATION to avoid
      a build failure, that will be removed once we've merged with the PM
      tree.
      Signed-off-by: NBalbir Singh <bsingharora@gmail.com>
      [mpe: Make it depend on !RELOCATABLE, munge change log]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      1e0fc9d1
  26. 02 7月, 2017 1 次提交
  27. 30 6月, 2017 1 次提交
  28. 22 6月, 2017 1 次提交
    • P
      powerpc: Convert VDSO update function to use new update_vsyscall interface · d4cfb113
      Paul Mackerras 提交于
      This converts the powerpc VDSO time update function to use the new
      interface introduced in commit 576094b7 ("time: Introduce new
      GENERIC_TIME_VSYSCALL", 2012-09-11).  Where the old interface gave
      us the time as of the last update in seconds and whole nanoseconds,
      with the new interface we get the nanoseconds part effectively in
      a binary fixed-point format with tk->tkr_mono.shift bits to the
      right of the binary point.
      
      With the old interface, the fractional nanoseconds got truncated,
      meaning that the value returned by the VDSO clock_gettime function
      would have about 1ns of jitter in it compared to the value computed
      by the generic timekeeping code in the kernel.
      
      The powerpc VDSO time functions (clock_gettime and gettimeofday)
      already work in units of 2^-32 seconds, or 0.23283 ns, because that
      makes it simple to split the result into seconds and fractional
      seconds, and represent the fractional seconds in either microseconds
      or nanoseconds.  This is good enough accuracy for now, so this patch
      avoids changing how the VDSO works or the interface in the VDSO data
      page.
      
      This patch converts the powerpc update_vsyscall_old to be called
      update_vsyscall and use the new interface.  We convert the fractional
      second to units of 2^-32 seconds without truncating to whole nanoseconds.
      (There is still a conversion to whole nanoseconds for any legacy users
      of the vdso_data/systemcfg stamp_xtime field.)
      
      In addition, this improves the accuracy of the computation of tb_to_xs
      for those systems with high-frequency timebase clocks (>= 268.5 MHz)
      by doing the right shift in two parts, one before the multiplication and
      one after, rather than doing the right shift before the multiplication.
      (We can't do all of the right shift after the multiplication unless we
      use 128-bit arithmetic.)
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      Acked-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      d4cfb113