Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp2962435rdh; Mon, 27 Nov 2023 03:34:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IGmWXNPuH2Q1strWIZ9NNT1wmIqrEOPcTIIhnVSSuhkYKy1OpHceyz7eDVEV9CYr719/bMb X-Received: by 2002:a17:902:b28c:b0:1cc:3fc9:1802 with SMTP id u12-20020a170902b28c00b001cc3fc91802mr9290815plr.61.1701084847806; Mon, 27 Nov 2023 03:34:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701084847; cv=none; d=google.com; s=arc-20160816; b=z+nhbTdPVfFNmu2DZM81MBHaUF9n8/20tDIgUUa6yFSd9ZzK9CybMwIcEv3etzURJQ OORmOUDEAb+oF1G5VgV0YkLBqd95yl/kyr1Q0ADqMVtWqfen61MtftdT7W03i8K9fF8N CMlkZ5tVj3zDzZMHo0Y0ipb2PMik4vgsPz1Bdp6yEc0ypJk1UFdlwmlXCQA63HmA2+bg Q1icnJxNFMrtYwkng5pUQgufUVEdS87mzN8YLK406ogJCCITF4r9Vcn8MXnXw9YokgRw LAZwZTwTF77c2Nl3xIfjF+ypV/nbmL760n1Y8Yy3CrnIQevexoShYmivTRpB7jgr5GLS 58fQ== 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 :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=y0/bsJyd/P3Wn0ARFfGpJRc/dvEE4Erjaiz6yBTTwns=; fh=CQLHSdxSsgw76AL8bhWbNSzTGHnm3kswiGHOsfubpaU=; b=V+aw0QKd4ezNWIj142CdVE+AbV9XBPEuUYJXMCi3mvFSeMxPZAlS0KLSjlze1Ypdxs aG+hu2wCszUyNBsq2tuOHRcYT35abLj0kryzxyYf+OQDf/4KXmuhMgty1QicAATQzBeV aCujytCyOrgr4o0YehlXEceYMEbfazEiZc5Wd8dwLLHWTV+pNF4iI3c5QKYLEFSr9THK z3mZf3UVg0wiPyK0vvhA2Kts6FwvgxTb69Fbt0ixI6VjpXyfT1IUn58QN5o7lb8/i2VY AOw8jWzfs3B6cCxoa+PkAPgqQhPyAdyNvIYBhVT++77qO/JMBMkRPxm1ykHJmFz2tKSM 1P+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id p2-20020a170902e74200b001cfd52a2266si1182725plf.403.2023.11.27.03.34.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 03:34:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 647DC80A9AAA; Mon, 27 Nov 2023 03:34:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233197AbjK0Ldv (ORCPT + 99 others); Mon, 27 Nov 2023 06:33:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233236AbjK0Lds (ORCPT ); Mon, 27 Nov 2023 06:33:48 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 71920101 for ; Mon, 27 Nov 2023 03:33:54 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C2FA22F4; Mon, 27 Nov 2023 03:34:41 -0800 (PST) Received: from [10.57.72.179] (unknown [10.57.72.179]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 094993F73F; Mon, 27 Nov 2023 03:33:51 -0800 (PST) Message-ID: <4a519708-6b5c-4947-b6ca-3fdd503392ed@arm.com> Date: Mon, 27 Nov 2023 11:33:52 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] drm/panfrost: Consider dma-buf imported objects as resident To: =?UTF-8?Q?Adri=C3=A1n_Larumbe?= , Boris Brezillon , Rob Herring , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , AngeloGioacchino Del Regno Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@collabora.com References: <20231125205438.375407-1-adrian.larumbe@collabora.com> <20231125205438.375407-2-adrian.larumbe@collabora.com> Content-Language: en-GB From: Steven Price In-Reply-To: <20231125205438.375407-2-adrian.larumbe@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 27 Nov 2023 03:34:05 -0800 (PST) On 25/11/2023 20:52, Adrián Larumbe wrote: > A GEM object constructed from a dma-buf imported sgtable should be regarded > as being memory resident, because the dma-buf API mandates backing storage > to be allocated when attachment succeeds. This obviously can cause a bit of double-counting system wide (both the exporter and importer could show the memory usage). But I think we're better off over-counting rather than under-counting. Reviewed-by: Steven Price > Signed-off-by: Adrián Larumbe > Fixes: 9ccdac7aa822 ("drm/panfrost: Add fdinfo support for memory stats") > Reported-by: Boris Brezillon > --- > drivers/gpu/drm/panfrost/panfrost_gem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panfrost/panfrost_gem.c > index 0cf64456e29a..d47b40b82b0b 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_gem.c > +++ b/drivers/gpu/drm/panfrost/panfrost_gem.c > @@ -200,7 +200,7 @@ static enum drm_gem_object_status panfrost_gem_status(struct drm_gem_object *obj > struct panfrost_gem_object *bo = to_panfrost_bo(obj); > enum drm_gem_object_status res = 0; > > - if (bo->base.pages) > + if (bo->base.base.import_attach || bo->base.pages) > res |= DRM_GEM_OBJECT_RESIDENT; > > if (bo->base.madv == PANFROST_MADV_DONTNEED)