Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp1557394rwo; Sat, 22 Jul 2023 16:56:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlG/zJV6EmBzu4x2CNa+cSukNojzUzPaGsEdxDhi8ksWvGKQFaZt9hm4cnIJqGHde24rGXHh X-Received: by 2002:a17:906:648a:b0:997:eab5:f1c6 with SMTP id e10-20020a170906648a00b00997eab5f1c6mr6263259ejm.30.1690070204513; Sat, 22 Jul 2023 16:56:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690070204; cv=none; d=google.com; s=arc-20160816; b=xC15EGxN3wCCE8bng4tW4vO+qWyuRHv3R0ktD7mZxGAH0A90ozSArMnSlH5n4WK4Kg WxIiecm+6mdC1IlqGxXeW8OhigqcNZglCtYlptKIfDsxCjSDrhHl42mSKIQEgiiMCWDN UEHNGuaX/TJVB29Qc3SxYsAMYDD/ea6qSl7ADYbkTMh88e4/zth6wytYkNe8OAhlR9ng EbbW4wtqFB2mMQiDsxLZVq24chpXeHHRqjAxkWNq3VDxhMISa4J7jejkEGARY0yoeAvc /7wgh1VQNrapYyLypu5GJMt+TVwVtiomhDsNptvSSTRIUrx6iSce9aOkuIOwp8Ct01HU xVIQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VKAKSZMi9d0V0kaFAfCcvjlWYftsFl7jgWDhAHUhEjE=; fh=HW3Ufk1vhKIUVKnU/E+oJKAnhVjAsUVyBQ2HXfnwBkM=; b=XjVQaJlyNteDSbID76z4qNiNDppdZLCWhwV8QWXv+hcta6xLEsnwOO8Wr0Cmiz2dlX +lUAzoNhhFUHhTy7coj14AGFM1laOnyiJyeHyyJbt+vAqB8OCVrkU6JZVcoN87dOSsav 6Q+8bJAapfilM0Qms/SlGBYuBRr46rpvqOmSFga/k7w//SDDoVK2bvVgyXGCxCXrf1xZ 07eCRlEVw76TzwsHwREq+mqs9BoMMhS/bsIPH+v0vbcuKPqQnFma42jMiMoU/AxJ1tQA zrZWAd1W/DaYCixpcfHQdD9KcPKHh5I7SdcUzOgPYGXIgL3NraznDmHBjqo6Ey+3+jHj /aQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Rq+fjdsd; 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=QUARANTINE sp=QUARANTINE 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 e17-20020a170906081100b0098d85fee2e2si4187261ejd.608.2023.07.22.16.56.21; Sat, 22 Jul 2023 16:56:44 -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=Rq+fjdsd; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229677AbjGVXxO (ORCPT + 99 others); Sat, 22 Jul 2023 19:53:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229727AbjGVXxI (ORCPT ); Sat, 22 Jul 2023 19:53:08 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AE90A0 for ; Sat, 22 Jul 2023 16:53:07 -0700 (PDT) Received: from workpc.. (109-252-150-127.dynamic.spd-mgts.ru [109.252.150.127]) (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 AC44566070F6; Sun, 23 Jul 2023 00:53:04 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1690069986; bh=DR/MzGr7Elx2maftKvgUdtGhebsMSg18JQ9dHQ1DW8Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rq+fjdsd95PSjGkphpEnDZlaTlQRPQm9fW0EHT8LIWRZNyt1/F454tqzyvlillWYf FRJsMy9YcvRkYRAEx4ktTC9sE2rbfUg90Sp3tYhQx4dfs1YVbBmOCLFGankD2P8Z79 rbUE8os+AJllH8SyTM1Ui2az3ZLOTa/xzNlIMKlCQHkaChLgB+QW/eZsDLqOWk0WMZ G9MMBGhJjrqzV8I1Bf1wLpTkasJ1PqYqdFSZlWRk57YhiEBruNsIiCzsVQ64rZwPfe u/opHcemc4gznT46ICWOVm8UBk4adomOySAS4qOcA8MAW5GvVsN1eSQ3CmOibcwExJ 7gjTCinBMYGsQ== From: Dmitry Osipenko To: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , =?UTF-8?q?Christian=20K=C3=B6nig?= , Qiang Yu , Steven Price , Boris Brezillon , Emma Anholt , Melissa Wen Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@collabora.com, virtualization@lists.linux-foundation.org Subject: [PATCH v14 03/12] drm/shmem-helper: Switch drm_gem_shmem_vmap/vunmap to use pin/unpin Date: Sun, 23 Jul 2023 02:47:37 +0300 Message-ID: <20230722234746.205949-4-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230722234746.205949-1-dmitry.osipenko@collabora.com> References: <20230722234746.205949-1-dmitry.osipenko@collabora.com> 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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 The vmapped pages shall be pinned in memory. Previously get/put pages were implicitly hard-pinning/unpinning the pages. This will no longer be the case with addition of memory shrinker because pages_use_count>0 won't determine anymore whether pages are hard-pinned (they will be soft-pinned), while the new pages_pin_count will do that. Switch the vmap/vunmap to use pin/unpin functions in a preparation of addition of the memory shrinker support. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index 42ba201dda50..c236ad835448 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -379,7 +379,7 @@ int drm_gem_shmem_vmap(struct drm_gem_shmem_object *shmem, return 0; } - ret = drm_gem_shmem_get_pages(shmem); + ret = drm_gem_shmem_pin_locked(shmem); if (ret) goto err_zero_use; @@ -402,7 +402,7 @@ int drm_gem_shmem_vmap(struct drm_gem_shmem_object *shmem, err_put_pages: if (!obj->import_attach) - drm_gem_shmem_put_pages(shmem); + drm_gem_shmem_unpin_locked(shmem); err_zero_use: shmem->vmap_use_count = 0; @@ -439,7 +439,7 @@ void drm_gem_shmem_vunmap(struct drm_gem_shmem_object *shmem, return; vunmap(shmem->vaddr); - drm_gem_shmem_put_pages(shmem); + drm_gem_shmem_unpin_locked(shmem); } shmem->vaddr = NULL; -- 2.41.0