1. 11 Mar, 2022 1 commit
    • Emil Renner Berthing's avatar
      riscv: Fix auipc+jalr relocation range checks · 0966d385
      Emil Renner Berthing authored
      RISC-V can do PC-relative jumps with a 32bit range using the following
      two instructions:
      
      	auipc	t0, imm20	; t0 = PC + imm20 * 2^12
      	jalr	ra, t0, imm12	; ra = PC + 4, PC = t0 + imm12
      
      Crucially both the 20bit immediate imm20 and the 12bit immediate imm12
      are treated as two's-complement signed values. For this reason the
      immediates are usually calculated like this:
      
      	imm20 = (offset + 0x800) >> 12
      	imm12 = offset & 0xfff
      
      ..where offset is the signed offset from the auipc instruction. When
      the 11th bit of offset is 0 the addition of 0x800 doesn't change the top
      20 bits and imm12 considered positive. When the 11th bit is 1 the carry
      of the addition by 0x800 means imm20 is one higher, but since imm12 is
      then considered negative the two's complement representation means it
      all cancels out nicely.
      
      However, this addition by 0x800 (2^11) means an offset greater than or
      equal to 2^31 - 2^11 would overflow so imm20 is considered negative and
      result in a backwards jump. Similarly the lower range of offset is also
      moved down by 2^11 and hence the true 32bit range is
      
      	[-2^31 - 2^11, 2^31 - 2^11)
      Signed-off-by: default avatarEmil Renner Berthing <kernel@esmil.dk>
      Fixes: e2c0cdfb ("RISC-V: User-facing API")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      0966d385
  2. 10 Mar, 2022 1 commit
  3. 04 Mar, 2022 1 commit
    • Niklas Cassel's avatar
      riscv: dts: k210: fix broken IRQs on hart1 · 74583f1b
      Niklas Cassel authored
      Commit 67d96729 ("riscv: Update Canaan Kendryte K210 device tree")
      incorrectly removed two entries from the PLIC interrupt-controller node's
      interrupts-extended property.
      
      The PLIC driver cannot know the mapping between hart contexts and hart ids,
      so this information has to be provided by device tree, as specified by the
      PLIC device tree binding.
      
      The PLIC driver uses the interrupts-extended property, and initializes the
      hart context registers in the exact same order as provided by the
      interrupts-extended property.
      
      In other words, if we don't specify the S-mode interrupts, the PLIC driver
      will simply initialize the hart0 S-mode hart context with the hart1 M-mode
      configuration. It is therefore essential to specify the S-mode IRQs even
      though the system itself will only ever be running in M-mode.
      
      Re-add the S-mode interrupts, so that we get working IRQs on hart1 again.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 67d96729 ("riscv: Update Canaan Kendryte K210 device tree")
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      74583f1b
  4. 03 Mar, 2022 6 commits
    • Alexandre Ghiti's avatar
      riscv: Fix kasan pud population · e4fcfe6e
      Alexandre Ghiti authored
      In sv48, the kasan inner regions are not aligned on PGDIR_SIZE and then
      when we populate the kasan linear mapping region, we clear the kasan
      vmalloc region which is in the same PGD.
      
      Fix this by copying the content of the kasan early pud after allocating a
      new PGD for the first time.
      
      Fixes: e8a62cc2 ("riscv: Implement sv48 support")
      Signed-off-by: default avatarAlexandre Ghiti <alexandre.ghiti@canonical.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      e4fcfe6e
    • Alexandre Ghiti's avatar
      riscv: Move high_memory initialization to setup_bootmem · 625e24a5
      Alexandre Ghiti authored
      high_memory used to be initialized in mem_init, way after setup_bootmem.
      But a call to dma_contiguous_reserve in this function gives rise to the
      below warning because high_memory is equal to 0 and is used at the very
      beginning at cma_declare_contiguous_nid.
      
      It went unnoticed since the move of the kasan region redefined
      KERN_VIRT_SIZE so that it does not encompass -1 anymore.
      
      Fix this by initializing high_memory in setup_bootmem.
      
      ------------[ cut here ]------------
      virt_to_phys used for non-linear address: ffffffffffffffff (0xffffffffffffffff)
      WARNING: CPU: 0 PID: 0 at arch/riscv/mm/physaddr.c:14 __virt_to_phys+0xac/0x1b8
      Modules linked in:
      CPU: 0 PID: 0 Comm: swapper Not tainted 5.17.0-rc1-00007-ga68b89289e26 #27
      Hardware name: riscv-virtio,qemu (DT)
      epc : __virt_to_phys+0xac/0x1b8
       ra : __virt_to_phys+0xac/0x1b8
      epc : ffffffff80014922 ra : ffffffff80014922 sp : ffffffff84a03c30
       gp : ffffffff85866c80 tp : ffffffff84a3f180 t0 : ffffffff86bce657
       t1 : fffffffef09406e8 t2 : 0000000000000000 s0 : ffffffff84a03c70
       s1 : ffffffffffffffff a0 : 000000000000004f a1 : 00000000000f0000
       a2 : 0000000000000002 a3 : ffffffff8011f408 a4 : 0000000000000000
       a5 : 0000000000000000 a6 : 0000000000f00000 a7 : ffffffff84a03747
       s2 : ffffffd800000000 s3 : ffffffff86ef4000 s4 : ffffffff8467f828
       s5 : fffffff800000000 s6 : 8000000000006800 s7 : 0000000000000000
       s8 : 0000000480000000 s9 : 0000000080038ea0 s10: 0000000000000000
       s11: ffffffffffffffff t3 : ffffffff84a035c0 t4 : fffffffef09406e8
       t5 : fffffffef09406e9 t6 : ffffffff84a03758
      status: 0000000000000100 badaddr: 0000000000000000 cause: 0000000000000003
      [<ffffffff8322ef4c>] cma_declare_contiguous_nid+0xf2/0x64a
      [<ffffffff83212a58>] dma_contiguous_reserve_area+0x46/0xb4
      [<ffffffff83212c3a>] dma_contiguous_reserve+0x174/0x18e
      [<ffffffff83208fc2>] paging_init+0x12c/0x35e
      [<ffffffff83206bd2>] setup_arch+0x120/0x74e
      [<ffffffff83201416>] start_kernel+0xce/0x68c
      irq event stamp: 0
      hardirqs last  enabled at (0): [<0000000000000000>] 0x0
      hardirqs last disabled at (0): [<0000000000000000>] 0x0
      softirqs last  enabled at (0): [<0000000000000000>] 0x0
      softirqs last disabled at (0): [<0000000000000000>] 0x0
      ---[ end trace 0000000000000000 ]---
      
      Fixes: f7ae0233 ("riscv: Move KASAN mapping next to the kernel mapping")
      Signed-off-by: default avatarAlexandre Ghiti <alexandre.ghiti@canonical.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      625e24a5
    • Alexandre Ghiti's avatar
      riscv: Fix config KASAN && DEBUG_VIRTUAL · c648c4bb
      Alexandre Ghiti authored
      __virt_to_phys function is called very early in the boot process (ie
      kasan_early_init) so it should not be instrumented by KASAN otherwise it
      bugs.
      
      Fix this by declaring phys_addr.c as non-kasan instrumentable.
      Signed-off-by: default avatarAlexandre Ghiti <alexandre.ghiti@canonical.com>
      Fixes: 8ad8b727 (riscv: Add KASAN support)
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      c648c4bb
    • Alexandre Ghiti's avatar
      riscv: Fix DEBUG_VIRTUAL false warnings · 5f763b3b
      Alexandre Ghiti authored
      KERN_VIRT_SIZE used to encompass the kernel mapping before it was
      redefined when moving the kasan mapping next to the kernel mapping to only
      match the maximum amount of physical memory.
      
      Then, kernel mapping addresses that go through __virt_to_phys are now
      declared as wrong which is not true, one can use __virt_to_phys on such
      addresses.
      
      Fix this by redefining the condition that matches wrong addresses.
      
      Fixes: f7ae0233 ("riscv: Move KASAN mapping next to the kernel mapping")
      Signed-off-by: default avatarAlexandre Ghiti <alexandre.ghiti@canonical.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      5f763b3b
    • Alexandre Ghiti's avatar
      riscv: Fix config KASAN && SPARSEMEM && !SPARSE_VMEMMAP · a3d32803
      Alexandre Ghiti authored
      In order to get the pfn of a struct page* when sparsemem is enabled
      without vmemmap, the mem_section structures need to be initialized which
      happens in sparse_init.
      
      But kasan_early_init calls pfn_to_page way before sparse_init is called,
      which then tries to dereference a null mem_section pointer.
      
      Fix this by removing the usage of this function in kasan_early_init.
      
      Fixes: 8ad8b727 ("riscv: Add KASAN support")
      Signed-off-by: default avatarAlexandre Ghiti <alexandre.ghiti@canonical.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      a3d32803
    • Alexandre Ghiti's avatar
      riscv: Fix is_linear_mapping with recent move of KASAN region · 8b274f22
      Alexandre Ghiti authored
      The KASAN region was recently moved between the linear mapping and the
      kernel mapping, is_linear_mapping used to check the validity of an
      address by using the start of the kernel mapping, which is now wrong.
      
      Fix this by using the maximum size of the physical memory.
      
      Fixes: f7ae0233 ("riscv: Move KASAN mapping next to the kernel mapping")
      Signed-off-by: default avatarAlexandre Ghiti <alexandre.ghiti@canonical.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      8b274f22
  5. 25 Feb, 2022 2 commits
    • Changbin Du's avatar
      riscv: fix oops caused by irqsoff latency tracer · 22e2100b
      Changbin Du authored
      The trace_hardirqs_{on,off}() require the caller to setup frame pointer
      properly. This because these two functions use macro 'CALLER_ADDR1' (aka.
      __builtin_return_address(1)) to acquire caller info. If the $fp is used
      for other purpose, the code generated this macro (as below) could trigger
      memory access fault.
      
         0xffffffff8011510e <+80>:    ld      a1,-16(s0)
         0xffffffff80115112 <+84>:    ld      s2,-8(a1)  # <-- paging fault here
      
      The oops message during booting if compiled with 'irqoff' tracer enabled:
      [    0.039615][    T0] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000f8
      [    0.041925][    T0] Oops [#1]
      [    0.042063][    T0] Modules linked in:
      [    0.042864][    T0] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.17.0-rc1-00233-g9a20c48d1ed2 #29
      [    0.043568][    T0] Hardware name: riscv-virtio,qemu (DT)
      [    0.044343][    T0] epc : trace_hardirqs_on+0x56/0xe2
      [    0.044601][    T0]  ra : restore_all+0x12/0x6e
      [    0.044721][    T0] epc : ffffffff80126a5c ra : ffffffff80003b94 sp : ffffffff81403db0
      [    0.044801][    T0]  gp : ffffffff8163acd8 tp : ffffffff81414880 t0 : 0000000000000020
      [    0.044882][    T0]  t1 : 0098968000000000 t2 : 0000000000000000 s0 : ffffffff81403de0
      [    0.044967][    T0]  s1 : 0000000000000000 a0 : 0000000000000001 a1 : 0000000000000100
      [    0.045046][    T0]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000000
      [    0.045124][    T0]  a5 : 0000000000000000 a6 : 0000000000000000 a7 : 0000000054494d45
      [    0.045210][    T0]  s2 : ffffffff80003b94 s3 : ffffffff81a8f1b0 s4 : ffffffff80e27b50
      [    0.045289][    T0]  s5 : ffffffff81414880 s6 : ffffffff8160fa00 s7 : 00000000800120e8
      [    0.045389][    T0]  s8 : 0000000080013100 s9 : 000000000000007f s10: 0000000000000000
      [    0.045474][    T0]  s11: 0000000000000000 t3 : 7fffffffffffffff t4 : 0000000000000000
      [    0.045548][    T0]  t5 : 0000000000000000 t6 : ffffffff814aa368
      [    0.045620][    T0] status: 0000000200000100 badaddr: 00000000000000f8 cause: 000000000000000d
      [    0.046402][    T0] [<ffffffff80003b94>] restore_all+0x12/0x6e
      
      This because the $fp(aka. $s0) register is not used as frame pointer in the
      assembly entry code.
      
      	resume_kernel:
      		REG_L s0, TASK_TI_PREEMPT_COUNT(tp)
      		bnez s0, restore_all
      		REG_L s0, TASK_TI_FLAGS(tp)
                      andi s0, s0, _TIF_NEED_RESCHED
                      beqz s0, restore_all
                      call preempt_schedule_irq
                      j restore_all
      
      To fix above issue, here we add one extra level wrapper for function
      trace_hardirqs_{on,off}() so they can be safely called by low level entry
      code.
      Signed-off-by: default avatarChangbin Du <changbin.du@gmail.com>
      Fixes: 3c469798 ("riscv: Enable LOCKDEP_SUPPORT & fixup TRACE_IRQFLAGS_SUPPORT")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      22e2100b
    • Damien Le Moal's avatar
      riscv: fix nommu_k210_sdcard_defconfig · 762e52f7
      Damien Le Moal authored
      Instead of an arbitrary delay, use the "rootwait" kernel option to wait
      for the mmc root device to be ready.
      Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
      Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
      Fixes: 7e09fd39 ("riscv: Add Canaan Kendryte K210 SD card defconfig")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      762e52f7
  6. 14 Feb, 2022 3 commits
  7. 10 Feb, 2022 2 commits
    • Aurelien Jarno's avatar
      riscv: fix build with binutils 2.38 · 6df2a016
      Aurelien Jarno authored
      From version 2.38, binutils default to ISA spec version 20191213. This
      means that the csr read/write (csrr*/csrw*) instructions and fence.i
      instruction has separated from the `I` extension, become two standalone
      extensions: Zicsr and Zifencei. As the kernel uses those instruction,
      this causes the following build failure:
      
        CC      arch/riscv/kernel/vdso/vgettimeofday.o
        <<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h: Assembler messages:
        <<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01'
        <<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01'
        <<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01'
        <<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01'
      
      The fix is to specify those extensions explicitely in -march. However as
      older binutils version do not support this, we first need to detect
      that.
      Signed-off-by: default avatarAurelien Jarno <aurelien@aurel32.net>
      Tested-by: default avatarAlexandre Ghiti <alexandre.ghiti@canonical.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      6df2a016
    • Pingfan Liu's avatar
      riscv: cpu-hotplug: clear cpu from numa map when teardown · f40fe31c
      Pingfan Liu authored
      There is numa_add_cpu() when cpus online, accordingly, there should be
      numa_remove_cpu() when cpus offline.
      Signed-off-by: default avatarPingfan Liu <kernelfans@gmail.com>
      Fixes: 4f0e8eef ("riscv: Add numa support for riscv64 platform")
      Cc: stable@vger.kernel.org
      [Palmer: Add missing NUMA include]
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      f40fe31c
  8. 09 Feb, 2022 1 commit
  9. 04 Feb, 2022 4 commits
    • Palmer Dabbelt's avatar
      riscv/mm: Add XIP_FIXUP for riscv_pfn_base · ca0cb9a6
      Palmer Dabbelt authored
      This manifests as a crash early in boot on VexRiscv.
      Signed-off-by: default avatarMyrtle Shah <gatecat@ds0.me>
      [Palmer: split commit]
      Fixes: 44c92257 ("RISC-V: enable XIP")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      ca0cb9a6
    • Palmer Dabbelt's avatar
      riscv/mm: Add XIP_FIXUP for phys_ram_base · 4b1c70aa
      Palmer Dabbelt authored
      This manifests as a crash early in boot on VexRiscv.
      Signed-off-by: default avatarMyrtle Shah <gatecat@ds0.me>
      [Palmer: split commit]
      Fixes: 6d7f91d9 ("riscv: Get rid of CONFIG_PHYS_RAM_BASE in kernel physical address conversion")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      4b1c70aa
    • Myrtle Shah's avatar
      riscv: Fix XIP_FIXUP_FLASH_OFFSET · 3c04d845
      Myrtle Shah authored
      There were several problems with the calculation. Not only was an 'and'
      being computed into t1 but thrown away; but the 'and' itself would
      cause problems if the granularity of the XIP physical address was less
      than XIP_OFFSET - in my case I had the kernel image at 2MB in SPI flash.
      
      Fixes: f9ace4ed ("riscv: remove .text section size limitation for XIP")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMyrtle Shah <gatecat@ds0.me>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      3c04d845
    • Changbin Du's avatar
      riscv: eliminate unreliable __builtin_frame_address(1) · 6a00ef44
      Changbin Du authored
      I tried different pieces of code which uses __builtin_frame_address(1)
      (with both gcc version 7.5.0 and 10.3.0) to verify whether it works as
      expected on riscv64. The result is negative.
      
      What the compiler had generated is as below:
      31                      fp = (unsigned long)__builtin_frame_address(1);
         0xffffffff80006024 <+200>:   ld      s1,0(s0)
      
      It takes '0(s0)' as the address of frame 1 (caller), but the actual address
      should be '-16(s0)'.
      
                |       ...       | <-+
                +-----------------+   |
                | return address  |   |
                | previous fp     |   |
                | saved registers |   |
                | local variables |   |
        $fp --> |       ...       |   |
                +-----------------+   |
                | return address  |   |
                | previous fp --------+
                | saved registers |
        $sp --> | local variables |
                +-----------------+
      
      This leads the kernel can not dump the full stack trace on riscv.
      
      [    7.222126][    T1] Call Trace:
      [    7.222804][    T1] [<ffffffff80006058>] dump_backtrace+0x2c/0x3a
      
      This problem is not exposed on most riscv builds just because the '0(s0)'
      occasionally is the address frame 2 (caller's caller), if only ra and fp
      are stored in frame 1 (caller).
      
                |       ...       | <-+
                +-----------------+   |
                | return address  |   |
        $fp --> | previous fp     |   |
                +-----------------+   |
                | return address  |   |
                | previous fp --------+
                | saved registers |
        $sp --> | local variables |
                +-----------------+
      
      This could be a *bug* of gcc that should be fixed. But as noted in gcc
      manual "Calling this function with a nonzero argument can have
      unpredictable effects, including crashing the calling program.", let's
      remove the '__builtin_frame_address(1)' in backtrace code.
      
      With this fix now it can show full stack trace:
      [   10.444838][    T1] Call Trace:
      [   10.446199][    T1] [<ffffffff8000606c>] dump_backtrace+0x2c/0x3a
      [   10.447711][    T1] [<ffffffff800060ac>] show_stack+0x32/0x3e
      [   10.448710][    T1] [<ffffffff80a005c0>] dump_stack_lvl+0x58/0x7a
      [   10.449941][    T1] [<ffffffff80a005f6>] dump_stack+0x14/0x1c
      [   10.450929][    T1] [<ffffffff804c04ee>] ubsan_epilogue+0x10/0x5a
      [   10.451869][    T1] [<ffffffff804c092e>] __ubsan_handle_load_invalid_value+0x6c/0x78
      [   10.453049][    T1] [<ffffffff8018f834>] __pagevec_release+0x62/0x64
      [   10.455476][    T1] [<ffffffff80190830>] truncate_inode_pages_range+0x132/0x5be
      [   10.456798][    T1] [<ffffffff80190ce0>] truncate_inode_pages+0x24/0x30
      [   10.457853][    T1] [<ffffffff8045bb04>] kill_bdev+0x32/0x3c
      ...
      Signed-off-by: default avatarChangbin Du <changbin.du@gmail.com>
      Fixes: eac2f305 ("riscv: stacktrace: fix the riscv stacktrace when CONFIG_FRAME_POINTER enabled")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      6a00ef44
  10. 23 Jan, 2022 6 commits
    • Linus Torvalds's avatar
      Linux 5.17-rc1 · e783362e
      Linus Torvalds authored
      e783362e
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-for-v5.17-2022-01-22' of... · 40c84321
      Linus Torvalds authored
      Merge tag 'perf-tools-for-v5.17-2022-01-22' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
      
      Pull more perf tools updates from Arnaldo Carvalho de Melo:
      
       - Fix printing 'phys_addr' in 'perf script'.
      
       - Fix failure to add events with 'perf probe' in ppc64 due to not
         removing leading dot (ppc64 ABIv1).
      
       - Fix cpu_map__item() python binding building.
      
       - Support event alias in form foo-bar-baz, add pmu-events and
         parse-event tests for it.
      
       - No need to setup affinities when starting a workload or attaching to
         a pid.
      
       - Use path__join() to compose a path instead of ad-hoc snprintf()
         equivalent.
      
       - Override attr->sample_period for non-libpfm4 events.
      
       - Use libperf cpumap APIs instead of accessing the internal state
         directly.
      
       - Sync x86 arch prctl headers and files changed by the new
         set_mempolicy_home_node syscall with the kernel sources.
      
       - Remove duplicate include in cpumap.h.
      
       - Remove redundant err variable.
      
      * tag 'perf-tools-for-v5.17-2022-01-22' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
        perf tools: Remove redundant err variable
        perf test: Add parse-events test for aliases with hyphens
        perf test: Add pmu-events test for aliases with hyphens
        perf parse-events: Support event alias in form foo-bar-baz
        perf evsel: Override attr->sample_period for non-libpfm4 events
        perf cpumap: Remove duplicate include in cpumap.h
        perf cpumap: Migrate to libperf cpumap api
        perf python: Fix cpu_map__item() building
        perf script: Fix printing 'phys_addr' failure issue
        tools headers UAPI: Sync files changed by new set_mempolicy_home_node syscall
        tools headers UAPI: Sync x86 arch prctl headers with the kernel sources
        perf machine: Use path__join() to compose a path instead of snprintf(dir, '/', filename)
        perf evlist: No need to setup affinities when disabling events for pid targets
        perf evlist: No need to setup affinities when enabling events for pid targets
        perf stat: No need to setup affinities when starting a workload
        perf affinity: Allow passing a NULL arg to affinity__cleanup()
        perf probe: Fix ppc64 'perf probe add events failed' case
      40c84321
    • Linus Torvalds's avatar
      Merge tag 'trace-v5.17-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · 67bfce0e
      Linus Torvalds authored
      Pull ftrace fix from Steven Rostedt:
       "Fix s390 breakage from sorting mcount tables.
      
        The latest merge of the tracing tree sorts the mcount table at build
        time. But s390 appears to do things differently (like always) and
        replaces the sorted table back to the original unsorted one. As the
        ftrace algorithm depends on it being sorted, bad things happen when it
        is not, and s390 experienced those bad things.
      
        Add a new config to tell the boot if the mcount table is sorted or
        not, and allow s390 to opt out of it"
      
      * tag 'trace-v5.17-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        ftrace: Fix assuming build time sort works for s390
      67bfce0e
    • Steven Rostedt (Google)'s avatar
      ftrace: Fix assuming build time sort works for s390 · 6b9b6413
      Steven Rostedt (Google) authored
      To speed up the boot process, as mcount_loc needs to be sorted for ftrace
      to work properly, sorting it at build time is more efficient than boot up
      and can save milliseconds of time. Unfortunately, this change broke s390
      as it will modify the mcount_loc location after the sorting takes place
      and will put back the unsorted locations. Since the sorting is skipped at
      boot up if it is believed that it was sorted at run time, ftrace can crash
      as its algorithms are dependent on the list being sorted.
      
      Add a new config BUILDTIME_MCOUNT_SORT that is set when
      BUILDTIME_TABLE_SORT but not if S390 is set. Use this config to determine
      if sorting should take place at boot up.
      
      Link: https://lore.kernel.org/all/yt9dee51ctfn.fsf@linux.ibm.com/
      
      Fixes: 72b3942a ("scripts: ftrace - move the sort-processing in ftrace_init")
      Reported-by: default avatarSven Schnelle <svens@linux.ibm.com>
      Tested-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      6b9b6413
    • Linus Torvalds's avatar
      Merge tag 'kbuild-fixes-v5.17' of... · 473aec0e
      Linus Torvalds authored
      Merge tag 'kbuild-fixes-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
      
      Pull Kbuild fixes from Masahiro Yamada:
      
       - Bring include/uapi/linux/nfc.h into the UAPI compile-test coverage
      
       - Revert the workaround of CONFIG_CC_IMPLICIT_FALLTHROUGH
      
       - Fix build errors in certs/Makefile
      
      * tag 'kbuild-fixes-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        certs: Fix build error when CONFIG_MODULE_SIG_KEY is empty
        certs: Fix build error when CONFIG_MODULE_SIG_KEY is PKCS#11 URI
        Revert "Makefile: Do not quote value for CONFIG_CC_IMPLICIT_FALLTHROUGH"
        usr/include/Makefile: add linux/nfc.h to the compile-test coverage
      473aec0e
    • Linus Torvalds's avatar
      Merge tag 'bitmap-5.17-rc1' of git://github.com/norov/linux · 3689f9f8
      Linus Torvalds authored
      Pull bitmap updates from Yury Norov:
      
       - introduce for_each_set_bitrange()
      
       - use find_first_*_bit() instead of find_next_*_bit() where possible
      
       - unify for_each_bit() macros
      
      * tag 'bitmap-5.17-rc1' of git://github.com/norov/linux:
        vsprintf: rework bitmap_list_string
        lib: bitmap: add performance test for bitmap_print_to_pagebuf
        bitmap: unify find_bit operations
        mm/percpu: micro-optimize pcpu_is_populated()
        Replace for_each_*_bit_from() with for_each_*_bit() where appropriate
        find: micro-optimize for_each_{set,clear}_bit()
        include/linux: move for_each_bit() macros from bitops.h to find.h
        cpumask: replace cpumask_next_* with cpumask_first_* where appropriate
        tools: sync tools/bitmap with mother linux
        all: replace find_next{,_zero}_bit with find_first{,_zero}_bit where appropriate
        cpumask: use find_first_and_bit()
        lib: add find_first_and_bit()
        arch: remove GENERIC_FIND_FIRST_BIT entirely
        include: move find.h from asm_generic to linux
        bitops: move find_bit_*_le functions from le.h to find.h
        bitops: protect find_first_{,zero}_bit properly
      3689f9f8
  11. 22 Jan, 2022 13 commits