- May 26, 2022
-
-
Dmitry Osipenko authored
Replace Panfrost's memory shrinker with a generic drm-shmem memory shrinker. Tested-by:
Steven Price <steven.price@arm.com> Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
Don't return -1 in error cases, return proper error code. The returned error codes propagate to error messages and to userspace and it's always good to have a meaningful error number for debugging purposes. Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
Use common dev_is_pci() helper to replace the strcmp("pci") used by driver. Suggested-by:
Robin Murphy <robin.murphy@arm.com> Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
Support generic drm-shmem memory shrinker and add new madvise IOCTL to the VirtIO-GPU driver. BO cache manager of Mesa driver will mark BOs as "don't need" using the new IOCTL to let shrinker purge the marked BOs on OOM, the shrinker will also evict unpurgeable shmem BOs from memory if guest supports SWAP file or partition. Altogether this allows to prevent OOM kills of guest applications that use VirGL by lowering memory pressure. Signed-off-by:
Daniel Almeida <daniel.almeida@collabora.com> Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
Add unlocked variants of drm_gem_un/pin() functions and make them public. These new helpers will take care of GEM dma-reservation locking for DRM drivers. We are going to add memory shrinking support to the VirtIO-GPU driver that will need to pin framebuffers explicitly to prevent eviction of the actively used buffers by the shrinker. VirtIO-GPU driver will use these new generic helpers to pin shmem framebuffers. Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
Introduce a common DRM SHMEM shrinker framework that allows to reduce code duplication among DRM drivers by replacing theirs custom shrinker implementations with the generic shrinker. In order to start using DRM SHMEM shrinker drivers should: 1. Implement new evict() shmem object callback. 2. Register shrinker using drm_gem_shmem_shrinker_register(drm_device). 3. Use drm_gem_shmem_set_purgeable(shmem) and alike API functions to activate shrinking of shmem GEMs. This patch is based on a ideas borrowed from Rob's Clark MSM shrinker, Thomas' Zimmermann variant of SHMEM shrinker and Intel's i915 shrinker. Signed-off-by:
Daniel Almeida <daniel.almeida@collabora.com> Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
Replace drm_gem_shmem locks with GEM reservation lock to make drm-shmem locks consistent with the new locking convention of dma-bufs which tells that dma-buf importers are responsible for holding reservation lock for all operations performed over dma-bufs. This prepares drm-shmem code for addition of the generic shmem shrinker framework. Suggested-by:
Daniel Vetter <daniel@ffwll.ch> Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
There is no need to refcount vmappings of dma-bufs because dma-buf core has its own refcounting. Drop the refcounting of dma-bufs. This will ease replacing of all drm-shmem locks with a single dma-buf reservation lock, preparing drm-shmem code for addition of the generic drm-shmem shrinker. Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
All dma-bufs have dma-reservation lock that allows drivers to perform exclusive operations over shared dma-bufs. Today's dma-buf API has incomplete locking specification, which creates dead lock situation for dma-buf importers and exporters that don't coordinate theirs locks. This patch introduces new locking convention for dma-buf users. From now on all dma-buf importers are responsible for holding dma-buf reservation lock around operations performed over dma-bufs. This patch implements the new dma-buf locking convention by: 1. Making dma-buf API functions to take the reservation lock. 2. Adding new locked variants of the dma-buf API functions for drivers that need to manage imported dma-bufs under the held lock. 3. Converting all drivers to the new locking scheme. Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
DRM API requires the DRM's driver to be backed with the device that can be used for generic DMA operations. The VirtIO-GPU device can't perform DMA operations if it uses PCI transport because PCI device driver creates a virtual VirtIO-GPU device that isn't associated with the PCI. Use PCI's GPU device for the DRM's device instead of the VirtIO-GPU device and drop DMA-related hacks from the VirtIO-GPU driver. Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
Change the order of SHMEM initialization and reservation locking to make code cleaner and to prepare for transitioning of the common GEM SHMEM code to use the GEM's reservation lock instead of the shmem.page_lock. There is no need to lock reservation during allocation of the SHMEM pages because the lock is needed only to avoid racing with the async host-side allocation. Hence we can safely move the SHMEM initialization out of the reservation lock. Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
drm_gem_shmem_get_sg_table() never returns NULL on error, but a ERR_PTR. Correct the doc comment which says that it returns NULL on error. Acked-by:
Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
The vmapping of dma-buf may succeed, but DRM SHMEM rejects the iomem mappings, and thus, drm_gem_shmem_vmap_locked() should unvmap the iomem before erroring out. Cc: stable@vger.kernel.org Fixes: 49a3f51d ("drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backends") Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
Make virtio_gpu_plane_cleanup_fb() to clean the state which DRM core wants to clean up and not the current plane's state. Normally the older atomic state is cleaned up, but the newer state could also be cleaned up in case of aborted commits. Cc: stable@vger.kernel.org Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
Unlock reservations on dma_resv_reserve_fences() error to fix recursive locking of the reservations when this error happens. Cc: stable@vger.kernel.org Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
Unlock reservations in the error code path of virtio_gpu_object_create() to silence debug warning splat produced by ww_mutex_destroy(&obj->lock) when GEM is released with the held lock. Cc: stable@vger.kernel.org Reviewed-by:
Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
Transferred 2D BO always must be a shmem BO. Add check for that to prevent NULL dereference if userspace passes a VRAM BO. Cc: stable@vger.kernel.org Reviewed-by:
Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
drm_gem_shmem_get_sg_table() never ever returned NULL on error. Correct the error handling to avoid crash on OOM. Cc: stable@vger.kernel.org Reviewed-by:
Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
Calling madvise IOCTL twice on BO causes memory shrinker list corruption and crashes kernel because BO is already on the list and it's added to the list again, while BO should be removed from from the list before it's re-added. Fix it. Cc: stable@vger.kernel.org Fixes: 013b6510 ("drm/panfrost: Add madvise and shrinker support") Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
When panfrost_mmu_map_fault_addr() fails, the BO's mapping should be unreferenced and not the shmem object which backs the mapping. Cc: stable@vger.kernel.org Fixes: bdefca2d ("drm/panfrost: Add the panfrost_gem_mapping concept") Reviewed-by:
Steven Price <steven.price@arm.com> Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
Drivers that use drm_gem_mmap() and drm_gem_mmap_obj() helpers don't handle imported dma-bufs properly, which results in mapping of something else than the imported dma-buf. For example, on NVIDIA Tegra we get a hard lockup when userspace writes to the memory mapping of a dma-buf that was imported into Tegra's DRM GEM. To fix this bug, move mapping of imported dma-bufs to drm_gem_mmap_obj(). Now mmaping of imported dma-bufs works properly for all DRM drivers. Cc: stable@vger.kernel.org Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
Use ww_acquire_fini() in the error code paths. Otherwise lockdep thinks that lock is held when lock's memory is freed after the drm_gem_lock_reservations() error. The WW needs to be annotated as "freed", which fixes the noisy "WARNING: held lock freed!" splat of VirtIO-GPU driver with CONFIG_DEBUG_MUTEXES=y and enabled lockdep. Cc: stable@vger.kernel.org Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Dmitry Osipenko authored
Interrupt context can't sleep. Drivers like Panfrost and MSM are taking mutex when job is released, and thus, that code can sleep. This results into "BUG: scheduling while atomic" if locks are contented while job is freed. There is no good reason for releasing scheduler's jobs in IRQ context, hence use normal context to fix the trouble. Reviewed-by:
Andrey Grodzovsky <andrey.grodzovsky@amd.com> Reviewed-by:
Steven Price <steven.price@arm.com> Tested-by:
Erico Nunes <nunes.erico@gmail.com> Cc: stable@vger.kernel.org Fixes: 542cff78 ("drm/sched: Avoid lockdep spalt on killing a processes") Signed-off-by:
Dmitry Osipenko <dmitry.osipenko@collabora.com>
-
Stephen Rothwell authored
Signed-off-by:
Stephen Rothwell <sfr@canb.auug.org.au>
-
Stephen Rothwell authored
-
Andrew Morton authored
arm allnoconfig: mm/oom_kill.c:60:25: warning: 'vm_oom_kill_table' defined but not used [-Wunused-variable] 60 | static struct ctl_table vm_oom_kill_table[] = { | ^~~~~~~~~~~~~~~~~ Cc: Luis Chamberlain <mcgrof@kernel.org> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Stephen Rothwell <sfr@canb.auug.org.au>
-
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mmStephen Rothwell authored
# Conflicts: # include/linux/ptrace.h
-
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mmStephen Rothwell authored
# Conflicts: # arch/x86/mm/Makefile # fs/nfs/file.c # include/linux/slab.h # mm/page_io.c
-
-
git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.gitStephen Rothwell authored
# Conflicts: # kernel/trace/ftrace.c
-
https://github.com/Rust-for-Linux/linux.gitStephen Rothwell authored
# Conflicts: # Makefile # include/uapi/linux/android/binder.h
-