Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp55991lqd; Tue, 23 Apr 2024 14:34:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXKiMPvHx7u4ws+Nws/qoplJxYF0MsBRXhsKGL6gUklbR71mlu1dQi1CNZmR/77Kjw0H4Zwi/P6CwVZSGBXNZMWiW0e1YB4ZqfnFdhQ0Q== X-Google-Smtp-Source: AGHT+IEaW7SpcEBL9hAZ3sC4600n+DF+Q5ihRY4nget8TJdL9ae6l0HO/FVyf4FrIsvrwa36htmB X-Received: by 2002:a05:620a:2551:b0:78f:1a57:a994 with SMTP id s17-20020a05620a255100b0078f1a57a994mr888495qko.9.1713908047195; Tue, 23 Apr 2024 14:34:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713908047; cv=pass; d=google.com; s=arc-20160816; b=dl+TfaGgKD5eF3FAKbup3l9K/okan5IHsC0AsFjNxD5n1MDg1Z5kjYz5hRhNe9gTqh 1MW0jAFZxynXmDm+BSluzGE7pfzTaDGMnwzEpP8mAlBmtU4d24J+aaSktnkK2feSv/w8 TtildIm+FelTA70iohmSxyR2/QZjTyfiM45oYzZkgmEYaM5rMXr7T8oqGtsghKq16CAp U4dqs9daAYCwujWLr6SqVaae9E7GzrxAwWTQIZD/G2iBEns5oJWkPHkNtu9Fpteh7giF I/0WPDuzan7SfhEpNp0xDYxTCBbH017FLGybpoOcqt6viRU9yrkDSQgnMdnZrXDnNvOG KkCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=0bkgl+yAxr+cEpmSZ1Ju6VeVVxSwAbcyDTxgiCcVy5o=; fh=azrFDCFzQjj8a/GfAvi3zjGm/wONppCG+fs8RCnI1Ho=; b=UT/FiuCDvRUfsIvWjFxgDlevGpWtCaOmRwLyH2rvU5YpwkXlJGgs05EC/1cemxyGCG c/wrfBU12jBg2hk6W8xASfSiA07+a5EAbtJi4lcSmlJds4UHK0CruhGbqolQI69zwn/s vfn1M9BN0+YPPIlKfpoLT1cNLhRRVCzk2cCOy7bLNBcFcmJDHLbpcbB3lmF/u2K8kbgg qp9LXN5fhUoIKDzTGgz7lU78XC4IPDRbUt9eMP+SxrzuzC+wvTuN1jDfCnxqSS6sgQj+ UTxHTweyc8kkTmQdgbJWWZwMexUqJMJJCY0hNE1SEpidq/HlTnfAOq+fmYH6Zrx2Ev8m vJ+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=KjjcZVg6; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-155929-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155929-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id wa13-20020a05620a4d0d00b0078ede2c40d0si13745146qkn.740.2024.04.23.14.34.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 14:34:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155929-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=KjjcZVg6; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-155929-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155929-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C58741C22307 for ; Tue, 23 Apr 2024 21:34:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E6BCB1442FD; Tue, 23 Apr 2024 21:33:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="KjjcZVg6" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20FC1143C47 for ; Tue, 23 Apr 2024 21:33:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713908015; cv=none; b=ZAys3rxf6YsELMmYDZzhwjl6Rr4WwdeuVc09AmZGrPSDpJSaJZuRQ3TLivxC5hy7/3hrEdB/6CRz/wvbnryiEyS23UnnSPOo1Ta3bJVOebphJV0Zdn1PmY7ldb7sjX3XeFVtqr+4zO3kigIXmaTUcG5Kcg5KsgEcviZmy62xa2U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713908015; c=relaxed/simple; bh=WTSDOsANVORGkRoRiiItlqmB10yYEFCjydCZuf55SdI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sctLngzM7a8Tbjq7P8s9GDfTTkbNmbXIsDmFzr60altvO+ssIvMMdhZpynLJa/YYK1OavMMSD5fRiNJ9UsEgFYKpFjcfKu8VGxh/O646PWKodp4mHSsxKfsIBl/dAM+GTiX/IPpIzMO2PtAmdydrDi5xoM2p/UEtg/FR+U8dC98= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=KjjcZVg6; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1713908010; bh=WTSDOsANVORGkRoRiiItlqmB10yYEFCjydCZuf55SdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KjjcZVg6Qmz/d19GHkqM09gbMVElPzwbC7mayziwjkbkKOvnAkCX1w2ywQOpCJ7Ze yzC3IbITJaRC5lQoJqAmkY5D8jfdN/OqUiMY++qgCJDLFPyVQbtAgHPceptebE1eMs 0lkts5DDQWGr5hU50dBuZzEdV3mGdVNYqNM71v9PbFNai0UV0Z8zFWWhRlbZR1dEEJ dqODXIwH9Z4iWz1qEgOaGRWeOCDmZNxbRaZfaNHKpu/yHO4hbfSEP9hu54e+Bztwif Ga/pQ7LZ56RPuAjAuq1aIBxAUJkUk55PCXIDE5ulWEPzv33fc6I3kCye8oRZ3XbZWl E71rRtk4uKVTQ== Received: from localhost.localdomain (cola.collaboradmins.com [195.201.22.229]) (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: alarumbe) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 18AB13782142; Tue, 23 Apr 2024 21:33:30 +0000 (UTC) From: =?UTF-8?q?Adri=C3=A1n=20Larumbe?= To: Boris Brezillon , Steven Price , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: kernel@collabora.com, Adrian Larumbe , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] drm/panthor: Enable fdinfo for memory stats Date: Tue, 23 Apr 2024 22:32:36 +0100 Message-ID: <20240423213240.91412-4-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240423213240.91412-1-adrian.larumbe@collabora.com> References: <20240423213240.91412-1-adrian.larumbe@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When vm-binding an already-created BO, the entirety of its virtual size is then backed by system memory, so its RSS is always the same as its virtual size. Also, we consider a PRIME imported BO to be resident if its matching dma_buf has an open attachment, which means its backing storage had already been allocated. Signed-off-by: Adrián Larumbe --- drivers/gpu/drm/panthor/panthor_gem.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c index d6483266d0c2..386c0dfeeb5f 100644 --- a/drivers/gpu/drm/panthor/panthor_gem.c +++ b/drivers/gpu/drm/panthor/panthor_gem.c @@ -143,6 +143,17 @@ panthor_gem_prime_export(struct drm_gem_object *obj, int flags) return drm_gem_prime_export(obj, flags); } +static enum drm_gem_object_status panthor_gem_status(struct drm_gem_object *obj) +{ + struct panthor_gem_object *bo = to_panthor_bo(obj); + enum drm_gem_object_status res = 0; + + if (bo->base.base.import_attach || bo->base.pages) + res |= DRM_GEM_OBJECT_RESIDENT; + + return res; +} + static const struct drm_gem_object_funcs panthor_gem_funcs = { .free = panthor_gem_free_object, .print_info = drm_gem_shmem_object_print_info, @@ -152,6 +163,7 @@ static const struct drm_gem_object_funcs panthor_gem_funcs = { .vmap = drm_gem_shmem_object_vmap, .vunmap = drm_gem_shmem_object_vunmap, .mmap = panthor_gem_mmap, + .status = panthor_gem_status, .export = panthor_gem_prime_export, .vm_ops = &drm_gem_shmem_vm_ops, }; -- 2.44.0