1. 25 7月, 2020 2 次提交
    • A
      RISC-V: Do not rely on initrd_start/end computed during early dt parsing · 4400231c
      Atish Patra 提交于
      Currently, initrd_start/end are computed during early_init_dt_scan
      but used during arch_setup. We will get the following panic if initrd is used
      and CONFIG_DEBUG_VIRTUAL is turned on.
      
      [    0.000000] ------------[ cut here ]------------
      [    0.000000] kernel BUG at arch/riscv/mm/physaddr.c:33!
      [    0.000000] Kernel BUG [#1]
      [    0.000000] Modules linked in:
      [    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.8.0-rc4-00015-ged0b226fed02 #886
      [    0.000000] epc: ffffffe0002058d2 ra : ffffffe0000053f0 sp : ffffffe001001f40
      [    0.000000]  gp : ffffffe00106e250 tp : ffffffe001009d40 t0 : ffffffe00107ee28
      [    0.000000]  t1 : 0000000000000000 t2 : ffffffe000a2e880 s0 : ffffffe001001f50
      [    0.000000]  s1 : ffffffe0001383e8 a0 : ffffffe00c087e00 a1 : 0000000080200000
      [    0.000000]  a2 : 00000000010bf000 a3 : ffffffe00106f3c8 a4 : ffffffe0010bf000
      [    0.000000]  a5 : ffffffe000000000 a6 : 0000000000000006 a7 : 0000000000000001
      [    0.000000]  s2 : ffffffe00106f068 s3 : ffffffe00106f070 s4 : 0000000080200000
      [    0.000000]  s5 : 0000000082200000 s6 : 0000000000000000 s7 : 0000000000000000
      [    0.000000]  s8 : 0000000080011010 s9 : 0000000080012700 s10: 0000000000000000
      [    0.000000]  s11: 0000000000000000 t3 : 000000000001fe30 t4 : 000000000001fe30
      [    0.000000]  t5 : 0000000000000000 t6 : ffffffe00107c471
      [    0.000000] status: 0000000000000100 badaddr: 0000000000000000 cause: 0000000000000003
      [    0.000000] random: get_random_bytes called from print_oops_end_marker+0x22/0x46 with crng_init=0
      
      To avoid the error, initrd_start/end can be computed from phys_initrd_start/size
      in setup itself. It also improves the initrd placement by aligning the start
      and size with the page size.
      
      Fixes: 76d2a049 ("RISC-V: Init and Halt Code")
      Signed-off-by: NAtish Patra <atish.patra@wdc.com>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      4400231c
    • A
      RISC-V: Set maximum number of mapped pages correctly · d0d8aae6
      Atish Patra 提交于
      Currently, maximum number of mapper pages are set to the pfn calculated
      from the memblock size of the memblock containing kernel. This will work
      until that memblock spans the entire memory. However, it will be set to
      a wrong value if there are multiple memblocks defined in kernel
      (e.g. with efi runtime services).
      
      Set the the maximum value to the pfn calculated from dram size.
      Signed-off-by: NAtish Patra <atish.patra@wdc.com>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      d0d8aae6
  2. 21 7月, 2020 1 次提交
  3. 18 7月, 2020 1 次提交
  4. 15 7月, 2020 1 次提交
  5. 10 7月, 2020 4 次提交
  6. 26 6月, 2020 3 次提交
    • G
      riscv: Fixup __vdso_gettimeofday broke dynamic ftrace · e05d57dc
      Guo Ren 提交于
      For linux-5.8-rc1, enable ftrace of riscv will cause boot panic:
      
      [    2.388980] Run /sbin/init as init process
      [    2.529938] init[39]: unhandled signal 4 code 0x1 at 0x0000003ff449e000
      [    2.531078] CPU: 0 PID: 39 Comm: init Not tainted 5.8.0-rc1-dirty #13
      [    2.532719] epc: 0000003ff449e000 ra : 0000003ff449e954 sp : 0000003fffedb900
      [    2.534005]  gp : 00000000000e8528 tp : 0000003ff449d800 t0 : 000000000000001e
      [    2.534965]  t1 : 000000000000000a t2 : 0000003fffedb89e s0 : 0000003fffedb920
      [    2.536279]  s1 : 0000003fffedb940 a0 : 0000003ff43d4b2c a1 : 0000000000000000
      [    2.537334]  a2 : 0000000000000001 a3 : 0000000000000000 a4 : fffffffffbad8000
      [    2.538466]  a5 : 0000003ff449e93a a6 : 0000000000000000 a7 : 0000000000000000
      [    2.539511]  s2 : 0000000000000000 s3 : 0000003ff448412c s4 : 0000000000000010
      [    2.541260]  s5 : 0000000000000016 s6 : 00000000000d0a30 s7 : 0000003fffedba70
      [    2.542152]  s8 : 0000000000000000 s9 : 0000000000000000 s10: 0000003fffedb960
      [    2.543335]  s11: 0000000000000000 t3 : 0000000000000000 t4 : 0000003fffedb8a0
      [    2.544471]  t5 : 0000000000000000 t6 : 0000000000000000
      [    2.545730] status: 0000000000004020 badaddr: 00000000464c457f cause: 0000000000000002
      [    2.549867] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004
      [    2.551267] CPU: 0 PID: 1 Comm: init Not tainted 5.8.0-rc1-dirty #13
      [    2.552061] Call Trace:
      [    2.552626] [<ffffffe00020374a>] walk_stackframe+0x0/0xc4
      [    2.553486] [<ffffffe0002039f4>] show_stack+0x40/0x4c
      [    2.553995] [<ffffffe00054a6ae>] dump_stack+0x7a/0x98
      [    2.554615] [<ffffffe00020b9b8>] panic+0x114/0x2f4
      [    2.555395] [<ffffffe00020ebd6>] do_exit+0x89c/0x8c2
      [    2.555949] [<ffffffe00020f930>] do_group_exit+0x3a/0x90
      [    2.556715] [<ffffffe000219e08>] get_signal+0xe2/0x6e6
      [    2.557388] [<ffffffe000202d72>] do_notify_resume+0x6a/0x37a
      [    2.558089] [<ffffffe000201c16>] ret_from_exception+0x0/0xc
      
      "ra:0x3ff449e954" is the return address of "call _mcount" in the
      prologue of __vdso_gettimeofday(). Without proper relocate, pc jmp
      to 0x0000003ff449e000 (vdso map base) with a illegal instruction
      trap.
      
      The solution comes from arch/arm64/kernel/vdso/Makefile:
      
      CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os $(CC_FLAGS_SCS)
      
       - CC_FLAGS_SCS is ShadowCallStack feature in Clang and only
         implemented for arm64, no use for riscv.
      
      Fixes: ad5d1122 ("riscv: use vDSO common flow to reduce the latency of the time-related functions")
      Cc: stable@vger.kernel.org
      Signed-off-by: NGuo Ren <guoren@linux.alibaba.com>
      Reviewed-by: NVincent Chen <vincent.chen@sifive.com>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      e05d57dc
    • V
      riscv: Add extern declarations for vDSO time-related functions · e93b327d
      Vincent Chen 提交于
      Add extern declarations for vDSO time-related functions to notify the
      compiler these functions will be used in somewhere to avoid
      "no previous prototype" compile warning.
      Reported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NVincent Chen <vincent.chen@sifive.com>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      e93b327d
    • V
      riscv: Add -fPIC option to CFLAGS_vgettimeofday.o · a0fc3b32
      Vincent Chen 提交于
      The time related vDSO functions use a variable, vdso_data, to access the
      vDSO data page to get the system time information. Because the vdso_data
      for CFLAGS_vgettimeofday.o is an external variable defined in vdso.o,
      the CFLAGS_vgettimeofday.o should be compiled with -fPIC to ensure
      that vdso_data is addressable.
      Reported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NVincent Chen <vincent.chen@sifive.com>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      a0fc3b32
  7. 19 6月, 2020 3 次提交
  8. 18 6月, 2020 1 次提交
  9. 13 6月, 2020 1 次提交
  10. 11 6月, 2020 2 次提交
  11. 10 6月, 2020 20 次提交
    • Z
      riscv: fix build warning of missing prototypes · 05589dde
      Zong Li 提交于
      Add the missing header in file, it was lost in original implementation.
      
      The warning message as follows:
       - no previous prototype for 'patch_text_nosync' [-Wmissing-prototypes]
       - no previous prototype for 'patch_text' [-Wmissing-prototypes]
      
      Changed in v2:
       - Correct the typo of commit message.
      Signed-off-by: NZong Li <zong.li@sifive.com>
      Reported-by: Nkbuild test robot <lkp@intel.com>
      Reviewed-by: NAtish Patra <atish.patra@wdc.com>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      05589dde
    • A
      RISC-V: Don't mark init section as non-executable · 4e0f9e3a
      Anup Patel 提交于
      The head text section (i.e. _start, secondary_start_sbi, etc) and the
      init section fall under same page table level-1 mapping.
      
      Currently, the runtime CPU hotplug is broken because we are marking
      init section as non-executable which in-turn marks head text section
      as non-executable.
      
      Further investigating other architectures, it seems marking the init
      section as non-executable is redundant because the init section pages
      are anyway poisoned and freed.
      
      To fix broken runtime CPU hotplug, we simply remove the code marking
      the init section as non-executable.
      
      Fixes: d27c3c90 ("riscv: add STRICT_KERNEL_RWX support")
      Cc: stable@vger.kernel.org
      Signed-off-by: NAnup Patel <anup.patel@wdc.com>
      Reviewed-by: NZong Li <zong.li@sifive.com>
      Reviewed-by: NAtish Patra <atish.patra@wdc.com>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      4e0f9e3a
    • A
      RISC-V: Force select RISCV_INTC for CONFIG_RISCV · e71ee06e
      Anup Patel 提交于
      The RISC-V per-HART local interrupt controller driver is mandatory
      for all RISC-V system (with/without MMU) hence we force select it
      for CONFIG_RISCV (just like RISCV_TIMER).
      Signed-off-by: NAnup Patel <anup.patel@wdc.com>
      Reviewed-by: NAtish Patra <atish.patra@wdc.com>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      e71ee06e
    • A
      RISC-V: Remove do_IRQ() function · 24dc1700
      Anup Patel 提交于
      The only thing do_IRQ() does is call handle_arch_irq function
      pointer. We can very well call handle_arch_irq function pointer
      directly from assembly and remove do_IRQ() function hence this
      patch.
      Signed-off-by: NAnup Patel <anup.patel@wdc.com>
      Reviewed-by: NAtish Patra <atish.patra@wdc.com>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      24dc1700
    • A
      clocksource/drivers/timer-riscv: Use per-CPU timer interrupt · 033a65de
      Anup Patel 提交于
      Instead of directly calling RISC-V timer interrupt handler from
      RISC-V local interrupt conntroller driver, this patch implements
      RISC-V timer interrupt as a per-CPU interrupt using per-CPU APIs
      of Linux IRQ subsystem.
      Signed-off-by: NAnup Patel <anup.patel@wdc.com>
      Reviewed-by: NAtish Patra <atish.patra@wdc.com>
      Reviewed-by: NMarc Zyngier <maz@kernel.org>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      033a65de
    • A
      irqchip: RISC-V per-HART local interrupt controller driver · 6b7ce892
      Anup Patel 提交于
      The RISC-V per-HART local interrupt controller manages software
      interrupts, timer interrupts, external interrupts (which are routed
      via the platform level interrupt controller) and other per-HART
      local interrupts.
      
      We add a driver for the RISC-V local interrupt controller, which
      eventually replaces the RISC-V architecture code, allowing for a
      better split between arch code and drivers.
      
      The driver is compliant with RISC-V Hart-Level Interrupt Controller
      DT bindings located at:
      Documentation/devicetree/bindings/interrupt-controller/riscv,cpu-intc.txt
      Co-developed-by: NPalmer Dabbelt <palmer@dabbelt.com>
      Signed-off-by: NAnup Patel <anup.patel@wdc.com>
      [Palmer: Cleaned up warnings]
      Signed-off-by: NPalmer Dabbelt <palmer@dabbelt.com>
      6b7ce892
    • A
      RISC-V: Rename and move plic_find_hart_id() to arch directory · d175d699
      Anup Patel 提交于
      The plic_find_hart_id() can be useful to other interrupt controller
      drivers (such as RISC-V local interrupt driver) so we rename this
      function to riscv_of_parent_hartid() and place it in arch directory
      along with riscv_of_processor_hartid().
      Signed-off-by: NAnup Patel <anup.patel@wdc.com>
      Reviewed-by: NAtish Patra <atish.patra@wdc.com>
      Reviewed-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      Acked-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      Reviewed-by: NMarc Zyngier <maz@kernel.org>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      d175d699
    • A
      RISC-V: self-contained IPI handling routine · 5cf998ba
      Anup Patel 提交于
      Currently, the IPI handling routine riscv_software_interrupt() does
      not take any argument and also does not perform irq_enter()/irq_exit().
      
      This patch makes IPI handling routine more self-contained by:
      1. Passing "pt_regs *" argument
      2. Explicitly doing irq_enter()/irq_exit()
      3. Explicitly save/restore "pt_regs *" using set_irq_regs()
      
      With above changes, IPI handling routine does not depend on caller
      function to perform irq_enter()/irq_exit() and save/restore of
      "pt_regs *" hence its more self-contained. This also enables us
      to call IPI handling routine from IRQCHIP drivers.
      Signed-off-by: NAnup Patel <anup.patel@wdc.com>
      Reviewed-by: NAtish Patra <atish.patra@wdc.com>
      Reviewed-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      Acked-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      5cf998ba
    • P
      RISC-V: Sort select statements alphanumerically · e8c7ef7d
      Palmer Dabbelt 提交于
      Like patch b1b3f49c ("ARM: config: sort select statements alphanumerically")
      , we sort all our select statements alphanumerically by using the perl
      script in patch b1b3f49c as above.
      
      As suggested by Andrew Morton:
      
        This is a pet peeve of mine.  Any time there's a long list of items
        (header file inclusions, kconfig entries, array initalisers, etc) and
        someone wants to add a new item, they *always* go and stick it at the
        end of the list.
      
        Guys, don't do this.  Either put the new item into a randomly-chosen
        position or, probably better, alphanumerically sort the list.
      Suggested-by: NZong Li <zong.li@sifive.com>
      [Palmer: Re-ran the script, as there were predictably a bunch of conflicts]
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      e8c7ef7d
    • M
      mmap locking API: convert mmap_sem comments · c1e8d7c6
      Michel Lespinasse 提交于
      Convert comments that reference mmap_sem to reference mmap_lock instead.
      
      [akpm@linux-foundation.org: fix up linux-next leftovers]
      [akpm@linux-foundation.org: s/lockaphore/lock/, per Vlastimil]
      [akpm@linux-foundation.org: more linux-next fixups, per Michel]
      Signed-off-by: NMichel Lespinasse <walken@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: NVlastimil Babka <vbabka@suse.cz>
      Reviewed-by: NDaniel Jordan <daniel.m.jordan@oracle.com>
      Cc: Davidlohr Bueso <dbueso@suse.de>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Jason Gunthorpe <jgg@ziepe.ca>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: Laurent Dufour <ldufour@linux.ibm.com>
      Cc: Liam Howlett <Liam.Howlett@oracle.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ying Han <yinghan@google.com>
      Link: http://lkml.kernel.org/r/20200520052908.204642-13-walken@google.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c1e8d7c6
    • M
      mmap locking API: convert mmap_sem API comments · 3e4e28c5
      Michel Lespinasse 提交于
      Convert comments that reference old mmap_sem APIs to reference
      corresponding new mmap locking APIs instead.
      Signed-off-by: NMichel Lespinasse <walken@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: NVlastimil Babka <vbabka@suse.cz>
      Reviewed-by: NDavidlohr Bueso <dbueso@suse.de>
      Reviewed-by: NDaniel Jordan <daniel.m.jordan@oracle.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Jason Gunthorpe <jgg@ziepe.ca>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: Laurent Dufour <ldufour@linux.ibm.com>
      Cc: Liam Howlett <Liam.Howlett@oracle.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ying Han <yinghan@google.com>
      Link: http://lkml.kernel.org/r/20200520052908.204642-12-walken@google.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3e4e28c5
    • M
      mmap locking API: convert mmap_sem call sites missed by coccinelle · 89154dd5
      Michel Lespinasse 提交于
      Convert the last few remaining mmap_sem rwsem calls to use the new mmap
      locking API.  These were missed by coccinelle for some reason (I think
      coccinelle does not support some of the preprocessor constructs in these
      files ?)
      
      [akpm@linux-foundation.org: convert linux-next leftovers]
      [akpm@linux-foundation.org: more linux-next leftovers]
      [akpm@linux-foundation.org: more linux-next leftovers]
      Signed-off-by: NMichel Lespinasse <walken@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: NDaniel Jordan <daniel.m.jordan@oracle.com>
      Reviewed-by: NLaurent Dufour <ldufour@linux.ibm.com>
      Reviewed-by: NVlastimil Babka <vbabka@suse.cz>
      Cc: Davidlohr Bueso <dbueso@suse.de>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Jason Gunthorpe <jgg@ziepe.ca>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: Liam Howlett <Liam.Howlett@oracle.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ying Han <yinghan@google.com>
      Link: http://lkml.kernel.org/r/20200520052908.204642-6-walken@google.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      89154dd5
    • M
      mmap locking API: use coccinelle to convert mmap_sem rwsem call sites · d8ed45c5
      Michel Lespinasse 提交于
      This change converts the existing mmap_sem rwsem calls to use the new mmap
      locking API instead.
      
      The change is generated using coccinelle with the following rule:
      
      // spatch --sp-file mmap_lock_api.cocci --in-place --include-headers --dir .
      
      @@
      expression mm;
      @@
      (
      -init_rwsem
      +mmap_init_lock
      |
      -down_write
      +mmap_write_lock
      |
      -down_write_killable
      +mmap_write_lock_killable
      |
      -down_write_trylock
      +mmap_write_trylock
      |
      -up_write
      +mmap_write_unlock
      |
      -downgrade_write
      +mmap_write_downgrade
      |
      -down_read
      +mmap_read_lock
      |
      -down_read_killable
      +mmap_read_lock_killable
      |
      -down_read_trylock
      +mmap_read_trylock
      |
      -up_read
      +mmap_read_unlock
      )
      -(&mm->mmap_sem)
      +(mm)
      Signed-off-by: NMichel Lespinasse <walken@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: NDaniel Jordan <daniel.m.jordan@oracle.com>
      Reviewed-by: NLaurent Dufour <ldufour@linux.ibm.com>
      Reviewed-by: NVlastimil Babka <vbabka@suse.cz>
      Cc: Davidlohr Bueso <dbueso@suse.de>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Jason Gunthorpe <jgg@ziepe.ca>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: Liam Howlett <Liam.Howlett@oracle.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ying Han <yinghan@google.com>
      Link: http://lkml.kernel.org/r/20200520052908.204642-5-walken@google.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d8ed45c5
    • 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
      mm: reorder includes after introduction of linux/pgtable.h · 65fddcfc
      Mike Rapoport 提交于
      The replacement of <asm/pgrable.h> with <linux/pgtable.h> made the include
      of the latter in the middle of asm includes.  Fix this up with the aid of
      the below script and manual adjustments here and there.
      
      	import sys
      	import re
      
      	if len(sys.argv) is not 3:
      	    print "USAGE: %s <file> <header>" % (sys.argv[0])
      	    sys.exit(1)
      
      	hdr_to_move="#include <linux/%s>" % sys.argv[2]
      	moved = False
      	in_hdrs = False
      
      	with open(sys.argv[1], "r") as f:
      	    lines = f.readlines()
      	    for _line in lines:
      		line = _line.rstrip('
      ')
      		if line == hdr_to_move:
      		    continue
      		if line.startswith("#include <linux/"):
      		    in_hdrs = True
      		elif not moved and in_hdrs:
      		    moved = True
      		    print hdr_to_move
      		print line
      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-4-rppt@kernel.orgSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      65fddcfc
    • 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
    • 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
    • D
      kernel: rename show_stack_loglvl() => show_stack() · 9cb8f069
      Dmitry Safonov 提交于
      Now the last users of show_stack() got converted to use an explicit log
      level, show_stack_loglvl() can drop it's redundant suffix and become once
      again well known show_stack().
      Signed-off-by: NDmitry Safonov <dima@arista.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/r/20200418201944.482088-51-dima@arista.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9cb8f069
    • D
      riscv: add show_stack_loglvl() · 0b3d4365
      Dmitry Safonov 提交于
      Currently, the log-level of show_stack() depends on a platform
      realization.  It creates situations where the headers are printed with
      lower log level or higher than the stacktrace (depending on a platform or
      user).
      
      Furthermore, it forces the logic decision from user to an architecture
      side.  In result, some users as sysrq/kdb/etc are doing tricks with
      temporary rising console_loglevel while printing their messages.  And in
      result it not only may print unwanted messages from other CPUs, but also
      omit printing at all in the unlucky case where the printk() was deferred.
      
      Introducing log-level parameter and KERN_UNSUPPRESSED [1] seems an easier
      approach than introducing more printk buffers.  Also, it will consolidate
      printings with headers.
      
      Introduce show_stack_loglvl(), that eventually will substitute
      show_stack().
      
      [1]: https://lore.kernel.org/lkml/20190528002412.1625-1-dima@arista.com/T/#uSigned-off-by: NDmitry Safonov <dima@arista.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Link: http://lkml.kernel.org/r/20200418201944.482088-28-dima@arista.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0b3d4365
    • D
      kallsyms/printk: add loglvl to print_ip_sym() · 2062a4e8
      Dmitry Safonov 提交于
      Patch series "Add log level to show_stack()", v3.
      
      Add log level argument to show_stack().
      
      Done in three stages:
      1. Introducing show_stack_loglvl() for every architecture
      2. Migrating old users with an explicit log level
      3. Renaming show_stack_loglvl() into show_stack()
      
      Justification:
      
      - It's a design mistake to move a business-logic decision into platform
        realization detail.
      
      - I have currently two patches sets that would benefit from this work:
        Removing console_loglevel jumps in sysrq driver [1] Hung task warning
        before panic [2] - suggested by Tetsuo (but he probably didn't realise
        what it would involve).
      
      - While doing (1), (2) the backtraces were adjusted to headers and other
        messages for each situation - so there won't be a situation when the
        backtrace is printed, but the headers are missing because they have
        lesser log level (or the reverse).
      
      - As the result in (2) plays with console_loglevel for kdb are removed.
      
      The least important for upstream, but maybe still worth to note that every
      company I've worked in so far had an off-list patch to print backtrace
      with the needed log level (but only for the architecture they cared
      about).  If you have other ideas how you will benefit from show_stack()
      with a log level - please, reply to this cover letter.
      
      See also discussion on v1:
      https://lore.kernel.org/linux-riscv/20191106083538.z5nlpuf64cigxigh@pathway.suse.cz/
      
      This patch (of 50):
      
      print_ip_sym() needs to have a log level parameter to comply with other
      parts being printed.  Otherwise, half of the expected backtrace would be
      printed and other may be missing with some logging level.
      
      The following callee(s) are using now the adjusted log level:
      - microblaze/unwind: the same level as headers & userspace unwind.
        Note that pr_debug()'s there are for debugging the unwinder itself.
      - nds32/traps: symbol addresses are printed with the same log level
        as backtrace headers.
      - lockdep: ip for locking issues is printed with the same log level
        as other part of the warning.
      - sched: ip where preemption was disabled is printed as error like
        the rest part of the message.
      - ftrace: bug reports are now consistent in the log level being used.
      Signed-off-by: NDmitry Safonov <dima@arista.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Ben Segall <bsegall@google.com>
      Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Burton <paulburton@kernel.org>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Cc: Vincent Guittot <vincent.guittot@linaro.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: Dmitry Safonov <0x7f454c46@gmail.com>
      Cc: Dmitry Safonov <dima@arista.com>
      Cc: Jiri Slaby <jslaby@suse.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      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: Aurelien Jacquiot <jacquiot.aurelien@gmail.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: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Stafford Horne <shorne@gmail.com>
      Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
      Cc: Helge Deller <deller@gmx.de>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Rich Felker <dalias@libc.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: Douglas Anderson <dianders@chromium.org>
      Cc: Jason Wessel <jason.wessel@windriver.com>
      Link: http://lkml.kernel.org/r/20200418201944.482088-2-dima@arista.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2062a4e8
  12. 09 6月, 2020 1 次提交
    • C
      mm: rename flush_icache_user_range to flush_icache_user_page · 885f7f8e
      Christoph Hellwig 提交于
      The function currently known as flush_icache_user_range only operates on
      a single page.  Rename it to flush_icache_user_page as we'll need the
      name flush_icache_user_range for something else soon.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
      Cc: Stafford Horne <shorne@gmail.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/20200515143646.3857579-20-hch@lst.deSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      885f7f8e