1. 08 Sep, 2023 4 commits
    • Palmer Dabbelt's avatar
      Merge patch "RISC-V: Add ptrace support for vectors" · f0936363
      Palmer Dabbelt authored
      This resurrects the vector ptrace() support that was removed for 6.5 due
      to some bugs cropping up as part of the GDB review process.
      
      * b4-shazam-merge:
        RISC-V: Add ptrace support for vectors
      
      Link: https://lore.kernel.org/r/20230825050248.32681-1-andy.chiu@sifive.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      f0936363
    • Palmer Dabbelt's avatar
      Merge patch series "Add non-coherent DMA support for AX45MP" · c23be918
      Palmer Dabbelt authored
      Prabhakar <prabhakar.csengg@gmail.com> says:
      
      From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
      
      non-coherent DMA support for AX45MP
      ====================================
      
      On the Andes AX45MP core, cache coherency is a specification option so it
      may not be supported. In this case DMA will fail. To get around with this
      issue this patch series does the below:
      
      1] Andes alternative ports is implemented as errata which checks if the
      IOCP is missing and only then applies to CMO errata. One vendor specific
      SBI EXT (ANDES_SBI_EXT_IOCP_SW_WORKAROUND) is implemented as part of
      errata.
      
      Below are the configs which Andes port provides (and are selected by
      RZ/Five):
            - ERRATA_ANDES
            - ERRATA_ANDES_CMO
      
      OpenSBI patch supporting ANDES_SBI_EXT_IOCP_SW_WORKAROUND SBI is now
      part v1.3 release.
      
      2] Andes AX45MP core has a Programmable Physical Memory Attributes (PMA)
      block that allows dynamic adjustment of memory attributes in the runtime.
      It contains a configurable amount of PMA entries implemented as CSR
      registers to control the attributes of memory locations in interest.
      OpenSBI configures the PMA regions as required and creates a reserve memory
      node and propagates it to the higher boot stack.
      
      Currently OpenSBI (upstream) configures the required PMA region and passes
      this a shared DMA pool to Linux.
      
          reserved-memory {
              #address-cells = <2>;
              #size-cells = <2>;
              ranges;
      
              pma_resv0@58000000 {
                  compatible = "shared-dma-pool";
                  reg = <0x0 0x58000000 0x0 0x08000000>;
                  no-map;
                  linux,dma-default;
              };
          };
      
      The above shared DMA pool gets appended to Linux DTB so the DMA memory
      requests go through this region.
      
      3] We provide callbacks to synchronize specific content between memory and
      cache.
      
      4] RZ/Five SoC selects the below configs
              - AX45MP_L2_CACHE
              - DMA_GLOBAL_POOL
              - ERRATA_ANDES
              - ERRATA_ANDES_CMO
      
      ----------x---------------------x--------------------x---------------x----
      
      * b4-shazam-merge:
        soc: renesas: Kconfig: Select the required configs for RZ/Five SoC
        cache: Add L2 cache management for Andes AX45MP RISC-V core
        dt-bindings: cache: andestech,ax45mp-cache: Add DT binding documentation for L2 cache controller
        riscv: mm: dma-noncoherent: nonstandard cache operations support
        riscv: errata: Add Andes alternative ports
        riscv: asm: vendorid_list: Add Andes Technology to the vendors list
      
      Link: https://lore.kernel.org/r/20230818135723.80612-1-prabhakar.mahadev-lad.rj@bp.renesas.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      c23be918
    • Palmer Dabbelt's avatar
      Merge patch series "riscv: dma-mapping: unify support for cache flushes" · 7f215d00
      Palmer Dabbelt authored
      Prabhakar <prabhakar.csengg@gmail.com> says:
      
      From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
      
      This patch series is a subset from Arnd's original series [0]. Ive just
      picked up the bits required for RISC-V unification of cache flushing.
      Remaining patches from the series [0] will be taken care by Arnd soon.
      
      * b4-shazam-merge:
        riscv: dma-mapping: switch over to generic implementation
        riscv: dma-mapping: skip invalidation before bidirectional DMA
        riscv: dma-mapping: only invalidate after DMA, not flush
      
      Link: https://lore.kernel.org/r/20230816232336.164413-1-prabhakar.mahadev-lad.rj@bp.renesas.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      7f215d00
    • Palmer Dabbelt's avatar
      Merge patch series "RISC-V: Probe for misaligned access speed" · 580253b5
      Palmer Dabbelt authored
      Evan Green <evan@rivosinc.com> says:
      
      The current setting for the hwprobe bit indicating misaligned access
      speed is controlled by a vendor-specific feature probe function. This is
      essentially a per-SoC table we have to maintain on behalf of each vendor
      going forward. Let's convert that instead to something we detect at
      runtime.
      
      We have two assembly routines at the heart of our probe: one that
      does a bunch of word-sized accesses (without aligning its input buffer),
      and the other that does byte accesses. If we can move a larger number of
      bytes using misaligned word accesses than we can with the same amount of
      time doing byte accesses, then we can declare misaligned accesses as
      "fast".
      
      The tradeoff of reducing this maintenance burden is boot time. We spend
      4-6 jiffies per core doing this measurement (0-2 on jiffie edge
      alignment, and 4 on measurement). The timing loop was based on
      raid6_choose_gen(), which uses (16+1)*N jiffies (where N is the number
      of algorithms). By taking only the fastest iteration out of all
      attempts for use in the comparison, variance between runs is very low.
      On my THead C906, it looks like this:
      
      [    0.047563] cpu0: Ratio of byte access time to unaligned word access is 4.34, unaligned accesses are fast
      
      Several others have chimed in with results on slow machines with the
      older algorithm, which took all runs into account, including noise like
      interrupts. Even with this variation, results indicate that in all cases
      (fast, slow, and emulated) the measured numbers are nowhere near each
      other (always multiple factors away).
      
      * b4-shazam-merge:
        RISC-V: alternative: Remove feature_probe_func
        RISC-V: Probe for unaligned access speed
      
      Link: https://lore.kernel.org/r/20230818194136.4084400-1-evan@rivosinc.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      580253b5
  2. 01 Sep, 2023 14 commits
  3. 31 Aug, 2023 22 commits
    • Linus Torvalds's avatar
      Merge tag 'nfs-for-6.6-1' of git://git.linux-nfs.org/projects/anna/linux-nfs · 99d99825
      Linus Torvalds authored
      Pull NFS client updates from Anna Schumaker:
       "New Features:
         - Enable the NFS v4.2 READ_PLUS operation by default
      
        Stable Fixes:
         - NFSv4/pnfs: minor fix for cleanup path in nfs4_get_device_info
         - NFS: Fix a potential data corruption
      
        Bugfixes:
         - Fix various READ_PLUS issues including:
            - smatch warnings
            - xdr size calculations
            - scratch buffer handling
            - 32bit / highmem xdr page handling
         - Fix checkpatch errors in file.c
         - Fix redundant readdir request after an EOF
         - Fix handling of COPY ERR_OFFLOAD_NO_REQ
         - Fix assignment of xprtdata.cred
      
        Cleanups:
         - Remove unused xprtrdma function declarations
         - Clean up an integer overflow check to avoid a warning
         - Clean up #includes in dns_resolve.c
         - Clean up nfs4_get_device_info so we don't pass a NULL pointer
           to __free_page()
         - Clean up sunrpc TCP socket timeout configuration
         - Guard against READDIR loops when entry names are too long
         - Use EXCHID4_FLAG_USE_PNFS_DS for DS servers"
      
      * tag 'nfs-for-6.6-1' of git://git.linux-nfs.org/projects/anna/linux-nfs: (22 commits)
        pNFS: Fix assignment of xprtdata.cred
        NFSv4.2: fix handling of COPY ERR_OFFLOAD_NO_REQ
        NFS: Guard against READDIR loop when entry names exceed MAXNAMELEN
        NFSv4.1: use EXCHGID4_FLAG_USE_PNFS_DS for DS server
        NFS/pNFS: Set the connect timeout for the pNFS flexfiles driver
        SUNRPC: Don't override connect timeouts in rpc_clnt_add_xprt()
        SUNRPC: Allow specification of TCP client connect timeout at setup
        SUNRPC: Refactor and simplify connect timeout
        SUNRPC: Set the TCP_SYNCNT to match the socket timeout
        NFS: Fix a potential data corruption
        nfs: fix redundant readdir request after get eof
        nfs/blocklayout: Use the passed in gfp flags
        filemap: Fix errors in file.c
        NFSv4/pnfs: minor fix for cleanup path in nfs4_get_device_info
        NFS: Move common includes outside ifdef
        SUNRPC: clean up integer overflow check
        xprtrdma: Remove unused function declaration rpcrdma_bc_post_recv()
        NFS: Enable the READ_PLUS operation by default
        SUNRPC: kmap() the xdr pages during decode
        NFSv4.2: Rework scratch handling for READ_PLUS (again)
        ...
      99d99825
    • Linus Torvalds's avatar
      Merge tag 'nfsd-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux · f35d1706
      Linus Torvalds authored
      Pull nfsd updates from Chuck Lever:
       "I'm thrilled to announce that the Linux in-kernel NFS server now
        offers NFSv4 write delegations. A write delegation enables a client to
        cache data and metadata for a single file more aggressively, reducing
        network round trips and server workload. Many thanks to Dai Ngo for
        contributing this facility, and to Jeff Layton and Neil Brown for
        reviewing and testing it.
      
        This release also sees the removal of all support for DES- and
        triple-DES-based Kerberos encryption types in the kernel's SunRPC
        implementation. These encryption types have been deprecated by the
        Internet community for years and are considered insecure. This change
        affects both the in-kernel NFS client and server.
      
        The server's UDP and TCP socket transports have now fully adopted
        David Howells' new bio_vec iterator so that no more than one sendmsg()
        call is needed to transmit each RPC message. In particular, this helps
        kTLS optimize record boundaries when sending RPC-with-TLS replies, and
        it takes the server a baby step closer to handling file I/O via
        folios.
      
        We've begun work on overhauling the SunRPC thread scheduler to remove
        a costly linked-list walk when looking for an idle RPC service thread
        to wake. The pre-requisites are included in this release. Thanks to
        Neil Brown for his ongoing work on this improvement"
      
      * tag 'nfsd-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: (56 commits)
        Documentation: Add missing documentation for EXPORT_OP flags
        SUNRPC: Remove unused declaration rpc_modcount()
        SUNRPC: Remove unused declarations
        NFSD: da_addr_body field missing in some GETDEVICEINFO replies
        SUNRPC: Remove return value of svc_pool_wake_idle_thread()
        SUNRPC: make rqst_should_sleep() idempotent()
        SUNRPC: Clean up svc_set_num_threads
        SUNRPC: Count ingress RPC messages per svc_pool
        SUNRPC: Deduplicate thread wake-up code
        SUNRPC: Move trace_svc_xprt_enqueue
        SUNRPC: Add enum svc_auth_status
        SUNRPC: change svc_xprt::xpt_flags bits to enum
        SUNRPC: change svc_rqst::rq_flags bits to enum
        SUNRPC: change svc_pool::sp_flags bits to enum
        SUNRPC: change cache_head.flags bits to enum
        SUNRPC: remove timeout arg from svc_recv()
        SUNRPC: change svc_recv() to return void.
        SUNRPC: call svc_process() from svc_recv().
        nfsd: separate nfsd_last_thread() from nfsd_put()
        nfsd: Simplify code around svc_exit_thread() call in nfsd()
        ...
      f35d1706
    • Linus Torvalds's avatar
      Merge tag '6.6-rc-ksmbd-fixes-part1' of git://git.samba.org/ksmbd · 8ae5d298
      Linus Torvalds authored
      Pull smb server updates from Steve French:
      
       - fix potential overflows in decoding create and in session setup
         requests
      
       - cleanup fixes
      
       - compounding fixes, including one for MacOS compounded read requests
      
       - session setup error handling fix
      
       - fix mode bit bug when applying force_directory_mode and
         force_create_mode
      
       - RDMA (smbdirect) write fix
      
      * tag '6.6-rc-ksmbd-fixes-part1' of git://git.samba.org/ksmbd:
        ksmbd: add missing calling smb2_set_err_rsp() on error
        ksmbd: replace one-element array with flex-array member in struct smb2_ea_info
        ksmbd: fix slub overflow in ksmbd_decode_ntlmssp_auth_blob()
        ksmbd: fix wrong DataOffset validation of create context
        ksmbd: Fix one kernel-doc comment
        ksmbd: reduce descriptor size if remaining bytes is less than request size
        ksmbd: fix `force create mode' and `force directory mode'
        ksmbd: fix wrong interim response on compound
        ksmbd: add support for read compound
        ksmbd: switch to use kmemdup_nul() helper
      8ae5d298
    • Linus Torvalds's avatar
      Merge tag 'jfs-6.6' of github.com:kleikamp/linux-shaggy · 7e5cd6f6
      Linus Torvalds authored
      Pull jfs updates from Dave Kleikamp:
       "A few small fixes"
      
      * tag 'jfs-6.6' of github.com:kleikamp/linux-shaggy:
        jfs: validate max amount of blocks before allocation.
        jfs: remove redundant initialization to pointer ip
        jfs: fix invalid free of JFS_IP(ipimap)->i_imap in diUnmount
        FS: JFS: (trivial) Fix grammatical error in extAlloc
        fs/jfs: prevent double-free in dbUnmount() after failed jfs_remount()
      7e5cd6f6
    • Linus Torvalds's avatar
      Merge tag 'ext4_for_linus-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · 3ef96fcf
      Linus Torvalds authored
      Pull ext4 updates from Ted Ts'o:
       "Many ext4 and jbd2 cleanups and bug fixes:
      
         - Cleanups in the ext4 remount code when going to and from read-only
      
         - Cleanups in ext4's multiblock allocator
      
         - Cleanups in the jbd2 setup/mounting code paths
      
         - Performance improvements when appending to a delayed allocation file
      
         - Miscellaneous syzbot and other bug fixes"
      
      * tag 'ext4_for_linus-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (60 commits)
        ext4: fix slab-use-after-free in ext4_es_insert_extent()
        libfs: remove redundant checks of s_encoding
        ext4: remove redundant checks of s_encoding
        ext4: reject casefold inode flag without casefold feature
        ext4: use LIST_HEAD() to initialize the list_head in mballoc.c
        ext4: do not mark inode dirty every time when appending using delalloc
        ext4: rename s_error_work to s_sb_upd_work
        ext4: add periodic superblock update check
        ext4: drop dio overwrite only flag and associated warning
        ext4: add correct group descriptors and reserved GDT blocks to system zone
        ext4: remove unused function declaration
        ext4: mballoc: avoid garbage value from err
        ext4: use sbi instead of EXT4_SB(sb) in ext4_mb_new_blocks_simple()
        ext4: change the type of blocksize in ext4_mb_init_cache()
        ext4: fix unttached inode after power cut with orphan file feature enabled
        jbd2: correct the end of the journal recovery scan range
        ext4: ext4_get_{dev}_journal return proper error value
        ext4: cleanup ext4_get_dev_journal() and ext4_get_journal()
        jbd2: jbd2_journal_init_{dev,inode} return proper error return value
        jbd2: drop useless error tag in jbd2_journal_wipe()
        ...
      3ef96fcf
    • Linus Torvalds's avatar
      Merge tag 'dlm-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm · 659b3613
      Linus Torvalds authored
      Pull dlm updates from David Teigland:
      
       - Allow blocking posix lock requests to be interrupted while waiting.
         This requires a cancel request to be sent to the userspace daemon
         where posix lock requests are processed across the cluster.
      
       - Fix a posix lock patch from the previous cycle in which lock requests
         from different file systems could be mixed up.
      
       - Fix some long standing problems with nfs posix lock cancelation.
      
       - Add a new debugfs file for printing queued callbacks.
      
       - Stop modifying buffers that have been used to receive a message.
      
       - Misc cleanups and some refactoring.
      
      * tag 'dlm-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm:
        dlm: fix plock lookup when using multiple lockspaces
        fs: dlm: don't use RCOM_NAMES for version detection
        fs: dlm: create midcomms nodes when configure
        fs: dlm: constify receive buffer
        fs: dlm: drop rxbuf manipulation in dlm_recover_master_copy
        fs: dlm: drop rxbuf manipulation in dlm_copy_master_names
        fs: dlm: get recovery sequence number as parameter
        fs: dlm: cleanup lock order
        fs: dlm: remove clear_members_cb
        fs: dlm: add plock dev tracepoints
        fs: dlm: check on plock ops when exit dlm
        fs: dlm: debugfs for queued callbacks
        fs: dlm: remove unused processed_nodes
        fs: dlm: add missing spin_unlock
        fs: dlm: fix F_CANCELLK to cancel pending request
        fs: dlm: allow to F_SETLKW getting interrupted
        fs: dlm: remove twice newline
      659b3613
    • Linus Torvalds's avatar
      Merge tag 'v6.6-vfs.super.fixes.2' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs · e7e9423d
      Linus Torvalds authored
      Pull more superblock follow-on fixes from Christian Brauner:
       "This contains two more small follow-up fixes for the super work this
        cycle. I went through all filesystems once more and detected two minor
        issues that still needed fixing:
      
         - Some filesystems support mtd devices (e.g., mount -t jffs2 mtd2
           /mnt). The mtd infrastructure uses the sb->s_mtd pointer to find an
           existing superblock. When the mtd device is put and sb->s_mtd
           cleared the superblock can still be found fs_supers and so this
           risks a use-after-free.
      
           Add a small patch that aligns mtd with what we did for regular
           block devices and switch keying to rely on sb->s_dev.
      
           (This was tested with mtd devices and jffs2 as xfstests doesn't
           support mtd devices.)
      
         - Switch nfs back to rely on kill_anon_super() so the superblock is
           removed from the list of active supers before sb->s_fs_info is
           freed"
      
      * tag 'v6.6-vfs.super.fixes.2' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
        NFS: switch back to using kill_anon_super
        mtd: key superblock by device number
        fs: export sget_dev()
      e7e9423d
    • Ingo Molnar's avatar
      powerpc: Fix pud_mkwrite() definition after pte_mkwrite() API changes · f441ff73
      Ingo Molnar authored
      Fix up missed semantic mis-merge between commits
      
        161e393c ("mm: Make pte_mkwrite() take a VMA")
        27af67f3 ("powerpc/book3s64/mm: enable transparent pud hugepage")
      
      where the newly introduced powerpc use of 'pte_mkwrite()' needs to use
      the 'novma()' versions as per commit 2f0584f3 ("mm: Rename arch
      pte_mkwrite()'s to pte_mkwrite_novma()").
      
      Fixes: df57721f ("Merge tag 'x86_shstk_for_6.6-rc1' of [...]")
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f441ff73
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm · 87dfd85c
      Linus Torvalds authored
      Pull ARM updates from Russell King:
      
       - Refactor VFP code and convert to C code (Ard Biesheuvel)
      
       - Fix hardware breakpoint single-stepping using bpf_overflow_handler
      
       - Make SMP stop calls asynchronous allowing panic from irq context to
         work
      
       - Fix for kernel-doc warnings for locomo
      
      * tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
        Revert part of ae1f8d79 ("ARM: 9304/1: add prototype for function called only from asm")
        ARM: 9318/1: locomo: move kernel-doc to prevent warnings
        ARM: 9317/1: kexec: Make smp stop calls asynchronous
        ARM: 9316/1: hw_breakpoint: fix single-stepping when using bpf_overflow_handler
        ARM: entry: Make asm coproc dispatch code NWFPE only
        ARM: iwmmxt: Use undef hook to enable coprocessor for task
        ARM: entry: Disregard Thumb undef exception in coproc dispatch
        ARM: vfp: Use undef hook for handling VFP exceptions
        ARM: kernel: Get rid of thread_info::used_cp[] array
        ARM: vfp: Reimplement VFP exception entry in C code
        ARM: vfp: Remove workaround for Feroceon CPUs
        ARM: vfp: Record VFP bounces as perf emulation faults
      87dfd85c
    • Linus Torvalds's avatar
      Merge tag 'powerpc-6.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · 4ad0a4c2
      Linus Torvalds authored
      Pull powerpc updates from Michael Ellerman:
      
       - Add HOTPLUG_SMT support (/sys/devices/system/cpu/smt) and honour the
         configured SMT state when hotplugging CPUs into the system
      
       - Combine final TLB flush and lazy TLB mm shootdown IPIs when using the
         Radix MMU to avoid a broadcast TLBIE flush on exit
      
       - Drop the exclusion between ptrace/perf watchpoints, and drop the now
         unused associated arch hooks
      
       - Add support for the "nohlt" command line option to disable CPU idle
      
       - Add support for -fpatchable-function-entry for ftrace, with GCC >=
         13.1
      
       - Rework memory block size determination, and support 256MB size on
         systems with GPUs that have hotpluggable memory
      
       - Various other small features and fixes
      
      Thanks to Andrew Donnellan, Aneesh Kumar K.V, Arnd Bergmann, Athira
      Rajeev, Benjamin Gray, Christophe Leroy, Frederic Barrat, Gautam
      Menghani, Geoff Levand, Hari Bathini, Immad Mir, Jialin Zhang, Joel
      Stanley, Jordan Niethe, Justin Stitt, Kajol Jain, Kees Cook, Krzysztof
      Kozlowski, Laurent Dufour, Liang He, Linus Walleij, Mahesh Salgaonkar,
      Masahiro Yamada, Michal Suchanek, Nageswara R Sastry, Nathan Chancellor,
      Nathan Lynch, Naveen N Rao, Nicholas Piggin, Nick Desaulniers, Omar
      Sandoval, Randy Dunlap, Reza Arbab, Rob Herring, Russell Currey, Sourabh
      Jain, Thomas Gleixner, Trevor Woerner, Uwe Kleine-König, Vaibhav Jain,
      Xiongfeng Wang, Yuan Tan, Zhang Rui, and Zheng Zengkai.
      
      * tag 'powerpc-6.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (135 commits)
        macintosh/ams: linux/platform_device.h is needed
        powerpc/xmon: Reapply "Relax frame size for clang"
        powerpc/mm/book3s64: Use 256M as the upper limit with coherent device memory attached
        powerpc/mm/book3s64: Fix build error with SPARSEMEM disabled
        powerpc/iommu: Fix notifiers being shared by PCI and VIO buses
        powerpc/mpc5xxx: Add missing fwnode_handle_put()
        powerpc/config: Disable SLAB_DEBUG_ON in skiroot
        powerpc/pseries: Remove unused hcall tracing instruction
        powerpc/pseries: Fix hcall tracepoints with JUMP_LABEL=n
        powerpc: dts: add missing space before {
        powerpc/eeh: Use pci_dev_id() to simplify the code
        powerpc/64s: Move CPU -mtune options into Kconfig
        powerpc/powermac: Fix unused function warning
        powerpc/pseries: Rework lppaca_shared_proc() to avoid DEBUG_PREEMPT
        powerpc: Don't include lppaca.h in paca.h
        powerpc/pseries: Move hcall_vphn() prototype into vphn.h
        powerpc/pseries: Move VPHN constants into vphn.h
        cxl: Drop unused detach_spa()
        powerpc: Drop zalloc_maybe_bootmem()
        powerpc/powernv: Use struct opal_prd_msg in more places
        ...
      4ad0a4c2
    • Linus Torvalds's avatar
      Merge tag 'x86_shstk_for_6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · df57721f
      Linus Torvalds authored
      Pull x86 shadow stack support from Dave Hansen:
       "This is the long awaited x86 shadow stack support, part of Intel's
        Control-flow Enforcement Technology (CET).
      
        CET consists of two related security features: shadow stacks and
        indirect branch tracking. This series implements just the shadow stack
        part of this feature, and just for userspace.
      
        The main use case for shadow stack is providing protection against
        return oriented programming attacks. It works by maintaining a
        secondary (shadow) stack using a special memory type that has
        protections against modification. When executing a CALL instruction,
        the processor pushes the return address to both the normal stack and
        to the special permission shadow stack. Upon RET, the processor pops
        the shadow stack copy and compares it to the normal stack copy.
      
        For more information, refer to the links below for the earlier
        versions of this patch set"
      
      Link: https://lore.kernel.org/lkml/20220130211838.8382-1-rick.p.edgecombe@intel.com/
      Link: https://lore.kernel.org/lkml/20230613001108.3040476-1-rick.p.edgecombe@intel.com/
      
      * tag 'x86_shstk_for_6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (47 commits)
        x86/shstk: Change order of __user in type
        x86/ibt: Convert IBT selftest to asm
        x86/shstk: Don't retry vm_munmap() on -EINTR
        x86/kbuild: Fix Documentation/ reference
        x86/shstk: Move arch detail comment out of core mm
        x86/shstk: Add ARCH_SHSTK_STATUS
        x86/shstk: Add ARCH_SHSTK_UNLOCK
        x86: Add PTRACE interface for shadow stack
        selftests/x86: Add shadow stack test
        x86/cpufeatures: Enable CET CR4 bit for shadow stack
        x86/shstk: Wire in shadow stack interface
        x86: Expose thread features in /proc/$PID/status
        x86/shstk: Support WRSS for userspace
        x86/shstk: Introduce map_shadow_stack syscall
        x86/shstk: Check that signal frame is shadow stack mem
        x86/shstk: Check that SSP is aligned on sigreturn
        x86/shstk: Handle signals for shadow stack
        x86/shstk: Introduce routines modifying shstk
        x86/shstk: Handle thread shadow stack
        x86/shstk: Add user-mode shadow stack support
        ...
      df57721f
    • Randy Dunlap's avatar
      macintosh/ams: linux/platform_device.h is needed · 85a61641
      Randy Dunlap authored
      ams.h uses struct platform_device, so the header should be used
      to prevent build errors:
      
      drivers/macintosh/ams/ams-input.c: In function 'ams_input_enable':
      drivers/macintosh/ams/ams-input.c:68:45: error: invalid use of undefined type 'struct platform_device'
         68 |         input->dev.parent = &ams_info.of_dev->dev;
      drivers/macintosh/ams/ams-input.c: In function 'ams_input_init':
      drivers/macintosh/ams/ams-input.c:146:51: error: invalid use of undefined type 'struct platform_device'
        146 |         return device_create_file(&ams_info.of_dev->dev, &dev_attr_joystick);
      drivers/macintosh/ams/ams-input.c: In function 'ams_input_exit':
      drivers/macintosh/ams/ams-input.c:151:44: error: invalid use of undefined type 'struct platform_device'
        151 |         device_remove_file(&ams_info.of_dev->dev, &dev_attr_joystick);
      drivers/macintosh/ams/ams-input.c: In function 'ams_input_init':
      drivers/macintosh/ams/ams-input.c:147:1: error: control reaches end of non-void function [-Werror=return-type]
        147 | }
      
      Fixes: 233d687d ("macintosh: Explicitly include correct DT includes")
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://msgid.link/20230829225837.15520-1-rdunlap@infradead.org
      85a61641
    • Christoph Hellwig's avatar
      NFS: switch back to using kill_anon_super · 5069ba84
      Christoph Hellwig authored
      NFS switch to open coding kill_anon_super in 7b14a213
      ("nfs: don't call bdi_unregister") to avoid the extra bdi_unregister
      call.  At that point bdi_destroy was called in nfs_free_server and
      thus it required a later freeing of the anon dev_t.  But since
      0db10944 ("nfs: Convert to separately allocated bdi") the bdi has
      been free implicitly by the sb destruction, so this isn't needed
      anymore.
      
      By not open coding kill_anon_super, nfs now inherits the fix in
      dc3216b1 ("super: ensure valid info"), and we remove the only
      open coded version of kill_anon_super.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Message-Id: <20230831052940.256193-1-hch@lst.de>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      5069ba84
    • Christian Brauner's avatar
      mtd: key superblock by device number · ec952aa2
      Christian Brauner authored
      The mtd driver has similar problems than the one that was fixed in
      commit dc3216b1 ("super: ensure valid info").
      
      The kill_mtd_super() helper calls shuts the superblock down but leaves
      the superblock on fs_supers as the devices are still in use but puts the
      mtd device and cleans out the superblock's s_mtd field.
      
      This means another mounter can find the superblock on the list accessing
      its s_mtd field while it is curently in the process of being freed or
      already freed.
      
      Prevent that from happening by keying superblock by dev_t just as we do
      in the generic code.
      
      Link: https://lore.kernel.org/linux-fsdevel/20230829-weitab-lauwarm-49c40fc85863@braunerAcked-by: default avatarRichard Weinberger <richard@nod.at>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Message-Id: <20230829-vfs-super-mtd-v1-2-fecb572e5df3@kernel.org>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      ec952aa2
    • Christian Brauner's avatar
      fs: export sget_dev() · 69881be3
      Christian Brauner authored
      They will be used for mtd devices as well.
      Acked-by: default avatarRichard Weinberger <richard@nod.at>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Message-Id: <20230829-vfs-super-mtd-v1-1-fecb572e5df3@kernel.org>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      69881be3
    • Nathan Chancellor's avatar
      lib/Kconfig.debug: Restrict DEBUG_INFO_SPLIT for RISC-V · 89775a27
      Nathan Chancellor authored
      When building for ARCH=riscv using LLVM < 14, there is an error with
      CONFIG_DEBUG_INFO_SPLIT=y:
      
        error: A dwo section may not contain relocations
      
      This was worked around in LLVM 15 by disallowing '-gsplit-dwarf' with
      '-mrelax' (the default), so CONFIG_DEBUG_INFO_SPLIT is not selectable
      with newer versions of LLVM:
      
        $ clang --target=riscv64-linux-gnu -gsplit-dwarf -c -o /dev/null -x c /dev/null
        clang: error: -gsplit-dwarf is unsupported with RISC-V linker relaxation (-mrelax)
      
      GCC silently had a similar issue that was resolved with GCC 12.x.
      Restrict CONFIG_DEBUG_INFO_SPLIT for RISC-V when using LLVM or GCC <
      12.x to avoid these known issues.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/1914
      Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090Reported-by: default avatarkernel test robot <lkp@intel.com>
      Closes: https://lore.kernel.org/all/202308090204.9yZffBWo-lkp@intel.com/Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Reviewed-by: default avatarFangrui Song <maskray@google.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Link: https://lore.kernel.org/r/20230816-riscv-debug_info_split-v1-1-d1019d6ccc11@kernel.orgSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      89775a27
    • Palmer Dabbelt's avatar
      Merge patch series "RISC-V: mm: Make SV48 the default address space" · 94f00388
      Palmer Dabbelt authored
      Charlie Jenkins <charlie@rivosinc.com> says:
      
      Make sv48 the default address space for mmap as some applications
      currently depend on this assumption. Users can now select a
      desired address space using a non-zero hint address to mmap. Previously,
      requesting the default address space from mmap by passing zero as the hint
      address would result in using the largest address space possible. Some
      applications depend on empty bits in the virtual address space, like Go and
      Java, so this patch provides more flexibility for application developers.
      
      * b4-shazam-merge:
        RISC-V: mm: Document mmap changes
        RISC-V: mm: Update pgtable comment documentation
        RISC-V: mm: Add tests for RISC-V mm
        RISC-V: mm: Restrict address space for sv39,sv48,sv57
      
      Link: https://lore.kernel.org/r/20230809232218.849726-1-charlie@rivosinc.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      94f00388
    • Palmer Dabbelt's avatar
      Merge patch series "riscv: Reduce ARCH_KMALLOC_MINALIGN to 8" · 52b77c28
      Palmer Dabbelt authored
      Jisheng Zhang <jszhang@kernel.org> says:
      
      Currently, riscv defines ARCH_DMA_MINALIGN as L1_CACHE_BYTES, I.E
      64Bytes, if CONFIG_RISCV_DMA_NONCOHERENT=y. To support unified kernel
      Image, usually we have to enable CONFIG_RISCV_DMA_NONCOHERENT, thus
      it brings some bad effects to coherent platforms:
      
      Firstly, it wastes memory, kmalloc-96, kmalloc-32, kmalloc-16 and
      kmalloc-8 slab caches don't exist any more, they are replaced with
      either kmalloc-128 or kmalloc-64.
      
      Secondly, larger than necessary kmalloc aligned allocations results
      in unnecessary cache/TLB pressure.
      
      This issue also exists on arm64 platforms. From last year, Catalin
      tried to solve this issue by decoupling ARCH_KMALLOC_MINALIGN from
      ARCH_DMA_MINALIGN, limiting kmalloc() minimum alignment to
      dma_get_cache_alignment() and replacing ARCH_KMALLOC_MINALIGN usage
      in various drivers with ARCH_DMA_MINALIGN etc.[1]
      
      One fact we can make use of for riscv: if the CPU doesn't support
      ZICBOM or T-HEAD CMO, we know the platform is coherent. Based on
      Catalin's work and above fact, we can easily solve the kmalloc align
      issue for riscv: we can override dma_get_cache_alignment(), then let
      it return ARCH_DMA_MINALIGN at the beginning and return 1 once we know
      the underlying HW neither supports ZICBOM nor supports T-HEAD CMO.
      
      So what about if the CPU supports ZICBOM or T-HEAD CMO, but all the
      devices are dma coherent? Well, we use ARCH_DMA_MINALIGN as the
      kmalloc minimum alignment, nothing changed in this case. This case
      can be improved in the future once we see such platforms in mainline.
      
      After this patch, a simple test of booting to a small buildroot rootfs
      on qemu shows:
      
      kmalloc-96           5041    5041     96  ...
      kmalloc-64           9606    9606     64  ...
      kmalloc-32           5128    5128     32  ...
      kmalloc-16           7682    7682     16  ...
      kmalloc-8           10246   10246      8  ...
      
      So we save about 1268KB memory. The saving will be much larger in normal
      OS env on real HW platforms.
      
      patch1 allows kmalloc() caches aligned to the smallest value.
      patch2 enables DMA_BOUNCE_UNALIGNED_KMALLOC.
      
      After this series:
      
      As for coherent platforms, kmalloc-{8,16,32,96} caches come back on
      coherent both RV32 and RV64 platforms, I.E !ZICBOM and !THEAD_CMO.
      
      As for noncoherent RV32 platforms, nothing changed.
      
      As for noncoherent RV64 platforms, I.E either ZICBOM or THEAD_CMO, the
      above kmalloc caches also come back if > 4GB memory or users pass
      "swiotlb=mmnn,force" to force swiotlb creation if <= 4GB memory. How
      much mmnn should be depends on the specific platform, it needs to be
      tried and tested all possible usage case on the specific hardware. For
      example, I can use the minimal I/O TLB slabs on Sipeed M1S Dock.
      
      * b4-shazam-merge:
        riscv: enable DMA_BOUNCE_UNALIGNED_KMALLOC for !dma_coherent
        riscv: allow kmalloc() caches aligned to the smallest value
      
      Link: https://lore.kernel.org/linux-arm-kernel/20230524171904.3967031-1-catalin.marinas@arm.com/ [1]
      Link: https://lore.kernel.org/r/20230718152214.2907-1-jszhang@kernel.orgSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      52b77c28
    • Jisheng Zhang's avatar
      riscv: support PREEMPT_DYNAMIC with static keys · 4e90d052
      Jisheng Zhang authored
      Currently, each architecture can support PREEMPT_DYNAMIC through
      either static calls or static keys. To support PREEMPT_DYNAMIC on
      riscv, we face three choices:
      
      1. only add static calls support to riscv
      As Mark pointed out in commit 99cf983c ("sched/preempt: Add
      PREEMPT_DYNAMIC using static keys"), static keys "...should have
      slightly lower overhead than non-inline static calls, as this
      effectively inlines each trampoline into the start of its callee. This
      may avoid redundant work, and may integrate better with CFI schemes."
      So even we add static calls(without inline static calls) to riscv,
      static keys is still a better choice.
      
      2. add static calls and inline static calls to riscv
      Per my understanding, inline static calls requires objtool support
      which is not easy.
      
      3. use static keys
      
      While riscv doesn't have static calls support, it supports static keys
      perfectly. So this patch selects HAVE_PREEMPT_DYNAMIC_KEY to enable
      support for PREEMPT_DYNAMIC on riscv, so that the preemption model can
      be chosen at boot time. It also patches asm-generic/preempt.h, mainly
      to add __preempt_schedule() and __preempt_schedule_notrace() macros
      for PREEMPT_DYNAMIC case. Other architectures which use generic
      preempt.h can also benefit from this patch by simply selecting
      HAVE_PREEMPT_DYNAMIC_KEY to enable PREEMPT_DYNAMIC if they supports
      static keys.
      Signed-off-by: default avatarJisheng Zhang <jszhang@kernel.org>
      Reviewed-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Link: https://lore.kernel.org/r/20230716164925.1858-1-jszhang@kernel.orgSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      4e90d052
    • Palmer Dabbelt's avatar
      Merge patch series "riscv: support ELF format binaries in nommu mode" · 150e3c92
      Palmer Dabbelt authored
      Greg Ungerer <gerg@kernel.org> says:
      
      The following changes add the ability to run ELF format binaries when
      running RISC-V in nommu mode. That support is actually part of the
      ELF-FDPIC loader, so these changes are all about making that work on
      RISC-V.
      
      The first issue to deal with is making the ELF-FDPIC loader capable of
      handling 64-bit ELF files. As coded right now it only supports 32-bit
      ELF files.
      
      Secondly some changes are required to enable and compile the ELF-FDPIC
      loader on RISC-V and to pass the ELF-FDPIC mapping addresses through to
      user space when execing the new program.
      
      These changes have not been used to run actual ELF-FDPIC binaries.
      It is used to load and run normal ELF - compiled -pie format. Though the
      underlying changes are expected to work with full ELF-FDPIC binaries if
      or when that is supported on RISC-V in gcc.
      
      To avoid needing changes to the C-library (tested with uClibc-ng
      currently) there is a simple runtime dynamic loader (interpreter)
      available to do the final relocations, https://github.com/gregungerer/uldso.
      The nice thing about doing it this way is that the same program
      binary can also be loaded with the usual ELF loader in MMU linux.
      
      The motivation here is to provide an easy to use alternative to the
      flat format binaries normally used for RISC-V nommu based systems.
      
      * b4-shazam-merge:
        riscv: support the elf-fdpic binfmt loader
        binfmt_elf_fdpic: support 64-bit systems
      
      Link: https://lore.kernel.org/r/20230711130754.481209-1-gerg@kernel.orgSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      150e3c92
    • Palmer Dabbelt's avatar
      Merge patch series "riscv: KCFI support" · 7f7d3ea6
      Palmer Dabbelt authored
      Sami Tolvanen <samitolvanen@google.com> says:
      
      This series adds KCFI support for RISC-V. KCFI is a fine-grained
      forward-edge control-flow integrity scheme supported in Clang >=16,
      which ensures indirect calls in instrumented code can only branch to
      functions whose type matches the function pointer type, thus making
      code reuse attacks more difficult.
      
      Patch 1 implements a pt_regs based syscall wrapper to address
      function pointer type mismatches in syscall handling. Patches 2 and 3
      annotate indirectly called assembly functions with CFI types. Patch 4
      implements error handling for indirect call checks. Patch 5 disables
      CFI for arch/riscv/purgatory. Patch 6 finally allows CONFIG_CFI_CLANG
      to be enabled for RISC-V.
      
      Note that Clang 16 has a generic architecture-agnostic KCFI
      implementation, which does work with the kernel, but doesn't produce
      a stable code sequence for indirect call checks, which means
      potential failures just trap and won't result in informative error
      messages. Clang 17 includes a RISC-V specific back-end implementation
      for KCFI, which emits a predictable code sequence for the checks and a
      .kcfi_traps section with locations of the traps, which patch 5 uses to
      produce more useful errors.
      
      The type mismatch fixes and annotations in the first three patches
      also become necessary in future if the kernel decides to support
      fine-grained CFI implemented using the hardware landing pad
      feature proposed in the in-progress Zicfisslp extension. Once the
      specification is ratified and hardware support emerges, implementing
      runtime patching support that replaces KCFI instrumentation with
      Zicfisslp landing pads might also be feasible (similarly to KCFI to
      FineIBT patching on x86_64), allowing distributions to ship a unified
      kernel binary for all devices.
      
      * b4-shazam-merge:
        riscv: Allow CONFIG_CFI_CLANG to be selected
        riscv/purgatory: Disable CFI
        riscv: Add CFI error handling
        riscv: Add ftrace_stub_graph
        riscv: Add types to indirectly called assembly functions
        riscv: Implement syscall wrappers
      
      Link: https://lore.kernel.org/r/20230710183544.999540-8-samitolvanen@google.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      7f7d3ea6
    • Alexandre Ghiti's avatar
      riscv: Move create_tmp_mapping() to init sections · 9bdd9248
      Alexandre Ghiti authored
      This function is only used at boot time so mark it as __init.
      
      Fixes: 96f9d4da ("riscv: Rework kasan population functions")
      Signed-off-by: default avatarAlexandre Ghiti <alexghiti@rivosinc.com>
      Link: https://lore.kernel.org/r/20230704074357.233982-2-alexghiti@rivosinc.com
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      9bdd9248