1. 31 Aug, 2023 1 commit
  2. 30 Aug, 2023 2 commits
    • Christoph Hellwig's avatar
      dma-contiguous: fix the Kconfig entry for CONFIG_DMA_NUMA_CMA · 2dcdf8c1
      Christoph Hellwig authored
      It makes no sense to expose CONFIG_DMA_NUMA_CMA if CONFIG_NUMA is not
      enabled, and random config options shouldn't be default unless there
      is a good reason.  Replace the default NUMA with a depends on to fix both
      issues.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarRobin Murphy <roin.murphy@arm.com>
      2dcdf8c1
    • Sergey Senozhatsky's avatar
      dma-debug: don't call __dma_entry_alloc_check_leak() under free_entries_lock · fb5a4315
      Sergey Senozhatsky authored
      __dma_entry_alloc_check_leak() calls into printk -> serial console
      output (qcom geni) and grabs port->lock under free_entries_lock
      spin lock, which is a reverse locking dependency chain as qcom_geni
      IRQ handler can call into dma-debug code and grab free_entries_lock
      under port->lock.
      
      Move __dma_entry_alloc_check_leak() call out of free_entries_lock
      scope so that we don't acquire serial console's port->lock under it.
      
      Trimmed-down lockdep splat:
      
       The existing dependency chain (in reverse order) is:
      
                     -> #2 (free_entries_lock){-.-.}-{2:2}:
              _raw_spin_lock_irqsave+0x60/0x80
              dma_entry_alloc+0x38/0x110
              debug_dma_map_page+0x60/0xf8
              dma_map_page_attrs+0x1e0/0x230
              dma_map_single_attrs.constprop.0+0x6c/0xc8
              geni_se_rx_dma_prep+0x40/0xcc
              qcom_geni_serial_isr+0x310/0x510
              __handle_irq_event_percpu+0x110/0x244
              handle_irq_event_percpu+0x20/0x54
              handle_irq_event+0x50/0x88
              handle_fasteoi_irq+0xa4/0xcc
              handle_irq_desc+0x28/0x40
              generic_handle_domain_irq+0x24/0x30
              gic_handle_irq+0xc4/0x148
              do_interrupt_handler+0xa4/0xb0
              el1_interrupt+0x34/0x64
              el1h_64_irq_handler+0x18/0x24
              el1h_64_irq+0x64/0x68
              arch_local_irq_enable+0x4/0x8
              ____do_softirq+0x18/0x24
              ...
      
                     -> #1 (&port_lock_key){-.-.}-{2:2}:
              _raw_spin_lock_irqsave+0x60/0x80
              qcom_geni_serial_console_write+0x184/0x1dc
              console_flush_all+0x344/0x454
              console_unlock+0x94/0xf0
              vprintk_emit+0x238/0x24c
              vprintk_default+0x3c/0x48
              vprintk+0xb4/0xbc
              _printk+0x68/0x90
              register_console+0x230/0x38c
              uart_add_one_port+0x338/0x494
              qcom_geni_serial_probe+0x390/0x424
              platform_probe+0x70/0xc0
              really_probe+0x148/0x280
              __driver_probe_device+0xfc/0x114
              driver_probe_device+0x44/0x100
              __device_attach_driver+0x64/0xdc
              bus_for_each_drv+0xb0/0xd8
              __device_attach+0xe4/0x140
              device_initial_probe+0x1c/0x28
              bus_probe_device+0x44/0xb0
              device_add+0x538/0x668
              of_device_add+0x44/0x50
              of_platform_device_create_pdata+0x94/0xc8
              of_platform_bus_create+0x270/0x304
              of_platform_populate+0xac/0xc4
              devm_of_platform_populate+0x60/0xac
              geni_se_probe+0x154/0x160
              platform_probe+0x70/0xc0
              ...
      
                     -> #0 (console_owner){-...}-{0:0}:
              __lock_acquire+0xdf8/0x109c
              lock_acquire+0x234/0x284
              console_flush_all+0x330/0x454
              console_unlock+0x94/0xf0
              vprintk_emit+0x238/0x24c
              vprintk_default+0x3c/0x48
              vprintk+0xb4/0xbc
              _printk+0x68/0x90
              dma_entry_alloc+0xb4/0x110
              debug_dma_map_sg+0xdc/0x2f8
              __dma_map_sg_attrs+0xac/0xe4
              dma_map_sgtable+0x30/0x4c
              get_pages+0x1d4/0x1e4 [msm]
              msm_gem_pin_pages_locked+0x38/0xac [msm]
              msm_gem_pin_vma_locked+0x58/0x88 [msm]
              msm_ioctl_gem_submit+0xde4/0x13ac [msm]
              drm_ioctl_kernel+0xe0/0x15c
              drm_ioctl+0x2e8/0x3f4
              vfs_ioctl+0x30/0x50
              ...
      
       Chain exists of:
         console_owner --> &port_lock_key --> free_entries_lock
      
        Possible unsafe locking scenario:
      
              CPU0                    CPU1
              ----                    ----
         lock(free_entries_lock);
                                      lock(&port_lock_key);
                                      lock(free_entries_lock);
         lock(console_owner);
      
                      *** DEADLOCK ***
      
       Call trace:
        dump_backtrace+0xb4/0xf0
        show_stack+0x20/0x30
        dump_stack_lvl+0x60/0x84
        dump_stack+0x18/0x24
        print_circular_bug+0x1cc/0x234
        check_noncircular+0x78/0xac
        __lock_acquire+0xdf8/0x109c
        lock_acquire+0x234/0x284
        console_flush_all+0x330/0x454
        console_unlock+0x94/0xf0
        vprintk_emit+0x238/0x24c
        vprintk_default+0x3c/0x48
        vprintk+0xb4/0xbc
        _printk+0x68/0x90
        dma_entry_alloc+0xb4/0x110
        debug_dma_map_sg+0xdc/0x2f8
        __dma_map_sg_attrs+0xac/0xe4
        dma_map_sgtable+0x30/0x4c
        get_pages+0x1d4/0x1e4 [msm]
        msm_gem_pin_pages_locked+0x38/0xac [msm]
        msm_gem_pin_vma_locked+0x58/0x88 [msm]
        msm_ioctl_gem_submit+0xde4/0x13ac [msm]
        drm_ioctl_kernel+0xe0/0x15c
        drm_ioctl+0x2e8/0x3f4
        vfs_ioctl+0x30/0x50
        ...
      Reported-by: default avatarRob Clark <robdclark@chromium.org>
      Signed-off-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
      Acked-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      fb5a4315
  3. 08 Aug, 2023 2 commits
  4. 01 Aug, 2023 9 commits
    • Petr Tesarik's avatar
      swiotlb: search the software IO TLB only if the device makes use of it · 1395706a
      Petr Tesarik authored
      Skip searching the software IO TLB if a device has never used it, making
      sure these devices are not affected by the introduction of multiple IO TLB
      memory pools.
      
      Additional memory barrier is required to ensure that the new value of the
      flag is visible to other CPUs after mapping a new bounce buffer. For
      efficiency, the flag check should be inlined, and then the memory barrier
      must be moved to is_swiotlb_buffer(). However, it can replace the existing
      barrier in swiotlb_find_pool(), because all callers use is_swiotlb_buffer()
      first to verify that the buffer address belongs to the software IO TLB.
      Signed-off-by: default avatarPetr Tesarik <petr.tesarik.ext@huawei.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      1395706a
    • Petr Tesarik's avatar
      swiotlb: allocate a new memory pool when existing pools are full · 1aaa7368
      Petr Tesarik authored
      When swiotlb_find_slots() cannot find suitable slots, schedule the
      allocation of a new memory pool. It is not possible to allocate the pool
      immediately, because this code may run in interrupt context, which is not
      suitable for large memory allocations. This means that the memory pool will
      be available too late for the currently requested mapping, but the stress
      on the software IO TLB allocator is likely to continue, and subsequent
      allocations will benefit from the additional pool eventually.
      
      Keep all memory pools for an allocator in an RCU list to avoid locking on
      the read side. For modifications, add a new spinlock to struct io_tlb_mem.
      
      The spinlock also protects updates to the total number of slabs (nslabs in
      struct io_tlb_mem), but not reads of the value. Readers may therefore
      encounter a stale value, but this is not an issue:
      
      - swiotlb_tbl_map_single() and is_swiotlb_active() only check for non-zero
        value. This is ensured by the existence of the default memory pool,
        allocated at boot.
      
      - The exact value is used only for non-critical purposes (debugfs, kernel
        messages).
      Signed-off-by: default avatarPetr Tesarik <petr.tesarik.ext@huawei.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      1aaa7368
    • Petr Tesarik's avatar
      swiotlb: determine potential physical address limit · ad96ce32
      Petr Tesarik authored
      The value returned by default_swiotlb_limit() should be constant, because
      it is used to decide whether DMA can be used. To allow allocating memory
      pools on the fly, use the maximum possible physical address rather than the
      highest address used by the default pool.
      
      For swiotlb_init_remap(), this is either an arch-specific limit used by
      memblock_alloc_low(), or the highest directly mapped physical address if
      the initialization flags include SWIOTLB_ANY. For swiotlb_init_late(), the
      highest address is determined by the GFP flags.
      Signed-off-by: default avatarPetr Tesarik <petr.tesarik.ext@huawei.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      ad96ce32
    • Petr Tesarik's avatar
      swiotlb: if swiotlb is full, fall back to a transient memory pool · 79636caa
      Petr Tesarik authored
      Try to allocate a transient memory pool if no suitable slots can be found
      and the respective SWIOTLB is allowed to grow. The transient pool is just
      enough big for this one bounce buffer. It is inserted into a per-device
      list of transient memory pools, and it is freed again when the bounce
      buffer is unmapped.
      
      Transient memory pools are kept in an RCU list. A memory barrier is
      required after adding a new entry, because any address within a transient
      buffer must be immediately recognized as belonging to the SWIOTLB, even if
      it is passed to another CPU.
      
      Deletion does not require any synchronization beyond RCU ordering
      guarantees. After a buffer is unmapped, its physical addresses may no
      longer be passed to the DMA API, so the memory range of the corresponding
      stale entry in the RCU list never matches. If the memory range gets
      allocated again, then it happens only after a RCU quiescent state.
      
      Since bounce buffers can now be allocated from different pools, add a
      parameter to swiotlb_alloc_pool() to let the caller know which memory pool
      is used. Add swiotlb_find_pool() to find the memory pool corresponding to
      an address. This function is now also used by is_swiotlb_buffer(), because
      a simple boundary check is no longer sufficient.
      
      The logic in swiotlb_alloc_tlb() is taken from __dma_direct_alloc_pages(),
      simplified and enhanced to use coherent memory pools if needed.
      
      Note that this is not the most efficient way to provide a bounce buffer,
      but when a DMA buffer can't be mapped, something may (and will) actually
      break. At that point it is better to make an allocation, even if it may be
      an expensive operation.
      Signed-off-by: default avatarPetr Tesarik <petr.tesarik.ext@huawei.com>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      79636caa
    • Petr Tesarik's avatar
      swiotlb: add a flag whether SWIOTLB is allowed to grow · 62708b2b
      Petr Tesarik authored
      Add a config option (CONFIG_SWIOTLB_DYNAMIC) to enable or disable dynamic
      allocation of additional bounce buffers.
      
      If this option is set, mark the default SWIOTLB as able to grow and
      restricted DMA pools as unable.
      
      However, if the address of the default memory pool is explicitly queried,
      make the default SWIOTLB also unable to grow. This is currently used to set
      up PCI BAR movable regions on some Octeon MIPS boards which may not be able
      to use a SWIOTLB pool elsewhere in physical memory. See octeon_pci_setup()
      for more details.
      
      If a remap function is specified, it must be also called on any dynamically
      allocated pools, but there are some issues:
      
      - The remap function may block, so it should not be called from an atomic
        context.
      - There is no corresponding unremap() function if the memory pool is
        freed.
      - The only in-tree implementation (xen_swiotlb_fixup) requires that the
        number of slots in the memory pool is a multiple of SWIOTLB_SEGSIZE.
      
      Keep it simple for now and disable growing the SWIOTLB if a remap function
      was specified.
      Signed-off-by: default avatarPetr Tesarik <petr.tesarik.ext@huawei.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      62708b2b
    • Petr Tesarik's avatar
      swiotlb: separate memory pool data from other allocator data · 158dbe9c
      Petr Tesarik authored
      Carve out memory pool specific fields from struct io_tlb_mem. The original
      struct now contains shared data for the whole allocator, while the new
      struct io_tlb_pool contains data that is specific to one memory pool of
      (potentially) many.
      Signed-off-by: default avatarPetr Tesarik <petr.tesarik.ext@huawei.com>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      158dbe9c
    • Petr Tesarik's avatar
      swiotlb: add documentation and rename swiotlb_do_find_slots() · fea18777
      Petr Tesarik authored
      Add some kernel-doc comments and move the existing documentation of struct
      io_tlb_slot to its correct location. The latter was forgotten in commit
      942a8186 ("swiotlb: move struct io_tlb_slot to swiotlb.c").
      
      Use the opportunity to give swiotlb_do_find_slots() a more descriptive name
      and make it clear how it differs from swiotlb_find_slots().
      Signed-off-by: default avatarPetr Tesarik <petr.tesarik.ext@huawei.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      fea18777
    • Petr Tesarik's avatar
      swiotlb: make io_tlb_default_mem local to swiotlb.c · 05ee7741
      Petr Tesarik authored
      SWIOTLB implementation details should not be exposed to the rest of the
      kernel. This will allow to make changes to the implementation without
      modifying non-swiotlb code.
      
      To avoid breaking existing users, provide helper functions for the few
      required fields.
      
      As a bonus, using a helper function to initialize struct device allows to
      get rid of an #ifdef in driver core.
      Signed-off-by: default avatarPetr Tesarik <petr.tesarik.ext@huawei.com>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      05ee7741
    • Petr Tesarik's avatar
      swiotlb: bail out of swiotlb_init_late() if swiotlb is already allocated · 0c6874a6
      Petr Tesarik authored
      If swiotlb is allocated, immediately return 0, so callers do not have to
      check io_tlb_default_mem.nslabs explicitly.
      Signed-off-by: default avatarPetr Tesarik <petr.tesarik.ext@huawei.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      0c6874a6
  5. 31 Jul, 2023 7 commits
  6. 30 Jul, 2023 14 commits
    • Linus Torvalds's avatar
      Linux 6.5-rc4 · 5d0c230f
      Linus Torvalds authored
      5d0c230f
    • Linus Torvalds's avatar
      Merge tag 'spi-fix-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi · d5bb4b89
      Linus Torvalds authored
      Pull spi fixes from Mark Brown:
       "A bunch of fixes for the Qualcomm QSPI driver, fixing multiple issues
        with the newly added DMA mode - it had a number of issues exposed when
        tested in a wider range of use cases, both race condition style issues
        and issues with different inputs to those that had been used in test"
      
      * tag 'spi-fix-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
        spi: spi-qcom-qspi: Add mem_ops to avoid PIO for badly sized reads
        spi: spi-qcom-qspi: Fallback to PIO for xfers that aren't multiples of 4 bytes
        spi: spi-qcom-qspi: Add DMA_CHAIN_DONE to ALL_IRQS
        spi: spi-qcom-qspi: Call dma_wmb() after setting up descriptors
        spi: spi-qcom-qspi: Use GFP_ATOMIC flag while allocating for descriptor
        spi: spi-qcom-qspi: Ignore disabled interrupts' status in isr
      d5bb4b89
    • Linus Torvalds's avatar
      Merge tag 'regulator-fix-v6.5-rc3' of... · 3dfe6886
      Linus Torvalds authored
      Merge tag 'regulator-fix-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
      
      Pull regulator fixes from Mark Brown:
       "A couple of small fixes for the the mt6358 driver, fixing error
        reporting and a bootstrapping issue"
      
      * tag 'regulator-fix-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
        regulator: mt6358: Fix incorrect VCN33 sync error message
        regulator: mt6358: Sync VCN33_* enable status after checking ID
      3dfe6886
    • Linus Torvalds's avatar
      Merge tag 'usb-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 88f66f13
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are a set of USB driver fixes for 6.5-rc4. Include in here are:
      
         - new USB serial device ids
      
         - dwc3 driver fixes for reported issues
      
         - typec driver fixes for reported problems
      
         - gadget driver fixes
      
         - reverts of some problematic USB changes that went into -rc1
      
        All of these have been in linux-next with no reported problems"
      
      * tag 'usb-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (24 commits)
        usb: misc: ehset: fix wrong if condition
        usb: dwc3: pci: skip BYT GPIO lookup table for hardwired phy
        usb: cdns3: fix incorrect calculation of ep_buf_size when more than one config
        usb: gadget: call usb_gadget_check_config() to verify UDC capability
        usb: typec: Use sysfs_emit_at when concatenating the string
        usb: typec: Iterate pds array when showing the pd list
        usb: typec: Set port->pd before adding device for typec_port
        usb: typec: qcom: fix return value check in qcom_pmic_typec_probe()
        Revert "usb: gadget: tegra-xudc: Fix error check in tegra_xudc_powerdomain_init()"
        Revert "usb: xhci: tegra: Fix error check"
        USB: gadget: Fix the memory leak in raw_gadget driver
        usb: gadget: core: remove unbalanced mutex_unlock in usb_gadget_activate
        Revert "usb: dwc3: core: Enable AutoRetry feature in the controller"
        Revert "xhci: add quirk for host controllers that don't update endpoint DCS"
        USB: quirks: add quirk for Focusrite Scarlett
        usb: xhci-mtk: set the dma max_seg_size
        MAINTAINERS: drop invalid usb/cdns3 Reviewer e-mail
        usb: dwc3: don't reset device side if dwc3 was configured as host-only
        usb: typec: ucsi: move typec_set_mode(TYPEC_STATE_SAFE) to ucsi_unregister_partner()
        usb: ohci-at91: Fix the unhandle interrupt when resume
        ...
      88f66f13
    • Linus Torvalds's avatar
      Merge tag 'tty-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · e6d34ced
      Linus Torvalds authored
      Pull tty/serial fixes from Greg KH:
       "Here are some small TTY and serial driver fixes for 6.5-rc4 for some
        reported problems. Included in here is:
      
         - TIOCSTI fix for braille readers
      
         - documentation fix for minor numbers
      
         - MAINTAINERS update for new serial files in -rc1
      
         - minor serial driver fixes for reported problems
      
        All of these have been in linux-next with no reported problems"
      
      * tag 'tty-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        serial: 8250_dw: Preserve original value of DLF register
        tty: serial: sh-sci: Fix sleeping in atomic context
        serial: sifive: Fix sifive_serial_console_setup() section
        Documentation: devices.txt: reconcile serial/ucc_uart minor numers
        MAINTAINERS: Update TTY layer for lists and recently added files
        tty: n_gsm: fix UAF in gsm_cleanup_mux
        TIOCSTI: always enable for CAP_SYS_ADMIN
      e6d34ced
    • Linus Torvalds's avatar
      Merge tag 'staging-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 3d6b77a8
      Linus Torvalds authored
      Pull staging driver fixes from Greg KH:
       "Here are three small staging driver fixes for 6.5-rc4 that resolve
        some reported problems. These fixes are:
      
         - fix for an old bug in the r8712 driver
      
         - fbtft driver fix for a spi device
      
         - potential overflow fix in the ks7010 driver
      
        All of these have been in linux-next with no reported problems"
      
      * tag 'staging-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        staging: ks7010: potential buffer overflow in ks_wlan_set_encode_ext()
        staging: fbtft: ili9341: use macro FBTFT_REGISTER_SPI_DRIVER
        staging: r8712: Fix memory leak in _r8712_init_xmit_priv()
      3d6b77a8
    • Linus Torvalds's avatar
      Merge tag 'char-misc-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · cf270e7b
      Linus Torvalds authored
      Pull char driver and Documentation fixes from Greg KH:
       "Here is a char driver fix and some documentation updates for 6.5-rc4
        that contain the following changes:
      
         - sram/genalloc bugfix for reported problem
      
         - security-bugs.rst update based on recent discussions
      
         - embargoed-hardware-issues minor cleanups and then partial revert
           for the project/company lists
      
        All of these have been in linux-next for a while with no reported
        problems, and the documentation updates have all been reviewed by the
        relevant developers"
      
      * tag 'char-misc-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        misc/genalloc: Name subpools by of_node_full_name()
        Documentation: embargoed-hardware-issues.rst: add AMD to the list
        Documentation: embargoed-hardware-issues.rst: clean out empty and unused entries
        Documentation: security-bugs.rst: clarify CVE handling
        Documentation: security-bugs.rst: update preferences when dealing with the linux-distros group
      cf270e7b
    • Linus Torvalds's avatar
      Merge tag 'probes-fixes-v6.5-rc3' of... · b0b9850e
      Linus Torvalds authored
      Merge tag 'probes-fixes-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
      
      Pull probe fixes from Masami Hiramatsu:
      
       - probe-events: add NULL check for some BTF API calls which can return
         error code and NULL.
      
       - ftrace selftests: check fprobe and kprobe event correctly. This fixes
         a miss condition of the test command.
      
       - kprobes: do not allow probing functions that start with "__cfi_" or
         "__pfx_" since those are auto generated for kernel CFI and not
         executed.
      
      * tag 'probes-fixes-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        kprobes: Prohibit probing on CFI preamble symbol
        selftests/ftrace: Fix to check fprobe event eneblement
        tracing/probes: Fix to add NULL check for BTF APIs
      b0b9850e
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 98a05fe8
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "x86:
      
         - Do not register IRQ bypass consumer if posted interrupts not
           supported
      
         - Fix missed device interrupt due to non-atomic update of IRR
      
         - Use GFP_KERNEL_ACCOUNT for pid_table in ipiv
      
         - Make VMREAD error path play nice with noinstr
      
         - x86: Acquire SRCU read lock when handling fastpath MSR writes
      
         - Support linking rseq tests statically against glibc 2.35+
      
         - Fix reference count for stats file descriptors
      
         - Detect userspace setting invalid CR0
      
        Non-KVM:
      
         - Remove coccinelle script that has caused multiple confusion
           ("debugfs, coccinelle: check for obsolete DEFINE_SIMPLE_ATTRIBUTE()
           usage", acked by Greg)"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (21 commits)
        KVM: selftests: Expand x86's sregs test to cover illegal CR0 values
        KVM: VMX: Don't fudge CR0 and CR4 for restricted L2 guest
        KVM: x86: Disallow KVM_SET_SREGS{2} if incoming CR0 is invalid
        Revert "debugfs, coccinelle: check for obsolete DEFINE_SIMPLE_ATTRIBUTE() usage"
        KVM: selftests: Verify stats fd is usable after VM fd has been closed
        KVM: selftests: Verify stats fd can be dup()'d and read
        KVM: selftests: Verify userspace can create "redundant" binary stats files
        KVM: selftests: Explicitly free vcpus array in binary stats test
        KVM: selftests: Clean up stats fd in common stats_test() helper
        KVM: selftests: Use pread() to read binary stats header
        KVM: Grab a reference to KVM for VM and vCPU stats file descriptors
        selftests/rseq: Play nice with binaries statically linked against glibc 2.35+
        Revert "KVM: SVM: Skip WRMSR fastpath on VM-Exit if next RIP isn't valid"
        KVM: x86: Acquire SRCU read lock when handling fastpath MSR writes
        KVM: VMX: Use vmread_error() to report VM-Fail in "goto" path
        KVM: VMX: Make VMREAD error path play nice with noinstr
        KVM: x86/irq: Conditionally register IRQ bypass consumer again
        KVM: X86: Use GFP_KERNEL_ACCOUNT for pid_table in ipiv
        KVM: x86: check the kvm_cpu_get_interrupt result before using it
        KVM: x86: VMX: set irr_pending in kvm_apic_update_irr
        ...
      98a05fe8
    • Linus Torvalds's avatar
      Merge tag 'locking_urgent_for_v6.5_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · c959e900
      Linus Torvalds authored
      Pull locking fix from Borislav Petkov:
      
       - Fix a rtmutex race condition resulting from sharing of the sort key
         between the lock waiters and the PI chain tree (->pi_waiters) of a
         task by giving each tree their own sort key
      
      * tag 'locking_urgent_for_v6.5_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        locking/rtmutex: Fix task->pi_waiters integrity
      c959e900
    • Linus Torvalds's avatar
      Merge tag 'x86_urgent_for_v6.5_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · d410b62e
      Linus Torvalds authored
      Pull x86 fixes from Borislav Petkov:
      
       - AMD's automatic IBRS doesn't enable cross-thread branch target
         injection protection (STIBP) for user processes. Enable STIBP on such
         systems.
      
       - Do not delete (but put the ref instead) of AMD MCE error thresholding
         sysfs kobjects when destroying them in order not to delete the kernfs
         pointer prematurely
      
       - Restore annotation in ret_from_fork_asm() in order to fix kthread
         stack unwinding from being marked as unreliable and thus breaking
         livepatching
      
      * tag 'x86_urgent_for_v6.5_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/cpu: Enable STIBP on AMD if Automatic IBRS is enabled
        x86/MCE/AMD: Decrement threshold_bank refcount when removing threshold blocks
        x86: Fix kthread unwind
      d410b62e
    • Linus Torvalds's avatar
      Merge tag 'irq_urgent_for_v6.5_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · eb9fe179
      Linus Torvalds authored
      Pull irq fixes from Borislav Petkov:
      
       - Work around an erratum on GIC700, where a race between a CPU handling
         a wake-up interrupt, a change of affinity, and another CPU going to
         sleep can result in a lack of wake-up event on the next interrupt
      
       - Fix the locking required on a VPE for GICv4
      
       - Enable Rockchip 3588001 erratum workaround for RK3588S
      
       - Fix the irq-bcm6345-l1 assumtions of the boot CPU always be the first
         CPU in the system
      
      * tag 'irq_urgent_for_v6.5_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/gic-v3: Workaround for GIC-700 erratum 2941627
        irqchip/gic-v3: Enable Rockchip 3588001 erratum workaround for RK3588S
        irqchip/gic-v4.1: Properly lock VPEs when doing a directLPI invalidation
        irq-bcm6345-l1: Do not assume a fixed block to cpu mapping
      eb9fe179
    • Linus Torvalds's avatar
      Merge tag '6.5-rc3-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6 · d31e3792
      Linus Torvalds authored
      Pull smb client fixes from Steve French:
       "Four small SMB3 client fixes:
      
         - two reconnect fixes (to address the case where non-default
           iocharset gets incorrectly overridden at reconnect with the
           default charset)
      
         - fix for NTLMSSP_AUTH request setting a flag incorrectly)
      
         - Add missing check for invalid tlink (tree connection) in ioctl"
      
      * tag '6.5-rc3-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: add missing return value check for cifs_sb_tlink
        smb3: do not set NTLMSSP_VERSION flag for negotiate not auth request
        cifs: fix charset issue in reconnection
        fs/nls: make load_nls() take a const parameter
      d31e3792
    • Linus Torvalds's avatar
      Merge tag 'trace-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace · b88e123c
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
      
       - Fix to /sys/kernel/tracing/per_cpu/cpu*/stats read and entries.
      
         If a resize shrinks the buffer it clears the read count to notify
         readers that they need to reset. But the read count is also used for
         accounting and this causes the numbers to be off. Instead, create a
         separate variable to use to notify readers to reset.
      
       - Fix the ref counts of the "soft disable" mode. The wrong value was
         used for testing if soft disable mode should be enabled or disable,
         but instead, just change the logic to do the enable and disable in
         place when the SOFT_MODE is set or cleared.
      
       - Several kernel-doc fixes
      
       - Removal of unused external declarations
      
      * tag 'trace-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        tracing: Fix warning in trace_buffered_event_disable()
        ftrace: Remove unused extern declarations
        tracing: Fix kernel-doc warnings in trace_seq.c
        tracing: Fix kernel-doc warnings in trace_events_trigger.c
        tracing/synthetic: Fix kernel-doc warnings in trace_events_synth.c
        ring-buffer: Fix kernel-doc warnings in ring_buffer.c
        ring-buffer: Fix wrong stat of cpu_buffer->read
      b88e123c
  7. 29 Jul, 2023 5 commits
    • Sven Joachim's avatar
      arch/*/configs/*defconfig: Replace AUTOFS4_FS by AUTOFS_FS · 1f2190d6
      Sven Joachim authored
      Commit a2225d93 ("autofs: remove left-over autofs4 stubs")
      promised the removal of the fs/autofs/Kconfig fragment for AUTOFS4_FS
      within a couple of releases, but five years later this still has not
      happened yet, and AUTOFS4_FS is still enabled in 63 defconfigs.
      
      Get rid of it mechanically:
      
         git grep -l CONFIG_AUTOFS4_FS -- '*defconfig' |
             xargs sed -i 's/AUTOFS4_FS/AUTOFS_FS/'
      
      Also just remove the AUTOFS4_FS config option stub.  Anybody who hasn't
      regenerated their config file in the last five years will need to just
      get the new name right when they do.
      Signed-off-by: default avatarSven Joachim <svenjoac@gmx.de>
      Acked-by: default avatarIan Kent <raven@themaw.net>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1f2190d6
    • Linus Torvalds's avatar
      Merge tag 'loongarch-fixes-6.5-1' of... · 12214540
      Linus Torvalds authored
      Merge tag 'loongarch-fixes-6.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
      
      Pull LoongArch fixes from Huacai Chen:
       "Some bug fixes for build system, builtin cmdline handling, bpf and
        {copy, clear}_user, together with a trivial cleanup"
      
      * tag 'loongarch-fixes-6.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson:
        LoongArch: Cleanup __builtin_constant_p() checking for cpu_has_*
        LoongArch: BPF: Fix check condition to call lu32id in move_imm()
        LoongArch: BPF: Enable bpf_probe_read{, str}() on LoongArch
        LoongArch: Fix return value underflow in exception path
        LoongArch: Fix CMDLINE_EXTEND and CMDLINE_BOOTLOADER handling
        LoongArch: Fix module relocation error with binutils 2.41
        LoongArch: Only fiddle with CHECKFLAGS if `need-compiler'
      12214540
    • Sean Christopherson's avatar
      KVM: selftests: Expand x86's sregs test to cover illegal CR0 values · 5a759117
      Sean Christopherson authored
      Add coverage to x86's set_sregs_test to verify KVM rejects vendor-agnostic
      illegal CR0 values, i.e. CR0 values whose legality doesn't depend on the
      current VMX mode.  KVM historically has neglected to reject bad CR0s from
      userspace, i.e. would happily accept a completely bogus CR0 via
      KVM_SET_SREGS{2}.
      
      Punt VMX specific subtests to future work, as they would require quite a
      bit more effort, and KVM gets coverage for CR0 checks in general through
      other means, e.g. KVM-Unit-Tests.
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230613203037.1968489-4-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      5a759117
    • Sean Christopherson's avatar
      KVM: VMX: Don't fudge CR0 and CR4 for restricted L2 guest · c4abd735
      Sean Christopherson authored
      Stuff CR0 and/or CR4 to be compliant with a restricted guest if and only
      if KVM itself is not configured to utilize unrestricted guests, i.e. don't
      stuff CR0/CR4 for a restricted L2 that is running as the guest of an
      unrestricted L1.  Any attempt to VM-Enter a restricted guest with invalid
      CR0/CR4 values should fail, i.e. in a nested scenario, KVM (as L0) should
      never observe a restricted L2 with incompatible CR0/CR4, since nested
      VM-Enter from L1 should have failed.
      
      And if KVM does observe an active, restricted L2 with incompatible state,
      e.g. due to a KVM bug, fudging CR0/CR4 instead of letting VM-Enter fail
      does more harm than good, as KVM will often neglect to undo the side
      effects, e.g. won't clear rmode.vm86_active on nested VM-Exit, and thus
      the damage can easily spill over to L1.  On the other hand, letting
      VM-Enter fail due to bad guest state is more likely to contain the damage
      to L2 as KVM relies on hardware to perform most guest state consistency
      checks, i.e. KVM needs to be able to reflect a failed nested VM-Enter into
      L1 irrespective of (un)restricted guest behavior.
      
      Cc: Jim Mattson <jmattson@google.com>
      Cc: stable@vger.kernel.org
      Fixes: bddd82d1 ("KVM: nVMX: KVM needs to unset "unrestricted guest" VM-execution control in vmcs02 if vmcs12 doesn't set it")
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230613203037.1968489-3-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      c4abd735
    • Sean Christopherson's avatar
      KVM: x86: Disallow KVM_SET_SREGS{2} if incoming CR0 is invalid · 26a0652c
      Sean Christopherson authored
      Reject KVM_SET_SREGS{2} with -EINVAL if the incoming CR0 is invalid,
      e.g. due to setting bits 63:32, illegal combinations, or to a value that
      isn't allowed in VMX (non-)root mode.  The VMX checks in particular are
      "fun" as failure to disallow Real Mode for an L2 that is configured with
      unrestricted guest disabled, when KVM itself has unrestricted guest
      enabled, will result in KVM forcing VM86 mode to virtual Real Mode for
      L2, but then fail to unwind the related metadata when synthesizing a
      nested VM-Exit back to L1 (which has unrestricted guest enabled).
      
      Opportunistically fix a benign typo in the prototype for is_valid_cr4().
      
      Cc: stable@vger.kernel.org
      Reported-by: syzbot+5feef0b9ee9c8e9e5689@syzkaller.appspotmail.com
      Closes: https://lore.kernel.org/all/000000000000f316b705fdf6e2b4@google.comSigned-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20230613203037.1968489-2-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      26a0652c