1. 06 3月, 2019 6 次提交
  2. 05 3月, 2019 1 次提交
    • L
      get rid of legacy 'get_ds()' function · 736706be
      Linus Torvalds 提交于
      Every in-kernel use of this function defined it to KERNEL_DS (either as
      an actual define, or as an inline function).  It's an entirely
      historical artifact, and long long long ago used to actually read the
      segment selector valueof '%ds' on x86.
      
      Which in the kernel is always KERNEL_DS.
      
      Inspired by a patch from Jann Horn that just did this for a very small
      subset of users (the ones in fs/), along with Al who suggested a script.
      I then just took it to the logical extreme and removed all the remaining
      gunk.
      
      Roughly scripted with
      
         git grep -l '(get_ds())' -- :^tools/ | xargs sed -i 's/(get_ds())/(KERNEL_DS)/'
         git grep -lw 'get_ds' -- :^tools/ | xargs sed -i '/^#define get_ds()/d'
      
      plus manual fixups to remove a few unusual usage patterns, the couple of
      inline function cases and to fix up a comment that had become stale.
      
      The 'get_ds()' function remains in an x86 kvm selftest, since in user
      space it actually does something relevant.
      Inspired-by: NJann Horn <jannh@google.com>
      Inspired-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      736706be
  3. 19 2月, 2019 1 次提交
    • A
      powerpc/powernv/sriov: Register IOMMU groups for VFs · 8f5b2734
      Alexey Kardashevskiy 提交于
      The compound IOMMU group rework moved iommu_register_group() together
      in pnv_pci_ioda_setup_iommu_api() (which is a part of
      ppc_md.pcibios_fixup). As the result, pnv_ioda_setup_bus_iommu_group()
      does not create groups any more, it only adds devices to groups.
      
      This works fine for boot time devices. However IOMMU groups for
      SRIOV's VFs were added by pnv_ioda_setup_bus_iommu_group() so this got
      broken: pnv_tce_iommu_bus_notifier() expects a group to be registered
      for VF and it is not.
      
      This adds missing group registration and adds a NULL pointer check
      into the bus notifier so we won't crash if there is no group, although
      it is not expected to happen now because of the change above.
      
      Example oops seen prior to this patch:
      
        $ echo 1 > /sys/bus/pci/devices/0000\:01\:00.0/sriov_numvfs
        Unable to handle kernel paging request for data at address 0x00000030
        Faulting instruction address: 0xc0000000004a6018
        Oops: Kernel access of bad area, sig: 11 [#1]
        LE SMP NR_CPUS=2048 NUMA PowerNV
        CPU: 46 PID: 7006 Comm: bash Not tainted 4.15-ish
        NIP:  c0000000004a6018 LR: c0000000004a6014 CTR: 0000000000000000
        REGS: c000008fc876b400 TRAP: 0300   Not tainted  (4.15-ish)
        MSR:  900000000280b033 <SF,HV,VEC,VSX,EE,FP,ME,IR,DR,RI,LE>
        CFAR: c000000000d0be20 DAR: 0000000000000030 DSISR: 40000000 SOFTE: 1
        ...
        NIP sysfs_do_create_link_sd.isra.0+0x68/0x150
        LR  sysfs_do_create_link_sd.isra.0+0x64/0x150
        Call Trace:
          pci_dev_type+0x0/0x30 (unreliable)
          iommu_group_add_device+0x8c/0x600
          iommu_add_device+0xe8/0x180
          pnv_tce_iommu_bus_notifier+0xb0/0xf0
          notifier_call_chain+0x9c/0x110
          blocking_notifier_call_chain+0x64/0xa0
          device_add+0x524/0x7d0
          pci_device_add+0x248/0x450
          pci_iov_add_virtfn+0x294/0x3e0
          pci_enable_sriov+0x43c/0x580
          mlx5_core_sriov_configure+0x15c/0x2f0 [mlx5_core]
          sriov_numvfs_store+0x180/0x240
          dev_attr_store+0x3c/0x60
          sysfs_kf_write+0x64/0x90
          kernfs_fop_write+0x1ac/0x240
          __vfs_write+0x3c/0x70
          vfs_write+0xd8/0x220
          SyS_write+0x6c/0x110
          system_call+0x58/0x6c
      
      Fixes: 0bd97167 ("powerpc/powernv/npu: Add compound IOMMU groups")
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Reported-by: NSantwana Samantray <santwana.samantray@in.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      8f5b2734
  4. 17 2月, 2019 1 次提交
    • M
      powerpc/64s: Fix possible corruption on big endian due to pgd/pud_present() · a5800762
      Michael Ellerman 提交于
      In v4.20 we changed our pgd/pud_present() to check for _PAGE_PRESENT
      rather than just checking that the value is non-zero, e.g.:
      
        static inline int pgd_present(pgd_t pgd)
        {
       -       return !pgd_none(pgd);
       +       return (pgd_raw(pgd) & cpu_to_be64(_PAGE_PRESENT));
        }
      
      Unfortunately this is broken on big endian, as the result of the
      bitwise & is truncated to int, which is always zero because
      _PAGE_PRESENT is 0x8000000000000000ul. This means pgd_present() and
      pud_present() are always false at compile time, and the compiler
      elides the subsequent code.
      
      Remarkably with that bug present we are still able to boot and run
      with few noticeable effects. However under some work loads we are able
      to trigger a warning in the ext4 code:
      
        WARNING: CPU: 11 PID: 29593 at fs/ext4/inode.c:3927 .ext4_set_page_dirty+0x70/0xb0
        CPU: 11 PID: 29593 Comm: debugedit Not tainted 4.20.0-rc1 #1
        ...
        NIP .ext4_set_page_dirty+0x70/0xb0
        LR  .set_page_dirty+0xa0/0x150
        Call Trace:
         .set_page_dirty+0xa0/0x150
         .unmap_page_range+0xbf0/0xe10
         .unmap_vmas+0x84/0x130
         .unmap_region+0xe8/0x190
         .__do_munmap+0x2f0/0x510
         .__vm_munmap+0x80/0x110
         .__se_sys_munmap+0x14/0x30
         system_call+0x5c/0x70
      
      The fix is simple, we need to convert the result of the bitwise & to
      an int before returning it.
      
      Thanks to Erhard, Jan Kara and Aneesh for help with debugging.
      
      Fixes: da7ad366 ("powerpc/mm/book3s: Update pmd_present to look at _PAGE_PRESENT bit")
      Cc: stable@vger.kernel.org # v4.20+
      Reported-by: NErhard F. <erhard_f@mailbox.org>
      Reviewed-by: NAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      a5800762
  5. 04 2月, 2019 1 次提交
    • D
      socket: Rename SO_RCVTIMEO/ SO_SNDTIMEO with _OLD suffixes · 45bdc661
      Deepa Dinamani 提交于
      SO_RCVTIMEO and SO_SNDTIMEO socket options use struct timeval
      as the time format. struct timeval is not y2038 safe.
      The subsequent patches in the series add support for new socket
      timeout options with _NEW suffix that will use y2038 safe
      data structures. Although the existing struct timeval layout
      is sufficiently wide to represent timeouts, because of the way
      libc will interpret time_t based on user defined flag, these
      new flags provide a way of having a structure that is the same
      for all architectures consistently.
      Rename the existing options with _OLD suffix forms so that the
      right option is enabled for userspace applications according
      to the architecture and time_t definition of libc.
      Signed-off-by: NDeepa Dinamani <deepa.kernel@gmail.com>
      Acked-by: NWillem de Bruijn <willemb@google.com>
      Cc: ccaulfie@redhat.com
      Cc: deller@gmx.de
      Cc: paulus@samba.org
      Cc: ralf@linux-mips.org
      Cc: rth@twiddle.net
      Cc: cluster-devel@redhat.com
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: linux-alpha@vger.kernel.org
      Cc: linux-arch@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: linux-parisc@vger.kernel.org
      Cc: sparclinux@vger.kernel.org
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      45bdc661
  6. 02 2月, 2019 1 次提交
  7. 01 2月, 2019 1 次提交
    • O
      powerpc/papr_scm: Use the correct bind address · 5a3840a4
      Oliver O'Halloran 提交于
      When binding an SCM volume to a physical address the hypervisor has the
      option to return early with a continue token with the expectation that
      the guest will resume the bind operation until it completes. A quirk of
      this interface is that the bind address will only be returned by the
      first bind h-call and the subsequent calls will return
      0xFFFF_FFFF_FFFF_FFFF for the bind address.
      
      We currently do not save the address returned by the first h-call. As a
      result we will use the junk address as the base of the bound region if
      the hypervisor decides to split the bind across multiple h-calls. This
      bug was found when testing with very large SCM volumes where the bind
      process would take more time than they hypervisor's internal h-call time
      limit would allow. This patch fixes the issue by saving the bind address
      from the first call.
      
      Cc: stable@vger.kernel.org
      Fixes: b5beae5e ("powerpc/pseries: Add driver for PAPR SCM regions")
      Signed-off-by: NOliver O'Halloran <oohall@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      5a3840a4
  8. 31 1月, 2019 1 次提交
    • A
      powerpc/radix: Fix kernel crash with mremap() · 579b9239
      Aneesh Kumar K.V 提交于
      With support for split pmd lock, we use pmd page pmd_huge_pte pointer
      to store the deposited page table. In those config when we move page
      tables we need to make sure we move the deposited page table to the
      correct pmd page. Otherwise this can result in crash when we withdraw
      of deposited page table because we can find the pmd_huge_pte NULL.
      
      eg:
      
        __split_huge_pmd+0x1070/0x1940
        __split_huge_pmd+0xe34/0x1940 (unreliable)
        vma_adjust_trans_huge+0x110/0x1c0
        __vma_adjust+0x2b4/0x9b0
        __split_vma+0x1b8/0x280
        __do_munmap+0x13c/0x550
        sys_mremap+0x220/0x7e0
        system_call+0x5c/0x70
      
      Fixes: 675d9952 ("powerpc/book3s64: Enable split pmd ptlock.")
      Cc: stable@vger.kernel.org # v4.18+
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      579b9239
  9. 27 1月, 2019 1 次提交
  10. 20 1月, 2019 1 次提交
  11. 15 1月, 2019 2 次提交
    • M
      powerpc/syscalls: Fix syscall tracing · 7bea7ac0
      Michael Ellerman 提交于
      Recently in commit fbf508da ("powerpc: split compat syscall table
      out from native table") we changed the layout of the system call
      table. Instead of having two entries for each syscall number, one for
      the regular entry point and one for the compat entry point, we now
      have separate tables for regular and compat entry points.
      
      This inadvertently broke syscall tracing (CONFIG_FTRACE_SYSCALLS),
      because our implementation of arch_syscall_addr() knew about the
      layout of the table (it did nr * 2).
      
      We can fix it just by dropping our version of arch_syscall_addr() and
      using the generic version which does:
      
      	return (unsigned long)sys_call_table[nr];
      
      Fixes: fbf508da ("powerpc: split compat syscall table out from native table")
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      7bea7ac0
    • J
      powerpc/pseries: Fix build break due to pnv_npu2_init() · da727097
      Jason A. Donenfeld 提交于
      Commit 3be2df00 ("powerpc/pseries/npu: Enable platform support")
      added a call to pnv_npu2_init() in pseries code. This causes a build
      break if we build with CONFIG_PPC_PSERIES && !CONFIG_PPC_POWERNV:
      
        powerpc64le-pc-linux-gnu-ld: arch/powerpc/platforms/pseries/pci.o: in function `pSeries_final_fixup':
        pci.c:(.init.text+0x1b0): undefined reference to `pnv_npu2_init'
      
      This commit therefore wraps that line in an ifdef, so that pseries
      builds without powernv.
      
      Fixes: 3be2df00 ("powerpc/pseries/npu: Enable platform support")
      Signed-off-by: NJason A. Donenfeld <Jason@zx2c4.com>
      Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      [mpe: Frob change log a bit to blame a different commit]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      da727097
  12. 11 1月, 2019 5 次提交
  13. 08 1月, 2019 2 次提交
  14. 06 1月, 2019 3 次提交
  15. 05 1月, 2019 2 次提交
    • J
      mm: treewide: remove unused address argument from pte_alloc functions · 4cf58924
      Joel Fernandes (Google) 提交于
      Patch series "Add support for fast mremap".
      
      This series speeds up the mremap(2) syscall by copying page tables at
      the PMD level even for non-THP systems.  There is concern that the extra
      'address' argument that mremap passes to pte_alloc may do something
      subtle architecture related in the future that may make the scheme not
      work.  Also we find that there is no point in passing the 'address' to
      pte_alloc since its unused.  This patch therefore removes this argument
      tree-wide resulting in a nice negative diff as well.  Also ensuring
      along the way that the enabled architectures do not do anything funky
      with the 'address' argument that goes unnoticed by the optimization.
      
      Build and boot tested on x86-64.  Build tested on arm64.  The config
      enablement patch for arm64 will be posted in the future after more
      testing.
      
      The changes were obtained by applying the following Coccinelle script.
      (thanks Julia for answering all Coccinelle questions!).
      Following fix ups were done manually:
      * Removal of address argument from  pte_fragment_alloc
      * Removal of pte_alloc_one_fast definitions from m68k and microblaze.
      
      // Options: --include-headers --no-includes
      // Note: I split the 'identifier fn' line, so if you are manually
      // running it, please unsplit it so it runs for you.
      
      virtual patch
      
      @pte_alloc_func_def depends on patch exists@
      identifier E2;
      identifier fn =~
      "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
      type T2;
      @@
      
       fn(...
      - , T2 E2
       )
       { ... }
      
      @pte_alloc_func_proto_noarg depends on patch exists@
      type T1, T2, T3, T4;
      identifier fn =~ "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
      @@
      
      (
      - T3 fn(T1, T2);
      + T3 fn(T1);
      |
      - T3 fn(T1, T2, T4);
      + T3 fn(T1, T2);
      )
      
      @pte_alloc_func_proto depends on patch exists@
      identifier E1, E2, E4;
      type T1, T2, T3, T4;
      identifier fn =~
      "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
      @@
      
      (
      - T3 fn(T1 E1, T2 E2);
      + T3 fn(T1 E1);
      |
      - T3 fn(T1 E1, T2 E2, T4 E4);
      + T3 fn(T1 E1, T2 E2);
      )
      
      @pte_alloc_func_call depends on patch exists@
      expression E2;
      identifier fn =~
      "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
      @@
      
       fn(...
      -,  E2
       )
      
      @pte_alloc_macro depends on patch exists@
      identifier fn =~
      "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
      identifier a, b, c;
      expression e;
      position p;
      @@
      
      (
      - #define fn(a, b, c) e
      + #define fn(a, b) e
      |
      - #define fn(a, b) e
      + #define fn(a) e
      )
      
      Link: http://lkml.kernel.org/r/20181108181201.88826-2-joelaf@google.comSigned-off-by: NJoel Fernandes (Google) <joel@joelfernandes.org>
      Suggested-by: NKirill A. Shutemov <kirill@shutemov.name>
      Acked-by: NKirill A. Shutemov <kirill@shutemov.name>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Julia Lawall <Julia.Lawall@lip6.fr>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: William Kucharski <william.kucharski@oracle.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4cf58924
    • L
      Fix access_ok() fallout for sparc32 and powerpc · 4caf4ebf
      Linus Torvalds 提交于
      These two architectures actually had an intentional use of the 'type'
      argument to access_ok() just to avoid warnings.
      
      I had actually noticed the powerpc one, but forgot to then fix it up.
      And I missed the sparc32 case entirely.
      
      This is hopefully all of it.
      Reported-by: NMathieu Malaterre <malat@debian.org>
      Reported-by: NGuenter Roeck <linux@roeck-us.net>
      Fixes: 96d4f267 ("Remove 'type' argument from access_ok() function")
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4caf4ebf
  16. 04 1月, 2019 2 次提交
    • M
      powerpc: Drop use of 'type' from access_ok() · 074400a7
      Mathieu Malaterre 提交于
      In commit 05a4ab82 ("powerpc/uaccess: fix warning/error with
      access_ok()") an attempt was made to remove a warning by referencing
      the variable `type`. However in commit 96d4f267 ("Remove 'type'
      argument from access_ok() function") the variable `type` has been
      removed, breaking the build:
      
        arch/powerpc/include/asm/uaccess.h:66:32: error: ‘type’ undeclared (first use in this function)
      
      This essentially reverts commit 05a4ab82 ("powerpc/uaccess: fix
      warning/error with access_ok()") to fix the error.
      
      Fixes: 96d4f267 ("Remove 'type' argument from access_ok() function")
      Signed-off-by: NMathieu Malaterre <malat@debian.org>
      [mpe: Reword change log slightly.]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      074400a7
    • L
      Remove 'type' argument from access_ok() function · 96d4f267
      Linus Torvalds 提交于
      Nobody has actually used the type (VERIFY_READ vs VERIFY_WRITE) argument
      of the user address range verification function since we got rid of the
      old racy i386-only code to walk page tables by hand.
      
      It existed because the original 80386 would not honor the write protect
      bit when in kernel mode, so you had to do COW by hand before doing any
      user access.  But we haven't supported that in a long time, and these
      days the 'type' argument is a purely historical artifact.
      
      A discussion about extending 'user_access_begin()' to do the range
      checking resulted this patch, because there is no way we're going to
      move the old VERIFY_xyz interface to that model.  And it's best done at
      the end of the merge window when I've done most of my merges, so let's
      just get this done once and for all.
      
      This patch was mostly done with a sed-script, with manual fix-ups for
      the cases that weren't of the trivial 'access_ok(VERIFY_xyz' form.
      
      There were a couple of notable cases:
      
       - csky still had the old "verify_area()" name as an alias.
      
       - the iter_iov code had magical hardcoded knowledge of the actual
         values of VERIFY_{READ,WRITE} (not that they mattered, since nothing
         really used it)
      
       - microblaze used the type argument for a debug printout
      
      but other than those oddities this should be a total no-op patch.
      
      I tried to fix up all architectures, did fairly extensive grepping for
      access_ok() uses, and the changes are trivial, but I may have missed
      something.  Any missed conversion should be trivially fixable, though.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      96d4f267
  17. 30 12月, 2018 8 次提交
    • C
      kgdb/treewide: constify struct kgdb_arch arch_kgdb_ops · cc028297
      Christophe Leroy 提交于
      checkpatch.pl reports the following:
      
        WARNING: struct kgdb_arch should normally be const
        #28: FILE: arch/mips/kernel/kgdb.c:397:
        +struct kgdb_arch arch_kgdb_ops = {
      
      This report makes sense, as all other ops struct, this
      one should also be const. This patch does the change.
      
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Rich Felker <dalias@libc.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: x86@kernel.org
      Acked-by: NDaniel Thompson <daniel.thompson@linaro.org>
      Acked-by: NPaul Burton <paul.burton@mips.com>
      Signed-off-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Acked-by: NBorislav Petkov <bp@suse.de>
      Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
      Signed-off-by: NDaniel Thompson <daniel.thompson@linaro.org>
      cc028297
    • D
      kgdb: Fix kgdb_roundup_cpus() for arches who used smp_call_function() · 3cd99ac3
      Douglas Anderson 提交于
      When I had lockdep turned on and dropped into kgdb I got a nice splat
      on my system.  Specifically it hit:
        DEBUG_LOCKS_WARN_ON(current->hardirq_context)
      
      Specifically it looked like this:
        sysrq: SysRq : DEBUG
        ------------[ cut here ]------------
        DEBUG_LOCKS_WARN_ON(current->hardirq_context)
        WARNING: CPU: 0 PID: 0 at .../kernel/locking/lockdep.c:2875 lockdep_hardirqs_on+0xf0/0x160
        CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.19.0 #27
        pstate: 604003c9 (nZCv DAIF +PAN -UAO)
        pc : lockdep_hardirqs_on+0xf0/0x160
        ...
        Call trace:
         lockdep_hardirqs_on+0xf0/0x160
         trace_hardirqs_on+0x188/0x1ac
         kgdb_roundup_cpus+0x14/0x3c
         kgdb_cpu_enter+0x53c/0x5cc
         kgdb_handle_exception+0x180/0x1d4
         kgdb_compiled_brk_fn+0x30/0x3c
         brk_handler+0x134/0x178
         do_debug_exception+0xfc/0x178
         el1_dbg+0x18/0x78
         kgdb_breakpoint+0x34/0x58
         sysrq_handle_dbg+0x54/0x5c
         __handle_sysrq+0x114/0x21c
         handle_sysrq+0x30/0x3c
         qcom_geni_serial_isr+0x2dc/0x30c
        ...
        ...
        irq event stamp: ...45
        hardirqs last  enabled at (...44): [...] __do_softirq+0xd8/0x4e4
        hardirqs last disabled at (...45): [...] el1_irq+0x74/0x130
        softirqs last  enabled at (...42): [...] _local_bh_enable+0x2c/0x34
        softirqs last disabled at (...43): [...] irq_exit+0xa8/0x100
        ---[ end trace adf21f830c46e638 ]---
      
      Looking closely at it, it seems like a really bad idea to be calling
      local_irq_enable() in kgdb_roundup_cpus().  If nothing else that seems
      like it could violate spinlock semantics and cause a deadlock.
      
      Instead, let's use a private csd alongside
      smp_call_function_single_async() to round up the other CPUs.  Using
      smp_call_function_single_async() doesn't require interrupts to be
      enabled so we can remove the offending bit of code.
      
      In order to avoid duplicating this across all the architectures that
      use the default kgdb_roundup_cpus(), we'll add a "weak" implementation
      to debug_core.c.
      
      Looking at all the people who previously had copies of this code,
      there were a few variants.  I've attempted to keep the variants
      working like they used to.  Specifically:
      * For arch/arc we passed NULL to kgdb_nmicallback() instead of
        get_irq_regs().
      * For arch/mips there was a bit of extra code around
        kgdb_nmicallback()
      
      NOTE: In this patch we will still get into trouble if we try to round
      up a CPU that failed to round up before.  We'll try to round it up
      again and potentially hang when we try to grab the csd lock.  That's
      not new behavior but we'll still try to do better in a future patch.
      Suggested-by: NDaniel Thompson <daniel.thompson@linaro.org>
      Signed-off-by: NDouglas Anderson <dianders@chromium.org>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Rich Felker <dalias@libc.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Acked-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NDaniel Thompson <daniel.thompson@linaro.org>
      3cd99ac3
    • D
      kgdb: Remove irq flags from roundup · 9ef7fa50
      Douglas Anderson 提交于
      The function kgdb_roundup_cpus() was passed a parameter that was
      documented as:
      
      > the flags that will be used when restoring the interrupts. There is
      > local_irq_save() call before kgdb_roundup_cpus().
      
      Nobody used those flags.  Anyone who wanted to temporarily turn on
      interrupts just did local_irq_enable() and local_irq_disable() without
      looking at them.  So we can definitely remove the flags.
      Signed-off-by: NDouglas Anderson <dianders@chromium.org>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Rich Felker <dalias@libc.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Acked-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NDaniel Thompson <daniel.thompson@linaro.org>
      9ef7fa50
    • M
      KVM: PPC: Book3S HV: radix: Fix uninitialized var build error · f4607722
      Michael Ellerman 提交于
      Old GCCs (4.6.3 at least), aren't able to follow the logic in
      __kvmhv_copy_tofrom_guest_radix() and warn that old_pid is used
      uninitialized:
      
        arch/powerpc/kvm/book3s_64_mmu_radix.c:75:3: error: 'old_pid' may be
        used uninitialized in this function
      
      The logic is OK, we only use old_pid if quadrant == 1, and in that
      case it has definitely be initialised, eg:
      
      	if (quadrant == 1) {
      		old_pid = mfspr(SPRN_PID);
      	...
      	if (quadrant == 1 && pid != old_pid)
      		mtspr(SPRN_PID, old_pid);
      
      Annotate it to fix the error.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      f4607722
    • M
      powerpc/configs: Add PPC4xx_OCM to ppc40x_defconfig · 42aee372
      Michael Ellerman 提交于
      There was recently a compilation break to this driver, but we didn't
      notice because none of our defconfigs have it enabled. Fix that.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      42aee372
    • M
      powerpc/4xx/ocm: Fix phys_addr_t printf warnings · 52b88fa1
      Michael Ellerman 提交于
      Currently the code produces several warnings, eg:
      
        arch/powerpc/platforms/4xx/ocm.c:240:38: error: format '%llx'
        expects argument of type 'long long unsigned int', but argument 3
        has type 'phys_addr_t {aka unsigned int}'
           seq_printf(m, "PhysAddr     : 0x%llx\n", ocm->phys);
                                         ~~~^     ~~~~~~~~~
      
      Fix it by using the special %pa[p] format for printing phys_addr_t.
      Note we need to pass the value by reference for the special specifier
      to work.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      52b88fa1
    • C
      powerpc/4xx/ocm: Fix compilation error due to PAGE_KERNEL usage · d0757237
      Christian Lamparter 提交于
      This patch fixes a recent compilation regression in ocm:
      
        ocm.c: In function ‘ocm_init_node’:
        ocm.c:182:18: error: invalid operands to binary |
              (have ‘int’ and ‘pgprot_t’ {aka ‘struct <anonymous>’})
              _PAGE_EXEC | PAGE_KERNEL_NCG);
                         ^
      
        ocm.c:197:17: error: invalid operands to binary |
              (have ‘int’ and ‘pgprot_t’ {aka ‘struct <anonymous>’})
               _PAGE_EXEC | PAGE_KERNEL);
                          ^
      
      Fixes: 56f3c141 ("powerpc/mm: properly set PAGE_KERNEL flags in ioremap()")
      Cc: stable@vger.kernel.org # v4.20
      Signed-off-by: NChristian Lamparter <chunkeey@gmail.com>
      Reviewed-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      d0757237
    • D
      powerpc/fsl: Fixed warning: orphan section `__btb_flush_fixup' · 039daac5
      Diana Craciun 提交于
      Fixed the following build warning:
      powerpc-linux-gnu-ld: warning: orphan section `__btb_flush_fixup' from
      `arch/powerpc/kernel/head_44x.o' being placed in section
      `__btb_flush_fixup'.
      Signed-off-by: NDiana Craciun <diana.craciun@nxp.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      039daac5
  18. 29 12月, 2018 1 次提交