1. 12 1月, 2021 9 次提交
    • G
      csky: Sync riscv mm/fault.c for easy maintenance · bd0bf90e
      Guo Ren 提交于
      Sync arch/riscv/mm/fault.c into arch/csky for easy maintenance.
      Here are the patches related to the modification:
      
      cac4d1dc "riscv/mm/fault: Move no context handling to no_context()"
      ac416a72 "riscv/mm/fault: Move vmalloc fault handling to vmalloc_fault()"
      6c11ffbf "riscv/mm/fault: Move fault error handling to mm_fault_error()"
      afb8c6fe "riscv/mm/fault: Move access error check to function"
      bda281d5 "riscv/mm/fault: Simplify fault error handling"
      a51271d9 "riscv/mm/fault: Move bad area handling to bad_area()"
      Signed-off-by: NGuo Ren <guoren@linux.alibaba.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: Palmer Dabbelt <palmerdabbelt@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      bd0bf90e
    • G
      csky: Fix TLB maintenance synchronization problem · 3b756ccd
      Guo Ren 提交于
      TLB invalidate didn't contain a barrier operation in csky cpu and
      we need to prevent previous PTW response after TLB invalidation
      instruction. Of cause, the ASID changing also needs to take care
      of the issue.
      
      CPU0                    CPU1
      ===============         ===============
      set_pte
      sync_is()        ->     See the previous set_pte for all harts
      tlbi.vas         ->     Invalidate all harts TLB entry & flush pipeline
      Signed-off-by: NGuo Ren <guoren@linux.alibaba.com>
      3b756ccd
    • G
      csky: Fixup PTE global for 2.5:1.5 virtual memory · 7b513cf2
      Guo Ren 提交于
      Fixup commit c2d1adfa9a24 "csky: Add memory layout 2.5G(user):1.5G
      (kernel)". That patch broke the global bit in PTE.
      
      C-SKY TLB's entry contain two pages:
      vpn, vpn + 1 -> ppn0, ppn1
      
      All PPN's attributes contain global bit and final global is PPN0.G
      & PPN1.G. So we must keep PPN0.G and PPN1.G same in one TLB's
      entry.
      Signed-off-by: NGuo Ren <guoren@linux.alibaba.com>
      7b513cf2
    • G
      csky: Cleanup asm/spinlock.h · 8e35ac73
      Guo Ren 提交于
      There are two implementation of spinlock in arch/csky:
       - simple one (NR_CPU = 1,2)
       - tick's one (NR_CPU = 3,4)
      Remove the simple one.
      
      There is already smp_mb in spinlock, so remove the definition of
      smp_mb__after_spinlock.
      
      Link: https://lore.kernel.org/linux-csky/20200807081253.GD2674@hirez.programming.kicks-ass.net/#tSigned-off-by: NGuo Ren <guoren@linux.alibaba.com>
      Cc: Peter Zijlstra <peterz@infradead.org>k
      Cc: Arnd Bergmann <arnd@arndb.de>
      8e35ac73
    • G
      csky: Fixup asm/cmpxchg.h with correct ordering barrier · c38425df
      Guo Ren 提交于
      Optimize the performance of cmpxchg by using more fine-grained
      acquire/release barriers.
      Signed-off-by: NGuo Ren <guoren@linux.alibaba.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Paul E. McKenney <paulmck@kernel.org>
      c38425df
    • G
      csky: Fixup futex SMP implementation · d6c5cb9f
      Guo Ren 提交于
      Arnd said:
      I would guess that for csky, this is a mistake, as the architecture
      is fairly new and should be able to implement it.
      
      Guo reply:
      The c610, c807, c810 don't support SMP, so futex_cmpxchg_enabled = 1
      with asm-generic's implementation.
      For c860, there is no HAVE_FUTEX_CMPXCHG and cmpxchg_inatomic/inuser
      implementation, so futex_cmpxchg_enabled = 0.
      
      Thx for point it out, we'll implement cmpxchg_inatomic/inuser for
      C860 and still use asm-generic for non-smp CPUs.
      
      LTP test:
      futex_wait01    1  TPASS  :  futex_wait(): errno=ETIMEDOUT(110): Connection timed out
      futex_wait01    2  TPASS  :  futex_wait(): errno=EAGAIN/EWOULDBLOCK(11): Resource temporarily unavailable
      futex_wait01    3  TPASS  :  futex_wait(): errno=ETIMEDOUT(110): Connection timed out
      futex_wait01    4  TPASS  :  futex_wait(): errno=EAGAIN/EWOULDBLOCK(11): Resource temporarily unavailable
      futex_wait02    1  TPASS  :  futex_wait() woken up
      futex_wait03    1  TPASS  :  futex_wait() woken up
      futex_wait04    1  TPASS  :  futex_wait() returned -1: errno=EAGAIN/EWOULDBLOCK(11): Resource temporarily unavailable
      Signed-off-by: NGuo Ren <guoren@linux.alibaba.com>
      Cc: Arnd Bergmann <arnd@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Paul E. McKenney <paulmck@kernel.org>
      Link: https://lore.kernel.org/lkml/CAK8P3a3+WaQNyJ6Za2qfu6=0mBgU1hApnRXrdp1b1=P7wwyRUg@mail.gmail.com/
      d6c5cb9f
    • G
      csky: Fixup barrier design · 8d11f21a
      Guo Ren 提交于
      Remove shareable bit for ordering barrier, just keep ordering
      in current hart is enough for SMP. Using three continuous
      sync.is as PTW barrier to prevent speculative PTW in 860
      microarchitecture.
      Signed-off-by: NGuo Ren <guoren@linux.alibaba.com>
      8d11f21a
    • G
      csky: Remove custom asm/atomic.h implementation · f92ddfb7
      Guo Ren 提交于
      Use generic atomic implementation based on cmpxchg. So remove csky
      asm/atomic.h.
      Signed-off-by: NGuo Ren <guoren@linux.alibaba.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnd Bergmann <arnd@kernel.org>
      Cc: Paul E. McKenney <paulmck@kernel.org>
      f92ddfb7
    • G
      csky: Add memory layout 2.5G(user):1.5G(kernel) · 0c8a32ee
      Guo Ren 提交于
      There are two ways for translating va to pa for csky:
       - Use TLB(Translate Lookup Buffer) and PTW (Page Table Walk)
       - Use SSEG0/1 (Simple Segment Mapping)
      
      We use tlb mapping 0-2G and 3G-4G virtual address area and SSEG0/1
      are for 2G-2.5G and 2.5G-3G translation. We could disable SSEG0
      to use 2G-2.5G as TLB user mapping.
      Signed-off-by: NGuo Ren <guoren@linux.alibaba.com>
      0c8a32ee
  2. 30 12月, 2020 1 次提交
  3. 21 11月, 2020 1 次提交
  4. 09 11月, 2020 1 次提交
  5. 07 11月, 2020 1 次提交
  6. 27 10月, 2020 1 次提交
  7. 26 10月, 2020 2 次提交
  8. 13 8月, 2020 1 次提交
  9. 08 8月, 2020 1 次提交
  10. 31 7月, 2020 5 次提交
    • G
      csky: Add irq_work support · 2c81b076
      Guo Ren 提交于
      Running work in hardware interrupt context for csky. Implement:
       - arch_irq_work_raise()
       - arch_irq_work_has_interrupt()
      Signed-off-by: NGuo Ren <guoren@linux.alibaba.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      2c81b076
    • G
      csky: Optimize the trap processing flow · 5bc46ce2
      Guo Ren 提交于
       - Seperate different trap functions
       - Add trap_no()
       - Remove panic code print
       - Redesign die_if_kerenl to die with riscv's
       - Print exact trap info for app segment fault
      
      [   17.389321] gzip[126]: unhandled signal 11 code 0x3 at 0x0007835a in busybox[8000+d4000]
      [   17.393882]
      [   17.393882] CURRENT PROCESS:
      [   17.393882]
      [   17.394309] COMM=gzip PID=126
      [   17.394513] TEXT=00008000-000db2e4 DATA=000dcf14-000dd1ad BSS=000dd1ad-000ff000
      [   17.395499] USER-STACK=7f888e50  KERNEL-STACK=bf130300
      [   17.395499]
      [   17.396801] PC: 0x0007835a (0x7835a)
      [   17.397048] LR: 0x000058b4 (0x58b4)
      [   17.397285] SP: 0xbe519f68
      [   17.397555] orig_a0: 0x00002852
      [   17.397886] PSR: 0x00020341
      [   17.398356]  a0: 0x00002852   a1: 0x000f2f5a   a2: 0x0000d7ae   a3: 0x0000005d
      [   17.399289]  r4: 0x000de150   r5: 0x00000002   r6: 0x00000102   r7: 0x00007efa
      [   17.399800]  r8: 0x7f888bc4   r9: 0x00000001  r10: 0x000002eb  r11: 0x0000aac1
      [   17.400166] r12: 0x00002ef2  r13: 0x00000007  r15: 0x000058b4
      [   17.400531] r16: 0x0000004c  r17: 0x00000031  r18: 0x000f5816  r19: 0x000e8068
      [   17.401006] r20: 0x000f5818  r21: 0x000e8068  r22: 0x000f5918  r23: 0x90000000
      [   17.401721] r24: 0x00000031  r25: 0x000000c8  r26: 0x00000000  r27: 0x00000000
      [   17.402199] r28: 0x2ac2a000  r29: 0x00000000  r30: 0x00000000  tls: 0x2aadbaa8
      [   17.402686]  hi: 0x00120340   lo: 0x7f888bec
      /etc/init.ci/ntfs3g_run: line 61:   126 Segmentation fault      gzip -c -9 /mnt/test.bin > /mnt/test_bin.gz
      Signed-off-by: NGuo Ren <guoren@linux.alibaba.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      5bc46ce2
    • G
      csky: Add support for function error injection · 71e193d7
      Guo Ren 提交于
      Inspired by the commit 42d038c4 ("arm64: Add support for function
      error injection"), this patch supports function error injection for
      csky.
      
      This patch mainly support two functions: one is regs_set_return_value()
      which is used to overwrite the return value; the another function is
      override_function_with_return() which is to override the probed
      function returning and jump to its caller.
      
      Test log:
      
       cd /sys/kernel/debug/fail_function/
       echo sys_clone > inject
       echo 100 > probability
       echo 1 > interval
       ls /
      [  108.644163] FAULT_INJECTION: forcing a failure.
      [  108.644163] name fail_function, interval 1, probability 100, space 0, times 1
      [  108.647799] CPU: 0 PID: 104 Comm: sh Not tainted 5.8.0-rc5+ #46
      [  108.648384] Call Trace:
      [  108.649339] [<8005eed4>] walk_stackframe+0x0/0xf0
      [  108.649679] [<8005f16a>] show_stack+0x32/0x5c
      [  108.649927] [<8040f9d2>] dump_stack+0x6e/0x9c
      [  108.650271] [<80406f7e>] should_fail+0x15e/0x1ac
      [  108.650720] [<80118ba8>] fei_kprobe_handler+0x28/0x5c
      [  108.651519] [<80754110>] kprobe_breakpoint_handler+0x144/0x1cc
      [  108.652289] [<8005d6da>] trap_c+0x8e/0x110
      [  108.652816] [<8005ce8c>] csky_trap+0x5c/0x70
      -sh: can't fork: Invalid argument
      Signed-off-by: NGuo Ren <guoren@linux.alibaba.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      71e193d7
    • G
      csky: Add SECCOMP_FILTER supported · e95a4f8c
      Guo Ren 提交于
      secure_computing() is called first in syscall_trace_enter() so that
      a system call will be aborted quickly without doing succeeding syscall
      tracing if seccomp rules want to deny that system call.
      
      TODO:
       - Update https://github.com/seccomp/libseccomp csky support
      Signed-off-by: NGuo Ren <guoren@linux.alibaba.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      e95a4f8c
    • T
      csky: remove unusued thread_saved_pc and *_segments functions/macros · c23dd240
      Tobias Klauser 提交于
      These are used nowhere in the tree (except for some architectures which
      define them for their own use) and were already removed for other
      architectures in:
      
      commit 6474924e ("arch: remove unused macro/function thread_saved_pc()")
      commit c17c0204 ("arch: remove unused *_segments() macros/functions")
      
      Remove them from arch/csky as well.
      Signed-off-by: NTobias Klauser <tklauser@distanz.ch>
      Signed-off-by: NGuo Ren <guoren@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      c23dd240
  11. 10 6月, 2020 3 次提交
    • M
      mm: consolidate pte_index() and pte_offset_*() definitions · 974b9b2c
      Mike Rapoport 提交于
      All architectures define pte_index() as
      
      	(address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)
      
      and all architectures define pte_offset_kernel() as an entry in the array
      of PTEs indexed by the pte_index().
      
      For the most architectures the pte_offset_kernel() implementation relies
      on the availability of pmd_page_vaddr() that converts a PMD entry value to
      the virtual address of the page containing PTEs array.
      
      Let's move x86 definitions of the PTE accessors to the generic place in
      <linux/pgtable.h> and then simply drop the respective definitions from the
      other architectures.
      
      The architectures that didn't provide pmd_page_vaddr() are updated to have
      that defined.
      
      The generic implementation of pte_offset_kernel() can be overridden by an
      architecture and alpha makes use of this because it has special ordering
      requirements for its version of pte_offset_kernel().
      
      [rppt@linux.ibm.com: v2]
        Link: http://lkml.kernel.org/r/20200514170327.31389-11-rppt@kernel.org
      [rppt@linux.ibm.com: update]
        Link: http://lkml.kernel.org/r/20200514170327.31389-12-rppt@kernel.org
      [rppt@linux.ibm.com: update]
        Link: http://lkml.kernel.org/r/20200514170327.31389-13-rppt@kernel.org
      [akpm@linux-foundation.org: fix x86 warning]
      [sfr@canb.auug.org.au: fix powerpc build]
        Link: http://lkml.kernel.org/r/20200607153443.GB738695@linux.ibm.comSigned-off-by: NMike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
      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: 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-10-rppt@kernel.orgSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      974b9b2c
    • M
      csky: replace definitions of __pXd_offset() with pXd_index() · c910951a
      Mike Rapoport 提交于
      All architectures use pXd_index() to get an entry in the page table page
      corresponding to a virtual address.
      
      Align csky with other architectures.
      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: 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-5-rppt@kernel.orgSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c910951a
    • M
      mm: introduce include/linux/pgtable.h · ca5999fd
      Mike Rapoport 提交于
      The include/linux/pgtable.h is going to be the home of generic page table
      manipulation functions.
      
      Start with moving asm-generic/pgtable.h to include/linux/pgtable.h and
      make the latter include asm/pgtable.h.
      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: 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-3-rppt@kernel.orgSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ca5999fd
  12. 05 6月, 2020 6 次提交
    • I
      kmap: consolidate kmap_prot definitions · 090e77e1
      Ira Weiny 提交于
      Most architectures define kmap_prot to be PAGE_KERNEL.
      
      Let sparc and xtensa define there own and define PAGE_KERNEL as the
      default if not overridden.
      
      [akpm@linux-foundation.org: coding style fixes]
      Suggested-by: NChristoph Hellwig <hch@infradead.org>
      Signed-off-by: NIra Weiny <ira.weiny@intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Helge Deller <deller@gmx.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20200507150004.1423069-16-ira.weiny@intel.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      090e77e1
    • I
      kmap: remove kmap_atomic_to_page() · 8bfb1a10
      Ira Weiny 提交于
      kmap_atomic_to_page() has no callers and is only defined on 1 arch and
      declared on another.  Remove it.
      Suggested-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NIra Weiny <ira.weiny@intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Helge Deller <deller@gmx.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20200507150004.1423069-13-ira.weiny@intel.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8bfb1a10
    • I
      arch/kunmap_atomic: consolidate duplicate code · abca2500
      Ira Weiny 提交于
      Every single architecture (including !CONFIG_HIGHMEM) calls...
      
      	pagefault_enable();
      	preempt_enable();
      
      ... before returning from __kunmap_atomic().  Lift this code into the
      kunmap_atomic() macro.
      
      While we are at it rename __kunmap_atomic() to kunmap_atomic_high() to
      be consistent.
      
      [ira.weiny@intel.com: don't enable pagefault/preempt twice]
        Link: http://lkml.kernel.org/r/20200518184843.3029640-1-ira.weiny@intel.com
      [akpm@linux-foundation.org: coding style fixes]
      Signed-off-by: NIra Weiny <ira.weiny@intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Helge Deller <deller@gmx.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Link: http://lkml.kernel.org/r/20200507150004.1423069-8-ira.weiny@intel.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      abca2500
    • I
      arch/kmap_atomic: consolidate duplicate code · 78b6d91e
      Ira Weiny 提交于
      Every arch has the same code to ensure atomic operations and a check for
      !HIGHMEM page.
      
      Remove the duplicate code by defining a core kmap_atomic() which only
      calls the arch specific kmap_atomic_high() when the page is high memory.
      
      [akpm@linux-foundation.org: coding style fixes]
      Signed-off-by: NIra Weiny <ira.weiny@intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Helge Deller <deller@gmx.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20200507150004.1423069-7-ira.weiny@intel.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      78b6d91e
    • I
      arch/kunmap: remove duplicate kunmap implementations · e23c4597
      Ira Weiny 提交于
      All architectures do exactly the same thing for kunmap(); remove all the
      duplicate definitions and lift the call to the core.
      
      This also has the benefit of changing kmap_unmap() on a number of
      architectures to be an inline call rather than an actual function.
      
      [akpm@linux-foundation.org: fix CONFIG_HIGHMEM=n build on various architectures]
      Signed-off-by: NIra Weiny <ira.weiny@intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Helge Deller <deller@gmx.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20200507150004.1423069-5-ira.weiny@intel.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e23c4597
    • I
      arch/kmap: remove redundant arch specific kmaps · 525aaf9b
      Ira Weiny 提交于
      The kmap code for all the architectures is almost 100% identical.
      
      Lift the common code to the core.  Use ARCH_HAS_KMAP_FLUSH_TLB to indicate
      if an arch defines kmap_flush_tlb() and call if if needed.
      
      This also has the benefit of changing kmap() on a number of architectures
      to be an inline call rather than an actual function.
      Signed-off-by: NIra Weiny <ira.weiny@intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Helge Deller <deller@gmx.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20200507150004.1423069-4-ira.weiny@intel.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      525aaf9b
  13. 28 5月, 2020 1 次提交
  14. 15 5月, 2020 2 次提交
    • A
      csky: Fixup raw_copy_from_user() · 51bb38cb
      Al Viro 提交于
      If raw_copy_from_user(to, from, N) returns K, callers expect
      the first N - K bytes starting at to to have been replaced with
      the contents of corresponding area starting at from and the last
      K bytes of destination *left* *unmodified*.
      
      What arch/sky/lib/usercopy.c is doing is broken - it can lead to e.g.
      data corruption on write(2).
      
      raw_copy_to_user() is inaccurate about return value, which is a bug,
      but consequences are less drastic than for raw_copy_from_user().
      And just what are those access_ok() doing in there?  I mean, look into
      linux/uaccess.h; that's where we do that check (as well as zero tail
      on failure in the callers that need zeroing).
      
      AFAICS, all of that shouldn't be hard to fix; something like a patch
      below might make a useful starting point.
      
      I would suggest moving these macros into usercopy.c (they are never
      used anywhere else) and possibly expanding them there; if you leave
      them alive, please at least rename __copy_user_zeroing(). Again,
      it must not zero anything on failed read.
      
      Said that, I'm not sure we won't be better off simply turning
      usercopy.c into usercopy.S - all that is left there is a couple of
      functions, each consisting only of inline asm.
      
      Guo Ren reply:
      
      Yes, raw_copy_from_user is wrong, it's no need zeroing code.
      
      unsigned long _copy_from_user(void *to, const void __user *from,
      unsigned long n)
      {
              unsigned long res = n;
              might_fault();
              if (likely(access_ok(from, n))) {
                      kasan_check_write(to, n);
                      res = raw_copy_from_user(to, from, n);
              }
              if (unlikely(res))
                      memset(to + (n - res), 0, res);
              return res;
      }
      EXPORT_SYMBOL(_copy_from_user);
      
      You are right and access_ok() should be removed.
      
      but, how about:
      do {
      ...
              "2:     stw     %3, (%1, 0)     \n"             \
      +       "       subi    %0, 4          \n"               \
              "9:     stw     %4, (%1, 4)     \n"             \
      +       "       subi    %0, 4          \n"               \
              "10:    stw     %5, (%1, 8)     \n"             \
      +       "       subi    %0, 4          \n"               \
              "11:    stw     %6, (%1, 12)    \n"             \
      +       "       subi    %0, 4          \n"               \
              "       addi    %2, 16          \n"             \
              "       addi    %1, 16          \n"             \
      
      Don't expand __ex_table
      
      AI Viro reply:
      
      Hey, I've no idea about the instruction scheduling on csky -
      if that doesn't slow the things down, all the better.  It's just
      that copy_to_user() and friends are on fairly hot codepaths,
      and in quite a few situations they will dominate the speed of
      e.g. read(2).  So I tried to keep the fast path unchanged.
      Up to the architecture maintainers, obviously.  Which would be
      you...
      
      As for the fixups size increase (__ex_table size is unchanged)...
      You have each of those macros expanded exactly once.
      So the size is not a serious argument, IMO - useless complexity
      would be, if it is, in fact, useless; the size... not really,
      especially since those extra subi will at least offset it.
      
      Again, up to you - asm optimizations of (essentially)
      memcpy()-style loops are tricky and can depend upon the
      fairly subtle details of architecture.  So even on something
      I know reasonably well I would resort to direct experiments
      if I can't pass the buck to architecture maintainers.
      
      It *is* worth optimizing - this is where read() from a file
      that is already in page cache spends most of the time, etc.
      
      Guo Ren reply:
      
      Thx, after fixup some typo “sub %0, 4”, apply the patch.
      
      TODO:
       - user copy/from codes are still need optimizing.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NGuo Ren <guoren@linux.alibaba.com>
      51bb38cb
    • G
      csky: Fixup gdbmacros.txt with name sp in thread_struct · 67002814
      Guo Ren 提交于
      The gdbmacros.txt use sp in thread_struct, but csky use ksp. This
      cause bttnobp fail to excute.
      
      TODO:
       - Still couldn't display the contents of stack.
      Signed-off-by: NGuo Ren <guoren@linux.alibaba.com>
      67002814
  15. 13 5月, 2020 3 次提交
    • G
      csky: Fixup remove unnecessary save/restore PSR code · 9e2ca153
      Guo Ren 提交于
      All processes' PSR could success from SETUP_MMU, so need set it
      in INIT_THREAD again.
      
      And use a3 instead of r7 in __switch_to for code convention.
      Signed-off-by: NGuo Ren <guoren@linux.alibaba.com>
      9e2ca153
    • G
      csky: Fixup calltrace panic · 18c07d23
      Guo Ren 提交于
      The implementation of show_stack will panic with wrong fp:
      
      addr    = *fp++;
      
      because the fp isn't checked properly.
      
      The current implementations of show_stack, wchan and stack_trace
      haven't been designed properly, so just deprecate them.
      
      This patch is a reference to riscv's way, all codes are modified from
      arm's. The patch is passed with:
      
       - cat /proc/<pid>/stack
       - cat /proc/<pid>/wchan
       - echo c > /proc/sysrq-trigger
      Signed-off-by: NGuo Ren <guoren@linux.alibaba.com>
      18c07d23
    • G
      csky: Fixup compile error for abiv1 entry.S · bd11aabd
      Guo Ren 提交于
      This bug is from uprobe signal definition in thread_info.h. The
      instruction (andi) of abiv1 immediate is smaller than abiv2, then
      it will cause:
      
        AS      arch/csky/kernel/entry.o
       arch/csky/kernel/entry.S: Assembler messages:
       arch/csky/kernel/entry.S:224: Error: Operand 2 immediate is overflow.
      Signed-off-by: NGuo Ren <guoren@linux.alibaba.com>
      bd11aabd
  16. 11 4月, 2020 2 次提交
    • A
      mm/special: create generic fallbacks for pte_special() and pte_mkspecial() · 78e7c5af
      Anshuman Khandual 提交于
      Currently there are many platforms that dont enable ARCH_HAS_PTE_SPECIAL
      but required to define quite similar fallback stubs for special page
      table entry helpers such as pte_special() and pte_mkspecial(), as they
      get build in generic MM without a config check.  This creates two
      generic fallback stub definitions for these helpers, eliminating much
      code duplication.
      
      mips platform has a special case where pte_special() and pte_mkspecial()
      visibility is wider than what ARCH_HAS_PTE_SPECIAL enablement requires.
      This restricts those symbol visibility in order to avoid redefinitions
      which is now exposed through this new generic stubs and subsequent build
      failure.  arm platform set_pte_at() definition needs to be moved into a
      C file just to prevent a build failure.
      
      [anshuman.khandual@arm.com: use defined(CONFIG_ARCH_HAS_PTE_SPECIAL) in mips per Thomas]
        Link: http://lkml.kernel.org/r/1583851924-21603-1-git-send-email-anshuman.khandual@arm.comSigned-off-by: NAnshuman Khandual <anshuman.khandual@arm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: Guo Ren <guoren@kernel.org>			[csky]
      Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>	[m68k]
      Acked-by: Stafford Horne <shorne@gmail.com>		[openrisc]
      Acked-by: Helge Deller <deller@gmx.de>			[parisc]
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Brian Cain <bcain@codeaurora.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Sam Creasey <sammy@sammy.net>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paulburton@kernel.org>
      Cc: Nick Hu <nickhu@andestech.com>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Cc: Ley Foon Tan <ley.foon.tan@intel.com>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Link: http://lkml.kernel.org/r/1583802551-15406-1-git-send-email-anshuman.khandual@arm.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      78e7c5af
    • A
      mm/vma: define a default value for VM_DATA_DEFAULT_FLAGS · c62da0c3
      Anshuman Khandual 提交于
      There are many platforms with exact same value for VM_DATA_DEFAULT_FLAGS
      This creates a default value for VM_DATA_DEFAULT_FLAGS in line with the
      existing VM_STACK_DEFAULT_FLAGS.  While here, also define some more
      macros with standard VMA access flag combinations that are used
      frequently across many platforms.  Apart from simplification, this
      reduces code duplication as well.
      Signed-off-by: NAnshuman Khandual <anshuman.khandual@arm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: NVlastimil Babka <vbabka@suse.cz>
      Acked-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Guo Ren <guoren@kernel.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Brian Cain <bcain@codeaurora.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paulburton@kernel.org>
      Cc: Nick Hu <nickhu@andestech.com>
      Cc: Ley Foon Tan <ley.foon.tan@intel.com>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Rich Felker <dalias@libc.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Chris Zankel <chris@zankel.net>
      Link: http://lkml.kernel.org/r/1583391014-8170-2-git-send-email-anshuman.khandual@arm.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c62da0c3
新手
引导
客服 返回
顶部