Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp3064436rwl; Sat, 5 Nov 2022 16:43:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM42N7WDuJu1jh1Z4EkSfyAAySvWxXzANKzYg505C39sk1mc+sU1nW3QSkfY90Y3urybd0AG X-Received: by 2002:a17:907:8688:b0:791:91a0:fdb3 with SMTP id qa8-20020a170907868800b0079191a0fdb3mr39585091ejc.499.1667691816325; Sat, 05 Nov 2022 16:43:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667691816; cv=none; d=google.com; s=arc-20160816; b=NSIbLBA4/TP5A++paFAxnF2EVS90vb6/szwalZf2wK5pKSvESJEBKzi17a34SmjJNu RZIs6Bitj/t6zd1xqmUIDnUo77JCf6+z+0HatO/aI9s9emFfRdQWXH/KhsJjiafG89+p 1O4SPotBHWBtdZxqgUh9pqSwBOEfTdn4BdV8lt6L1c3gH7nxXLCTGvP5NqleIv3kRJp0 ztg1zcWTqWeLexkQYj+90+VnKmufbPqylSFYcKdWTXXNHcGxqmYwYqg4Hilfz7W/UBes dIKuWMIEHL5O8lZ7YYiUrEBItJ0bE9J5rcGP1vjiZ4RsV1EW5Y6zJZOj1FUe6CD3ZdZW tT5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=5pO+1trZALxolp+yy9TVdCJHHdNFMtTbGoGUpa+Cff4=; b=teje00b249Q0iWy0u33AiyY7F5rfG3EkKPtoiY80hpGqqba+X+RZ1RXZZy9WUyJNMy 0P6p7iruxrFq6JtXad0WjMXIepw1/h4+gMo6vIPbC6IrsdadZ8cDRQeay1445ibkcL3X OLOW0d4gdxpTIqEWDt7GvQQUfBf0ur78HEuRcP4bGQ8cmUdeyGLv4cgB1cjhxMH55oTM /U1lTSO18L4vnxGIbiwmYUK0fwZIo3V63cPCdE+xpHl72bxnI0f7xpZCVG7NUPxrANpT RbT2F8760ikwp/GdX/fSfHqN5snJ0ACnWhR0N/RjYIgdDcjLVSswWAh0H5x+u2Z/n1CB eUwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Hlx8GuJf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wy8-20020a170906fe0800b0078334ccc570si3473441ejb.328.2022.11.05.16.43.12; Sat, 05 Nov 2022 16:43:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Hlx8GuJf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230070AbiKEX3G (ORCPT + 97 others); Sat, 5 Nov 2022 19:29:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229533AbiKEX3E (ORCPT ); Sat, 5 Nov 2022 19:29:04 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54B3C10B44 for ; Sat, 5 Nov 2022 16:29:03 -0700 (PDT) Received: from dimapc.. (109-252-117-140.nat.spd-mgts.ru [109.252.117.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dmitry.osipenko) by madras.collabora.co.uk (Postfix) with ESMTPSA id 95158660238B; Sat, 5 Nov 2022 23:28:59 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1667690941; bh=HY3jByZOhIouY34XB68EiSAMQWVk92uiCiyD+1rVWoc=; h=From:To:Cc:Subject:Date:From; b=Hlx8GuJfaALO5LgKJC9VAc76F84DLXDaUgW1ytwSU/0+3CCpiuJbzErfB/YfRCJph 5aEWQZweA2Z2h3c8s2Z1PMtDsotCXTYzyIjD0UQDuX8aBFzjjRsM/zVM5QcIMgg6nk ayzfiAtRJFl2dEyXxaRW2CS6REyU/0jp72qXH4tkx4sL7bhZUqVZ0P9bgzvx3EKKY9 sBd+eapxhMt02ZIOlNDcrau14SGStR3qznRxBQgkfeBYXkJ1eY6vgZjSQBVrN+kMpM OQ4it0siEorvr0S5vvB5iA+xTbfpGRXn22v9Zvl0T5eYAHVPtPxV/7yXochXIwH35E xUDpObMozLH6Q== From: Dmitry Osipenko To: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Daniel Almeida , Gustavo Padovan , Daniel Stone , Tomeu Vizoso , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Clark , Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= , Qiang Yu , Steven Price , Alyssa Rosenzweig , Rob Herring , Sean Paul , Dmitry Baryshkov , Abhinav Kumar Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Dmitry Osipenko , kernel@collabora.com, virtualization@lists.linux-foundation.org Subject: [PATCH v8 0/7] Add generic memory shrinker to VirtIO-GPU and Panfrost DRM drivers Date: Sun, 6 Nov 2022 02:27:12 +0300 Message-Id: <20221105232719.302619-1-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series: 1. Adds common drm-shmem memory shrinker 2. Enables shrinker for VirtIO-GPU driver 3. Switches Panfrost driver to the common shrinker Related patches: Mesa: https://gitlab.freedesktop.org/digetx/mesa/-/commits/virgl-madvise igt: https://gitlab.freedesktop.org/digetx/igt-gpu-tools/-/commits/virtio-madvise https://gitlab.freedesktop.org/digetx/igt-gpu-tools/-/commits/panfrost-madvise I'll upstream Mesa and igt patches once kernel part will be merged. Changelog: v8: - Rebased on top of recent linux-next that now has dma-buf locking convention patches merged, which was blocking shmem shrinker before. - Shmem shrinker now uses new drm_gem_lru helper. - Dropped Steven Price t-b from the Panfrost patch because code changed significantly since v6 and should be re-tested. v7: - dma-buf locking convention v6: https://lore.kernel.org/dri-devel/20220526235040.678984-1-dmitry.osipenko@collabora.com/ Dmitry Osipenko (7): drm/msm/gem: Prevent blocking within shrinker loop drm/shmem-helper: Don't use vmap_use_count for dma-bufs drm/shmem-helper: Switch to reservation lock drm/shmem-helper: Add memory shrinker drm/gem: Add drm_gem_pin_unlocked() drm/virtio: Support memory shrinking drm/panfrost: Switch to generic memory shrinker drivers/gpu/drm/drm_gem.c | 38 +- drivers/gpu/drm/drm_gem_shmem_helper.c | 648 ++++++++++++++---- drivers/gpu/drm/lima/lima_gem.c | 8 +- drivers/gpu/drm/msm/msm_gem_shrinker.c | 8 +- drivers/gpu/drm/panfrost/Makefile | 1 - drivers/gpu/drm/panfrost/panfrost_device.h | 4 - drivers/gpu/drm/panfrost/panfrost_drv.c | 26 +- drivers/gpu/drm/panfrost/panfrost_gem.c | 33 +- drivers/gpu/drm/panfrost/panfrost_gem.h | 9 - .../gpu/drm/panfrost/panfrost_gem_shrinker.c | 122 ---- drivers/gpu/drm/panfrost/panfrost_job.c | 18 +- drivers/gpu/drm/panfrost/panfrost_mmu.c | 19 +- drivers/gpu/drm/virtio/virtgpu_drv.h | 18 +- drivers/gpu/drm/virtio/virtgpu_gem.c | 55 ++ drivers/gpu/drm/virtio/virtgpu_ioctl.c | 37 + drivers/gpu/drm/virtio/virtgpu_kms.c | 9 + drivers/gpu/drm/virtio/virtgpu_object.c | 138 +++- drivers/gpu/drm/virtio/virtgpu_plane.c | 22 +- drivers/gpu/drm/virtio/virtgpu_vq.c | 40 ++ include/drm/drm_device.h | 4 + include/drm/drm_gem.h | 7 +- include/drm/drm_gem_shmem_helper.h | 99 ++- include/uapi/drm/virtgpu_drm.h | 14 + 23 files changed, 1003 insertions(+), 374 deletions(-) delete mode 100644 drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c -- 2.37.3