1. Aug 02, 2021
    • Nadav Amit's avatar
      iommu: Factor iommu_iotlb_gather_is_disjoint() out · febb82c2
      Nadav Amit authored
      
      
      Refactor iommu_iotlb_gather_add_page() and factor out the logic that
      detects whether IOTLB gather range and a new range are disjoint. To be
      used by the next patch that implements different gathering logic for
      AMD.
      
      Note that updating gather->pgsize unconditionally does not affect
      correctness as the function had (and has) an invariant, in which
      gather->pgsize always represents the flushing granularity of its range.
      Arguably, “size" should never be zero, but lets assume for the matter of
      discussion that it might.
      
      If "size" equals to "gather->pgsize", then the assignment in question
      has no impact.
      
      Otherwise, if "size" is non-zero, then iommu_iotlb_sync() would
      initialize the size and range (see iommu_iotlb_gather_init()), and the
      invariant is kept.
      
      Otherwise, "size" is zero, and "gather" already holds a range, so
      gather->pgsize is non-zero and (gather->pgsize && gather->pgsize !=
      size) is true. Therefore, again, iommu_iotlb_sync() would be called and
      initialize the size.
      
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Jiajun Cao <caojiajun@vmware.com>
      Cc: Lu Baolu <baolu.lu@linux.intel.com>
      Cc: iommu@lists.linux-foundation.org
      Cc: linux-kernel@vger.kernel.org>
      Reviewed-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Acked-by: default avatarWill Deacon <will@kernel.org>
      Signed-off-by: default avatarNadav Amit <namit@vmware.com>
      Link: https://lore.kernel.org/r/20210723093209.714328-5-namit@vmware.com
      
      
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      febb82c2
    • Robin Murphy's avatar
      iommu: Improve iommu_iotlb_gather helpers · 3136895c
      Robin Murphy authored
      
      
      The Mediatek driver is not the only one which might want a basic
      address-based gathering behaviour, so although it's arguably simple
      enough to open-code, let's factor it out for the sake of cleanliness.
      Let's also take this opportunity to document the intent of these
      helpers for clarity.
      
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: Jiajun Cao <caojiajun@vmware.com>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Lu Baolu <baolu.lu@linux.intel.com>
      Cc: iommu@lists.linux-foundation.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: default avatarNadav Amit <namit@vmware.com>
      Link: https://lore.kernel.org/r/20210723093209.714328-4-namit@vmware.com
      
      
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      3136895c
    • Nadav Amit's avatar
      iommu/amd: Do not use flush-queue when NpCache is on · 6664340c
      Nadav Amit authored
      Do not use flush-queue on virtualized environments, where the NpCache
      capability of the IOMMU is set. This is required to reduce
      virtualization overheads.
      
      This change follows a similar change to Intel's VT-d and a detailed
      explanation as for the rationale is described in commit 29b32839
      
      
      ("iommu/vt-d: Do not use flush-queue when caching-mode is on").
      
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: Jiajun Cao <caojiajun@vmware.com>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Lu Baolu <baolu.lu@linux.intel.com>
      Cc: iommu@lists.linux-foundation.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarNadav Amit <namit@vmware.com>
      Link: https://lore.kernel.org/r/20210723093209.714328-3-namit@vmware.com
      
      
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      6664340c
    • Nadav Amit's avatar
      iommu/amd: Selective flush on unmap · fc65d0ac
      Nadav Amit authored
      
      
      Recent patch attempted to enable selective page flushes on AMD IOMMU but
      neglected to adapt amd_iommu_iotlb_sync() to use the selective flushes.
      
      Adapt amd_iommu_iotlb_sync() to use selective flushes and change
      amd_iommu_unmap() to collect the flushes. As a defensive measure, to
      avoid potential issues as those that the Intel IOMMU driver encountered
      recently, flush the page-walk caches by always setting the "pde"
      parameter. This can be removed later.
      
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: Jiajun Cao <caojiajun@vmware.com>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Lu Baolu <baolu.lu@linux.intel.com>
      Cc: iommu@lists.linux-foundation.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarNadav Amit <namit@vmware.com>
      Link: https://lore.kernel.org/r/20210723093209.714328-2-namit@vmware.com
      
      
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      fc65d0ac
  2. Jul 26, 2021
  3. Jul 25, 2021
    • Linus Torvalds's avatar
      Merge tag '5.14-rc2-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6 · d8079fac
      Linus Torvalds authored
      Pull cifs fixes from Steve French:
       "Five cifs/smb3 fixes, including a DFS failover fix, two fallocate
        fixes, and two trivial coverity cleanups"
      
      * tag '5.14-rc2-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: fix fallocate when trying to allocate a hole.
        CIFS: Clarify SMB1 code for POSIX delete file
        CIFS: Clarify SMB1 code for POSIX Create
        cifs: support share failover when remounting
        cifs: only write 64kb at a time when fallocating a small region of a file
      d8079fac
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-5.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 6498f615
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
      
       - properly set the memory size, which fixes 32-bit systems
      
       - allow initrd to load anywhere in memory, rather that restricting it
         to the first 256MiB
      
       - fix the 'mem=' parameter on 64-bit systems to properly account for
         the maximum supported memory now that the kernel is outside the
         linear map
      
       - avoid installing mappings into the last 4KiB of memory, which
         conflicts with error values
      
       - avoid the stack from being freed while it is being walked
      
       - a handful of fixes to the new copy to/from user routines
      
      * tag 'riscv-for-linus-5.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        riscv: __asm_copy_to-from_user: Fix: Typos in comments
        riscv: __asm_copy_to-from_user: Remove unnecessary size check
        riscv: __asm_copy_to-from_user: Fix: fail on RV32
        riscv: __asm_copy_to-from_user: Fix: overrun copy
        riscv: stacktrace: pin the task's stack in get_wchan
        riscv: Make sure the kernel mapping does not overlap with IS_ERR_VALUE
        riscv: Make sure the linear mapping does not use the kernel mapping
        riscv: Fix memory_limit for 64-bit kernel
        RISC-V: load initrd wherever it fits into memory
        riscv: Fix 32-bit RISC-V boot failure
      6498f615
    • Linus Torvalds's avatar
      ACPI: fix NULL pointer dereference · fc68f42a
      Linus Torvalds authored
      Commit 71f64283 ("ACPI: utils: Fix reference counting in
      for_each_acpi_dev_match()") started doing "acpi_dev_put()" on a pointer
      that was possibly NULL.  That fails miserably, because that helper
      inline function is not set up to handle that case.
      
      Just make acpi_dev_put() silently accept a NULL pointer, rather than
      calling down to put_device() with an invalid offset off that NULL
      pointer.
      
      Link: https://lore.kernel.org/lkml/a607c149-6bf6-0fd0-0e31-100378504da2@kernel.dk/
      
      
      Reported-and-tested-by: default avatarJens Axboe <axboe@kernel.dk>
      Tested-by: default avatarDaniel Scally <djrscally@gmail.com>
      Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fc68f42a
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 7ffca2bb
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "Four fixes, all in drivers, all of which can lead to user visible
        problems in certain situations"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: target: Fix NULL dereference on XCOPY completion
        scsi: mpt3sas: Transition IOC to Ready state during shutdown
        scsi: target: Fix protect handling in WRITE SAME(32)
        scsi: iscsi: Fix iface sysfs attr detection
      7ffca2bb
    • Linus Torvalds's avatar
      Merge tag 'io_uring-5.14-2021-07-24' of git://git.kernel.dk/linux-block · 0ee818c3
      Linus Torvalds authored
      Pull io_uring fixes from Jens Axboe:
      
       - Fix a memory leak due to a race condition in io_init_wq_offload
         (Yang)
      
       - Poll error handling fixes (Pavel)
      
       - Fix early fdput() regression (me)
      
       - Don't reissue iopoll requests off release path (me)
      
       - Add a safety check for io-wq queue off wrong path (me)
      
      * tag 'io_uring-5.14-2021-07-24' of git://git.kernel.dk/linux-block:
        io_uring: explicitly catch any illegal async queue attempt
        io_uring: never attempt iopoll reissue from release path
        io_uring: fix early fdput() of file
        io_uring: fix memleak in io_init_wq_offload()
        io_uring: remove double poll entry on arm failure
        io_uring: explicitly count entries for poll reqs
      0ee818c3
    • Linus Torvalds's avatar
      Merge tag 'block-5.14-2021-07-24' of git://git.kernel.dk/linux-block · 4d4a60ce
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
      
       - NVMe pull request (Christoph):
          - tracing fix (Keith Busch)
          - fix multipath head refcounting (Hannes Reinecke)
          - Write Zeroes vs PI fix (me)
          - drop a bogus WARN_ON (Zhihao Cheng)
      
       - Increase max blk-cgroup policy size, now that mq-deadline
         uses it too (Oleksandr)
      
      * tag 'block-5.14-2021-07-24' of git://git.kernel.dk/linux-block:
        nvme: set the PRACT bit when using Write Zeroes with T10 PI
        nvme: fix nvme_setup_command metadata trace event
        nvme: fix refcounting imbalance when all paths are down
        nvme-pci: don't WARN_ON in nvme_reset_work if ctrl.state is not RESETTING
        block: increase BLKCG_MAX_POLS
      4d4a60ce
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 0823baef
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "Two bugfixes for the I2C subsystem"
      
      * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: mpc: Poll for MCF
        misc: eeprom: at24: Always append device id even if label property is set.
      0823baef
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · bca1d4de
      Linus Torvalds authored
      Merge misc mm fixes from Andrew Morton:
       "15 patches.
      
        VM subsystems affected by this patch series: userfaultfd, kfence,
        highmem, pagealloc, memblock, pagecache, secretmem, pagemap, and
        hugetlbfs"
      
      * akpm:
        hugetlbfs: fix mount mode command line processing
        mm: fix the deadlock in finish_fault()
        mm: mmap_lock: fix disabling preemption directly
        mm/secretmem: wire up ->set_page_dirty
        writeback, cgroup: do not reparent dax inodes
        writeback, cgroup: remove wb from offline list before releasing refcnt
        memblock: make for_each_mem_range() traverse MEMBLOCK_HOTPLUG regions
        mm: page_alloc: fix page_poison=1 / INIT_ON_ALLOC_DEFAULT_ON interaction
        mm: use kmap_local_page in memzero_page
        mm: call flush_dcache_page() in memcpy_to_page() and memzero_page()
        kfence: skip all GFP_ZONEMASK allocations
        kfence: move the size check to the beginning of __kfence_alloc()
        kfence: defer kfence_test_init to ensure that kunit debugfs is created
        selftest: use mmap instead of posix_memalign to allocate memory
        userfaultfd: do not untag user pointers
      bca1d4de
  4. Jul 24, 2021