From patchwork Mon Feb 12 21:04:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Deucher, Alexander" X-Patchwork-Id: 13553971 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 E2D2AC4829E for ; Mon, 12 Feb 2024 21:05:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C7D4310E5E8; Mon, 12 Feb 2024 21:04:51 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="2inHAatk"; dkim-atps=neutral Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2071.outbound.protection.outlook.com [40.107.95.71]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7188110E160; Mon, 12 Feb 2024 21:04:48 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DSax6p9vmbYrDLs+qtM/5jOn1ksTHvxDNDhx4dkXSr2ByOzryFyk4uvdfrvGltLvk99pgRNdJJdOKNQLjzL3jU1K+B2qJ4zlEiFlJUEfwvy4l8Sh08daPW7Dv1n2zvH213/0hVZhVMFfbdZDMLmrreI8wEjIlCHcThc5e4D54y3YGXWUSSYO2kR1BQcZLcjctnpXEeTx/JM1whkBaKE0dWew0hS4DydQ5isEpgLymOZbyN9waURPC+Uk4ufJOS5X7Z379aZgWHE9hvt+A+/xQ3YyOJVKKojHgCa045n7ASOjemPMFs2ex+mB3oX7y7xhXibIfFscwOaXKCJzD6xneA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=2Np36lfcunEX+5VEROtXjAQrxsG9zSYLvkILaJ1ru3Y=; b=HnYHDbIVZG/oT+ECdykPjMTke0pmZ3vUPwjXGH+jshb8zU8QqPCFK17zneRUnejeoJfNGebP2q242i/IJx291aVJJKQoF287bDMOsSFWKYRuJxSdnwZSb0fL/eERAeO4cvS5aoHA0gO5/kUNtv08V80yPiyNLXoE4O5YBCm6LUdCQb1gilkCDDACNarHsHr8uaZa4KNFkiqfQ67S2VSJ02OJ9tNRYDu9ub7TLoUNnkeZA/s7OF/xcED4cr6N7/qpLWUTEN3r4O0arCrrcD7n48ZNyP6Bblo73bujSSYF+nhcTSqrUkD0DabNicKQk2cAnFlzUfCGiSFaCyqjXB9EqA== 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=2Np36lfcunEX+5VEROtXjAQrxsG9zSYLvkILaJ1ru3Y=; b=2inHAatkjbXGgaiCEw/U04Cg2osMVylEToEEu+1rJeikjRhJoSytdQy0nIYAH83y7TjQysi7A5//3Jg8CYJkP9djmb/cLoqpuRStnp9sy3NevBE2FqWXZoO9H2I5ggyTbBR9phS7JtZPptJ7V5BnFNcG9zYSInEeORv+ZkY1p5g= Received: from CH0PR04CA0083.namprd04.prod.outlook.com (2603:10b6:610:74::28) by CH3PR12MB8481.namprd12.prod.outlook.com (2603:10b6:610:157::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.11; Mon, 12 Feb 2024 21:04:45 +0000 Received: from CH3PEPF0000000E.namprd04.prod.outlook.com (2603:10b6:610:74:cafe::c2) by CH0PR04CA0083.outlook.office365.com (2603:10b6:610:74::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.38 via Frontend Transport; Mon, 12 Feb 2024 21:04:45 +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 CH3PEPF0000000E.mail.protection.outlook.com (10.167.244.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Mon, 12 Feb 2024 21:04:45 +0000 Received: from tr4.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.35; Mon, 12 Feb 2024 15:04:43 -0600 From: Alex Deucher To: , , , , , CC: Alex Deucher , Tvrtko Ursulin Subject: [PATCH 1/6] Documentation/gpu: Update documentation on drm-shared-* Date: Mon, 12 Feb 2024 16:04:23 -0500 Message-ID: <20240212210428.851952-2-alexander.deucher@amd.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240212210428.851952-1-alexander.deucher@amd.com> References: <20240212210428.851952-1-alexander.deucher@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF0000000E:EE_|CH3PR12MB8481:EE_ X-MS-Office365-Filtering-Correlation-Id: 891b74b4-ecb6-48a6-6e1c-08dc2c0e3da6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Sn4OzUIrln0fIDZcoHtm2PI+T51xNKDZlFhQCR/VjyxE9+CqxtG7wH5bsfBd/umVetUVoZri8+oRvaw2rbD2+VtfgJ1ir4kfdrVCS8G/sIWA3h5ukZ3fedy/8Y6gkSMAXuQXdW+mM3mc/j8fEnSaIr1Q9D+7bh9E1RtKnIPpT3PcprrzRSW6bKq/iApcxWNQO0JPrmpegdLIZABvheL35wYGhykfXgYtok0qR2WYY84cRKQgQUCSpv/O2SewiRhLDh01lOhqDJYuXQWjWhekbnzsdw+zCGz7hWP4rMHJbwKYYyz8w6OrHRUOa8onrUPZrCpSSirqzayNGKiZ93Su7aa16gBYrrNC5CObzSuVCcc4rG/69546sbh1AU5Ar6o4qjEZOVwdRnsjlwMgfUtMLDzwqOXZp0aIwR/cRdg9YT56LQHKkxyqb4vi2WkKeeTQmCChFnMnX/TtiwiNwKYFlJd6cG7jAnDYQ0uTi4dKUeQfGrB1wB+JL3cW7gMoKpEfrMXrB+3d3+9CD75gnPQyWEQZLvpnBF5f7K2wMqTLxZb1NZC4WUrhn1vmipzINLFd9q/hbxkILP1vRDFnveUrsg== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(39860400002)(396003)(346002)(136003)(376002)(230922051799003)(1800799012)(451199024)(82310400011)(186009)(64100799003)(36840700001)(40470700004)(46966006)(316002)(81166007)(82740400003)(41300700001)(356005)(86362001)(426003)(36756003)(4744005)(15650500001)(2906002)(5660300002)(6666004)(4326008)(54906003)(336012)(70206006)(70586007)(83380400001)(8936002)(8676002)(478600001)(110136005)(7696005)(2616005)(26005)(1076003)(966005)(16526019); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2024 21:04:45.4624 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 891b74b4-ecb6-48a6-6e1c-08dc2c0e3da6 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: CH3PEPF0000000E.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8481 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" Clarify the documentation in preparation for updated helpers which check the handle count as well as whether a dma-buf has been attached. Link: https://lore.kernel.org/all/20231207180225.439482-1-alexander.deucher@amd.com/ Reviewed-by: Tvrtko Ursulin Signed-off-by: Alex Deucher --- Documentation/gpu/drm-usage-stats.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/gpu/drm-usage-stats.rst b/Documentation/gpu/drm-usage-stats.rst index 7aca5c7a7b1d..6dc299343b48 100644 --- a/Documentation/gpu/drm-usage-stats.rst +++ b/Documentation/gpu/drm-usage-stats.rst @@ -138,7 +138,7 @@ indicating kibi- or mebi-bytes. - drm-shared-: [KiB|MiB] -The total size of buffers that are shared with another file (ie. have more +The total size of buffers that are shared with another file (e.g., have more than a single handle). - drm-total-: [KiB|MiB] From patchwork Mon Feb 12 21:04:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Deucher, Alexander" X-Patchwork-Id: 13553973 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 76768C48BC4 for ; Mon, 12 Feb 2024 21:05:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C7A2610E649; Mon, 12 Feb 2024 21:04:52 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="LYwb13iW"; dkim-atps=neutral Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2083.outbound.protection.outlook.com [40.107.244.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id CF10310E22D; Mon, 12 Feb 2024 21:04:49 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VNglfy8NHyZ8Dslpsj4D1lX4SgQDwsL3jGNzaSR5qyvTUtLnT3n236+IyAZIg9c/FL/iTdbDTMdIUTxun3e92+HEBohN7yIgkuOPHFh1WP28r3p28UBdF0M4PQQKTJpiIhPpQqnv05h4+W78MdBdWez0RZBzIU4Szo/GP31AAEwxT8fA79s5ojpVUuKttIxmgZyAFhWmurLzC2wz4LrVyO0pKuz3Ry49dX2RwX3c7XlbbszG5kJKnE3CYtI1mAAmFjfD42KQgCziCW5o5VEva4Y3x8FnS2xwSjMaK354UqKoshsXU5AUUqpEVmbiAbrl3//f2VEbxRdNnH3KwrrUjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=XBOTU3gLXyog1pj6k0Xvv+X/e5HLrfrfl6QX1SZIVkQ=; b=cz123V1palqdeI5DJFwI34Q6OcmZOiUDxtnk5kzfDZrQn9Bl4YGr05iuMVCXquDTBCXFfc5UUp0oEnG/iZfAbRrY7hiQDNcI73nGB7QnwZax/CZAQsMDDJA5wb6c0gceOWIVZao8SU546795iyERB6G+FuxqVHk/7a4N0F9KscZAOnujRVou1nO9dSSatINbkUL0ksfODodobhNFebTu2/IEbY22slLXnYdLoI/NrZydimC35gdedaMXIGPCQ92W8kANoKSDTfrn8HqKpJKTfWw1f7PDmOcLxRpbokjjy0vPqUOa4uU0u0CWgUcqT5fK44ke/p25zrDVLnXk0OaNaQ== 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=XBOTU3gLXyog1pj6k0Xvv+X/e5HLrfrfl6QX1SZIVkQ=; b=LYwb13iW9JRlJ3DYwEQarBy/zxfVE14fAfaNOKZUcNTACdbyv5NWKuBwGuOA6DUBtyfqIoXjnzUeOE0zji7qkhAnqkH8rjVIdKHw4CjTl6cfVbC7RDbOrCuFozFmnLticNOropbo6/uzyIx8O1MDJlGLn2qpZo9x5UOKNrmW7Dg= Received: from CH0PR04CA0061.namprd04.prod.outlook.com (2603:10b6:610:74::6) by PH0PR12MB7486.namprd12.prod.outlook.com (2603:10b6:510:1e9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25; Mon, 12 Feb 2024 21:04:46 +0000 Received: from CH3PEPF0000000E.namprd04.prod.outlook.com (2603:10b6:610:74:cafe::d6) by CH0PR04CA0061.outlook.office365.com (2603:10b6:610:74::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.39 via Frontend Transport; Mon, 12 Feb 2024 21:04:45 +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 CH3PEPF0000000E.mail.protection.outlook.com (10.167.244.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Mon, 12 Feb 2024 21:04:45 +0000 Received: from tr4.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.35; Mon, 12 Feb 2024 15:04:44 -0600 From: Alex Deucher To: , , , , , CC: Alex Deucher , Tvrtko Ursulin Subject: [PATCH 2/6] drm: add drm_gem_object_is_shared_for_memory_stats() helper Date: Mon, 12 Feb 2024 16:04:24 -0500 Message-ID: <20240212210428.851952-3-alexander.deucher@amd.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240212210428.851952-1-alexander.deucher@amd.com> References: <20240212210428.851952-1-alexander.deucher@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF0000000E:EE_|PH0PR12MB7486:EE_ X-MS-Office365-Filtering-Correlation-Id: 922fb86c-d671-4f24-445c-08dc2c0e3ddd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zgK8Lpx18KXe2JpXG6MaGgUWby7gJwqo3QTtzyEkDY3VDWvPLbRkuz7An9U3JVrch8Azbsr5lBHpI2UM6MYx6MoC9/oYNsrH3gawn+4OjtXcUI0gQZkq6ZmibGrDQRwExF5mdv2XsBIlXPCgzUtnDwS3oMZIddUrb28h4kzn4CFUVs5J4HaUqQvyCp6LjqlhSNYu82nkTLtoQA81ADyQgcNl2madIW2ekBty0wYL5hCXo/r8IUHwfeKcOFfyfa3Bzy/DMWDu0JX502+17lIStLoCDYcKic6Pem2jenrk8PWUC9q2x97Wh1L3von6avz+asVeT5yfE9L7MN+/5W5skmSLuvHTl2XQBulySES+JGp99eFzfMQFMMoWHLjemux5GYNBsDyo0s95aEYxCABAx0Q6eG2c+S89npSPhM5NiXzwbE+LdssH0Gio2T6n1d0iCY8Bkz2ZfZk54+l6Nq/Ct+z1p5xQYtnjnjo1T/b92KVzuiFrIeZMMXA1zJblO9tc4kAAPn7GoyLm8e6j0ofp08tSo+B3F1oDN4gGVsAm3WyPIfwhQ+CYuiiWQ+iFk1AEtO36hHb7vqe+NZITk8wCwA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(136003)(376002)(346002)(39860400002)(396003)(230922051799003)(64100799003)(451199024)(1800799012)(82310400011)(186009)(36840700001)(46966006)(40470700004)(2906002)(8936002)(4326008)(8676002)(5660300002)(336012)(426003)(83380400001)(2616005)(1076003)(26005)(82740400003)(36756003)(16526019)(356005)(86362001)(81166007)(110136005)(316002)(70586007)(70206006)(54906003)(7696005)(6666004)(966005)(478600001)(41300700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2024 21:04:45.8374 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 922fb86c-d671-4f24-445c-08dc2c0e3ddd 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: CH3PEPF0000000E.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7486 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 so that drm drivers can consistently report shared status via the fdinfo shared memory stats interface. In addition to handle count, show buffers as shared if they are shared via dma-buf as well (e.g., shared with v4l or some other subsystem). v2: switch to inline function Link: https://lore.kernel.org/all/20231207180225.439482-1-alexander.deucher@amd.com/ Reviewed-by: Tvrtko Ursulin (v1) Signed-off-by: Alex Deucher --- include/drm/drm_gem.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h index 369505447acd..2ebec3984cd4 100644 --- a/include/drm/drm_gem.h +++ b/include/drm/drm_gem.h @@ -553,6 +553,19 @@ unsigned long drm_gem_lru_scan(struct drm_gem_lru *lru, int drm_gem_evict(struct drm_gem_object *obj); +/** + * drm_gem_object_is_shared_for_memory_stats - helper for shared memory stats + * + * This helper should only be used for fdinfo shared memory stats to determine + * if a GEM object is shared. + * + * @obj: obj in question + */ +static inline bool drm_gem_object_is_shared_for_memory_stats(struct drm_gem_object *obj) +{ + return (obj->handle_count > 1) || obj->dma_buf; +} + #ifdef CONFIG_LOCKDEP /** * drm_gem_gpuva_set_lock() - Set the lock protecting accesses to the gpuva list. From patchwork Mon Feb 12 21:04:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Deucher, Alexander" X-Patchwork-Id: 13553970 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 50EAFC4829D for ; Mon, 12 Feb 2024 21:04:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C9DFE10E445; Mon, 12 Feb 2024 21:04:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="oY20aOv8"; dkim-atps=neutral Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2055.outbound.protection.outlook.com [40.107.220.55]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3867010E186; Mon, 12 Feb 2024 21:04:49 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iiF6igY6Nv3Xy6sKJHHny6oJ4k3EvH95Sd6wBgbtgwHSvgjs1SSeA/43iB/z/g3MhRL7JwFfPBNJKh88xLkp67DKgxJrI10geHRDbw8SgaxpFUwT+FD+U8zkbKhbEXI/rYEYj8ry7RiSpqNFw721R+uwrO6H6LqS05PwuvXzFxoNXOCTQWZd7eT6TuVxpij3taBORalIe347gi0vTYUpg9XjlaaXqjTrGj6YzMD/bCUX5FOU8fZr+zo25v3ruh2S5qhtIOdrbs6xB2Ne7NCXzusWVj4gvU0ZVdiZqzOAg7us0+ksyOnVOmMaxOw4ij7KyA938z2kcDIqt8MBzW3MxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Iaw174XqstUFlubmP8makauL3rvlcv95/STdbCiUNss=; b=Vu1VXOhV3Bf4ovIzkZe3kD1T/POGW4WOd7XeKUaB3gB7h2xzU9EvEv7ZMqHOyGDeLiRRXxwsuR9M1zX1PcDI3XCLFgLfuqmHRXfy4B84pNJH3xj0E7rp6Ck0yOiN4pctWav8OXvT690Z/eGbkacc0/8mL9qvGcgo8fdDG/oQ3EUzjTw98CbDjCsb/Q7EtnMjhtZCgrsrYy7TxloHlP4RfNvEBKqapaJGAUpL/rZosnHwE/kxCXol0xDexKjd8w7n2LcMbOTZnvMJFVXG6Ac2QJeYr3QXxW6wzV7JQpIVTlmMW/sncvqOiXzLx0KzU6MmxbZ5yiWHhPE3AZIhFxk0ZA== 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=Iaw174XqstUFlubmP8makauL3rvlcv95/STdbCiUNss=; b=oY20aOv8qIZ2OHaJIkBVaTvJxzR/hvUEYH1T07unIwgb9o9x6k3Co4PTu8yEL5MtbmzFncNl2KuDb960YNOPj/5EJR/r74ldL9yfkDJV25uSFMEOWX/N49E/y80wPwh83P3MqiYuf56Ulb7LsuOQ6VdE0IZ5eGxeVoeVaEiQkTg= Received: from CH0PR03CA0413.namprd03.prod.outlook.com (2603:10b6:610:11b::11) by LV8PR12MB9450.namprd12.prod.outlook.com (2603:10b6:408:202::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.24; Mon, 12 Feb 2024 21:04:47 +0000 Received: from CH3PEPF00000009.namprd04.prod.outlook.com (2603:10b6:610:11b:cafe::92) by CH0PR03CA0413.outlook.office365.com (2603:10b6:610:11b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.38 via Frontend Transport; Mon, 12 Feb 2024 21:04:47 +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 CH3PEPF00000009.mail.protection.outlook.com (10.167.244.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Mon, 12 Feb 2024 21:04:47 +0000 Received: from tr4.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.35; Mon, 12 Feb 2024 15:04:45 -0600 From: Alex Deucher To: , , , , , CC: Alex Deucher , Rob Clark , Tvrtko Ursulin Subject: [PATCH 3/6] drm: update drm_show_memory_stats() for dma-bufs Date: Mon, 12 Feb 2024 16:04:25 -0500 Message-ID: <20240212210428.851952-4-alexander.deucher@amd.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240212210428.851952-1-alexander.deucher@amd.com> References: <20240212210428.851952-1-alexander.deucher@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000009:EE_|LV8PR12MB9450:EE_ X-MS-Office365-Filtering-Correlation-Id: cbd29e6e-f662-43bb-fa87-08dc2c0e3e95 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iL1HzqyhM9C2GEMwsN9s2BBX+1EW4zyuqkwioxqw6Ywa9NGIIOhNqCg15r+pfv9xifERngZBFRRkaE+RHnTiLLXcRxXMVRJePFVXi6gfiS3vAon6s06D5dNslkb+DFmksyPH7XPHKgDWd5xfq/PnpJY3QlXimH5m/StFmjXFjhJST0B2hRtmCdOK2VWaYywvCNoUb1azPoWHZmyaj+5qVJGhHYp3O6RaHICbXUY3qsFUDhu2BL8SlbfB/CxJmdH3IA5qcCgyjj2CX6Uav7z815IG925hM3uCMQp2eg3RNebeBrxVkEAhFjW0EiIbBCb4jywtc3vywlPZmtdd3SB6bGgzdIZCyQuyobzUvv9usdp4/pzbkMtbx7G480tbzE9rNZ6N0uWCtwnl5sLkLtXi92kOFI6rIRcT6e3zJ+fq1c+QQTKmHtDpFrDTjNoaFVwvk6G3Qxkbpr9dvV+EaRuQLBdWY9k8PdUhFzeEPk+GiH2av2mwdeCFCbbAxugswGnj2NILHUF0VOl1QOehwToLn4lp8PFp6uMnXHo+NL2cVDBtmioavukiMH6QFJ9baOBsUbIlS2iE0KBNP2j0Rpgu/w== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(346002)(136003)(39860400002)(396003)(376002)(230922051799003)(186009)(82310400011)(64100799003)(451199024)(1800799012)(36840700001)(40470700004)(46966006)(86362001)(5660300002)(70206006)(70586007)(8676002)(8936002)(82740400003)(4744005)(4326008)(478600001)(7696005)(2906002)(16526019)(356005)(336012)(426003)(41300700001)(2616005)(1076003)(83380400001)(81166007)(966005)(26005)(6666004)(316002)(36756003)(54906003)(110136005); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2024 21:04:47.0323 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cbd29e6e-f662-43bb-fa87-08dc2c0e3e95 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: CH3PEPF00000009.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9450 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" Show buffers as shared if they are shared via dma-buf as well (e.g., shared with v4l or some other subsystem). v2: switch to gem helper Link: https://lore.kernel.org/all/20231207180225.439482-1-alexander.deucher@amd.com/ Reviewed-by: Rob Clark (v1) Reviewed-by: Tvrtko Ursulin Signed-off-by: Alex Deucher Cc: Rob Clark --- drivers/gpu/drm/drm_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c index 8c87287c3e16..638ffa4444f5 100644 --- a/drivers/gpu/drm/drm_file.c +++ b/drivers/gpu/drm/drm_file.c @@ -913,7 +913,7 @@ void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file) DRM_GEM_OBJECT_PURGEABLE; } - if (obj->handle_count > 1) { + if (drm_gem_object_is_shared_for_memory_stats(obj)) { status.shared += obj->size; } else { status.private += obj->size; From patchwork Mon Feb 12 21:04:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Deucher, Alexander" X-Patchwork-Id: 13553975 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 339C8C4829D for ; Mon, 12 Feb 2024 21:05:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 25E7B10E7B9; Mon, 12 Feb 2024 21:04:54 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="TqYQGgTt"; dkim-atps=neutral Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2085.outbound.protection.outlook.com [40.107.100.85]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2D67F10E687; Mon, 12 Feb 2024 21:04:52 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eY/WjeKB+BAbLfimTFmhSJuciNevYosD9jtZL7jpm66m1gBRKHHx3DgDYrlyEoAnC12SchjA/uunl+vjVvmmmwVtXR/L7apNsD9vWSNCLFGJfWSDpA7jOV7emF+KKOCwUrYetb19hu7fVI9/E3ZQxBzrbrkELnAfrbU4S0yX+5w0a6GqmyiBnT0t4LgX6X5azeCwc5E6UCnDeIL29XkuBhbrKgLNdWUkMGKcszgM5KYYhZaNlhBhA/dmfhs+g7KOO5NDHxYFoxozl/l9+J1fqZzIRBHMjhUu6UDVYzmY3aZ0ZVnTT7Nn97KAiLGoegVL/uWHtDfSRCGZ7x84VMdKsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=5YVKnoGgKkZc7MoAGUDW0o4DHwsUZtPtNerq3Jcp78A=; b=RJfecvkxrJIZ5qL65eKljUJQEViA2qNgKyPntYEKaCsYUjDzjWIQLRp76ioElIryTlHB1tmm18zY6Cssu7RFAgJZ7XMkTXUoI4iN9nId1PI/vzHCf7rV03z6qBX56pFURjQyStrkct30G4Quucn3VFfWV5rtZaSQe7U+QeNtYkmQrVqqq/as2iRojedzSpYUc8LzIKCRK8SYKq8u17TpEPd4t5r7ZpoPl13+a0rCfC2ltmSnH+0rjXMQVZIxN0aFl6pchzFmcZoqTy3hiIIP7r/tmA84pUo8wtI0Z2fYfpBhadF9mmrDG8LTdXHBImP7LxQU5cv2OSfkRp6dog7I4w== 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=5YVKnoGgKkZc7MoAGUDW0o4DHwsUZtPtNerq3Jcp78A=; b=TqYQGgTt7tLHqIleFiLyPv82RqW7NKdRYzle3/zxYLWcQUe9Juwmq2HbHmP8C3yc2vOiyXvrS+Pbuzw5Jnpj0dmf017CxtZNoF0c/qN+RgHdLg0UTIOOgAg6PmxgU/qJgwbY4HJtuuEMAzAs9JdGWHDlRP2DoQ+mW1GYPx7ToKc= Received: from CH0PR03CA0412.namprd03.prod.outlook.com (2603:10b6:610:11b::24) by DM6PR12MB4124.namprd12.prod.outlook.com (2603:10b6:5:221::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25; Mon, 12 Feb 2024 21:04:48 +0000 Received: from CH3PEPF00000009.namprd04.prod.outlook.com (2603:10b6:610:11b:cafe::c) by CH0PR03CA0412.outlook.office365.com (2603:10b6:610:11b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.38 via Frontend Transport; Mon, 12 Feb 2024 21:04:47 +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 CH3PEPF00000009.mail.protection.outlook.com (10.167.244.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Mon, 12 Feb 2024 21:04:47 +0000 Received: from tr4.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.35; Mon, 12 Feb 2024 15:04:46 -0600 From: Alex Deucher To: , , , , , CC: Alex Deucher , Rob Clark Subject: [PATCH 4/6] drm/amdgpu: add shared fdinfo stats Date: Mon, 12 Feb 2024 16:04:26 -0500 Message-ID: <20240212210428.851952-5-alexander.deucher@amd.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240212210428.851952-1-alexander.deucher@amd.com> References: <20240212210428.851952-1-alexander.deucher@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000009:EE_|DM6PR12MB4124:EE_ X-MS-Office365-Filtering-Correlation-Id: c772eccb-29f3-497b-44b4-08dc2c0e3f01 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1jUbtLRDDDEgmI74g6yN2HDKD7pdyT/SEVfmmKIar2KbU3MYsiPCuaJU+6M579POHJCl2oQ/o9sV1Vc6ez5Iw5xXpWZRZo3qptwZxuJtGash8p2sjw8NAW/2i5rpQ1GUB3c84m+jEQ4rDrywQ7hY4RFJR96Y7VdDVBTz1ycn7h4rrxTYk+Mujsaa+DTK9gkx3fxClBXPGb54fLAnPbodhEvLHtGFeeDUa+g7Y/O7Gah4QhjUYbOBbBnEChv9l6n4ZmnsEwW1YlbcyUJ6yQ70XO7EIBYn5rhXtrV+LkBIcBvGkLTCKZUX4+hrGgJEy93+c7l6BGC0ICY2dNWGz6BOcDCjvCU5dyBoXgriuBQ55b8nRVNLxMmsf+zPywz7Vnhw9pukSKGV5RPM3+VadzFEF+vFBHCUvBiDRU/WWB08c91hP02KsyserAOmgeEdhK4z6QPr/9nzoXtITXesB+Non60iCnys9rGz7SxELpAPGpJWPOOV9RukaTX4DOTbd8mYnY14OOHiAR0Ibao8jpgcSiEntPAZSFypHsFnRFfQLCYgCjmq0TxbWm13qWIfT9SEPZSGiIhmPf2FN2Oy+8gvrQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(136003)(376002)(39860400002)(346002)(396003)(230922051799003)(82310400011)(186009)(64100799003)(1800799012)(451199024)(40470700004)(36840700001)(46966006)(41300700001)(6666004)(356005)(81166007)(2616005)(336012)(426003)(70586007)(110136005)(70206006)(8676002)(316002)(4326008)(8936002)(2906002)(82740400003)(54906003)(5660300002)(36756003)(16526019)(1076003)(86362001)(478600001)(26005)(83380400001)(7696005)(966005); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2024 21:04:47.7354 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c772eccb-29f3-497b-44b4-08dc2c0e3f01 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: CH3PEPF00000009.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4124 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 shared stats. Useful for seeing shared memory. v2: take dma-buf into account as well v3: use the new gem helper Link: https://lore.kernel.org/all/20231207180225.439482-1-alexander.deucher@amd.com/ Signed-off-by: Alex Deucher Cc: Rob Clark --- drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 11 +++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c index 5706b282a0c7..c7df7fa3459f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c @@ -97,6 +97,10 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file) stats.requested_visible_vram/1024UL); drm_printf(p, "amd-requested-gtt:\t%llu KiB\n", stats.requested_gtt/1024UL); + drm_printf(p, "drm-shared-vram:\t%llu KiB\n", stats.vram_shared/1024UL); + drm_printf(p, "drm-shared-gtt:\t%llu KiB\n", stats.gtt_shared/1024UL); + drm_printf(p, "drm-shared-cpu:\t%llu KiB\n", stats.cpu_shared/1024UL); + for (hw_ip = 0; hw_ip < AMDGPU_HW_IP_NUM; ++hw_ip) { if (!usage[hw_ip]) continue; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 425cebcc5cbf..e6f69fce539b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -1276,25 +1276,36 @@ void amdgpu_bo_get_memory(struct amdgpu_bo *bo, struct amdgpu_mem_stats *stats) { uint64_t size = amdgpu_bo_size(bo); + struct drm_gem_object *obj; unsigned int domain; + bool shared; /* Abort if the BO doesn't currently have a backing store */ if (!bo->tbo.resource) return; + obj = &bo->tbo.base; + shared = drm_gem_object_is_shared_for_memory_stats(obj); + domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type); switch (domain) { case AMDGPU_GEM_DOMAIN_VRAM: stats->vram += size; if (amdgpu_bo_in_cpu_visible_vram(bo)) stats->visible_vram += size; + if (shared) + stats->vram_shared += size; break; case AMDGPU_GEM_DOMAIN_GTT: stats->gtt += size; + if (shared) + stats->gtt_shared += size; break; case AMDGPU_GEM_DOMAIN_CPU: default: stats->cpu += size; + if (shared) + stats->cpu_shared += size; break; } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h index a3ea8a82db23..be679c42b0b8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h @@ -138,12 +138,18 @@ struct amdgpu_bo_vm { struct amdgpu_mem_stats { /* current VRAM usage, includes visible VRAM */ uint64_t vram; + /* current shared VRAM usage, includes visible VRAM */ + uint64_t vram_shared; /* current visible VRAM usage */ uint64_t visible_vram; /* current GTT usage */ uint64_t gtt; + /* current shared GTT usage */ + uint64_t gtt_shared; /* current system memory usage */ uint64_t cpu; + /* current shared system memory usage */ + uint64_t cpu_shared; /* sum of evicted buffers, includes visible VRAM */ uint64_t evicted_vram; /* sum of evicted buffers due to CPU access */ From patchwork Mon Feb 12 21:04:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Deucher, Alexander" X-Patchwork-Id: 13553972 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 E8B2CC48BEF for ; Mon, 12 Feb 2024 21:05:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1D37210E65E; Mon, 12 Feb 2024 21:04:52 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="FQh1jiky"; dkim-atps=neutral Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2057.outbound.protection.outlook.com [40.107.220.57]) by gabe.freedesktop.org (Postfix) with ESMTPS id F382910E3BE; Mon, 12 Feb 2024 21:04:49 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WTeLru3nyN1ONB+aWSV9sjXzUASCI4iHa4Ci3J3N30MSMPCcZTrb0SVAzMiAIpkqikYy4swvg2ERkPX7pMYgkLjMQhWCiz5+nl1iEmf8XhCcBnh2mu5dI5mu554FuofUtffFBYICcdsQ2TK4Ky4Cwo5AKx7LQFtC+FZr89km4Pho0mWvM6mnG4PoMML8iJe5sxEWw5NxSt/ny2r5U7+TLvmZAsulktj9T7mRvUr888feO1vEd7kTw2ZlK/N42PIhn7UUhYX/fjfp6l2kCTA59/co6w5uHsjeyeUxTDXpVllT+UyYWgJlfS4VKFqKI5kPLm1G7j1ux4eh47oMhZfKww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Q87PkI5BLKVn0unDjNjtkn4F9ccJc/ecu5jfQJ2/7M0=; b=CoQOsHPcBYDuSg0527LK2BKFNi3mF+J9MwNlQkY0MSLZwAo5nc/dMH8bQYinQwEOH9BMT/sZEoK1HEdQU7EfXHCFdtIno8nCXc1dnivUrX043qvnEq9TnRPxhKiKhGCKwl1vRk9OVrNcYnywURYh0qVkqWwEkr7Sqfa7MIg8IvZJrVY28IgrAAAlPu3Am1BL4TNWDua8ZhbD/olzi+/IticSLAjWaLklGZQr2k5YifMwFi+6R80SJjfRezwdVn4RqGIdn0LPiVWj3OaO2KTSF6Uod+jOrediIHsrIwGgnsuViwMOmfNy3kE8yGq9Ie3J0+sANU8a6MxTslF4PDGT/Q== 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=Q87PkI5BLKVn0unDjNjtkn4F9ccJc/ecu5jfQJ2/7M0=; b=FQh1jikygN3TgV1+9mS3dcTNMQqV0HKOMmY3Fg9WqdnWPV/xxEZ8C2Toh5GHDko3XQPsOdRLaCwurDT6Nk8IKXKyjx2+9jNvu/tIHVipLRRpd4oP/kYupK1u4rwQs3mE9HpxytH6LKXOAN+i1wrLJ4f5cbw52IjK8W09Ze+T4+o= Received: from CH0PR04CA0070.namprd04.prod.outlook.com (2603:10b6:610:74::15) by SA1PR12MB8144.namprd12.prod.outlook.com (2603:10b6:806:337::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.14; Mon, 12 Feb 2024 21:04:48 +0000 Received: from CH3PEPF0000000E.namprd04.prod.outlook.com (2603:10b6:610:74:cafe::e9) by CH0PR04CA0070.outlook.office365.com (2603:10b6:610:74::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.39 via Frontend Transport; Mon, 12 Feb 2024 21:04:47 +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 CH3PEPF0000000E.mail.protection.outlook.com (10.167.244.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Mon, 12 Feb 2024 21:04:47 +0000 Received: from tr4.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.35; Mon, 12 Feb 2024 15:04:46 -0600 From: Alex Deucher To: , , , , , CC: Alex Deucher , Tvrtko Ursulin Subject: [PATCH 5/6] drm/i915: Update shared stats to use the new gem helper Date: Mon, 12 Feb 2024 16:04:27 -0500 Message-ID: <20240212210428.851952-6-alexander.deucher@amd.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240212210428.851952-1-alexander.deucher@amd.com> References: <20240212210428.851952-1-alexander.deucher@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF0000000E:EE_|SA1PR12MB8144:EE_ X-MS-Office365-Filtering-Correlation-Id: d9c96f15-4889-4bcd-c068-08dc2c0e3f1c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TjGR0008t1P7XVzHMG5yoquuTX6XOaAeFRqsomdCGkFohnrq9TOwUdPO8ntdK5PNZPNFya8iU2yRWhjuIuZfSQmcNykqJRYhvWBn7bmqq3WUZn6YcqYDZGKTCOPtab4phcdyJ4ARNmNYBXUs4LeQbU2vuh/UC1DRnxeqJeWM3f+nwY38rFfDXlJ/id9D0CHHsiFlEFqw37jUhBFQIOt1wOgBvHCXsrd7lYGi8mOlz8NsGOkR9FXkJFtALSyzgwOuXu2Rrn5tHI+Dmg3UcKJPJieWvKBMwuq6oz/Kcw9f+47W9GWJ08w3b4NL+/zBSPjG9rtmS9guAN2ELaNrFC94PCAqJSog+0CYg2SyHcMXP0LiWCmHVz0HVKszbDjKEmYXh6MmJFxaNmsMQJk473qglc46C/K/WSTFGst1n+NAqdNsvm/cFiK66fvEt66YYfvP1izf/mteuBS3AXC2+AB4K9WhlZIJ2Nczcz3x8zt/O7Yd78z/yGBmAnOjP6QBexRooeUpGgFrFlPxEnYYXZXlT/yIWWNxz9TsEBoUOXE7ImW1YK+gOrK5LNhUblbc/JqZYe9pVbiQuuVrsA0W8Q5vqA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(136003)(396003)(376002)(39860400002)(346002)(230922051799003)(451199024)(186009)(82310400011)(1800799012)(64100799003)(46966006)(40470700004)(36840700001)(5660300002)(2906002)(82740400003)(356005)(4744005)(86362001)(81166007)(26005)(8936002)(7696005)(6666004)(83380400001)(316002)(426003)(70206006)(2616005)(1076003)(16526019)(4326008)(336012)(110136005)(70586007)(8676002)(54906003)(966005)(478600001)(36756003)(41300700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2024 21:04:47.9155 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d9c96f15-4889-4bcd-c068-08dc2c0e3f1c 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: CH3PEPF0000000E.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8144 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" Switch to using the new gem shared memory stats helper rather than hand rolling it. Link: https://lore.kernel.org/all/20231207180225.439482-1-alexander.deucher@amd.com/ Reviewed-by: Tvrtko Ursulin Signed-off-by: Alex Deucher --- drivers/gpu/drm/i915/i915_drm_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_drm_client.c b/drivers/gpu/drm/i915/i915_drm_client.c index fa6852713bee..f58682505491 100644 --- a/drivers/gpu/drm/i915/i915_drm_client.c +++ b/drivers/gpu/drm/i915/i915_drm_client.c @@ -53,7 +53,7 @@ obj_meminfo(struct drm_i915_gem_object *obj, obj->mm.region->id : INTEL_REGION_SMEM; const u64 sz = obj->base.size; - if (obj->base.handle_count > 1) + if (drm_gem_object_is_shared_for_memory_stats(&obj->base)) stats[id].shared += sz; else stats[id].private += sz; From patchwork Mon Feb 12 21:04:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Deucher, Alexander" X-Patchwork-Id: 13553974 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 8A59AC4829E for ; Mon, 12 Feb 2024 21:05:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8620E10E724; Mon, 12 Feb 2024 21:04:53 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="mYvBnzb8"; dkim-atps=neutral Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2074.outbound.protection.outlook.com [40.107.220.74]) by gabe.freedesktop.org (Postfix) with ESMTPS id 175D710E56D; Mon, 12 Feb 2024 21:04:51 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IUTKtUWnpkGauod+rpSoHHTNoDRXWfIgM3Tvrm7tFaEg19RwextUNPsL7A35852uArVglQtS4EMIqm3cHSR6aYg7bS/ePnO2qQEBdIsymbRtYlqKw7RbBxGcKsdMi+2cq7SolvLqHtK/kO+BNr0I6NaX+m8OhzjyMK00KYZACb2nWySmvf5zqxUhgsQ+ni2vqRxH3yJ+LANxWNHnKMj5we793vI+Zf25wKLfOsRW0gg1j1EbIpI0ZPMJE9oirJf9fp9kdVqq3VYUeBlDAa4Bhx5q28ex5xJ9xpfzqhi77bHqN3tcpuiGFi1GGsYVp1xt4yLShNW/Jv+/C+8eAxxcYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=FRtM1wsUyneTByH711abrNxiqsruk/2WT67jRGs7CKc=; b=Mltbwsmwt4s/xGEvhx7zAIOdVMtGiOWYA9X62oE633WUQmBOzdsFPb6aG9OQeFp1e1eFxN/2tSXL2z01Ci8V0F+08QVpTR2VSEvMcYgDI0Ham+JQM6kC42D1J2GacZXVkpnZ9DnxfyaayPUnF4bbg1ywpAd09wflntZDw+U5fASCDtWRS8tEPk/qTDNhriA19RoUnM5OKs8Hb5jxqdXhWQmzBx/Ohqeg/IlGgUqVNMXuP4mPYP8mO++3rWqh6CtJ9XelAZeWaMZ/lDQSZBTzGbnKmOj8ZzKhtr+rwBnbmfjTKtdhzXyNDTB8FzGrPxd3PsqWo3BsS3M374x+zvo9lg== 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=FRtM1wsUyneTByH711abrNxiqsruk/2WT67jRGs7CKc=; b=mYvBnzb8HHndQMZJff/p2sbVwEEk4SBkhju77Qbv9Xm4s2JF9k1QdmfMhZSGmOqlacw+uv6jwyj4SHQL94Z58kysL3XVRFzG56fxS/FgYV8EHuUSs7tupbKY4W0K7ZlJGDChwsRCwjnJfZxHI8hvziiFybjvzLzOyRJiaL3N5bU= Received: from CH0PR04CA0083.namprd04.prod.outlook.com (2603:10b6:610:74::28) by BL1PR12MB5047.namprd12.prod.outlook.com (2603:10b6:208:31a::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.23; Mon, 12 Feb 2024 21:04:48 +0000 Received: from CH3PEPF0000000E.namprd04.prod.outlook.com (2603:10b6:610:74:cafe::fb) by CH0PR04CA0083.outlook.office365.com (2603:10b6:610:74::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.38 via Frontend Transport; Mon, 12 Feb 2024 21:04:48 +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 CH3PEPF0000000E.mail.protection.outlook.com (10.167.244.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Mon, 12 Feb 2024 21:04:48 +0000 Received: from tr4.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.35; Mon, 12 Feb 2024 15:04:47 -0600 From: Alex Deucher To: , , , , , CC: Alex Deucher Subject: [PATCH 6/6] drm/xe: Update shared stats to use the new gem helper Date: Mon, 12 Feb 2024 16:04:28 -0500 Message-ID: <20240212210428.851952-7-alexander.deucher@amd.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240212210428.851952-1-alexander.deucher@amd.com> References: <20240212210428.851952-1-alexander.deucher@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF0000000E:EE_|BL1PR12MB5047:EE_ X-MS-Office365-Filtering-Correlation-Id: 0ed80f1d-a569-4b89-0a7b-08dc2c0e3f88 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QOD4OR9ED8xqw/UXMk9LYLHifHYgi8XocO/HdIrrDH0XJBMtu+dJPP0gpEsBbQvHLTYD6WjSugEIP/L9a0lleV/IGtuGVEfPZyd6SSuHu+XCH4dgxp94WRLxNY90mD60DYYURw/EWKsyeyEFyx+ahXUdLa+VMm7qizc5M2gW3WnJUX8zuQuUWmDnhaRoihylqF3B74U14+oC9ecrI+jHQ1m0dPcUgFCdTVKwHCjfNNe2AlcHpuME9ZoIU8OKcVIznudMj1nwT46YCspvHv3xAwsgWnKxpw7oQkspuMFBp+JtNTj2lh09g/NVxxHEAvuCt80ztJNt97unQp0tbCj1ihkZITClfhKplnFaoexgabQvKWUnnM6p+zCUWGk8xu+sqN2GSldqlFEtVwoXd54mh0YAvYPOz9OOUyJtI9pOlPT2GXdvxffeI03eI3uJNUMgohye7mh484fNZBg0pnC7pYUcGDD6UoRogZrP+7gg57BuXiBV4PzJHoiqOCmbAcaHurF1v+q8iSn+RHMUF/BtQvP5YgXxlCIN4AgiLaVM82Dg7Ei08fsptbxlBMz/yMRVaAKrxbltfOCyFQjG+VfdXA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(396003)(136003)(376002)(346002)(39860400002)(230922051799003)(82310400011)(451199024)(186009)(1800799012)(64100799003)(36840700001)(46966006)(40470700004)(36756003)(2906002)(966005)(7696005)(6666004)(336012)(110136005)(83380400001)(82740400003)(316002)(478600001)(426003)(26005)(41300700001)(16526019)(8676002)(1076003)(70586007)(70206006)(8936002)(86362001)(4326008)(5660300002)(4744005)(81166007)(2616005)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2024 21:04:48.6187 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0ed80f1d-a569-4b89-0a7b-08dc2c0e3f88 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: CH3PEPF0000000E.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5047 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" Switch to using the new gem shared memory stats helper rather than hand rolling it. Link: https://lore.kernel.org/all/20231207180225.439482-1-alexander.deucher@amd.com/ Signed-off-by: Alex Deucher --- drivers/gpu/drm/xe/xe_drm_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_drm_client.c b/drivers/gpu/drm/xe/xe_drm_client.c index 82d1305e831f..ecf2eb67d310 100644 --- a/drivers/gpu/drm/xe/xe_drm_client.c +++ b/drivers/gpu/drm/xe/xe_drm_client.c @@ -113,7 +113,7 @@ static void bo_meminfo(struct xe_bo *bo, else mem_type = XE_PL_TT; - if (bo->ttm.base.handle_count > 1) + if (drm_gem_object_is_shared_for_memory_stats(&bo->ttm.base)) stats[mem_type].shared += sz; else stats[mem_type].private += sz;