1. 12 Oct, 2022 40 commits
    • Linus Torvalds's avatar
      Merge tag 'mm-nonmm-stable-2022-10-11' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm · 676cb495
      Linus Torvalds authored
      Pull non-MM updates from Andrew Morton:
      
       - hfs and hfsplus kmap API modernization (Fabio Francesco)
      
       - make crash-kexec work properly when invoked from an NMI-time panic
         (Valentin Schneider)
      
       - ntfs bugfixes (Hawkins Jiawei)
      
       - improve IPC msg scalability by replacing atomic_t's with percpu
         counters (Jiebin Sun)
      
       - nilfs2 cleanups (Minghao Chi)
      
       - lots of other single patches all over the tree!
      
      * tag 'mm-nonmm-stable-2022-10-11' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (71 commits)
        include/linux/entry-common.h: remove has_signal comment of arch_do_signal_or_restart() prototype
        proc: test how it holds up with mapping'less process
        mailmap: update Frank Rowand email address
        ia64: mca: use strscpy() is more robust and safer
        init/Kconfig: fix unmet direct dependencies
        ia64: update config files
        nilfs2: replace WARN_ONs by nilfs_error for checkpoint acquisition failure
        fork: remove duplicate included header files
        init/main.c: remove unnecessary (void*) conversions
        proc: mark more files as permanent
        nilfs2: remove the unneeded result variable
        nilfs2: delete unnecessary checks before brelse()
        checkpatch: warn for non-standard fixes tag style
        usr/gen_init_cpio.c: remove unnecessary -1 values from int file
        ipc/msg: mitigate the lock contention with percpu counter
        percpu: add percpu_counter_add_local and percpu_counter_sub_local
        fs/ocfs2: fix repeated words in comments
        relay: use kvcalloc to alloc page array in relay_alloc_page_array
        proc: make config PROC_CHILDREN depend on PROC_FS
        fs: uninline inode_maybe_inc_iversion()
        ...
      676cb495
    • Linus Torvalds's avatar
      Merge tag 'loongarch-6.1' of... · 95b8b595
      Linus Torvalds authored
      Merge tag 'loongarch-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
      
      Pull LoongArch updates from Huacai Chen:
      
       - Use EXPLICIT_RELOCS (ABIv2.0)
      
       - Use generic BUG() handler
      
       - Refactor TLB/Cache operations
      
       - Add qspinlock support
      
       - Add perf events support
      
       - Add kexec/kdump support
      
       - Add BPF JIT support
      
       - Add ACPI-based laptop driver
      
       - Update the default config file
      
      * tag 'loongarch-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson: (25 commits)
        LoongArch: Update Loongson-3 default config file
        LoongArch: Add ACPI-based generic laptop driver
        LoongArch: Add BPF JIT support
        LoongArch: Add some instruction opcodes and formats
        LoongArch: Move {signed,unsigned}_imm_check() to inst.h
        LoongArch: Add kdump support
        LoongArch: Add kexec support
        LoongArch: Use generic BUG() handler
        LoongArch: Add SysRq-x (TLB Dump) support
        LoongArch: Add perf events support
        LoongArch: Add qspinlock support
        LoongArch: Use TLB for ioremap()
        LoongArch: Support access filter to /dev/mem interface
        LoongArch: Refactor cache probe and flush methods
        LoongArch: mm: Refactor TLB exception handlers
        LoongArch: Support R_LARCH_GOT_PC_{LO12,HI20} in modules
        LoongArch: Support PC-relative relocations in modules
        LoongArch: Define ELF relocation types added in ABIv2.0
        LoongArch: Adjust symbol addressing for AS_HAS_EXPLICIT_RELOCS
        LoongArch: Add Kconfig option AS_HAS_EXPLICIT_RELOCS
        ...
      95b8b595
    • Linus Torvalds's avatar
      Merge tag 'irq-core-2022-10-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 60ac35bf
      Linus Torvalds authored
      Pull interrupt updates from Thomas Gleixner:
       "Core code:
      
         - Provide a generic wrapper which can be utilized in drivers to
           handle the problem of force threaded demultiplex interrupts on RT
           enabled kernels. This avoids conditionals and horrible quirks in
           drivers all over the place
      
         - Fix up affected pinctrl and GPIO drivers to make them cleanly RT
           safe
      
        Interrupt drivers:
      
         - A new driver for the FSL MU platform specific MSI implementation
      
         - Make irqchip_init() available for pure ACPI based systems
      
         - Provide a functional DT binding for the Realtek RTL interrupt chip
      
         - The usual DT updates and small code improvements all over the
           place"
      
      * tag 'irq-core-2022-10-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (21 commits)
        irqchip: IMX_MU_MSI should depend on ARCH_MXC
        irqchip/imx-mu-msi: Fix wrong register offset for 8ulp
        irqchip/ls-extirq: Fix invalid wait context by avoiding to use regmap
        dt-bindings: irqchip: Describe the IMX MU block as a MSI controller
        irqchip: Add IMX MU MSI controller driver
        dt-bindings: irqchip: renesas,irqc: Add r8a779g0 support
        irqchip/gic-v3: Fix typo in comment
        dt-bindings: interrupt-controller: ti,sci-intr: Fix missing reg property in the binding
        dt-bindings: irqchip: ti,sci-inta: Fix warning for missing #interrupt-cells
        irqchip: Allow extra fields to be passed to IRQCHIP_PLATFORM_DRIVER_END
        platform-msi: Export symbol platform_msi_create_irq_domain()
        irqchip/realtek-rtl: use parent interrupts
        dt-bindings: interrupt-controller: realtek,rtl-intc: require parents
        irqchip/realtek-rtl: use irq_domain_add_linear()
        irqchip: Make irqchip_init() usable on pure ACPI systems
        bcma: gpio: Use generic_handle_irq_safe()
        gpio: mlxbf2: Use generic_handle_irq_safe()
        platform/x86: intel_int0002_vgpio: Use generic_handle_irq_safe()
        ssb: gpio: Use generic_handle_irq_safe()
        pinctrl: amd: Use generic_handle_irq_safe()
        ...
      60ac35bf
    • Huacai Chen's avatar
      LoongArch: Update Loongson-3 default config file · 2c8577f5
      Huacai Chen authored
      1, Enable ZBOOT, KEXEC and BPF_JIT;
      2, Add more patition types;
      3, Add some USB Type-C options;
      4, Add some common network options;
      5, Add some Bluetooth device drivers;
      6, Remove obsolete config options (for some detailed information, see
         Link).
      
      Link: https://lore.kernel.org/kernel-janitors/20220929090645.1389-1-lukas.bulwahn@gmail.com/Co-developed-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Co-developed-by: default avatarYouling Tang <tangyouling@loongson.cn>
      Signed-off-by: default avatarYouling Tang <tangyouling@loongson.cn>
      Co-developed-by: default avatarLukas Bulwahn <lukas.bulwahn@gmail.com>
      Signed-off-by: default avatarLukas Bulwahn <lukas.bulwahn@gmail.com>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      2c8577f5
    • Jianmin Lv's avatar
      LoongArch: Add ACPI-based generic laptop driver · 6246ed09
      Jianmin Lv authored
      This add ACPI-based generic laptop driver for Loongson-3. Some of the
      codes are derived from drivers/platform/x86/thinkpad_acpi.c.
      Signed-off-by: default avatarJianmin Lv <lvjianmin@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      6246ed09
    • Tiezhu Yang's avatar
      LoongArch: Add BPF JIT support · 5dc61552
      Tiezhu Yang authored
      BPF programs are normally handled by a BPF interpreter, add BPF JIT
      support for LoongArch to allow the kernel to generate native code when
      a program is loaded into the kernel. This will significantly speed-up
      processing of BPF programs.
      Co-developed-by: default avatarYouling Tang <tangyouling@loongson.cn>
      Signed-off-by: default avatarYouling Tang <tangyouling@loongson.cn>
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      5dc61552
    • Tiezhu Yang's avatar
      LoongArch: Add some instruction opcodes and formats · 4e59e5a4
      Tiezhu Yang authored
      According to the "Table of Instruction Encoding" in LoongArch Reference
      Manual [1], add some instruction opcodes and formats which are used in
      the BPF JIT for LoongArch.
      
      [1] https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#table-of-instruction-encodingSigned-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      4e59e5a4
    • Tiezhu Yang's avatar
      LoongArch: Move {signed,unsigned}_imm_check() to inst.h · 8a34228e
      Tiezhu Yang authored
      {signed,unsigned}_imm_check() will also be used in the bpf jit, so move
      them from module.c to inst.h, this is preparation for later patches.
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      8a34228e
    • Youling Tang's avatar
      LoongArch: Add kdump support · 4e62d1d8
      Youling Tang authored
      This patch adds support for kdump. In kdump case the normal kernel will
      reserve a region for the crash kernel and jump there on panic.
      
      Arch-specific functions are added to allow for implementing a crash dump
      file interface, /proc/vmcore, which can be viewed as a ELF file.
      
      A user-space tool, such as kexec-tools, is responsible for allocating a
      separate region for the core's ELF header within the crash kdump kernel
      memory and filling it in when executing kexec_load().
      
      Then, its location will be advertised to the crash dump kernel via a
      command line argument "elfcorehdr=", and the crash dump kernel will
      preserve this region for later use with arch_reserve_vmcore() at boot
      time.
      
      At the same time, the crash kdump kernel is also limited within the
      "crashkernel" area via a command line argument "mem=", so as not to
      destroy the original kernel dump data.
      
      In the crash dump kernel environment, /proc/vmcore is used to access the
      primary kernel's memory with copy_oldmem_page().
      
      I tested kdump on LoongArch machines (Loongson-3A5000) and it works as
      expected (suggested crashkernel parameter is "crashkernel=512M@2560M"),
      you may test it by triggering a crash through /proc/sysrq-trigger:
      
       $ sudo kexec -p /boot/vmlinux-kdump --reuse-cmdline --append="nr_cpus=1"
       # echo c > /proc/sysrq-trigger
      Signed-off-by: default avatarYouling Tang <tangyouling@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      4e62d1d8
    • Youling Tang's avatar
      LoongArch: Add kexec support · 4a03b2ac
      Youling Tang authored
      Add three new files, kexec.h, machine_kexec.c and relocate_kernel.S to
      the LoongArch architecture, so as to add support for the kexec re-boot
      mechanism (CONFIG_KEXEC) on LoongArch platforms.
      
      Kexec supports loading vmlinux.elf in ELF format and vmlinux.efi in PE
      format.
      
      I tested kexec on LoongArch machines (Loongson-3A5000) and it works as
      expected:
      
       $ sudo kexec -l /boot/vmlinux.efi --reuse-cmdline
       $ sudo kexec -e
      Signed-off-by: default avatarYouling Tang <tangyouling@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      4a03b2ac
    • Youling Tang's avatar
      LoongArch: Use generic BUG() handler · 2d2c3952
      Youling Tang authored
      Inspired by commit 9fb7410f("arm64/BUG: Use BRK instruction for
      generic BUG traps"), do similar for LoongArch to use generic BUG()
      handler.
      
      This patch uses the BREAK software breakpoint instruction to generate
      a trap instead, similarly to most other arches, with the generic BUG
      code generating the dmesg boilerplate.
      
      This allows bug metadata to be moved to a separate table and reduces
      the amount of inline code at BUG() and WARN() sites. This also avoids
      clobbering any registers before they can be dumped.
      
      To mitigate the size of the bug table further, this patch makes use of
      the existing infrastructure for encoding addresses within the bug table
      as 32-bit relative pointers instead of absolute pointers.
      
      (Note: this limits the max kernel size to 2GB.)
      
      Before patch:
      [ 3018.338013] lkdtm: Performing direct entry BUG
      [ 3018.342445] Kernel bug detected[#5]:
      [ 3018.345992] CPU: 2 PID: 865 Comm: cat Tainted: G D 6.0.0-rc6+ #35
      
      After patch:
      [  125.585985] lkdtm: Performing direct entry BUG
      [  125.590433] ------------[ cut here ]------------
      [  125.595020] kernel BUG at drivers/misc/lkdtm/bugs.c:78!
      [  125.600211] Oops - BUG[#1]:
      [  125.602980] CPU: 3 PID: 410 Comm: cat Not tainted 6.0.0-rc6+ #36
      
      Out-of-line file/line data information obtained compared to before.
      Signed-off-by: default avatarYouling Tang <tangyouling@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      2d2c3952
    • Huacai Chen's avatar
      LoongArch: Add SysRq-x (TLB Dump) support · dea2df3c
      Huacai Chen authored
      Add SysRq-x (TLB Dump) support for LoongArch, which is useful for
      debugging.
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      dea2df3c
    • Huacai Chen's avatar
      LoongArch: Add perf events support · b37042b2
      Huacai Chen authored
      The perf events infrastructure of LoongArch is very similar to old MIPS-
      based Loongson, so most of the codes are derived from MIPS.
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      b37042b2
    • Huacai Chen's avatar
      LoongArch: Add qspinlock support · 5f1e001b
      Huacai Chen authored
      On NUMA system, the performance of qspinlock is better than generic
      spinlock. Below is the UnixBench test results on a 8 nodes (4 cores
      per node, 32 cores in total) machine.
      
      A. With generic spinlock:
      
      System Benchmarks Index Values               BASELINE       RESULT    INDEX
      Dhrystone 2 using register variables         116700.0  449574022.5  38523.9
      Double-Precision Whetstone                       55.0      85190.4  15489.2
      Execl Throughput                                 43.0      14696.2   3417.7
      File Copy 1024 bufsize 2000 maxblocks          3960.0     143157.8    361.5
      File Copy 256 bufsize 500 maxblocks            1655.0      37631.8    227.4
      File Copy 4096 bufsize 8000 maxblocks          5800.0     444814.2    766.9
      Pipe Throughput                               12440.0    5047490.7   4057.5
      Pipe-based Context Switching                   4000.0    2021545.7   5053.9
      Process Creation                                126.0      23829.8   1891.3
      Shell Scripts (1 concurrent)                     42.4      33756.7   7961.5
      Shell Scripts (8 concurrent)                      6.0       4062.9   6771.5
      System Call Overhead                          15000.0    2479748.6   1653.2
                                                                         ========
      System Benchmarks Index Score                                        2955.6
      
      B. With qspinlock:
      
      System Benchmarks Index Values               BASELINE       RESULT    INDEX
      Dhrystone 2 using register variables         116700.0  449467876.9  38514.8
      Double-Precision Whetstone                       55.0      85174.6  15486.3
      Execl Throughput                                 43.0      14769.1   3434.7
      File Copy 1024 bufsize 2000 maxblocks          3960.0     146150.5    369.1
      File Copy 256 bufsize 500 maxblocks            1655.0      37496.8    226.6
      File Copy 4096 bufsize 8000 maxblocks          5800.0     447527.0    771.6
      Pipe Throughput                               12440.0    5175989.2   4160.8
      Pipe-based Context Switching                   4000.0    2207747.8   5519.4
      Process Creation                                126.0      25125.5   1994.1
      Shell Scripts (1 concurrent)                     42.4      33461.2   7891.8
      Shell Scripts (8 concurrent)                      6.0       4024.7   6707.8
      System Call Overhead                          15000.0    2917278.6   1944.9
                                                                         ========
      System Benchmarks Index Score                                        3040.1
      Signed-off-by: default avatarRui Wang <wangrui@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      5f1e001b
    • Huacai Chen's avatar
      LoongArch: Use TLB for ioremap() · d2791341
      Huacai Chen authored
      We can support more cache attributes (e.g., CC, SUC and WUC) and page
      protection when we use TLB for ioremap(). The implementation is based
      on GENERIC_IOREMAP.
      
      The existing simple ioremap() implementation has better performance so
      we keep it and introduce ARCH_IOREMAP to control the selection.
      
      We move pagetable_init() earlier to make early ioremap() works, and we
      modify the PCI ecam mapping because the TLB-based version of ioremap()
      will actually take the size into account.
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      d2791341
    • Huacai Chen's avatar
      LoongArch: Support access filter to /dev/mem interface · 235d074f
      Huacai Chen authored
      Accidental access to /dev/mem is obviously disastrous, but specific
      access can be used by people debugging the kernel. So select GENERIC_
      LIB_DEVMEM_IS_ALLOWED, as well as define ARCH_HAS_VALID_PHYS_ADDR_RANGE
      and related helpers, to support access filter to /dev/mem interface.
      Signed-off-by: default avatarWeihao Li <liweihao@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      235d074f
    • Huacai Chen's avatar
      LoongArch: Refactor cache probe and flush methods · b61a40af
      Huacai Chen authored
      Current cache probe and flush methods have some drawbacks:
      1, Assume there are 3 cache levels and only 3 levels;
      2, Assume L1 = I + D, L2 = V, L3 = S, V is exclusive, S is inclusive.
      
      However, the fact is I + D, I + D + V, I + D + S and I + D + V + S are
      all valid. So, refactor the cache probe and flush methods to adapt more
      types of cache hierarchy.
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      b61a40af
    • Rui Wang's avatar
      LoongArch: mm: Refactor TLB exception handlers · a2a84e36
      Rui Wang authored
      This patch simplifies TLB load, store and modify exception handlers:
      
      1. Reduce instructions, such as alu/csr and memory access;
      2. Execute tlb search instruction only in the fast path;
      3. Return directly from the fast path for both normal and huge pages;
      4. Re-tab the assembly for better vertical alignment.
      
      And fixes the concurrent modification issue of fast path for huge pages.
      
      This issue will occur in the following steps:
      
         CPU-1 (In TLB exception)         CPU-2 (In THP splitting)
      1: Load PMD entry (HUGE=1)
      2: Goto huge path
      3:                                  Store PMD entry (HUGE=0)
      4: Reload PMD entry (HUGE=0)
      5: Fill TLB entry (PA is incorrect)
      
      This patch also slightly improves the TLB processing performance:
      
      * Normal pages: 2.15%, Huge pages: 1.70%.
      
        #include <stdio.h>
        #include <stdlib.h>
        #include <unistd.h>
        #include <sys/mman.h>
      
        int main(int argc, char *argv[])
        {
              size_t page_size;
              size_t mem_size;
              size_t off;
              void *base;
              int flags;
              int i;
      
              if (argc < 2) {
                      fprintf(stderr, "%s MEM_SIZE [HUGE]\n", argv[0]);
                      return -1;
              }
      
              page_size = sysconf(_SC_PAGESIZE);
              flags = MAP_PRIVATE | MAP_ANONYMOUS;
              mem_size = strtoul(argv[1], NULL, 10);
              if (argc > 2)
                      flags |= MAP_HUGETLB;
      
              for (i = 0; i < 10; i++) {
                      base = mmap(NULL, mem_size, PROT_READ, flags, -1, 0);
                      if (base == MAP_FAILED) {
                              fprintf(stderr, "Map memory failed!\n");
                              return -1;
                      }
      
                      for (off = 0; off < mem_size; off += page_size)
                              *(volatile int *)(base + off);
      
                      munmap(base, mem_size);
              }
      
              return 0;
        }
      Signed-off-by: default avatarRui Wang <wangrui@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      a2a84e36
    • Xi Ruoyao's avatar
      LoongArch: Support R_LARCH_GOT_PC_{LO12,HI20} in modules · 59b3d4a9
      Xi Ruoyao authored
      GCC >= 13 and GNU assembler >= 2.40 use these relocations to address
      external symbols, so we need to add them.
      
      Let the module loader emit GOT entries for data symbols so we would be
      able to handle GOT relocations. The GOT entry is just the data's symbol
      address.
      
      In module.lds, emit a stub .got section for a section header entry. The
      actual content of the section entry will be filled at runtime by module_
      frob_arch_sections().
      Tested-by: default avatarWANG Xuerui <git@xen0n.name>
      Signed-off-by: default avatarXi Ruoyao <xry111@xry111.site>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      59b3d4a9
    • Xi Ruoyao's avatar
      LoongArch: Support PC-relative relocations in modules · 9bd1e380
      Xi Ruoyao authored
      Binutils >= 2.40 uses R_LARCH_B26 instead of R_LARCH_SOP_PUSH_PLT_PCREL,
      and R_LARCH_PCALA* instead of R_LARCH_SOP_PUSH_PCREL.
      
      Handle R_LARCH_B26 and R_LARCH_PCALA* in the module loader. For R_LARCH_
      B26, also create a PLT entry as needed.
      Tested-by: default avatarWANG Xuerui <git@xen0n.name>
      Signed-off-by: default avatarXi Ruoyao <xry111@xry111.site>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      9bd1e380
    • Xi Ruoyao's avatar
      LoongArch: Define ELF relocation types added in ABIv2.0 · 0a75e5d1
      Xi Ruoyao authored
      These relocation types are used by GNU binutils >= 2.40 and GCC >= 13.
      Add their definitions so we will be able to use them in later patches.
      
      Link: https://github.com/loongson/LoongArch-Documentation/pull/57Tested-by: default avatarWANG Xuerui <git@xen0n.name>
      Signed-off-by: default avatarXi Ruoyao <xry111@xry111.site>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      0a75e5d1
    • Xi Ruoyao's avatar
      LoongArch: Adjust symbol addressing for AS_HAS_EXPLICIT_RELOCS · 11cd8a64
      Xi Ruoyao authored
      If explicit relocation hints are used by the toolchain, -Wa,-mla-*
      options will be useless for the C code. So only use them for the
      !CONFIG_AS_HAS_EXPLICIT_RELOCS case.
      
      Replace "la" with "la.pcrel" in head.S to keep the semantic consistent
      with new and old toolchains for the low level startup code.
      
      For per-CPU variables, the "address" of the symbol is actually an offset
      from $r21. The value is near the loading address of main kernel image,
      but far from the loading address of modules. So we use model("extreme")
      attibute to tell the compiler that a PC-relative addressing with 32-bit
      offset is not sufficient for local per-CPU variables.
      
      The behavior with different assemblers and compilers are summarized in
      the following table:
      
      AS has            CC has
      explicit relocs   explicit relocs * Behavior
      ==============================================================
      No                No                Use la.* macros.
                                          No change from Linux 6.0.
      --------------------------------------------------------------
      No                Yes               Disable explicit relocs.
                                          No change from Linux 6.0.
      --------------------------------------------------------------
      Yes               No                Not supported.
      --------------------------------------------------------------
      Yes               Yes               Enable explicit relocs.
                                          No -Wa,-mla* options used.
      ==============================================================
      *: We assume CC must have model attribute if it has explicit relocs.
         Both features are added in GCC 13 development cycle, so any GCC
         release >= 13 should be OK. Using early GCC 13 development snapshots
         may produce modules with unsupported relocations.
      
      Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=f09482a
      Link: https://gcc.gnu.org/r13-1834
      Link: https://gcc.gnu.org/r13-2199Tested-by: default avatarWANG Xuerui <git@xen0n.name>
      Signed-off-by: default avatarXi Ruoyao <xry111@xry111.site>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      11cd8a64
    • Xi Ruoyao's avatar
      LoongArch: Add Kconfig option AS_HAS_EXPLICIT_RELOCS · 0d8dad70
      Xi Ruoyao authored
      GNU as >= 2.40 and GCC >= 13 will support using explicit relocation
      hints in the assembly code, instead of la.* macros. The usage of
      explicit relocation hints can improve code generation so it's enabled
      by default by GCC >= 13.
      
      Introduce a Kconfig option AS_HAS_EXPLICIT_RELOCS as the switch for
      "use explicit relocation hints or not".
      Tested-by: default avatarWANG Xuerui <git@xen0n.name>
      Signed-off-by: default avatarXi Ruoyao <xry111@xry111.site>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      0d8dad70
    • Colin Ian King's avatar
      LoongArch: Kconfig: Fix spelling mistake "delibrately" -> "deliberately" · 9550dfde
      Colin Ian King authored
      There is a spelling mistake in a commented section. Fix it.
      Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      9550dfde
    • Huacai Chen's avatar
      LoongArch: Mark __xchg() and __cmpxchg() as __always_inline · ddf50271
      Huacai Chen authored
      Commit ac7c3e4f ("compiler: enable CONFIG_OPTIMIZE_INLINING
      forcibly") allows compiler to uninline functions marked as 'inline'.
      In case of __xchg()/__cmpxchg() this would cause to reference
      BUILD_BUG(), which is an error case for catching bugs and will not
      happen for correct code, if __xchg()/__cmpxchg() is inlined.
      
      This bug can be produced with CONFIG_DEBUG_SECTION_MISMATCH enabled,
      and the solution is similar to below commits:
      46f16195 ("MIPS: include: Mark __xchg as __always_inline"),
      88356d09 ("MIPS: include: Mark __cmpxchg as __always_inline").
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      ddf50271
    • Huacai Chen's avatar
      LoongArch: Flush TLB earlier at initialization · 1299a129
      Huacai Chen authored
      Move local_flush_tlb_all() earlier (just after setup_ptwalker() and
      before page allocation). This can avoid stale TLB entries misguiding
      the later page allocation. Without this patch the second kernel of
      kexec/kdump fails to boot SMP.
      
      BTW, move output_pgtable_bits_defines() into tlb_init() since it has
      nothing to do with tlb handler setup.
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      1299a129
    • Tiezhu Yang's avatar
      LoongArch: Do not create sysfs control file for io master CPUs · a522b7ad
      Tiezhu Yang authored
      Now io master CPUs are not hotpluggable on LoongArch, but in the current
      code only /sys/devices/system/cpu/cpu0/online is not created. Let us set
      the hotpluggable field of all the io master CPUs as 0, then prevent to
      create sysfs control file for all the io master CPUs which confuses some
      user space tools. This is similar with commit 9cce844a ("MIPS: CPU#0
      is not hotpluggable").
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      a522b7ad
    • Jianmin Lv's avatar
      LoongArch: Fix cpu name after CPU-hotplug · 4b2edd38
      Jianmin Lv authored
      Don't overwrite the SMBIOS-provided CPU name on coming back from CPU-
      hotplug (including S3/S4) if it is already initialized.
      Reviewed-by: default avatarWANG Xuerui <git@xen0n.name>
      Signed-off-by: default avatarJianmin Lv <lvjianmin@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      4b2edd38
    • Thomas Gleixner's avatar
      Merge tag 'irqchip-fixes-6.1-1' of... · b8d49bcd
      Thomas Gleixner authored
      Merge tag 'irqchip-fixes-6.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms into irq/core
      
      Pull irqchip fixes from Marc Zyngier:
      
        - Fix IMX-MU Kconfig, keeping it private to IMX
      
        - Fix a register offset for the same IMX-MU driver
      
        - Fix the ls-extirq irqchip driver that would use the wrong
          flavour of spinlocks
      
      Link: https://lore.kernel.org/r/20221012075125.1244143-1-maz@kernel.org
      b8d49bcd
    • Geert Uytterhoeven's avatar
      irqchip: IMX_MU_MSI should depend on ARCH_MXC · 6c9f7434
      Geert Uytterhoeven authored
      The Freescale/NXP i.MX Messaging Unit is only present on Freescale/NXP
      i.MX SoCs.  Hence add a dependency on ARCH_MXC, to prevent asking the
      user about this driver when configuring a kernel without Freescale/NXP
      i.MX SoC family support.
      
      While at it, expand "MU" to "Messaging Unit" in the help text.
      
      Fixes: 70afdab9 ("irqchip: Add IMX MU MSI controller driver")
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/7f3bd932614ddbff46a1b750ef45b231130364ad.1664900434.git.geert+renesas@glider.be
      6c9f7434
    • Linus Torvalds's avatar
      Merge tag 'memblock-v6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock · 49da0700
      Linus Torvalds authored
      Pull memblock updates from Mike Rapoport:
       "Test suite improvements:
      
         - Added verification that memblock allocations zero the allocated
           memory
      
         - Added more test cases for memblock_add(), memblock_remove(),
           memblock_reserve() and memblock_free()
      
         - Added tests for memblock_*_raw() family
      
         - Added tests for NUMA-aware allocations in memblock_alloc_try_nid()
           and memblock_alloc_try_nid_raw()"
      
      * tag 'memblock-v6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock:
        memblock tests: add generic NUMA tests for memblock_alloc_try_nid*
        memblock tests: add bottom-up NUMA tests for memblock_alloc_try_nid*
        memblock tests: add top-down NUMA tests for memblock_alloc_try_nid*
        memblock tests: add simulation of physical memory with multiple NUMA nodes
        memblock_tests: move variable declarations to single block
        memblock tests: remove 'cleared' from comment blocks
        memblock tests: add tests for memblock_trim_memory
        memblock tests: add tests for memblock_*bottom_up functions
        memblock tests: update alloc_nid_api to test memblock_alloc_try_nid_raw
        memblock tests: update alloc_api to test memblock_alloc_raw
        memblock tests: add additional tests for basic api and memblock_alloc
        memblock tests: add labels to verbose output for generic alloc tests
        memblock tests: update zeroed memory check for memblock_alloc_* tests
        memblock tests: update tests to check if memblock_alloc zeroed memory
        memblock tests: update reference to obsolete build option in comments
        memblock tests: add command line help option
      49da0700
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · f311d498
      Linus Torvalds authored
      Pull more kvm updates from Paolo Bonzini:
       "The main batch of ARM + RISC-V changes, and a few fixes and cleanups
        for x86 (PMU virtualization and selftests).
      
        ARM:
      
         - Fixes for single-stepping in the presence of an async exception as
           well as the preservation of PSTATE.SS
      
         - Better handling of AArch32 ID registers on AArch64-only systems
      
         - Fixes for the dirty-ring API, allowing it to work on architectures
           with relaxed memory ordering
      
         - Advertise the new kvmarm mailing list
      
         - Various minor cleanups and spelling fixes
      
        RISC-V:
      
         - Improved instruction encoding infrastructure for instructions not
           yet supported by binutils
      
         - Svinval support for both KVM Host and KVM Guest
      
         - Zihintpause support for KVM Guest
      
         - Zicbom support for KVM Guest
      
         - Record number of signal exits as a VCPU stat
      
         - Use generic guest entry infrastructure
      
        x86:
      
         - Misc PMU fixes and cleanups.
      
         - selftests: fixes for Hyper-V hypercall
      
         - selftests: fix nx_huge_pages_test on TDP-disabled hosts
      
         - selftests: cleanups for fix_hypercall_test"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (57 commits)
        riscv: select HAVE_POSIX_CPU_TIMERS_TASK_WORK
        RISC-V: KVM: Use generic guest entry infrastructure
        RISC-V: KVM: Record number of signal exits as a vCPU stat
        RISC-V: KVM: add __init annotation to riscv_kvm_init()
        RISC-V: KVM: Expose Zicbom to the guest
        RISC-V: KVM: Provide UAPI for Zicbom block size
        RISC-V: KVM: Make ISA ext mappings explicit
        RISC-V: KVM: Allow Guest use Zihintpause extension
        RISC-V: KVM: Allow Guest use Svinval extension
        RISC-V: KVM: Use Svinval for local TLB maintenance when available
        RISC-V: Probe Svinval extension form ISA string
        RISC-V: KVM: Change the SBI specification version to v1.0
        riscv: KVM: Apply insn-def to hlv encodings
        riscv: KVM: Apply insn-def to hfence encodings
        riscv: Introduce support for defining instructions
        riscv: Add X register names to gpr-nums
        KVM: arm64: Advertise new kvmarm mailing list
        kvm: vmx: keep constant definition format consistent
        kvm: mmu: fix typos in struct kvm_arch
        KVM: selftests: Fix nx_huge_pages_test on TDP-disabled hosts
        ...
      f311d498
    • Tiezhu Yang's avatar
      include/linux/entry-common.h: remove has_signal comment of arch_do_signal_or_restart() prototype · 6a961bff
      Tiezhu Yang authored
      The argument has_signal of arch_do_signal_or_restart() has been removed in
      commit 8ba62d37 ("task_work: Call tracehook_notify_signal from
      get_signal on all architectures"), let us remove the related comment.
      
      Link: https://lkml.kernel.org/r/1662090106-5545-1-git-send-email-yangtiezhu@loongson.cn
      Fixes: 8ba62d37 ("task_work: Call tracehook_notify_signal from get_signal on all architectures")
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      6a961bff
    • Alexey Dobriyan's avatar
      proc: test how it holds up with mapping'less process · 5bc73bb3
      Alexey Dobriyan authored
      Create process without mappings and check
      
      	/proc/*/maps
      	/proc/*/numa_maps
      	/proc/*/smaps
      	/proc/*/smaps_rollup
      
      They must be empty (excluding vsyscall page) or full of zeroes.
      
      Retroactively this test should've caught embarassing /proc/*/smaps_rollup
      oops:
      
      [17752.703567] BUG: kernel NULL pointer dereference, address: 0000000000000000
      [17752.703580] #PF: supervisor read access in kernel mode
      [17752.703583] #PF: error_code(0x0000) - not-present page
      [17752.703587] PGD 0 P4D 0
      [17752.703593] Oops: 0000 [#1] PREEMPT SMP PTI
      [17752.703598] CPU: 0 PID: 60649 Comm: cat Tainted: G        W         5.19.9-100.fc35.x86_64 #1
      [17752.703603] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./X99 Extreme6/3.1, BIOS P3.30 08/05/2016
      [17752.703607] RIP: 0010:show_smaps_rollup+0x159/0x2e0
      
      Note 1:
      	ProtectionKey field in /proc/*/smaps is optional,
      	so check most of its contents, not everything.
      
      Note 2:
      	due to the nature of this test, child process hardly can signal
      	its readiness (after unmapping everything!) to parent.
      	I feel like "sleep(1)" is justified.
      	If you know how to do it without sleep please tell me.
      
      Note 3:
      	/proc/*/statm is not tested but can be.
      
      Link: https://lkml.kernel.org/r/Yz3liL6Dn+n2SD8Q@localhost.localdomainSigned-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      5bc73bb3
    • Frank Rowand's avatar
      mailmap: update Frank Rowand email address · 0f4107d1
      Frank Rowand authored
      Frank is no longer at Sony, add an entry for his latest Sony email
      
      Link: https://lkml.kernel.org/r/20221001015009.3994518-1-frowand.list@gmail.comSigned-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      Cc: Tim Bird <Tim.Bird@sony.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      0f4107d1
    • xu xin's avatar
      ia64: mca: use strscpy() is more robust and safer · 95e9a855
      xu xin authored
      The implementation of strscpy() is more robust and safer.  That's now the
      recommended way to copy NUL terminated strings.
      
      Link: https://lkml.kernel.org/r/20220930061950.288290-1-xu.xin16@zte.com.cnReported-by: default avatarZeal Robot <zealci@zte.com.cn>
      Signed-off-by: default avatarXu Panda <xu.panda@zte.com.cn>
      Signed-off-by: default avatarxu xin <xu.xin16@zte.com.cn>
      Cc: Haowen Bai <baihaowen@meizu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      95e9a855
    • Ren Zhijie's avatar
      init/Kconfig: fix unmet direct dependencies · 30341ec9
      Ren Zhijie authored
      Commit 3c07bfce92a5 ("proc: make config PROC_CHILDREN depend on PROC_FS")
      make config PROC_CHILDREN depend on PROC_FS.
      
      When CONFIG_PROC_FS is not set and CONFIG_CHECKPOINT_RESTORE=y,
      make menuconfig screams like this:
      
      WARNING: unmet direct dependencies detected for PROC_CHILDREN
        Depends on [n]: PROC_FS [=n]
        Selected by [y]:
        - CHECKPOINT_RESTORE [=y]
      
      CHECKPOINT_RESTORE would select PROC_CHILDREN which depends on PROC_FS,
      so add depends on PROC_FS to CHECKPOINT_RESTORE to fix this.
      
      Link: https://lkml.kernel.org/r/20220929070057.59044-1-renzhijie2@huawei.com
      Fixes: 3c07bfce92a5 ("proc: make config PROC_CHILDREN depend on PROC_FS")
      Signed-off-by: default avatarRen Zhijie <renzhijie2@huawei.com>
      Reviewed-by: default avatarLukas Bulwahn <lukas.bulwahn@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      30341ec9
    • Lukas Bulwahn's avatar
      ia64: update config files · 329028e0
      Lukas Bulwahn authored
      Clean up config files by:
        - removing configs that were deleted in the past
        - removing configs not in tree and without recently pending patches
        - adding new configs that are replacements for old configs in the file
      
      For some detailed information, see Link.
      
      Link: https://lore.kernel.org/kernel-janitors/20220929090645.1389-1-lukas.bulwahn@gmail.com/
      
      Link: https://lkml.kernel.org/r/20220929101441.32009-1-lukas.bulwahn@gmail.comSigned-off-by: default avatarLukas Bulwahn <lukas.bulwahn@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      329028e0
    • Ryusuke Konishi's avatar
      nilfs2: replace WARN_ONs by nilfs_error for checkpoint acquisition failure · 723ac751
      Ryusuke Konishi authored
      If creation or finalization of a checkpoint fails due to anomalies in the
      checkpoint metadata on disk, a kernel warning is generated.
      
      This patch replaces the WARN_ONs by nilfs_error, so that a kernel, booted
      with panic_on_warn, does not panic.  A nilfs_error is appropriate here to
      handle the abnormal filesystem condition.
      
      This also replaces the detected error codes with an I/O error so that
      neither of the internal error codes is returned to callers.
      
      Link: https://lkml.kernel.org/r/20220929123330.19658-1-konishi.ryusuke@gmail.comSigned-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Reported-by: syzbot+fbb3e0b24e8dae5a16ee@syzkaller.appspotmail.com
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      723ac751
    • Xu Panda's avatar
      fork: remove duplicate included header files · ef79361b
      Xu Panda authored
      linux/sched/mm.h is included more than once.
      
      Link: https://lkml.kernel.org/r/20220912071556.16811-1-xu.panda@zte.com.cnSigned-off-by: default avatarXu Panda <xu.panda@zte.com.cn>
      Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Christian Brauner (Microsoft) <brauner@kernel.org>
      Cc: "Eric W . Biederman" <ebiederm@xmission.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      ef79361b