From patchwork Thu Nov 28 18:54:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yunxiang Li X-Patchwork-Id: 13888282 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 36DE5D70DEB for ; Thu, 28 Nov 2024 18:54:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 83B2010E6C7; Thu, 28 Nov 2024 18:54:33 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="huMBTn3y"; dkim-atps=neutral Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2061.outbound.protection.outlook.com [40.107.223.61]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3F48A10E6C7; Thu, 28 Nov 2024 18:54:32 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ch9rpCtpKQM9CLlFIWTDgYOMBesJ23NZJ8e8+KYX0FF/i97TAmnApjYsbSNrGjuYPEG4F0Ps4K+u5nAHSJRxNEuRACanqDCSZQvPh3maYI5JLTTK1JoEatK5eZ6eeAkrx5tmb+dWK0T9lgD+VK/dnrkWLnsOY5UeLDlM/O4AkwTXGYv2+OmyiU8LWrMkMQWBOezeo61q+ylwVtbX6gWP+GqkHIusvuj9jQeur61B3/gUEygVid7rRkGHiX3cvHWUC2YZb/8Lk74Ni6LCrngcQgZ4mi5SUm4RKAqG6RQ0CZQv3AKMUt2Ooi1P+Jzlo3cV0+7mba7lkSoiYKBGRMP1Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xSWAjmpW0RzYA3fPKkCKeVEDXtQcv56hW8REsGhZQAw=; b=jsiRFxnwD9MAzsvO8nNXPttllKcEPI8rPAMEOIfSuca7UJvD+TmoIZtUlK+0ywD+GeV3pZ6sZNdAj+RSGlfYk0kkilJGHbIudtIAwmevyXblkHSaiqzHSXJW6Skb8nCcU3fwsU8m3U2zUKGQ4JXrsvbPOdwt4hcfecMIuiW1gl63cGI4b7hS+47lFiWMoXEfpsyTMIPNVAnL29FTTgA/ghS3ZYS9WhyChjmRd5p3B/cE4brxZlOYQutfBgSkyzGAKvrFFUHx0O/RoHopP6NjbiqZpt+nardaC6VLTIUfGwGBqmQXFnfpDaGmF0AQGAlCa2HCboN2s3SkHjpXhpUbwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xSWAjmpW0RzYA3fPKkCKeVEDXtQcv56hW8REsGhZQAw=; b=huMBTn3yOcPLBzeHli7RuCKORxmhx12/IJQK3VmsZP0+DOarQx8rvZhITzdgNGdIWfmglejx4Oo8685psx6dXsuewt1RBP6xz3QraILKEW7mJpbZhCaP6EEW+ljCe0eG57WIj99tqq7Kzt/n/4C2I+Rt0y364v0Rf8j4ixiwkH8= Received: from MN2PR02CA0034.namprd02.prod.outlook.com (2603:10b6:208:fc::47) by CYYPR12MB8701.namprd12.prod.outlook.com (2603:10b6:930:bf::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.20; Thu, 28 Nov 2024 18:54:26 +0000 Received: from MN1PEPF0000ECD9.namprd02.prod.outlook.com (2603:10b6:208:fc:cafe::6a) by MN2PR02CA0034.outlook.office365.com (2603:10b6:208:fc::47) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.14 via Frontend Transport; Thu, 28 Nov 2024 18:54:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000ECD9.mail.protection.outlook.com (10.167.242.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8207.12 via Frontend Transport; Thu, 28 Nov 2024 18:54:25 +0000 Received: from MKM-L10-YUNXIA9.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 28 Nov 2024 12:54:24 -0600 From: Yunxiang Li To: , , CC: , Yunxiang Li , Subject: [PATCH v9 1/5] drm: add drm_memory_stats_is_zero Date: Thu, 28 Nov 2024 13:54:00 -0500 Message-ID: <20241128185404.2672-2-Yunxiang.Li@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241128185404.2672-1-Yunxiang.Li@amd.com> References: <20241128185404.2672-1-Yunxiang.Li@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD9:EE_|CYYPR12MB8701:EE_ X-MS-Office365-Filtering-Correlation-Id: 9158c3f8-b0e1-473d-503e-08dd0fde14ab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?0X72ipArl0uLJffdwGmzzUM1Fkn+cBi?= =?utf-8?q?uKspgZ5FHSw8z1aNmGeVeceZ+PM5BznlAkAxWbBA2+ooSH/0R0Q0suj3oT7k1YSwd?= =?utf-8?q?1e3CBQZk1NXI040/rNElyV58U/8bkxpbaKrCdd+RR5FZZVXAfL6wz2cvkNfioKD7S?= =?utf-8?q?Kx50fUfTCdv8saIS3uXMeiAUgJ9Y/BlEFe0HLJqSHB/Cjzz5NNYSEC5CeogL2rXZt?= =?utf-8?q?Ood/IFsExZClFyNULCK+DFu+i/cbc71fCAEBd1JNM8u6Ixq2LdtyTB8xOHm6RwH87?= =?utf-8?q?L/BaZFFeGZ1b0dKpTsHdn0JkLm4sn9wxn4Mz/J8ZaAXmnbNCvy7JEXf8jVN8S3es6?= =?utf-8?q?vIsoAWL1smPUFfTZC5zkPs4xnim3WbPDAIq5dA1V5AAi7y3GGGDBQ2fUaPUinrZd1?= =?utf-8?q?tMlBJsIvNC8xv5KLaOtyoQ/lMztZdbZi3QL3AkPwg18AVK89AL7wrAKv2g9Z9V271?= =?utf-8?q?SX9Th1UDaL6ialv3oEdM4AxuwW71d14kKHn4pgA/bo1KXJvKOv/G4ZwhbDbRfHBpS?= =?utf-8?q?SfC3dhwLqzBU9wXfkNcIzXLRB7id2/1YMN69OFaRp2z0vaYMvP+KEgm8tlc9NbIxs?= =?utf-8?q?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V:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2024 18:54:25.9781 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9158c3f8-b0e1-473d-503e-08dd0fde14ab X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000ECD9.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8701 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add a helper to check if the memory stats is zero, this will be used to check for memory accounting errors. Signed-off-by: Yunxiang Li Reviewed-by: Christian König CC: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/drm_file.c | 10 ++++++++++ include/drm/drm_file.h | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c index 714e42b051080..e285fcc28c59c 100644 --- a/drivers/gpu/drm/drm_file.c +++ b/drivers/gpu/drm/drm_file.c @@ -859,6 +859,16 @@ static void print_size(struct drm_printer *p, const char *stat, drm_printf(p, "drm-%s-%s:\t%llu%s\n", stat, region, sz, units[u]); } +int drm_memory_stats_is_zero(const struct drm_memory_stats *stats) +{ + return (stats->shared == 0 && + stats->private == 0 && + stats->resident == 0 && + stats->purgeable == 0 && + stats->active == 0); +} +EXPORT_SYMBOL(drm_memory_stats_is_zero); + /** * drm_print_memory_stats - A helper to print memory stats * @p: The printer to print output to diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h index ab230d3af138d..7f91e35d027d9 100644 --- a/include/drm/drm_file.h +++ b/include/drm/drm_file.h @@ -477,6 +477,7 @@ struct drm_memory_stats { enum drm_gem_object_status; +int drm_memory_stats_is_zero(const struct drm_memory_stats *stats); void drm_print_memory_stats(struct drm_printer *p, const struct drm_memory_stats *stats, enum drm_gem_object_status supported_status, From patchwork Thu Nov 28 18:54:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunxiang Li X-Patchwork-Id: 13888284 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A5198D70DEE for ; Thu, 28 Nov 2024 18:54:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E4C6110ED40; Thu, 28 Nov 2024 18:54:37 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="epx7aDIN"; dkim-atps=neutral Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2045.outbound.protection.outlook.com [40.107.237.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id 67CAF10ED36; Thu, 28 Nov 2024 18:54:34 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bWnbe2z1BCao6v7JH0YLaWgh+hJt/wefml7ROjuwdG4My9eqTHiijLl7mD62W02ZGMZkwgS/82Pv1EbhK2UkUZIrOvGdTnKwdVYRdMYPwcKvPnKaAmE7Zud4aU2QZVI32UOq7eR1LZ7EOqgbxw32XcGZNL1wr/fSZA3WctuYAEKHYO+aBQ1j4CEwvY2as3ZC8aJbEzbO+MPTBl0kEXvwfR2WX0XjzxZdbc0D11oyW0dWQcQxcDY174kD0uiiyHDMqVyRQpQ36z9dc/mX9Os7O+Upbbpnc3Rn9cCPVwez0uYw2Fk+bHpQ91YtO28alsmlC6rYrETQi9SbsCetXhqTpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lLHTfjcTCiXPpPtnlIDOB9p8wCkYTu0iaOqlmuXjixU=; b=eBx1gwZ7EX43oltYILALMSRuCQN4PEzP9QVdE9MMbB5Nm+5rJdJ88TvyTN1CmshG52jdELgwUyEkMP+jw3gzKf8NEX3bRaizPysqgMTJGCHtjz9UJndtxhrhOi6h24QXUnIEYu8QWqn87R9FUJvvEDoeziXAX/iV55ndRz/4hvItv8R4dcTS49za0y6gnGKQcyKG2xSCHNxxi3pmx7ajf9B9l5YitYQnsSCiXlaClh+7ZDdy4bftjjsjpgSIHpz0PvLOIUmA2BAxMwCcnYWCPo3/BTF34L2fZhgIXmnJ2eXWBng3h8OeDb6QVENZiNnPbIUubR3kdg/v210wU8VD8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lLHTfjcTCiXPpPtnlIDOB9p8wCkYTu0iaOqlmuXjixU=; b=epx7aDINJzsBB5aiKf658OMc9WsMD4mlynNnlGWhvBkMkB9wtPo/ncDttYqR31dEq1uWeUALArATbjvqmjdiD1xqsKa6OReedQonmcYWHyiZWGyeNSi+ELrdzmKlWXyJfF4yWevjHrGVgQeDvzCCjoK0vml17v15cDEwHB30lCg= Received: from MN2PR02CA0019.namprd02.prod.outlook.com (2603:10b6:208:fc::32) by SJ1PR12MB6339.namprd12.prod.outlook.com (2603:10b6:a03:454::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Thu, 28 Nov 2024 18:54:27 +0000 Received: from MN1PEPF0000ECD9.namprd02.prod.outlook.com (2603:10b6:208:fc:cafe::20) by MN2PR02CA0019.outlook.office365.com (2603:10b6:208:fc::32) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8182.18 via Frontend Transport; Thu, 28 Nov 2024 18:54:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000ECD9.mail.protection.outlook.com (10.167.242.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8207.12 via Frontend Transport; Thu, 28 Nov 2024 18:54:26 +0000 Received: from MKM-L10-YUNXIA9.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 28 Nov 2024 12:54:25 -0600 From: Yunxiang Li To: , , CC: , Yunxiang Li , , Subject: [PATCH v9 2/5] drm: make drm-active- stats optional Date: Thu, 28 Nov 2024 13:54:01 -0500 Message-ID: <20241128185404.2672-3-Yunxiang.Li@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241128185404.2672-1-Yunxiang.Li@amd.com> References: <20241128185404.2672-1-Yunxiang.Li@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD9:EE_|SJ1PR12MB6339:EE_ X-MS-Office365-Filtering-Correlation-Id: 505b216f-ccd1-439a-4a94-08dd0fde1527 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|82310400026|36860700013|7053199007; X-Microsoft-Antispam-Message-Info: hiRpFA1OHgfU/hjHGHFLnEqrFupFR1j17jyhwPhU8sv80ZnPIJeXZcPGcc6Znz4vSLP3+dpvgulq0aXfhAyXM25HTMl2oZMSbU/zWo2cBmdbtpEdXfkF2kcL5fPT3337rw6GFsik/nqKWpsQ3hcNfZMpkxqdTLdhxie7uFx2s2OQlUd1audTFtOULjDui2ZsZIqVFyl8s1RoZyuhiXtmgFY0FvqaUkZ2KIlrjuh1PHoAHo5Vgs8debLjKL7zxJ6RU3iom/rVVhT8V12ibEIIPA1RSUjj/rgUWx+3LySqAlP0xNanQ9D4ThxJUDjhGYZqTItGddCrdx9fXbUd1ZakxyMtUakPLwnu+oRX4trnSyn6Nf4JrfLnSQ2lk4ta+VmtGm95H2ACU61UG0ZTRiLS9q4BwmV7+LcnRElJ1QLaqKXSxQ1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; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(376014)(82310400026)(36860700013)(7053199007); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2024 18:54:26.7906 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 505b216f-ccd1-439a-4a94-08dd0fde1527 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000ECD9.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6339 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When memory stats is generated fresh everytime by going though all the BOs, their active information is quite easy to get. But if the stats are tracked with BO's state this becomes harder since the job scheduling part doesn't really deal with individual buffers. Make drm-active- optional to enable amdgpu to switch to the second method. Signed-off-by: Yunxiang Li CC: dri-devel@lists.freedesktop.org CC: intel-gfx@lists.freedesktop.org CC: amd-gfx@lists.freedesktop.org --- drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c | 1 + drivers/gpu/drm/drm_file.c | 13 +++++++------ drivers/gpu/drm/i915/i915_drm_client.c | 1 + drivers/gpu/drm/xe/xe_drm_client.c | 1 + include/drm/drm_gem.h | 14 ++++++++------ 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c index df2cf5c339255..7717e3e4f05b5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c @@ -97,6 +97,7 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file) drm_print_memory_stats(p, &stats[i].drm, + DRM_GEM_OBJECT_ACTIVE | DRM_GEM_OBJECT_RESIDENT | DRM_GEM_OBJECT_PURGEABLE, pl_name[i]); diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c index e285fcc28c59c..fd06671054723 100644 --- a/drivers/gpu/drm/drm_file.c +++ b/drivers/gpu/drm/drm_file.c @@ -884,7 +884,9 @@ void drm_print_memory_stats(struct drm_printer *p, { print_size(p, "total", region, stats->private + stats->shared); print_size(p, "shared", region, stats->shared); - print_size(p, "active", region, stats->active); + + if (supported_status & DRM_GEM_OBJECT_ACTIVE) + print_size(p, "active", region, stats->active); if (supported_status & DRM_GEM_OBJECT_RESIDENT) print_size(p, "resident", region, stats->resident); @@ -917,15 +919,13 @@ void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file) if (obj->funcs && obj->funcs->status) { s = obj->funcs->status(obj); - supported_status = DRM_GEM_OBJECT_RESIDENT | - DRM_GEM_OBJECT_PURGEABLE; + supported_status |= s; } - if (drm_gem_object_is_shared_for_memory_stats(obj)) { + if (drm_gem_object_is_shared_for_memory_stats(obj)) status.shared += obj->size; - } else { + else status.private += obj->size; - } if (s & DRM_GEM_OBJECT_RESIDENT) { status.resident += add_size; @@ -938,6 +938,7 @@ void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file) if (!dma_resv_test_signaled(obj->resv, dma_resv_usage_rw(true))) { status.active += add_size; + supported_status |= DRM_GEM_OBJECT_ACTIVE; /* If still active, don't count as purgeable: */ s &= ~DRM_GEM_OBJECT_PURGEABLE; diff --git a/drivers/gpu/drm/i915/i915_drm_client.c b/drivers/gpu/drm/i915/i915_drm_client.c index f586825054918..168d7375304bc 100644 --- a/drivers/gpu/drm/i915/i915_drm_client.c +++ b/drivers/gpu/drm/i915/i915_drm_client.c @@ -102,6 +102,7 @@ static void show_meminfo(struct drm_printer *p, struct drm_file *file) for_each_memory_region(mr, i915, id) drm_print_memory_stats(p, &stats[id], + DRM_GEM_OBJECT_ACTIVE | DRM_GEM_OBJECT_RESIDENT | DRM_GEM_OBJECT_PURGEABLE, mr->uabi_name); diff --git a/drivers/gpu/drm/xe/xe_drm_client.c b/drivers/gpu/drm/xe/xe_drm_client.c index 6a26923fa10e0..54941b4e850c4 100644 --- a/drivers/gpu/drm/xe/xe_drm_client.c +++ b/drivers/gpu/drm/xe/xe_drm_client.c @@ -229,6 +229,7 @@ static void show_meminfo(struct drm_printer *p, struct drm_file *file) if (man) { drm_print_memory_stats(p, &stats[mem_type], + DRM_GEM_OBJECT_ACTIVE | DRM_GEM_OBJECT_RESIDENT | (mem_type != XE_PL_SYSTEM ? 0 : DRM_GEM_OBJECT_PURGEABLE), diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h index bae4865b2101a..da11c16e212aa 100644 --- a/include/drm/drm_gem.h +++ b/include/drm/drm_gem.h @@ -48,19 +48,21 @@ struct drm_gem_object; * enum drm_gem_object_status - bitmask of object state for fdinfo reporting * @DRM_GEM_OBJECT_RESIDENT: object is resident in memory (ie. not unpinned) * @DRM_GEM_OBJECT_PURGEABLE: object marked as purgeable by userspace + * @DRM_GEM_OBJECT_ACTIVE: object is currently used by an active submission * * Bitmask of status used for fdinfo memory stats, see &drm_gem_object_funcs.status - * and drm_show_fdinfo(). Note that an object can DRM_GEM_OBJECT_PURGEABLE if - * it still active or not resident, in which case drm_show_fdinfo() will not + * and drm_show_fdinfo(). Note that an object can report DRM_GEM_OBJECT_PURGEABLE + * and be active or not resident, in which case drm_show_fdinfo() will not * account for it as purgeable. So drivers do not need to check if the buffer - * is idle and resident to return this bit. (Ie. userspace can mark a buffer - * as purgeable even while it is still busy on the GPU.. it does not _actually_ - * become puregeable until it becomes idle. The status gem object func does - * not need to consider this.) + * is idle and resident to return this bit, i.e. userspace can mark a buffer as + * purgeable even while it is still busy on the GPU. It will not get reported in + * the puregeable stats until it becomes idle. The status gem object func does + * not need to consider this. */ enum drm_gem_object_status { DRM_GEM_OBJECT_RESIDENT = BIT(0), DRM_GEM_OBJECT_PURGEABLE = BIT(1), + DRM_GEM_OBJECT_ACTIVE = BIT(2), }; /** From patchwork Thu Nov 28 18:54:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunxiang Li X-Patchwork-Id: 13888283 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 80ADAD70DF1 for ; Thu, 28 Nov 2024 18:54:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 99B3510E262; Thu, 28 Nov 2024 18:54:37 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="ZRMTKwo9"; dkim-atps=neutral Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2073.outbound.protection.outlook.com [40.107.243.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2F44C10E6C7; Thu, 28 Nov 2024 18:54:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YuITKM8ttdZxN/A3ECH1ffGCpUG/7U/QYnVqppc2GLLN7Bkak3yIj7Kl6wZfqZVW/6vx5NGs8yW5gFrTFoxmyuW5X+Pibd6qDLnb41CHroflv/a+QqLnWJmNuI8CTV3tqhKpk1d+pFCH8iu6TxCr41u4sKdK4XgSnWBrOR+GZTpvHUNPZgDzXznc2vluPI79WPLSNy9gn6Dth8LgFvoEyy8TlphpMGUf4LwEzUrAL1IyvQ1NDFlw5hQKtsGW7EQGAC7njdoRG2uRfOV6lG6zmoyUza4Pv2hvzqvXOnaDnydqeGObn5twu+chwPleH7m5JKehfP57bibvx9CdBe/LLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gJf5QQ+eMk/yRKAI+8sS9Xhdhu8kc+3V8cHpSKPmBU4=; b=DQlCTeQxbXpJ0ns5/JWepz+lDs+i4oz+2w+ZBHjGQLQTvQKC93mHJEuqU4wmGFuK4+bgMw3ViW3cslszN4KDaiHX37zkhMVRjlZFWTIZ4NBfDgBRb0+TC53yDzvxZIjfQHPwGvhvaFFoEtf0fy/3Tmib9zwYeGKEYtYT+uTe3x9uiXogkOO1O3KI6BcgWeJAzDn9SWPzmkrjABNNTbt68Oyq2ZL5eUzgnEmiuGCOaVVg4PaGGXhU/BpkCg1qePMZ08VW2bBqUHkOWh1W6VmR+PcUXcT/LwXdLTR8kyEX/XeCx/LnIdPMvYmtZkacgpkoBOANMVm+whkKEKPBV5euEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gJf5QQ+eMk/yRKAI+8sS9Xhdhu8kc+3V8cHpSKPmBU4=; b=ZRMTKwo9TNmGAVH7JUeFKhW9zmpWHCUzDBlmxGcFsFl4FKtX24PwjYZRC/zNWPq8oLNLucYKKDg0UhvdOTsSPrjirh1AcR1w2VcDdGxE/TeI4ru9T43h9PkIIX2PbdI6R//qOiDZIu/YtXrpisX39sCAWXzJixg+jIsqEzwVo50= Received: from MN2PR02CA0028.namprd02.prod.outlook.com (2603:10b6:208:fc::41) by IA0PR12MB8907.namprd12.prod.outlook.com (2603:10b6:208:492::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.14; Thu, 28 Nov 2024 18:54:27 +0000 Received: from MN1PEPF0000ECD9.namprd02.prod.outlook.com (2603:10b6:208:fc:cafe::5a) by MN2PR02CA0028.outlook.office365.com (2603:10b6:208:fc::41) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.14 via Frontend Transport; Thu, 28 Nov 2024 18:54:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000ECD9.mail.protection.outlook.com (10.167.242.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8207.12 via Frontend Transport; Thu, 28 Nov 2024 18:54:27 +0000 Received: from MKM-L10-YUNXIA9.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 28 Nov 2024 12:54:26 -0600 From: Yunxiang Li To: , , CC: , Yunxiang Li , Subject: [PATCH v9 3/5] Documentation/gpu: Clarify drm memory stats definition Date: Thu, 28 Nov 2024 13:54:02 -0500 Message-ID: <20241128185404.2672-4-Yunxiang.Li@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241128185404.2672-1-Yunxiang.Li@amd.com> References: <20241128185404.2672-1-Yunxiang.Li@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD9:EE_|IA0PR12MB8907:EE_ X-MS-Office365-Filtering-Correlation-Id: fdcd4762-1a4c-482b-ccdc-08dd0fde15cb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|1800799024|30052699003|82310400026; X-Microsoft-Antispam-Message-Info: zDGnSK1wL4lzDy3oPlRAzdWdBoUeUVo6BWyqPt+6Eh7n49FqiRsm7pP3FDWO/zFess4v6yzjphJ3j0oZvphrloYFpVawSr2sCvkgc89+P7ZDjWbDCrEVG6Zpg4KjCz8pRiFMDk0zFQ9xbMERpdnbyXnKEjjY1KidduEG2eJ7QlkXpKFzLxXZi0bqj9+2+KvfBxwE7etKNfehkNYwaETOa7uNrYDnj7uc247tJNlED876GVNpUsRRRrA5ErvLLVGlnEg454MSgwXnhKL+PiC0VJsS+KsZJbFXU11bJQ3fgcWPM8ISrf9QzysPQfV4xcWPYO/ovkjdeTrR0Iqql2ATz0vTIi7WkaRwzS6viDaBeo9ideKkx7HLo8LIcB79tQiJ6qcjp3LIRppXlp7L9mCUoLqVrqgdpM5gJOpTKuH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SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(376014)(1800799024)(30052699003)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2024 18:54:27.8687 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fdcd4762-1a4c-482b-ccdc-08dd0fde15cb X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000ECD9.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8907 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Define how to handle buffers with multiple possible placement so we don't get incompatible implementations. Callout the resident requirement for drm-purgeable- explicitly. Remove the confusing requirement for there to be only drm-memory- or only drm-resident-, and clarify that drm-memory- is legacy, amdgpu only behavior. Re-order the paragraphs to flow better as well. Signed-off-by: Yunxiang Li CC: dri-devel@lists.freedesktop.org --- Documentation/gpu/drm-usage-stats.rst | 54 +++++++++++++-------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/Documentation/gpu/drm-usage-stats.rst b/Documentation/gpu/drm-usage-stats.rst index ff964c707754a..19a5323d0e682 100644 --- a/Documentation/gpu/drm-usage-stats.rst +++ b/Documentation/gpu/drm-usage-stats.rst @@ -140,57 +140,57 @@ both. Memory ^^^^^^ -- drm-memory-: [KiB|MiB] - -Each possible memory type which can be used to store buffer objects by the -GPU in question shall be given a stable and unique name to be returned as the -string here. +Each possible memory type which can be used to store buffer objects by the GPU +in question shall be given a stable and unique name to be used as the "" +string. The region name "memory" is reserved to refer to normal system memory. -Value shall reflect the amount of storage currently consumed by the buffer +The value shall reflect the amount of storage currently consumed by the buffer objects belong to this client, in the respective memory region. Default unit shall be bytes with optional unit specifiers of 'KiB' or 'MiB' indicating kibi- or mebi-bytes. -This key is deprecated and is an alias for drm-resident-. Only one of -the two should be present in the output. - -- drm-shared-: [KiB|MiB] +- drm-total-: [KiB|MiB] -The total size of buffers that are shared with another file (e.g., have more -than a single handle). +The total size of all requested buffers, including both shared and private +memory. The backing store for the buffers does not need to be currently +instantiated to count under this category. To avoid double-counting, if a buffer +has multiple regions where it can be allocated to, the implementation should +consistently select a single region for accounting purposes. -- drm-total-: [KiB|MiB] +- drm-shared-: [KiB|MiB] -The total size of all created buffers including shared and private memory. The -backing store for the buffers does not have to be currently instantiated to be -counted under this category. +The total size of buffers that are shared with another file (i.e., have more +than one handle). The same requirement to avoid double-counting that applies to +drm-total- also applies here. - drm-resident-: [KiB|MiB] -The total size of buffers that are resident (have their backing store present or -instantiated) in the specified region. +The total size of buffers that are resident (i.e., have their backing store +present or instantiated) in the specified region. + +- drm-memory-: [KiB|MiB] -This is an alias for drm-memory- and only one of the two should be -present in the output. +This key is deprecated and is only printed by amdgpu; it is an alias for +drm-resident-. - drm-purgeable-: [KiB|MiB] -The total size of buffers that are purgeable. +The total size of buffers that are resident and purgeable. -For example drivers which implement a form of 'madvise' like functionality can -here count buffers which have instantiated backing store, but have been marked -with an equivalent of MADV_DONTNEED. +For example, drivers that implement functionality similar to 'madvise' can count +buffers that have instantiated backing stores but have been marked with an +equivalent of MADV_DONTNEED. - drm-active-: [KiB|MiB] The total size of buffers that are active on one or more engines. -One practical example of this can be presence of unsignaled fences in an GEM -buffer reservation object. Therefore the active category is a subset of -resident. +One practical example of this could be the presence of unsignaled fences in a +GEM buffer reservation object. Therefore, the active category is a subset of the +resident category. Implementation Details ======================