1. 15 7月, 2020 1 次提交
  2. 10 6月, 2020 1 次提交
    • M
      mm: don't include asm/pgtable.h if linux/mm.h is already included · e31cf2f4
      Mike Rapoport 提交于
      Patch series "mm: consolidate definitions of page table accessors", v2.
      
      The low level page table accessors (pXY_index(), pXY_offset()) are
      duplicated across all architectures and sometimes more than once.  For
      instance, we have 31 definition of pgd_offset() for 25 supported
      architectures.
      
      Most of these definitions are actually identical and typically it boils
      down to, e.g.
      
      static inline unsigned long pmd_index(unsigned long address)
      {
              return (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1);
      }
      
      static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
      {
              return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(address);
      }
      
      These definitions can be shared among 90% of the arches provided
      XYZ_SHIFT, PTRS_PER_XYZ and xyz_page_vaddr() are defined.
      
      For architectures that really need a custom version there is always
      possibility to override the generic version with the usual ifdefs magic.
      
      These patches introduce include/linux/pgtable.h that replaces
      include/asm-generic/pgtable.h and add the definitions of the page table
      accessors to the new header.
      
      This patch (of 12):
      
      The linux/mm.h header includes <asm/pgtable.h> to allow inlining of the
      functions involving page table manipulations, e.g.  pte_alloc() and
      pmd_alloc().  So, there is no point to explicitly include <asm/pgtable.h>
      in the files that include <linux/mm.h>.
      
      The include statements in such cases are remove with a simple loop:
      
      	for f in $(git grep -l "include <linux/mm.h>") ; do
      		sed -i -e '/include <asm\/pgtable.h>/ d' $f
      	done
      Signed-off-by: NMike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Cain <bcain@codeaurora.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Ungerer <gerg@linux-m68k.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Guo Ren <guoren@kernel.org>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Ley Foon Tan <ley.foon.tan@intel.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: Nick Hu <nickhu@andestech.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Link: http://lkml.kernel.org/r/20200514170327.31389-1-rppt@kernel.org
      Link: http://lkml.kernel.org/r/20200514170327.31389-2-rppt@kernel.orgSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e31cf2f4
  3. 05 6月, 2020 1 次提交
  4. 02 6月, 2020 1 次提交
  5. 26 5月, 2020 1 次提交
    • M
      powerpc: Add ppc_inst_next() · c5ff46d6
      Michael Ellerman 提交于
      In a few places we want to calculate the address of the next
      instruction. Previously that was simple, we just added 4 bytes, or if
      using a u32 * we incremented that pointer by 1.
      
      But prefixed instructions make it more complicated, we need to advance
      by either 4 or 8 bytes depending on the actual instruction. We also
      can't do pointer arithmetic using struct ppc_inst, because it is
      always 8 bytes in size on 64-bit, even though we might only need to
      advance by 4 bytes.
      
      So add a ppc_inst_next() helper which calculates the location of the
      next instruction, if the given instruction was located at the given
      address. Note the instruction doesn't need to actually be at the
      address in memory.
      
      Although it would seem natural for the value to be passed by value,
      that makes it too easy to write a loop that will read off the end of a
      page, eg:
      
      	for (; src < end; src = ppc_inst_next(src, *src),
      			  dest = ppc_inst_next(dest, *dest))
      
      As noticed by Christophe and Jordan, if end is the exact end of a
      page, and the next page is not mapped, this will fault, because *dest
      will read 8 bytes, 4 bytes into the next page.
      
      So value is passed by reference, so the helper can be careful to use
      ppc_inst_read() on it.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Reviewed-by: NJordan Niethe <jniethe5@gmail.com>
      Link: https://lore.kernel.org/r/20200522133318.1681406-1-mpe@ellerman.id.au
      c5ff46d6
  6. 18 5月, 2020 17 次提交
  7. 15 5月, 2020 3 次提交
  8. 26 3月, 2020 1 次提交
  9. 25 3月, 2020 1 次提交
    • M
      powerpc/xmon: Lower limits on nidump and ndump · d64c7dbb
      Michael Ellerman 提交于
      In xmon we have two variables that are used by the dump commands.
      There's ndump which is the number of bytes to dump using 'd', and
      nidump which is the number of instructions to dump using 'di'.
      
      ndump starts as 64 and nidump starts as 16, but both can be set by the
      user.
      
      It's fairly common to be pasting addresses into xmon when trying to
      debug something, and if you inadvertently double paste an address like
      so:
      
        0:mon> di c000000002101f6c c000000002101f6c
      
      The second value is interpreted as the number of instructions to dump.
      
      Luckily it doesn't dump 13 quintrillion instructions, the value is
      limited to MAX_DUMP (128K). But as each instruction is dumped on a
      single line, that's still a lot of output. If you're on a slow console
      that can take multiple minutes to print. If you were "just popping in
      and out of xmon quickly before the RCU/hardlockup detector fires" you
      are now having a bad day.
      
      Things are not as bad with 'd' because we print 16 bytes per line, so
      it's fewer lines. But it's still quite a lot.
      
      So shrink the maximum for 'd' to 64K (one page), which is 4096 lines.
      For 'di' add a new limit which is the above / 4 - because instructions
      are 4 bytes, meaning again we can dump one page.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20200219110007.31195-1-mpe@ellerman.id.au
      d64c7dbb
  10. 18 2月, 2020 1 次提交
    • O
      powerpc/xmon: Fix whitespace handling in getstring() · 066bc357
      Oliver O'Halloran 提交于
      The ls (lookup symbol) and zr (reboot) commands use xmon's getstring()
      helper to read a string argument from the xmon prompt. This function
      skips over leading whitespace, but doesn't check if the first
      "non-whitespace" character is a newline which causes some odd
      behaviour (<enter> indicates a the enter key was pressed):
      
        0:mon> ls printk<enter>
        printk: c0000000001680c4
      
        0:mon> ls<enter>
        printk<enter>
        Symbol '
        printk' not found.
        0:mon>
      
      With commit 2d9b332d ("powerpc/xmon: Allow passing an argument to
      ppc_md.restart()") we have a similar problem with the zr command.
      Previously zr took no arguments so "zr<enter> would trigger a reboot.
      With that patch applied a second newline needs to be sent in order for
      the reboot to occur. Fix this by checking if the leading whitespace
      ended on a newline:
      
        0:mon> ls<enter>
        Symbol '' not found.
      
      Fixes: 2d9b332d ("powerpc/xmon: Allow passing an argument to ppc_md.restart()")
      Reported-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NOliver O'Halloran <oohall@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20200217041343.2454-1-oohall@gmail.com
      066bc357
  11. 23 1月, 2020 1 次提交
  12. 14 1月, 2020 1 次提交
  13. 13 11月, 2019 1 次提交
  14. 28 10月, 2019 2 次提交
  15. 13 9月, 2019 1 次提交
  16. 19 8月, 2019 3 次提交
  17. 04 7月, 2019 1 次提交
  18. 02 7月, 2019 1 次提交
    • N
      powerpc/64s/exception: remove bad stack branch · 0a882e28
      Nicholas Piggin 提交于
      The bad stack test in interrupt handlers has a few problems. For
      performance it is taken in the common case, which is a fetch bubble
      and a waste of i-cache.
      
      For code development and maintainence, it requires yet another stack
      frame setup routine, and that constrains all exception handlers to
      follow the same register save pattern which inhibits future
      optimisation.
      
      Remove the test/branch and replace it with a trap. Teach the program
      check handler to use the emergency stack for this case.
      
      This does not result in quite so nice a message, however the SRR0 and
      SRR1 of the crashed interrupt can be seen in r11 and r12, as is the
      original r1 (adjusted by INT_FRAME_SIZE). These are the most important
      parts to debugging the issue.
      
      The original r9-12 and cr0 is lost, which is the main downside.
      
        kernel BUG at linux/arch/powerpc/kernel/exceptions-64s.S:847!
        Oops: Exception in kernel mode, sig: 5 [#1]
        BE SMP NR_CPUS=2048 NUMA PowerNV
        Modules linked in:
        CPU: 0 PID: 1 Comm: swapper/0 Not tainted
        NIP:  c000000000009108 LR: c000000000cadbcc CTR: c0000000000090f0
        REGS: c0000000fffcbd70 TRAP: 0700   Not tainted
        MSR:  9000000000021032 <SF,HV,ME,IR,DR,RI>  CR: 28222448  XER: 20040000
        CFAR: c000000000009100 IRQMASK: 0
        GPR00: 000000000000003d fffffffffffffd00 c0000000018cfb00 c0000000f02b3166
        GPR04: fffffffffffffffd 0000000000000007 fffffffffffffffb 0000000000000030
        GPR08: 0000000000000037 0000000028222448 0000000000000000 c000000000ca8de0
        GPR12: 9000000002009032 c000000001ae0000 c000000000010a00 0000000000000000
        GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
        GPR20: c0000000f00322c0 c000000000f85200 0000000000000004 ffffffffffffffff
        GPR24: fffffffffffffffe 0000000000000000 0000000000000000 000000000000000a
        GPR28: 0000000000000000 0000000000000000 c0000000f02b391c c0000000f02b3167
        NIP [c000000000009108] decrementer_common+0x18/0x160
        LR [c000000000cadbcc] .vsnprintf+0x3ec/0x4f0
        Call Trace:
        Instruction dump:
        996d098a 994d098b 38610070 480246ed 48005518 60000000 38200000 718a4000
        7c2a0b78 3821fd00 41c20008 e82d0970 <0981fd00> f92101a0 f9610170 f9810178
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      0a882e28
  19. 01 7月, 2019 1 次提交
    • N
      powerpc/xmon: Fix disabling tracing while in xmon · aaf06665
      Naveen N. Rao 提交于
      Commit ed49f7fd ("powerpc/xmon: Disable tracing when entering
      xmon") added code to disable recording trace entries while in xmon. The
      commit introduced a variable 'tracing_enabled' to record if tracing was
      enabled on xmon entry, and used this to conditionally enable tracing
      during exit from xmon.
      
      However, we are not checking the value of 'fromipi' variable in
      xmon_core() when setting 'tracing_enabled'. Due to this, when secondary
      cpus enter xmon, they will see tracing as being disabled already and
      tracing won't be re-enabled on exit. Fix the same.
      
      Fixes: ed49f7fd ("powerpc/xmon: Disable tracing when entering xmon")
      Signed-off-by: NNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      aaf06665