Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7679666rwb; Wed, 23 Nov 2022 09:21:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf6FHI3fLKv7Kjc+TeU9C4wjhQrmx4jKS7WJ5iPgRTSM+AgP41nEaz3CtgIQpeqKy8/4I2Vf X-Received: by 2002:a65:6741:0:b0:477:ac77:2366 with SMTP id c1-20020a656741000000b00477ac772366mr6105625pgu.413.1669224086495; Wed, 23 Nov 2022 09:21:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669224086; cv=none; d=google.com; s=arc-20160816; b=w1VOilOSJTnl/wG3Je31SAKI93oMBtrXe1RyPqigqoh86omGVAwcKngFKy4r6/yehE 21t+xHqAU3i7HQWMJ25B2+M4tedkJwu1aIkeNpML7wFCXvedwcEn0U6/brILRJ7uBGB+ 5osA2a8kcbKTTlhKzGgHmCJqgeLK1ckukLJrtJJqGD8UuakZWOLu4n06HsGL+pv3KijT jhSpaZvSyR49DG3uUYEei6We6OF5EfhVP6bGNQjcWJjHWpQRTpRtG9gO7bYJ1Ej7PyVk VMa3barlKiNbc4lNLFDXmWsu2++LTfKwU86B5S6SRV2Ew7/wS1dXgIRD8dmVXKLXeha3 M3LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=nz2EIQdM6xg7eg3/wPrOyqZnmwKpmQnJSlKBWzNd5lU=; b=cAVpLfff/2Xcyogc4N/WqbqGuWlUFK/q0B9e9aRNTg3sSRRXl1boCjrhdkoni7ySYV XOs0sD/CQE+f6H8Fg3tY1PHyGnm6fdObLK+ERXaLHv1qV+k9OZOb55G5YTLfaOly8bo9 3osZ1e3i1vVNKBFTEFIL9i0l2cG4Xo4t6WJqLljc3Byf44jrNJ7c4rmNAM9Qf7zBHKtz uVHXKcYCRAkEAErrTacEq8FBR/DGNceVVMIew8Ete9avTDlCM4/zTw2a67q3yyT4VBX9 uVJK2jdaGGKY2CDppucjpjDN3eGtGljKTC7GlO/X0DfnvpvWXGAEwgUrp5HVdVe2V2Hr AevA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="Y4/HSy/f"; 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 q16-20020a056a00085000b0056c882d3d06si18726322pfk.199.2022.11.23.09.21.15; Wed, 23 Nov 2022 09:21:26 -0800 (PST) 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="Y4/HSy/f"; 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 S239002AbiKWQkV (ORCPT + 88 others); Wed, 23 Nov 2022 11:40:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238951AbiKWQkT (ORCPT ); Wed, 23 Nov 2022 11:40:19 -0500 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 57702BA5A3 for ; Wed, 23 Nov 2022 08:40:18 -0800 (PST) Received: from [192.168.2.109] (109-252-117-140.nat.spd-mgts.ru [109.252.117.140]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 009BB6600367; Wed, 23 Nov 2022 16:40:13 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1669221616; bh=9jAcNG5mmc8WdRcm1FU/6k9HjRgP8OF/p9T3eXcNN5g=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Y4/HSy/fWd8Zgc3i5mYx/xGvm7+frMwkYiTm2sHW37EP882UGsVPbqeHZ8blbQQY9 sPiKyi5LJsSKrVbRvyu2iq4EfFsI//PPQNI6WQ2XEGiru4Uh1mHFdOStdEvNns0qai V0rXdL0fBs3gGPdPbKqZSOFiLxl+H2iJxnZAbuyEuEF+FzUg685TWWUqR99/v0SKKW +MRB89IfKmwxp0XcVLLiWD70lF10fZdq0GLMXchbnEgvtqFXWGYbSuTRZ0cbU+qu2u OgSjhAYlVVgO9/+EPZno8IcvUkRSALHakD89Cb0buTjFS9kP7TCDrBUC109IUvMgqB Fmw5sowFqxNKA== Message-ID: <2d63940e-1cc2-a03e-a253-dac4d697e7d1@collabora.com> Date: Wed, 23 Nov 2022 19:40:10 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: [PATCH v9 03/11] drm/gem: Add evict() callback to drm_gem_object_funcs Content-Language: en-US To: Steven Price , 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_K=c3=b6nig?= , Qiang Yu , Alyssa Rosenzweig , Rob Herring , Sean Paul , Dmitry Baryshkov , Abhinav Kumar Cc: kernel@collabora.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org References: <20221123025723.695075-1-dmitry.osipenko@collabora.com> <20221123025723.695075-4-dmitry.osipenko@collabora.com> From: Dmitry Osipenko In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 On 11/23/22 18:58, Steven Price wrote: > On 23/11/2022 02:57, Dmitry Osipenko wrote: >> Add new common evict() callback to drm_gem_object_funcs and corresponding >> drm_gem_object_evict() helper. This is a first step on a way to providing >> common GEM-shrinker API for DRM drivers. >> >> Suggested-by: Thomas Zimmermann >> Signed-off-by: Dmitry Osipenko >> --- >> drivers/gpu/drm/drm_gem.c | 15 +++++++++++++++ >> include/drm/drm_gem.h | 12 ++++++++++++ >> 2 files changed, 27 insertions(+) >> >> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c >> index 299bca1390aa..c0510b8080d2 100644 >> --- a/drivers/gpu/drm/drm_gem.c >> +++ b/drivers/gpu/drm/drm_gem.c >> @@ -1458,3 +1458,18 @@ drm_gem_lru_scan(struct drm_gem_lru *lru, >> return freed; >> } >> EXPORT_SYMBOL(drm_gem_lru_scan); >> + >> +/** >> + * drm_gem_object_evict - helper to evict backing pages for a GEM object >> + * @obj: obj in question >> + */ >> +bool >> +drm_gem_object_evict(struct drm_gem_object *obj) >> +{ >> + dma_resv_assert_held(obj->resv); >> + >> + if (obj->funcs->evict) >> + return obj->funcs->evict(obj); >> + >> + return false; >> +} > > This function needs exporting for the module build to work correctly. Indeed, I missed that drm-shmem can be built as a separate module. -- Best regards, Dmitry