1. 14 Feb, 2023 1 commit
  2. 03 Feb, 2023 2 commits
  3. 30 Jan, 2023 1 commit
    • Jason Gunthorpe's avatar
      Merge branch 'iommu-memory-accounting' of... · fd9f2a91
      Jason Gunthorpe authored
      Merge branch 'iommu-memory-accounting' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/joro/iommu intoiommufd/for-next
      
      Jason Gunthorpe says:
      
      ====================
      iommufd follows the same design as KVM and uses memory cgroups to limit
      the amount of kernel memory a iommufd file descriptor can pin down. The
      various internal data structures already use GFP_KERNEL_ACCOUNT to charge
      its own memory.
      
      However, one of the biggest consumers of kernel memory is the IOPTEs
      stored under the iommu_domain and these allocations are not tracked.
      
      This series is the first step in fixing it.
      
      The iommu driver contract already includes a 'gfp' argument to the
      map_pages op, allowing iommufd to specify GFP_KERNEL_ACCOUNT and then
      having the driver allocate the IOPTE tables with that flag will capture a
      significant amount of the allocations.
      
      Update the iommu_map() API to pass in the GFP argument, and fix all call
      sites. Replace iommu_map_atomic().
      
      Audit the "enterprise" iommu drivers to make sure they do the right thing.
      Intel and S390 ignore the GFP argument and always use GFP_ATOMIC. This is
      problematic for iommufd anyhow, so fix it. AMD and ARM SMMUv2/3 are
      already correct.
      
      A follow up series will be needed to capture the allocations made when the
      iommu_domain itself is allocated, which will complete the job.
      ====================
      
      * 'iommu-memory-accounting' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/s390: Use GFP_KERNEL in sleepable contexts
        iommu/s390: Push the gfp parameter to the kmem_cache_alloc()'s
        iommu/intel: Use GFP_KERNEL in sleepable contexts
        iommu/intel: Support the gfp argument to the map_pages op
        iommu/intel: Add a gfp parameter to alloc_pgtable_page()
        iommufd: Use GFP_KERNEL_ACCOUNT for iommu_map()
        iommu/dma: Use the gfp parameter in __iommu_dma_alloc_noncontiguous()
        iommu: Add a gfp parameter to iommu_map_sg()
        iommu: Remove iommu_map_atomic()
        iommu: Add a gfp parameter to iommu_map()
      
      Link: https://lore.kernel.org/linux-iommu/0-v3-76b587fe28df+6e3-iommu_map_gfp_jgg@nvidia.comSigned-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      fd9f2a91
  4. 25 Jan, 2023 10 commits
  5. 23 Jan, 2023 3 commits
    • Yi Liu's avatar
      iommufd: Add three missing structures in ucmd_buffer · 84798f28
      Yi Liu authored
      struct iommu_ioas_copy, struct iommu_option and struct iommu_vfio_ioas are
      missed in ucmd_buffer. Although they are smaller than the size of
      ucmd_buffer, it is safer to list them in ucmd_buffer explicitly.
      
      Fixes: aad37e71 ("iommufd: IOCTLs for the io_pagetable")
      Fixes: d624d665 ("iommufd: vfio container FD ioctl compatibility")
      Link: https://lore.kernel.org/r/20230120122040.280219-1-yi.l.liu@intel.comSigned-off-by: default avatarYi Liu <yi.l.liu@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      84798f28
    • Nicolin Chen's avatar
      selftests: iommu: Fix test_cmd_destroy_access() call in user_copy · 9fabbdf3
      Nicolin Chen authored
      The test_cmd_destroy_access() should end with a semicolon, so add one.
      There is a test_ioctl_destroy(ioas_id) following already, so drop one.
      
      Fixes: 57f09887 ("iommufd: Add a selftest")
      Link: https://lore.kernel.org/r/20230120074204.1368-1-nicolinc@nvidia.comSigned-off-by: default avatarNicolin Chen <nicolinc@nvidia.com>
      Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      9fabbdf3
    • Jason Gunthorpe's avatar
      Merge branch 'isolated_msi' into iommufd.git for-next · fc387309
      Jason Gunthorpe authored
      Jason Gunthorpe says:
      
      ====================
      Harmonize these into a single irq_domain based check under
      msi_device_has_isolated_msi().
      
      In real HW "isolated MSI" is implemented in a few different ways:
      
       - x86 uses "interrupt remapping" which is a block that sits between
         the device and APIC, that can "remap" the MSI MemWr. AMD uses per-RID
         tables to implement isolation while Intel stores the authorized RID in
         each IRTE entry. Part of the remapping is discarding, HW will not
         forward MSIs that don't positively match the tables.
      
       - ARM GICv3 ITS integrates the concept of an out-of-band "device ID"
         directly into the interrupt controller logic. The tables the GIC checks
         that determine how to deliver the interrupt through the ITS device table
         and interrupt translation tables allow limiting which interrupts device
         IDs can trigger.
      
       - S390 has unconditionally claimed it has isolated MSI through the iommu
         driver. This is a weaker version of the other arches in that it only
         works between "gisa" domains. See zpci_set_airq() and
      
          https://lore.kernel.org/r/31af8174-35e9-ebeb-b9ef-74c90d4bfd93@linux.ibm.com/
      
      After this series the "isolated MSI" is tagged based only on the
      irq_domains that the interrupt travels through. For x86 enabling interrupt
      remapping causes IR irq_domains to be installed in the path, and they can
      carry the IRQ_DOMAIN_FLAG_ISOLATED_MSI. For ARM the GICv3 ITS itself
      already sets the flag when it is running in a isolated mode, and S390
      simply sets it always through an arch hook since it doesn't use
      irq_domains at all.
      
      This removes the intrusion of IRQ subsystem information into the iommu
      drivers. Linux's iommu_domains abstraction has no bearing at all on the
      security of MSI. Even if HW linked to the IOMMU may implement the security
      on x86 implementations, Linux models that HW through the irq_domain, not
      the iommu_domain.
      ====================
      
      * branch 'isolated_msi':
        iommu: Remove IOMMU_CAP_INTR_REMAP
        irq/s390: Add arch_is_isolated_msi() for s390
        iommu/x86: Replace IOMMU_CAP_INTR_REMAP with IRQ_DOMAIN_FLAG_ISOLATED_MSI
        genirq/msi: Rename IRQ_DOMAIN_MSI_REMAP to IRQ_DOMAIN_ISOLATED_MSI
        genirq/irqdomain: Remove unused irq_domain_check_msi_remap() code
        iommufd: Convert to msi_device_has_isolated_msi()
        vfio/type1: Convert to iommu_group_has_isolated_msi()
        iommu: Add iommu_group_has_isolated_msi()
        genirq/msi: Add msi_device_has_isolated_msi()
      
      Link: https://lore.kernel.org/r/0-v3-3313bb5dd3a3+10f11-secure_msi_jgg@nvidia.comSigned-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      fc387309
  6. 11 Jan, 2023 9 commits
  7. 08 Jan, 2023 3 commits
  8. 07 Jan, 2023 6 commits
  9. 06 Jan, 2023 5 commits
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2023-01-06' of git://anongit.freedesktop.org/drm/drm · 0a715535
      Linus Torvalds authored
      Pull drm fixes from Daniel Vetter:
       "Still not much, but more than last week. Dave should be back next week
        from the beaching.
      
        drivers:
         - i915-gvt fixes
         - amdgpu/kfd fixes
         - panfrost bo refcounting fix
         - meson afbc corruption fix
         - imx plane width fix
      
        core:
         - drm/sched fixes
         - drm/mm kunit test fix
         - dma-buf export error handling fixes"
      
      * tag 'drm-fixes-2023-01-06' of git://anongit.freedesktop.org/drm/drm:
        Revert "drm/amd/display: Enable Freesync Video Mode by default"
        drm/i915/gvt: fix double free bug in split_2MB_gtt_entry
        drm/i915/gvt: use atomic operations to change the vGPU status
        drm/i915/gvt: fix vgpu debugfs clean in remove
        drm/i915/gvt: fix gvt debugfs destroy
        drm/i915: unpin on error in intel_vgpu_shadow_mm_pin()
        drm/amd/display: Uninitialized variables causing 4k60 UCLK to stay at DPM1 and not DPM0
        drm/amdkfd: Fix kernel warning during topology setup
        drm/scheduler: Fix lockup in drm_sched_entity_kill()
        drm/imx: ipuv3-plane: Fix overlay plane width
        drm/scheduler: Fix lockup in drm_sched_entity_kill()
        drm/virtio: Fix memory leak in virtio_gpu_object_create()
        drm/meson: Reduce the FIFO lines held when AFBC is not used
        drm/tests: reduce drm_mm_test stack usage
        drm/panfrost: Fix GEM handle creation ref-counting
        drm/plane-helper: Add the missing declaration of drm_atomic_state
        dma-buf: fix dma_buf_export init order v2
      0a715535
    • Jason A. Donenfeld's avatar
      tpm: Allow system suspend to continue when TPM suspend fails · 1382999a
      Jason A. Donenfeld authored
      TPM 1 is sometimes broken across system suspends, due to races or
      locking issues or something else that haven't been diagnosed or fixed
      yet, most likely having to do with concurrent reads from the TPM's
      hardware random number generator driver. These issues prevent the system
      from actually suspending, with errors like:
      
        tpm tpm0: A TPM error (28) occurred continue selftest
        ...
        tpm tpm0: A TPM error (28) occurred attempting get random
        ...
        tpm tpm0: Error (28) sending savestate before suspend
        tpm_tis 00:08: PM: __pnp_bus_suspend(): tpm_pm_suspend+0x0/0x80 returns 28
        tpm_tis 00:08: PM: dpm_run_callback(): pnp_bus_suspend+0x0/0x10 returns 28
        tpm_tis 00:08: PM: failed to suspend: error 28
        PM: Some devices failed to suspend, or early wake event detected
      
      This issue was partially fixed by 23393c64 ("char: tpm: Protect
      tpm_pm_suspend with locks"), in a last minute 6.1 commit that Linus took
      directly because the TPM maintainers weren't available. However, it
      seems like this just addresses the most common cases of the bug, rather
      than addressing it entirely. So there are more things to fix still,
      apparently.
      
      In lieu of actually fixing the underlying bug, just allow system suspend
      to continue, so that laptops still go to sleep fine. Later, this can be
      reverted when the real bug is fixed.
      
      Link: https://lore.kernel.org/lkml/7cbe96cf-e0b5-ba63-d1b4-f63d2e826efa@suse.cz/
      Cc: stable@vger.kernel.org # 6.1+
      Reported-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Acked-by: default avatarLuigi Semenzato <semenzato@chromium.org>
      Cc: Peter Huewe <peterhuewe@gmx.de>
      Cc: Jarkko Sakkinen <jarkko@kernel.org>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Cc: Johannes Altmanninger <aclopte@gmail.com>
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1382999a
    • Linus Torvalds's avatar
      hfs/hfsplus: avoid WARN_ON() for sanity check, use proper error handling · cb7a95af
      Linus Torvalds authored
      Commit 55d1cbbb ("hfs/hfsplus: use WARN_ON for sanity check") fixed
      a build warning by turning a comment into a WARN_ON(), but it turns out
      that syzbot then complains because it can trigger said warning with a
      corrupted hfs image.
      
      The warning actually does warn about a bad situation, but we are much
      better off just handling it as the error it is.  So rather than warn
      about us doing bad things, stop doing the bad things and return -EIO.
      
      While at it, also fix a memory leak that was introduced by an earlier
      fix for a similar syzbot warning situation, and add a check for one case
      that historically wasn't handled at all (ie neither comment nor
      subsequent WARN_ON).
      
      Reported-by: syzbot+7bb7cd3595533513a9e7@syzkaller.appspotmail.com
      Fixes: 55d1cbbb ("hfs/hfsplus: use WARN_ON for sanity check")
      Fixes: 8d824e69 ("hfs: fix OOB Read in __hfs_brec_find")
      Link: https://lore.kernel.org/lkml/000000000000dbce4e05f170f289@google.com/Tested-by: default avatarMichael Schmitz <schmitzmic@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Viacheslav Dubeyko <slava@dubeyko.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cb7a95af
    • Linus Torvalds's avatar
      Merge tag 'block-2023-01-06' of git://git.kernel.dk/linux · a689b938
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "The big change here is obviously the revert of the pktcdvd driver
        removal. Outside of that, just minor tweaks. In detail:
      
         - Re-instate the pktcdvd driver, which necessitates adding back
           bio_copy_data_iter() and the fops->devnode() hook for now (me)
      
         - Fix for splitting of a bio marked as NOWAIT, causing either nowait
           reads or writes to error with EAGAIN even if parts of the IO
           completed (me)
      
         - Fix for ublk, punting management commands to io-wq as they can all
           easily block for extended periods of time (Ming)
      
         - Removal of SRCU dependency for the block layer (Paul)"
      
      * tag 'block-2023-01-06' of git://git.kernel.dk/linux:
        block: Remove "select SRCU"
        Revert "pktcdvd: remove driver."
        Revert "block: remove devnode callback from struct block_device_operations"
        Revert "block: bio_copy_data_iter"
        ublk: honor IO_URING_F_NONBLOCK for handling control command
        block: don't allow splitting of a REQ_NOWAIT bio
        block: handle bio_split_to_limits() NULL return
      a689b938
    • Linus Torvalds's avatar
      Merge tag 'io_uring-2023-01-06' of git://git.kernel.dk/linux · ef1a4a77
      Linus Torvalds authored
      Pull io_uring fixes from Jens Axboe:
       "A few minor fixes that should go into the 6.2 release:
      
         - Fix for a memory leak in io-wq worker creation, if we ultimately
           end up canceling the worker creation before it gets created (me)
      
         - lockdep annotations for the CQ locking (Pavel)
      
         - A regression fix for CQ timeout handling (Pavel)
      
         - Ring pinning around deferred task_work fix (Pavel)
      
         - A trivial member move in struct io_ring_ctx, saving us some memory
           (me)"
      
      * tag 'io_uring-2023-01-06' of git://git.kernel.dk/linux:
        io_uring: fix CQ waiting timeout handling
        io_uring: move 'poll_multi_queue' bool in io_ring_ctx
        io_uring: lockdep annotate CQ locking
        io_uring: pin context while queueing deferred tw
        io_uring/io-wq: free worker if task_work creation is canceled
      ef1a4a77