From patchwork Fri Feb 16 15:09:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Eric Pelloux-Prayer X-Patchwork-Id: 13560168 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 2CD5AC48260 for ; Fri, 16 Feb 2024 15:11:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 288FE10EB87; Fri, 16 Feb 2024 15:11:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="zH9w+WbY"; dkim-atps=neutral Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2069.outbound.protection.outlook.com [40.107.220.69]) by gabe.freedesktop.org (Postfix) with ESMTPS id BABF410EB87; Fri, 16 Feb 2024 15:11:20 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BMqebRBLMbjclz9HvWd3zzu36m/NHSlIqDWfrSBUQca97wbpez1HDlMI8shiJZGqEZo7fbR23Q33dh8MrdOEwqOhnRWeeoxnyklvhAA7WWDG1qSCktEy1rKHr2GQP4vFK/ep6Nd+UzUMgKyROT6ayQF05h+fDyqYAzaweDLJQZB4BsO83L9USJCc1vyKJnw1Ciu88sIgW7F5hSa9aTmPINZ6zIdJh6fwJ7SyfpFTUi7ESgun2VYZXCTvXVgboRddb9UzNx1ry7lhiekttM7nTOA5vj2bKlSnBxwVM6X4A2oMJWL/U6cK7WQgJm2ihxzjulpCsvMzdHMQiYqBGNM92w== 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=CpTSVo2kk6slrMF45OEiNz5zy+SsirxruPo4DHrTL3k=; b=X5xDRrqq7q9dv06pGaJxOkCZ0Br8MqvwDdtkYSkUyjAxmfG6CUtvjJUT8v6/bQkjGuP+c/KX+5ZnAeNyDjZkLvFFGskJsN8Eb52kQKtdQkqZ+K2wGmK4iWwFivDl8NXgHg8QJCiKNNvcDWs+5keAcsEWHXtn6lJmQB8ypPCpvbPTPzEo6uolneFqIffMK7Jif2+NQvaXJ6JRuOMa7Z8ul9rNGY6NH92iqymnIe95ZFpDMMK7uwOy/d5t0CYSqNuC52iRvjG+LYqS3Ta5mLmiNr0frWl84u3os18FpuqwKau05np9DpqYMAN3CG0cINsG+7UofrogY2V1Oc46okff8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linaro.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=CpTSVo2kk6slrMF45OEiNz5zy+SsirxruPo4DHrTL3k=; b=zH9w+WbYceoA6wC+IaiYczSJIQi0YGWaJytAsSkHGue3ZIF+aVegmmF0MzfDozxBWkvFENZimDr+BMVbYdSqHa2qaU+MFbG2TgLj4rGkXUiNSBZJXwvc1Y1vEJL3wnNNa6c53oIOD5/VNe0oEUY9lElhgT8yVwSzZwbmltHUXQ0= Received: from MN2PR17CA0031.namprd17.prod.outlook.com (2603:10b6:208:15e::44) by CY5PR12MB6203.namprd12.prod.outlook.com (2603:10b6:930:24::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.14; Fri, 16 Feb 2024 15:11:16 +0000 Received: from MN1PEPF0000F0DF.namprd04.prod.outlook.com (2603:10b6:208:15e:cafe::1c) by MN2PR17CA0031.outlook.office365.com (2603:10b6:208:15e::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.26 via Frontend Transport; Fri, 16 Feb 2024 15:11:16 +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 MN1PEPF0000F0DF.mail.protection.outlook.com (10.167.242.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Fri, 16 Feb 2024 15:11:16 +0000 Received: from patedamande.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; Fri, 16 Feb 2024 09:11:11 -0600 From: Pierre-Eric Pelloux-Prayer To: Pierre-Eric Pelloux-Prayer , "Sumit Semwal" , Gustavo Padovan , =?utf-8?q?Christian_K=C3=B6nig?= , Steven Rostedt , Masami Hiramatsu , "Mathieu Desnoyers" , , , , Alex Deucher , Subject: [PATCH v3 1/8] tracing, dma-buf: add a trace_dma_fence_sync_to event Date: Fri, 16 Feb 2024 16:09:50 +0100 Message-ID: <20240216151006.475077-2-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240216151006.475077-1-pierre-eric.pelloux-prayer@amd.com> References: <20240216151006.475077-1-pierre-eric.pelloux-prayer@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: MN1PEPF0000F0DF:EE_|CY5PR12MB6203:EE_ X-MS-Office365-Filtering-Correlation-Id: e3f509a2-d33b-444c-a998-08dc2f018599 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gm9VSNEFJhIrgibaYgpDCwy9RyY4qYQ8SsPYKIooN/oG/eWqqGlkdi6J1KVh8mDX5Ph9vexPeYGf3mVmS/7QNGFNdY+H6DbjZBZV6+qJJfRDvESaRkhqt2nSDsnCCdww21+GAcxsturCuD54vkfaWyCdA3wE5tke+jZLp5WMRfOC5/a4D6L0PIQ+T7yXCDouXptadsf7gFfm2bG3DN5/Gs3QIVd9onuiMy6XkuHEbLXDYdZQHwwUrXUkTLXJU9bSXMnGQ3tQb/LWPM9/Uj7WRaBOjN2tuOIFarrb5fPtZF+oSakrR8Aavb7KhEZFgJsoV6jvDQGqdZfoPY4Jhk721Z/0ZAVEUjcHG6zBMsjh0f9BuhDVEjeuugsSFZyc8ytJ0M0X9sghyqGcrJB/fl3ehZmdKU1EF7og2s7RqgKd0VYncyaJzc1FuzgrBdwO7jpV3cdnSXcWvC981wqHU2hmb7wN1gQ6WlZZt/hF+5IUJsX5+skf2B68Q2uDryzfBycix8zSdoVKCo/uA0KNy6BCnl6vZ67YQ7WlbOdUx4Kja2lhp/djp1dYQVgQd02z7wQ1xDknUlpPoMoSBGmh7VuliIvZpGYIV70acVhw5q+SG7/AAOqenTeAlNZMK+6YOoRzuh9frKEd1uhztOu6uJlvwzbd3Dtn9zY7OjgaPHadwkw= 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)(376002)(346002)(396003)(136003)(39860400002)(230922051799003)(186009)(64100799003)(1800799012)(82310400011)(451199024)(36860700004)(40470700004)(46966006)(2906002)(6666004)(8936002)(8676002)(5660300002)(336012)(86362001)(921011)(426003)(1076003)(7696005)(26005)(36756003)(82740400003)(356005)(16526019)(83380400001)(2616005)(81166007)(70586007)(70206006)(110136005)(316002)(478600001)(41300700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2024 15:11:16.2368 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e3f509a2-d33b-444c-a998-08dc2f018599 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: MN1PEPF0000F0DF.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6203 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" This new event can be used to trace where a given dma_fence is added as a dependency of some other work. I plan to use it in amdgpu. Signed-off-by: Pierre-Eric Pelloux-Prayer --- drivers/dma-buf/dma-fence.c | 1 + include/trace/events/dma_fence.h | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c index 0393a9bba3a8..e7276c043984 100644 --- a/drivers/dma-buf/dma-fence.c +++ b/drivers/dma-buf/dma-fence.c @@ -23,6 +23,7 @@ EXPORT_TRACEPOINT_SYMBOL(dma_fence_emit); EXPORT_TRACEPOINT_SYMBOL(dma_fence_enable_signal); EXPORT_TRACEPOINT_SYMBOL(dma_fence_signaled); +EXPORT_TRACEPOINT_SYMBOL(dma_fence_used_as_dependency); static DEFINE_SPINLOCK(dma_fence_stub_lock); static struct dma_fence dma_fence_stub; diff --git a/include/trace/events/dma_fence.h b/include/trace/events/dma_fence.h index 3963e79ca7b4..5a5d272031ce 100644 --- a/include/trace/events/dma_fence.h +++ b/include/trace/events/dma_fence.h @@ -83,6 +83,33 @@ DEFINE_EVENT(dma_fence, dma_fence_wait_end, TP_ARGS(fence) ); +TRACE_EVENT(dma_fence_used_as_dependency, + + TP_PROTO(struct dma_fence *fence, const char *reason), + + TP_ARGS(fence, reason), + + TP_STRUCT__entry( + __string(driver, fence->ops->get_driver_name(fence)) + __string(timeline, fence->ops->get_timeline_name(fence)) + __field(unsigned int, context) + __field(unsigned int, seqno) + __string(reason, reason) + ), + + TP_fast_assign( + __assign_str(driver, fence->ops->get_driver_name(fence)); + __assign_str(timeline, fence->ops->get_timeline_name(fence)); + __entry->context = fence->context; + __entry->seqno = fence->seqno; + __assign_str(reason, reason); + ), + + TP_printk("driver=%s timeline=%s context=%u seqno=%u reason=%s", + __get_str(driver), __get_str(timeline), __entry->context, + __entry->seqno, __get_str(reason)) +); + #endif /* _TRACE_DMA_FENCE_H */ /* This part must be outside protection */ From patchwork Fri Feb 16 15:09:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Eric Pelloux-Prayer X-Patchwork-Id: 13560169 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 29EF6C48BEF for ; Fri, 16 Feb 2024 15:11:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3164210EBA1; Fri, 16 Feb 2024 15:11:36 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="Ja6E55G4"; dkim-atps=neutral Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2062.outbound.protection.outlook.com [40.107.237.62]) by gabe.freedesktop.org (Postfix) with ESMTPS id BCD9110EB99; Fri, 16 Feb 2024 15:11:34 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oTmbTaNLwfsCx3ttE6ro/SIYmG1lOayKm/XD37HVLKtCuayHVgZ+a2zCEzgxAS9IW3Vj538/ZCifFWjTtzXfnW63OvhAzL+WyRzPGuEn4ENeGz/3A6AjXLkeWnzWhFuOClxY6Bh27mJzssjKS507tkvkgAbqSm8UfZ4fgnn85n1k/KW3jgJgkX+iJ1STrDiLpGg+3bHCuQ/OvHa1I6bbgDXbmTVwWh9TogdhQsyLOPn6lvx8jfsy37lhXu6SCmgL54cxIfmbMZUN5j9b2shsGLyKt4kPgZvS6oNvXMPUzfM09D94U7LZEs9pDU/cIyxeqjM4wonIJDaeMRQU4T0Dmg== 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=ICCI0nm6dGnnrxMIjneXXjS64ZTygPY6q4C1ea+Vdts=; b=XIY92XMvvsWIL2iCtapZcQp7fo1b8FeZ3TYo+NMkQwQJcUC3NnZdigIRVtvQ6OxmJPNlD+vVHNGJ4fBmfTEpvzBOAfEN7lzWG+6vGme9A2V0quzpN/2QBHJ9MwU5rjNlzd6+mozB1kuJrU6yxt35aE3XunNUr1eWIXoWPDIZlSosPSyq+DRX31MYhiR6OBplsRa5kuRYEFXDeqJeqRIpHtIgxBvujsQoYHWZi2/aUWCYw5bOMsOfNXAQ0pIpHY9bl6sfuNY+2tNLTrayFpCK7nismx31tBOxfAOEKwVZyg0DPZ/27veERpMfakEqyFNhFxJC7BtE0YOBxvB5dH20ug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linaro.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=ICCI0nm6dGnnrxMIjneXXjS64ZTygPY6q4C1ea+Vdts=; b=Ja6E55G4D5yS+ThG5aK/lfEfVOitUrl4T1IHx5WQhBVIaB6INkChgQ400CPKSJAB9FvBTdRSWnDi7a/qVNGjKL2oSg2OdwIMVCUuMCLkeL+xEn/lpFXbO7A9lqtEea9InxLtkn8BwpM8Q4f5ujARUYocSXbSYa0r4MxZG7pyyow= Received: from BLAPR05CA0014.namprd05.prod.outlook.com (2603:10b6:208:36e::18) by PH7PR12MB8153.namprd12.prod.outlook.com (2603:10b6:510:2b0::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.11; Fri, 16 Feb 2024 15:11:31 +0000 Received: from MN1PEPF0000F0DE.namprd04.prod.outlook.com (2603:10b6:208:36e:cafe::4e) by BLAPR05CA0014.outlook.office365.com (2603:10b6:208:36e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.14 via Frontend Transport; Fri, 16 Feb 2024 15:11:31 +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 MN1PEPF0000F0DE.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Fri, 16 Feb 2024 15:11:31 +0000 Received: from patedamande.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; Fri, 16 Feb 2024 09:11:28 -0600 From: Pierre-Eric Pelloux-Prayer To: Pierre-Eric Pelloux-Prayer , "Sumit Semwal" , Gustavo Padovan , =?utf-8?q?Christian_K=C3=B6nig?= , Steven Rostedt , Masami Hiramatsu , "Mathieu Desnoyers" , , , , Alex Deucher , Subject: [PATCH v3 2/8] dma-buf/fence-chain: use trace_dma_fence_sync_to Date: Fri, 16 Feb 2024 16:09:51 +0100 Message-ID: <20240216151006.475077-3-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240216151006.475077-1-pierre-eric.pelloux-prayer@amd.com> References: <20240216151006.475077-1-pierre-eric.pelloux-prayer@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: MN1PEPF0000F0DE:EE_|PH7PR12MB8153:EE_ X-MS-Office365-Filtering-Correlation-Id: e783b0ca-66b7-4704-4d72-08dc2f018ea2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ztsynES0Xhbmgcbc9zRAwB1rBOgMt+wjoNdYDKR1utHMLgh96GyOB7yNTtVQawp97ocWeAJn7Y2DPke/0fYs26c6cqYV8tPRNVk54iKI7NujItiFpSMGljk8/IpYkGo9P9om15JnH4WuQ5EjyL/x/YSaUj3qhCLcS6UfAqoPv98gtwg9jgNF9cOeDaK4f9n6LPfrSN7uSeGvgDooRcb9W2AHdWAWG2n3O2MG8WLHNvfTqGNVBXwp0ATykI6LpMpv1w+Phjc+7DnUOc2HADBk4RT9uSv0vHKdnkN+QSv3RGyaF47udyinNOAjM0M5GJJCKxNKCkOmBo9QZPcJualc9sUGcix/IzKTZu3VXrN5Idc6bgPRmCN60OcL9DHc1kFxtfVyfez3ogG93EOw6Jhf2XgIblAvS/E1RaQ/EAcy4bsUT/lm2ifK4vTx9tujUXXQoUvHKfCI+GVgbFyCKNvY0pbxTmiRgpoY6jTpPDB87PM5zuItr+ILmihOqJzAnQxYoZbYwa88xx7H3CCcoCYTYvcmFJadfQ67ETSoaSRcquCvldtIUBwwz1ct1RbCo/usaZ43zLlcQDlnyiGHXW7Nv7ZZ8QfbIEN8oWL0Usdl7e8qqBcC5njYMicC/LLYNwbyeqyRgoCNZO7Z/Eo36ULXMCmLlrLWMH5pKJHSn4PHDXg= 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)(376002)(136003)(39860400002)(346002)(230922051799003)(186009)(64100799003)(1800799012)(82310400011)(36860700004)(451199024)(40470700004)(46966006)(478600001)(41300700001)(2906002)(5660300002)(70586007)(4744005)(8936002)(8676002)(26005)(426003)(7696005)(316002)(6666004)(2616005)(16526019)(110136005)(336012)(82740400003)(356005)(86362001)(70206006)(36756003)(921011)(81166007)(1076003); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2024 15:11:31.3773 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e783b0ca-66b7-4704-4d72-08dc2f018ea2 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: MN1PEPF0000F0DE.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8153 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" To inform tools about the relationship between the fences. Signed-off-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Christian König --- drivers/dma-buf/dma-fence-chain.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/dma-buf/dma-fence-chain.c b/drivers/dma-buf/dma-fence-chain.c index 9663ba1bb6ac..3435078c45b7 100644 --- a/drivers/dma-buf/dma-fence-chain.c +++ b/drivers/dma-buf/dma-fence-chain.c @@ -9,6 +9,8 @@ #include +#include "trace/events/dma_fence.h" + static bool dma_fence_chain_enable_signaling(struct dma_fence *fence); /** @@ -251,6 +253,8 @@ void dma_fence_chain_init(struct dma_fence_chain *chain, chain->fence = fence; chain->prev_seqno = 0; + trace_dma_fence_used_as_dependency(fence, __func__); + /* Try to reuse the context of the previous chain node. */ if (prev_chain && __dma_fence_is_later(seqno, prev->seqno, prev->ops)) { context = prev->context; From patchwork Fri Feb 16 15:09:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Eric Pelloux-Prayer X-Patchwork-Id: 13560170 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 589D1C48BC4 for ; Fri, 16 Feb 2024 15:12:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 60CAB10EBA7; Fri, 16 Feb 2024 15:12:02 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="fhtMK77M"; dkim-atps=neutral Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2058.outbound.protection.outlook.com [40.107.220.58]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7CCC710EBA3; Fri, 16 Feb 2024 15:11:58 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fg9WggaLPJSaYWpOftfetvWrLnHNsZesAyvMbZc6gkUU68pxHUGduUKztkrc2EnDBv2EZFhTgdbD5d9Ty9JSiLCBraVs9LmjwV8wYDVu+EsDPVp5kwMvlPx6FdU5tPXeLhbNmmTFq2VD0wUmu55nmj9uSlu9HDRNBHjjwM1nAXK8sRX8nKxsjGNGiBSq2ldKEWmDBtVL26fXGS3NXr8gW2djFxA0zgEKpFM9OqpQE4HNxdju/JAWYUeOH4oB+0n0rP52yX9pipHIUaNnbZ13L1KxuUSUhIsKOS5/rLbwQcGDH8TYfmUF7/LnIoeBuzrxj/IZIPLejDOLowUJd2jmTA== 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=ZmLc2QsBOukZimiLaKvgyuRt6KRywEvVVlG7RyziCAk=; b=oXSzY6rvVOoPHHYDTHUknab4Lt1Y9bgpXEAYygFpuEDxgEkQ8UDcs7iGl0jr2WWOGH/4gvfd/+1H9yS7VhEnXuFRyyzPkI2DOBdz2rCaLdNNvLNrOScvAoIe0YZ3scnL6Bwr7dUEiebR8ifOi+Sk+Yt3Ah2gY7MN1nC13noCtpzoZfbc+1q7xy/7oKn039V3yRsYT/atv1u8gn5LvnoR9Bnn9V2wFNQ4gDiIJG4eq/sNfcDaDvm4P/pMrer9JOyQi8f4ZNFT9dPHrrZSL3kYP0Zs2gyR1YjnzXL6GS8Ea1LTmI4IslvD8b27E9G53aWmAwZAJ5eFPwytEUHS+sDgiw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linaro.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=ZmLc2QsBOukZimiLaKvgyuRt6KRywEvVVlG7RyziCAk=; b=fhtMK77MGPoM+d/PwdaLIPpvhe6taV7FsMO8jJMIoJK4pdfJODPbim/WAOnTAuP1xE+T2JdDRKXs+nCyqojkpx69OQNSqbfmbqRkoX8sMZW80Kjwqq5U1hwxpHbXuXgTA7jCPhi/OMmE6zQutfQQIKRGV0KbQkoVbKhAxnw34/4= Received: from MN2PR15CA0019.namprd15.prod.outlook.com (2603:10b6:208:1b4::32) by PH7PR12MB7916.namprd12.prod.outlook.com (2603:10b6:510:26a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.26; Fri, 16 Feb 2024 15:11:55 +0000 Received: from MN1PEPF0000F0E4.namprd04.prod.outlook.com (2603:10b6:208:1b4:cafe::f8) by MN2PR15CA0019.outlook.office365.com (2603:10b6:208:1b4::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.29 via Frontend Transport; Fri, 16 Feb 2024 15:11:55 +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 MN1PEPF0000F0E4.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Fri, 16 Feb 2024 15:11:55 +0000 Received: from patedamande.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; Fri, 16 Feb 2024 09:11:52 -0600 From: Pierre-Eric Pelloux-Prayer To: Pierre-Eric Pelloux-Prayer , "Sumit Semwal" , Gustavo Padovan , =?utf-8?q?Christian_K=C3=B6nig?= , Steven Rostedt , Masami Hiramatsu , "Mathieu Desnoyers" , , , , Alex Deucher , Subject: [PATCH v3 3/8] amdgpu: use trace_dma_fence_sync_to in amdgpu_fence_sync Date: Fri, 16 Feb 2024 16:09:52 +0100 Message-ID: <20240216151006.475077-4-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240216151006.475077-1-pierre-eric.pelloux-prayer@amd.com> References: <20240216151006.475077-1-pierre-eric.pelloux-prayer@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: MN1PEPF0000F0E4:EE_|PH7PR12MB7916:EE_ X-MS-Office365-Filtering-Correlation-Id: e9a3869e-c4f2-49a8-8825-08dc2f019d02 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9HvU23uQH88ECE/AE2+nGzk7pu13W5Uu1fcVD8eD49Z4fTywdmdpIPZ+mWrh69jQUHsbqUw8x0uGuQZZEKRKESTTqmpVjXzHg7uVpFfUyKMwuqJhnzrzU19NfUZb0GuIAFxWvk6pa/zIHughU4ub5S2+QPSRtcRZtX7shXOsuCqetgUAMlj+DWgrdTWcftSfXpWtnwvH7s2c2S9FkrprewIWF+lUZwzO714cVBvRxYZAjaXOcgB4tMfozZZujsPnkzy5LILeM+bnAM4I3OlNE9tSABIBLFuPxv0dYXGbrhQX9xJobGf5aZuc32oM3id2R+jrqRqq/uy+yuHApvIIRX/BbUwUxWmBsS1V3dbKyNOr3+g+SXYms8BScdi/5cGHsA3BvHtBngTI62vfB80+iS/tcV8O8lXvFVBWAtr2G6HQpvYy0nwFTAftLvw8H4TRT3BpC1mdXSzVEnJInf1pMOKr1OjDzoBpXvmuchoxlBvMX2V44S0NAwS5YCSQb69+VepjTpZn5pwXDBPbzvFjYmfB+14xHPzX8zT8DeUs0nYGuxy3pY1aBEC3sIbokMCeZ4s1GJ0IWMkKFrkqt/cC2yGzYEPygalx9mnP4zYpS4bbto+5Id8jPhe1tJeMH+xPcKYN15S+cSpvVqpUC7N6YQ== 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)(376002)(39860400002)(136003)(346002)(230922051799003)(64100799003)(186009)(82310400011)(1800799012)(451199024)(36860700004)(46966006)(40470700004)(2906002)(8676002)(5660300002)(86362001)(16526019)(2616005)(356005)(36756003)(26005)(7696005)(478600001)(966005)(81166007)(82740400003)(1076003)(83380400001)(426003)(336012)(8936002)(921011)(70206006)(70586007)(316002)(110136005)(41300700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2024 15:11:55.5116 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9a3869e-c4f2-49a8-8825-08dc2f019d02 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: MN1PEPF0000F0E4.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7916 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" This makes it possible to understand the dependencies between jobs. Possible usage of this trace: * stuttering issues like Mesa !9189 * incorrect synchronization: I don't have a link for this one, but having these events was very useful to debug a virtio-gpu / native-context / radeonsi sync issue I have prototype code using this in UMR, as can be see here: https://gitlab.freedesktop.org/tomstdenis/umr/-/merge_requests/37 v2: add a macro since every caller passes __func__ as the reason parameter Signed-off-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 9 +++++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c index 1b013a44ca99..9a3fdc4be51e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c @@ -30,6 +30,7 @@ */ #include +#include #include "amdgpu.h" #include "amdgpu_trace.h" @@ -145,14 +146,16 @@ static bool amdgpu_sync_add_later(struct amdgpu_sync *sync, struct dma_fence *f) } /** - * amdgpu_sync_fence - remember to sync to this fence + * amdgpu_sync_fence_with_reason - remember to sync to this fence * * @sync: sync object to add fence to * @f: fence to sync to + * @reason: why do we sync to this fence * * Add the fence to the sync object. */ -int amdgpu_sync_fence(struct amdgpu_sync *sync, struct dma_fence *f) +int amdgpu_sync_fence_with_reason(struct amdgpu_sync *sync, struct dma_fence *f, + const char *reason) { struct amdgpu_sync_entry *e; @@ -166,6 +169,8 @@ int amdgpu_sync_fence(struct amdgpu_sync *sync, struct dma_fence *f) if (!e) return -ENOMEM; + trace_dma_fence_used_as_dependency(f, reason); + hash_add(sync->fences, &e->node, f->context); e->fence = dma_fence_get(f); return 0; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h index cf1e9e858efd..52e7306801de 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h @@ -47,7 +47,9 @@ struct amdgpu_sync { }; void amdgpu_sync_create(struct amdgpu_sync *sync); -int amdgpu_sync_fence(struct amdgpu_sync *sync, struct dma_fence *f); +int amdgpu_sync_fence_with_reason(struct amdgpu_sync *sync, struct dma_fence *f, + const char *reason); +#define amdgpu_sync_fence(s, f) amdgpu_sync_fence_with_reason(s, f, __func__) int amdgpu_sync_resv(struct amdgpu_device *adev, struct amdgpu_sync *sync, struct dma_resv *resv, enum amdgpu_sync_mode mode, void *owner); From patchwork Fri Feb 16 15:09:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Eric Pelloux-Prayer X-Patchwork-Id: 13560171 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 3D93CC48BC4 for ; Fri, 16 Feb 2024 15:12:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 90EE910EBAD; Fri, 16 Feb 2024 15:12:20 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="WYyowgSJ"; dkim-atps=neutral Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0503C10EBAC; Fri, 16 Feb 2024 15:12:19 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gR2zxfLdJ/uUx+g5Shv3yJVKA4yS6GytYo/SnTk/nxpuEd0C2xUnqn+MbT6f/SCO6mBvOt+uLoOSu9VrW5MwGRxfFRIwm/Ct8YWzFjIzFrUhqpdzTHGBtxnwTF53Expvg5jp099n2I4JFuJQVLq/1aQvC4cHbQ+X0CFno5KbDtCdWtlkjzB2j9X1eUGCLM4tB4nu+NVThmEG5ZxCwSHX4/I7JUEQCLYRaWopv58InIPhIydkBk5xr/Sq6ZCUgCKVK2vCJLkkPDlzWLGhIoeZIpD4XleZsdmlRuAKCYWRhMAa3xp1YEhJA6xs6I8mkdjN8edA1cw01lSZysUeByZftQ== 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=oeQdUqaUytJOABNwn7pGpwrkwYuLAr/PHtE7tGKM95A=; b=fhP75xg9YPa33xsG9tRHT7/hEp2ydg2SDvs4If7Tn+pUlZvjL3PBwI1BiFC09ea7QdQbfmyTM86DD4SKfcgxAVpGFy7tMHAhpoab62ied2wkFkclw/YwHgIpIVm22KBxp/I5p+UQ8mERAmpDIKG7Mo95jr6L1mJOZ7r2ysW31COY75/P5VFlAAulmv3SqE5eLPlfmFjKB/tZD0KYXpIIWGhPVld9ye1GLWAxQfT9izraJf/kE7lnddSLhfZ7N3iJ1QyssIYFvmXbuP7j70Zjy9C6ldCP49g3fCZB3V2ezrvM2iKGIsx3sWlrMI+07PgcYpXjzZQqjZe8I6SCT+O5vA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linaro.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=oeQdUqaUytJOABNwn7pGpwrkwYuLAr/PHtE7tGKM95A=; b=WYyowgSJvV6H5pQ2Bdn0YrUKhMY8QrIAfp4uuyGGn7hoXBR11i/sEyUj/kNPYgdHkFLa1ontuskfbcl87Ocm7p7BiCNb+TA3VS4+EF5dFEOD6tntUHyV/4DQP5ac/IoDPt1LKGgbe2jZHfGUigq3P8Nn2GLK9NexAKdId5QzJbw= Received: from BL1P222CA0021.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:2c7::26) by IA1PR12MB8078.namprd12.prod.outlook.com (2603:10b6:208:3f1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.15; Fri, 16 Feb 2024 15:12:13 +0000 Received: from MN1PEPF0000F0E3.namprd04.prod.outlook.com (2603:10b6:208:2c7:cafe::c0) by BL1P222CA0021.outlook.office365.com (2603:10b6:208:2c7::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.40 via Frontend Transport; Fri, 16 Feb 2024 15:12:13 +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 MN1PEPF0000F0E3.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Fri, 16 Feb 2024 15:12:13 +0000 Received: from patedamande.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; Fri, 16 Feb 2024 09:12:10 -0600 From: Pierre-Eric Pelloux-Prayer To: Pierre-Eric Pelloux-Prayer , "Sumit Semwal" , Gustavo Padovan , =?utf-8?q?Christian_K=C3=B6nig?= , Steven Rostedt , Masami Hiramatsu , "Mathieu Desnoyers" , , , , Alex Deucher , Subject: [PATCH v3 4/8] drm/amdgpu: add a amdgpu_bo_fill trace event Date: Fri, 16 Feb 2024 16:09:53 +0100 Message-ID: <20240216151006.475077-5-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240216151006.475077-1-pierre-eric.pelloux-prayer@amd.com> References: <20240216151006.475077-1-pierre-eric.pelloux-prayer@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: MN1PEPF0000F0E3:EE_|IA1PR12MB8078:EE_ X-MS-Office365-Filtering-Correlation-Id: e37ade10-9ef0-4e11-92a1-08dc2f01a7e9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6bXUVrJLZNkWTKsjpi4I5MeRuOH+YysyS+6zVa8MO/zJTRGIJFlZd0gu0GP6+L7pzAZGIWaJ0X1CJFm7/Ho1Y7HL/X1pa4Q8MGki/f5FNzUpNu4R5YRwtc4dDIJfMwyHVmygkLKQDVFwJHnbMLcG6+hQjUsV6KXNyskCY4qxtMfMyJ5Y50LY5FC3aajKytRaTMKfRYEy1huJzBonA0lsJzU3McV5kzvUH1vJ8MeYglrwR1NIAjvDjw01at1NUE1bgyi7h/pJkcJRv07Kpg/cDsd0JRg8Eb0tvStkhnp0ungtTXxdLqa+20d4D2S6c5eiXF4F4wIt2UhGboTAkxOS4H29Q5KSWVqs/wG/1aCBUqrfDXq1/MbRlQZTZVEk9R1ROcG9xc67xI1wZFRggtrVb7cBksT8eDKMAyh3rFiCi+VIwRs4Mu3m0oHNtjfYE9qjz9YmsEwk9ThjBbTDcSZUMWqGB0naNQ99aSL+2OJ0SiacKw2LcFGXarLhO2IQSrGiLM725Yrjft3ULgyeNwCzImTgZRELE9fTmuE60r6lkfWcjbbe8pdybh5zM9syh32uWym7R1yjbg3uct4tM+6HDKq6dphtEogpGKezS1o8jAYDCVrgZfO5nWsvLSeeNJGTortLPBGSuBWSNoyAFS9oCqR2pK+eIzCQBp+Vl/vAzT0= 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)(136003)(346002)(376002)(230922051799003)(64100799003)(1800799012)(82310400011)(36860700004)(186009)(451199024)(46966006)(40470700004)(921011)(316002)(336012)(26005)(16526019)(83380400001)(426003)(8676002)(41300700001)(110136005)(6666004)(8936002)(70586007)(70206006)(2616005)(1076003)(7696005)(478600001)(82740400003)(36756003)(81166007)(356005)(86362001)(5660300002)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2024 15:12:13.7874 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e37ade10-9ef0-4e11-92a1-08dc2f01a7e9 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: MN1PEPF0000F0E3.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8078 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" Useful to identify why sdma jobs are submitted. v2: moved from amdgpu_bo_create to amdgpu_bo_fill Signed-off-by: Pierre-Eric Pelloux-Prayer --- drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 18 ++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 ++ 2 files changed, 20 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h index f539b1d00234..0e47cbe7e0a9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h @@ -514,6 +514,24 @@ TRACE_EVENT(amdgpu_bo_move, __entry->new_placement, __entry->bo_size) ); +TRACE_EVENT(amdgpu_bo_fill, + TP_PROTO(struct amdgpu_bo *bo, uint32_t value), + TP_ARGS(bo, value), + TP_STRUCT__entry( + __field(struct amdgpu_bo *, bo) + __field(u64, bo_size) + __field(u32, value) + ), + + TP_fast_assign( + __entry->bo = bo; + __entry->bo_size = amdgpu_bo_size(bo); + __entry->value = value; + ), + TP_printk("bo=%p, size=%lld, value=0x%08x", + __entry->bo, __entry->bo_size, __entry->value) +); + TRACE_EVENT(amdgpu_ib_pipe_sync, TP_PROTO(struct amdgpu_job *sched_job, struct dma_fence *fence), TP_ARGS(sched_job, fence), diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 8722beba494e..7d0b2c1191f8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -2231,6 +2231,8 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, return -EINVAL; } + trace_amdgpu_bo_fill(bo, src_data); + amdgpu_res_first(bo->tbo.resource, 0, amdgpu_bo_size(bo), &dst); mutex_lock(&adev->mman.gtt_window_lock); From patchwork Fri Feb 16 15:09:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Eric Pelloux-Prayer X-Patchwork-Id: 13560172 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 631A5C48BEF for ; Fri, 16 Feb 2024 15:12:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 53BBD10EBAA; Fri, 16 Feb 2024 15:12:43 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="kW2k0nVG"; dkim-atps=neutral Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2068.outbound.protection.outlook.com [40.107.93.68]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4FF0910EB8F; Fri, 16 Feb 2024 15:12:41 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=We1dKE8s6lOJqOlkDuPwsFqai93Z1TbikYXsZRjerTVPzeSuHIidBTulR9U/XeWXcnRCdO9O8fDuvOxXGe5A7i4gDrYvDNP3FHo4S/Ow5Kd8QAAiewONgyqEpUoboxrKMbrRujVlQZITB5kA12LC9KgeShvf2nXJjyl7ezyyFRDxIR3/6rsewiIGO9CoBBKiN0wX6CW66wnE/Lr09s3CpwXTQJ3XOmzF+KqL0OGRFxz35pOcDlD7fkEtm/1iJRVquW8kxhB55U9P6KpFpB3gl1VQNF+Vx5fZeRF6qgwNLBJd1idLaJ6dBRJckGcIfQ21mfnwpN/psiXW4mfkA+zuNg== 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=RJDNg0QGI964boRyWOyUWRBgcjJuuIEqVTso9xHO8mM=; b=ZuHfqCImb08F5lsavfJw6IG5twr8M0Iix9B3CE+U1N+h5Ok5DGoAMUJFdbsf/0q68t2tWVlGsN0icQt16FvU2CvT4zh6EL1ciaddFjHnRfDBMCBb6enGRlJszETg0k+5ZeZET8IAb+/o0YKdSdoJxjTqDBWiAJj51qRQZtoMU8hCBmcp78FPbt0uq1z8rjTUDwwEHdG67YADvqJ9WYfCFJTsUT4TmAcHbTtL3iKs9SxQgiErzDQP55NY5fW/q3pwuk9UPoj4oHWh+RXW4Y9liRKSu1ypzZlgz2rT0+PbGI41Eid4sbfRwt2keWInvX/A/OF7Gfw5+xvjpwVJXTLy5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linaro.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=RJDNg0QGI964boRyWOyUWRBgcjJuuIEqVTso9xHO8mM=; b=kW2k0nVGNDiq79YxEVozojUGJoWFwSc/dWLOTEDPbjHV5Dmr311MUPSuIuZ3SZN+Q5Up8Dj10ltYdKQXRL+5vtMfKfVIxopgXNqZ1A57yvSbPQEr6oPPcUK2Jzn7r1Xsq5LKMtCozK9G3dCy6OoixQwhYwM8Tfo9VeH6hb3lPXA= Received: from BL0PR02CA0095.namprd02.prod.outlook.com (2603:10b6:208:51::36) by PH0PR12MB8029.namprd12.prod.outlook.com (2603:10b6:510:26c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.29; Fri, 16 Feb 2024 15:12:37 +0000 Received: from MN1PEPF0000F0E0.namprd04.prod.outlook.com (2603:10b6:208:51:cafe::f) by BL0PR02CA0095.outlook.office365.com (2603:10b6:208:51::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.29 via Frontend Transport; Fri, 16 Feb 2024 15:12:37 +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 MN1PEPF0000F0E0.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Fri, 16 Feb 2024 15:12:37 +0000 Received: from patedamande.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; Fri, 16 Feb 2024 09:12:33 -0600 From: Pierre-Eric Pelloux-Prayer To: Pierre-Eric Pelloux-Prayer , "Sumit Semwal" , Gustavo Padovan , =?utf-8?q?Christian_K=C3=B6nig?= , Steven Rostedt , Masami Hiramatsu , "Mathieu Desnoyers" , , , , Alex Deucher , Subject: [PATCH v3 5/8] drm/amdgpu: add a amdgpu_cs_start trace event Date: Fri, 16 Feb 2024 16:09:54 +0100 Message-ID: <20240216151006.475077-6-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240216151006.475077-1-pierre-eric.pelloux-prayer@amd.com> References: <20240216151006.475077-1-pierre-eric.pelloux-prayer@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: MN1PEPF0000F0E0:EE_|PH0PR12MB8029:EE_ X-MS-Office365-Filtering-Correlation-Id: 5651acfc-45e0-41b2-ef02-08dc2f01b5c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OI0BUkxCH/o1ZDW0zaNAbayQWsvh95h6agGKjg93vraoGqv4eobO//7dD3h0W9f/mQVO5Fn4IFrf3lxjk3UwkePv4Eldkekhjx7xVeNJBHzOKt3MqC7fOgl9t3qvEODOcEh3QYx6jUA31sTsYg17HkmHD8yP2eYdUSbtinQnJ4RhGzDbEeCQywVk4dCWu8d/Zkuozaqjh3T/no1zIRXwypXXfJ4CMvkrRAnalfxuYjMMKcrrR3pz39WeyxKBvlbAyTuRG/vlyzvq6FgGC5VPCocLOZewlBS9QszOr/GzYGktAiXMIkCow7rPpbznNjYxZf/jHVGEOIM3MaBPkO8WdgOLjgKM6ce6qlSWXrjSsVCqYAR0oLi45rmIDZmaz0UbF0s1UyqQFSNED9glFzL1dEE4QXAHLEuvG2oJAfgXqwtcLbD7XofYMjRwTvziiaRAJVQt29aTO2BpAdKPXURSTP9nFjkRzQboe2KGhE5q9445Eh1At539ObGT8uWKxqOUTZTe00F7ue9SHtZrmBU76A5/LqY0oDn92Vhg7/ds90k2B66PPFxmezJIagKoDhi2qsh6UAclc/N/bIFxJPRJz92KuLPwkQprZAMI0uH7/bHyHWlW+UivFB1YCocAvyJGUQ0jfDT37YHY3F+obHpOZKUIXkrsiSDjMv0lG2Ug8+0= 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)(346002)(376002)(136003)(396003)(230922051799003)(82310400011)(186009)(451199024)(1800799012)(64100799003)(36860700004)(46966006)(40470700004)(478600001)(7696005)(41300700001)(2616005)(8676002)(2906002)(8936002)(5660300002)(70206006)(70586007)(110136005)(6666004)(316002)(26005)(16526019)(1076003)(86362001)(36756003)(82740400003)(921011)(81166007)(336012)(426003)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2024 15:12:37.0485 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5651acfc-45e0-41b2-ef02-08dc2f01b5c6 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: MN1PEPF0000F0E0.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8029 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" amdgpu_cs_ioctl already exists but serves a different purpose. amdgpu_cs_start marks the beginning of the kernel processing of the ioctl which is useful for tools to map which events belong to the same submission (without this, the first event would be the amdgpu_bo_set_list ones). v2: renamed to amdgpu_cs_start Signed-off-by: Pierre-Eric Pelloux-Prayer --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 0a4b09709cfb..f3369cd0d9a3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -1402,6 +1402,8 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) return r; } + trace_amdgpu_cs_start(data); + r = amdgpu_cs_pass1(&parser, data); if (r) goto error_fini; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h index 0e47cbe7e0a9..3f18f570e5ac 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h @@ -189,6 +189,18 @@ TRACE_EVENT(amdgpu_cs_ioctl, __entry->seqno, __get_str(ring), __entry->num_ibs) ); +TRACE_EVENT(amdgpu_cs_start, + TP_PROTO(union drm_amdgpu_cs *cs), + TP_ARGS(cs), + TP_STRUCT__entry( + __field(uint32_t, ctx_id) + ), + TP_fast_assign( + __entry->ctx_id = cs->in.ctx_id; + ), + TP_printk("context=%u", __entry->ctx_id) +); + TRACE_EVENT(amdgpu_sched_run_job, TP_PROTO(struct amdgpu_job *job), TP_ARGS(job), From patchwork Fri Feb 16 15:09:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Eric Pelloux-Prayer X-Patchwork-Id: 13560173 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 E51A5C48260 for ; Fri, 16 Feb 2024 15:13:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 25F3010EBB4; Fri, 16 Feb 2024 15:13:04 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="rcaDrJB1"; dkim-atps=neutral Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2088.outbound.protection.outlook.com [40.107.93.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id B4D8110EBB4; Fri, 16 Feb 2024 15:13:03 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jaSWrR3h/YUPwlC4stR/Qdvjg74ZtJYoAuFhEzjg2Y63IiMWoFroX3ykRx3fF8AvwJS6CzJXcORNCsWbJQRARADt//leT+DUD93gr/QQbvt52+OtDmJAauBFvtl9W0bafL1bFIqqpraIDRHtb4xlNjpluIKm0iJtuSmAyJYLMeNch8EuwW2NdqFNeNrg4P1I6oDZ0ssGRFOTSW5z7eNdnE+DJxcHSNarDOHvggm4tx0+QaMktD040bjGKbSaB5nNQnD/tYQtwwM0ThLdPrRMDZrW+QxdezBtg2Tb24j8qxfUXt+AHtT7wx+ZU07/WNhvePqgg2Q+g/5XOtpspeDXEw== 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=Ljojgy8rwY5qa00A4ybe260/3tI9/pfNwX8PxXXmDvQ=; b=YNidFxa/pGTQmH4xz90Pdrx8KXt4ihk2HMAsWunk3gUYrQH/luD5BM+ARQquv5nz97qsx6FxT/H7uohJUS4yOesQB8vy5Ko2QHFLofZ4UtsVDJCEbdlD8tE8XaGhChZ6XVfKFxKAR/VbuGTQJKMOQSoExjd2TAnHjDqu9eIW/aXqzVx9hhhrfKxKAuPPNOsv6VhBjzw5yaMZrgfSMLvcchR0ZUEjoRNSoIA2RqEwfryPytsAJHHqo2eshHvmyy6QRgdxgbypBMqy8xn93chlCeclDE5lg/uth113tq+ljdF6l5miYbVi+CcR4Qi3GGZcIzwCZ7TPGc7hfknTuge8PA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linaro.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=Ljojgy8rwY5qa00A4ybe260/3tI9/pfNwX8PxXXmDvQ=; b=rcaDrJB1P/IiWmg4yAU2Egvu0mpq38J1SJkMv0ThaM7tOGCO3j3q4cpaZdAWKdDVjCY4V/BfpcH6BL+lYwaxPtrX9zuA37NrPsyxD+lwjqjQuEueKRWJVBuh/rTOY1GzZRyKMUwYdUPiM3U6v5kofsAxHqNTmqCza+2OoYNg6jw= Received: from BL0PR02CA0137.namprd02.prod.outlook.com (2603:10b6:208:35::42) by DM4PR12MB5151.namprd12.prod.outlook.com (2603:10b6:5:392::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.15; Fri, 16 Feb 2024 15:13:00 +0000 Received: from MN1PEPF0000F0E4.namprd04.prod.outlook.com (2603:10b6:208:35:cafe::d0) by BL0PR02CA0137.outlook.office365.com (2603:10b6:208:35::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.26 via Frontend Transport; Fri, 16 Feb 2024 15:12:59 +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 MN1PEPF0000F0E4.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Fri, 16 Feb 2024 15:12:59 +0000 Received: from patedamande.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; Fri, 16 Feb 2024 09:12:56 -0600 From: Pierre-Eric Pelloux-Prayer To: Pierre-Eric Pelloux-Prayer , "Sumit Semwal" , Gustavo Padovan , =?utf-8?q?Christian_K=C3=B6nig?= , Steven Rostedt , Masami Hiramatsu , "Mathieu Desnoyers" , , , , Alex Deucher , Subject: [PATCH v3 6/8] drm: add drm_mode_atomic_commit event Date: Fri, 16 Feb 2024 16:09:55 +0100 Message-ID: <20240216151006.475077-7-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240216151006.475077-1-pierre-eric.pelloux-prayer@amd.com> References: <20240216151006.475077-1-pierre-eric.pelloux-prayer@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: MN1PEPF0000F0E4:EE_|DM4PR12MB5151:EE_ X-MS-Office365-Filtering-Correlation-Id: ff27c672-5678-491e-7dd7-08dc2f01c355 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6/rWuyC38DI0OIusBk4W7Be6pdd+VrcFmRLwnFECXuEsJqZ40p8npDiV1o3TrWyOTYMZzaVC6MPkHp3LKPH2lPj7DBBqa45YrU1Ctt94p4GnJRTlgMeiFfTQHCd87qkrONAFw7HPFwPoC1PXhjk5CYVYfuZCP2p1V8l2rNrxQKZ6kPlUYtNS8zX7VfL+sBfs2Hh2wKZUGOu8CQmhSUvjxwfeISd2/v9fi8LYPLt8nIwwxK04yf47r9ewRptTqbSFii8NU8V5KUi1YbbMC9Kaqi49b32iOpZ0ScGOlbHDvmJ0RTLn5jVYJ7CaqIE+GtxwVvAeqNwm7aaqW0H19m82fLHKlgBmmCKYHKoYDEPH44k3m7RyFccF1ITEKutTcDgbprk5wwJF7MIOFYEAVCNfnmN6T8BrN/PVMKKdnNMH4w++lR5Io8JoeM8VxX0R4ehQFydYyQhSUfru/ZqcnYwDDWwteYi9jPBK9f448GXTpp2QLUwh3FHjEw00O3XdgE6To2vlohM5IXGGCF6vLhOjGMMMMtmlCZufTw/URg0QM6pecSoNJB++oVqFSGHEMRdo7GYlSah6VP4byyr6hlJQ3+Y/CFzyuf3YPR2vOGs3RZtiJmArd0AfSjX3OYor3mYLwyd8ZFDaq+HxhpcMKIJnAK+P018lbuiq2A8omSVzWqg= 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)(346002)(396003)(136003)(376002)(230922051799003)(1800799012)(36860700004)(186009)(82310400011)(451199024)(64100799003)(46966006)(40470700004)(478600001)(41300700001)(2906002)(8676002)(8936002)(5660300002)(316002)(7696005)(70206006)(110136005)(70586007)(2616005)(1076003)(26005)(356005)(86362001)(81166007)(16526019)(426003)(921011)(336012)(36756003)(82740400003); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2024 15:12:59.8087 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff27c672-5678-491e-7dd7-08dc2f01c355 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: MN1PEPF0000F0E4.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5151 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" With this and the dma_fence_used_as_dependency event, a tool can draw the relationship between the compositing draw, the atomic commit, and vblank. An example on a 2 monitors system look like this: gnome-shell-1638 [018] ..... 2571.905124: drm_mode_atomic_commit: file=00000000245c3f0c, pid= 1165, flags=00000201, crtcs={0x1} gnome-shell-1638 [018] ..... 2571.905147: dma_fence_used_as_dependency: driver=drm_sched timeline=gfx_0.0.0 context=270 seqno=73240 reason=dma_fence_chain_init gnome-shell-1638 [018] ..... 2571.913226: drm_mode_atomic_commit: file=00000000245c3f0c, pid= 1165, flags=00000201, crtcs={0x0} gnome-shell-1638 [018] ..... 2571.913250: dma_fence_used_as_dependency: driver=drm_sched timeline=gfx_0.0.0 context=270 seqno=73241 reason=dma_fence_chain_init -0 [018] d.h3. 2571.915687: drm_vblank_event: crtc=1, seq=155747, time=2571916093743, high-prec=true -0 [018] d.h3. 2571.915968: drm_vblank_event: crtc=0, seq=153862, time=2571916377180, high-prec=true v2: fix unchecked memory allocation Signed-off-by: Pierre-Eric Pelloux-Prayer --- drivers/gpu/drm/drm_atomic_uapi.c | 21 +++++++++++++++++++++ drivers/gpu/drm/drm_trace.h | 23 +++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index 29d4940188d4..f31b5c6f870b 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -41,6 +41,7 @@ #include #include "drm_crtc_internal.h" +#include "drm_trace.h" /** * DOC: overview @@ -1503,6 +1504,26 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, drm_mode_object_put(obj); } + if (trace_drm_mode_atomic_commit_enabled()) { + struct drm_crtc_state *crtc_state; + struct drm_crtc *crtc; + int *crtcs; + int i, num_crtcs; + + crtcs = kcalloc(dev->mode_config.num_crtc, sizeof(int), + GFP_KERNEL); + + if (crtcs) { + num_crtcs = 0; + for_each_new_crtc_in_state(state, crtc, crtc_state, i) + crtcs[num_crtcs++] = drm_crtc_index(crtc); + + trace_drm_mode_atomic_commit(file_priv, crtcs, num_crtcs, arg->flags); + + kfree(crtcs); + } + } + ret = prepare_signaling(dev, state, arg, file_priv, &fence_state, &num_fences); if (ret) diff --git a/drivers/gpu/drm/drm_trace.h b/drivers/gpu/drm/drm_trace.h index 11c6dd577e8e..63489923c289 100644 --- a/drivers/gpu/drm/drm_trace.h +++ b/drivers/gpu/drm/drm_trace.h @@ -66,6 +66,29 @@ TRACE_EVENT(drm_vblank_event_delivered, __entry->seq) ); +TRACE_EVENT(drm_mode_atomic_commit, + TP_PROTO(struct drm_file *file, int *crtcs, int ncrtcs, uint32_t flags), + TP_ARGS(file, crtcs, ncrtcs, flags), + TP_STRUCT__entry( + __field(struct drm_file *, file) + __dynamic_array(u32, crtcs, ncrtcs) + __field(uint32_t, ncrtcs) + __field(uint32_t, flags) + ), + TP_fast_assign( + unsigned int i; + + __entry->file = file; + for (i = 0; i < ncrtcs; i++) + ((u32 *)__get_dynamic_array(crtcs))[i] = crtcs[i]; + __entry->ncrtcs = ncrtcs; + __entry->flags = flags; + ), + TP_printk("file=%p, pid=%8d, flags=%08x, crtcs=%s", __entry->file, + pid_nr(__entry->file->pid), __entry->flags, + __print_array(__get_dynamic_array(crtcs), __entry->ncrtcs, 4)) +); + #endif /* _DRM_TRACE_H_ */ /* This part must be outside protection */ From patchwork Fri Feb 16 15:09:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Eric Pelloux-Prayer X-Patchwork-Id: 13560174 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 CD009C48BC4 for ; Fri, 16 Feb 2024 15:13:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1EB6810EB8F; Fri, 16 Feb 2024 15:13:18 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="ZOZZX9xc"; dkim-atps=neutral Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2049.outbound.protection.outlook.com [40.107.223.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id C840010EB8F; Fri, 16 Feb 2024 15:13:16 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LTPz8CrHfM+FIJRFYKXsxbBVMrGXBOAuCGJ8/eIA+Mdlr3n2UPgzV5qD0lC45PBwLrD66tkcusRr2Aigsvv+Rb4SQ9q/J1RF6x2BEI9CplFkSinzwlZwN8AX/DTWT6L0qDw0at8ub/izSAjcx6amsBhdsAH2nwM5tlDvq9awrHAELxT9SyYl89rb8ci0wKewDbGfn/XPGHED7ikj2gsRNA7X/v7SZn5xu2eBS0oi5NMHi+0WPceHhoagY5VbPZepWju9J4QB01YogSBZpNN4T2ydQDOKM7ldIU1CPBVT9DeTfmiFKessIdxSBUGOZTgKDQwkbs2VE5fYxlJ+GxUorw== 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=JdkNUzs3n8SktVyT8ddjNXfd+jBe9xhPGSbbxW9DBSs=; b=mcl8Etn1Eth3NH2UMFX2AYf4lqhs2gZDhIBuvj6JM8lsVQpcTrjbAzZnBBbD+W7CWosVUenGfhX/rGvgFt90NsyTxp3MQOC2WTFBoWovNFCNhNc8l5xkr7STkRh0RpzqNfUC1CpyJux6zSb5FVGHrs8HaKYOk2pacr6iJ4scvZ+3BriObf0tWsNh8NAL6eBEQsz6iVhDiF/yCYaeseUb+NDodjujIAlZJFvkdRvBCdzB7GuQu/rEODt0eljNAhTPtfLk9ybqkGxV2C4G7L/GOC54S6Bf/QTDOHC90j+onb7FBeKFJgNOAQPpwKAxYlNZh/P9n/aWkcUdfiEPmOlakw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linaro.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=JdkNUzs3n8SktVyT8ddjNXfd+jBe9xhPGSbbxW9DBSs=; b=ZOZZX9xcynaYRUFCjuQ22UvMzb4MqJfsnvEGDv8t+Hxv6oOV7jGx1+bWo6FrDtKScFm+tWXrkkv6BEL/IW8kmR4Ks3a7EVBZVKONPnqWuQUTMOYUmUJbT47Q3RyJAZXzMmIH02EQvkGNYyO8GO3z8Jo0nzUXfxg7nkbSu8eqo84= Received: from BL1PR13CA0336.namprd13.prod.outlook.com (2603:10b6:208:2c6::11) by DS0PR12MB7702.namprd12.prod.outlook.com (2603:10b6:8:130::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.28; Fri, 16 Feb 2024 15:13:14 +0000 Received: from MN1PEPF0000F0E1.namprd04.prod.outlook.com (2603:10b6:208:2c6:cafe::56) by BL1PR13CA0336.outlook.office365.com (2603:10b6:208:2c6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.12 via Frontend Transport; Fri, 16 Feb 2024 15:13:14 +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 MN1PEPF0000F0E1.mail.protection.outlook.com (10.167.242.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Fri, 16 Feb 2024 15:13:14 +0000 Received: from patedamande.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; Fri, 16 Feb 2024 09:13:11 -0600 From: Pierre-Eric Pelloux-Prayer To: Pierre-Eric Pelloux-Prayer , "Sumit Semwal" , Gustavo Padovan , =?utf-8?q?Christian_K=C3=B6nig?= , Steven Rostedt , Masami Hiramatsu , "Mathieu Desnoyers" , , , , Alex Deucher , Subject: [PATCH v3 7/8] drm/sched: use trace_dma_fence_used_as_dependency Date: Fri, 16 Feb 2024 16:09:56 +0100 Message-ID: <20240216151006.475077-8-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240216151006.475077-1-pierre-eric.pelloux-prayer@amd.com> References: <20240216151006.475077-1-pierre-eric.pelloux-prayer@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: MN1PEPF0000F0E1:EE_|DS0PR12MB7702:EE_ X-MS-Office365-Filtering-Correlation-Id: e5a1f602-ef32-4fd8-760c-08dc2f01cbfb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9Q9Hkb2NKr1S2LlfX+AfHzukQEbY4kgqMdEPxGbNHLA4oW5gabcBSqznAkC3IqYOsNvSS89WP6ImLHiCuBHqLAY1R5wWi4xPcVxrqqdm3xsHSwc4b4f2EqSSW8UJV4mvwVQGFgmb0oaTMsrV2bqDhZyvQvYRADhFdfiEQM5fBS3Py3t9AVtDwo/D+QdmgRYJytAXVQiXFLSvNPQ7igljlth1uB3wEiC+oZWpX0oX+msMA76+WTb3/5tc1ztV6S2mR+VWxEkhWmA8F2R/M8iBHI3vbXV59GmYa/B599iRUlmXJ4epdJ/W56SLLRGxU9/AXxKzbrOQsR7COrNGVrz/7tpfgFDNchh0cjTy+s4mLOg6GDFAzlFlD1V1D41dBqbZnLJZUU8Wm7W3LBrWQNFAV87F9xSNk326tf7DDRgQ4GiR6gKZ5ltcE0iSUqULr0Se+5/fm4PZIrGsUiYpUI0oVz7FWBxbz1gF83875paokNFc+svbfPjxSDe+G7V929vXX2vVxFlTqyBaGlmlDFVf9/+wLpAmJmpP3I5ReGGmd/93OBLPs0fRNYt0v4ZXESeRpVsi4lqSWeoyM2XctrN2pWnJnlUvMkmlHN/oSSbYA3RwzhVpwqhGSQO73K4u7x6+MI8S6M4eJMLWoRVn0lZDeutzaBEfy/iJu9FMxXuX0LQ= 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)(396003)(39860400002)(376002)(230922051799003)(1800799012)(82310400011)(186009)(451199024)(36860700004)(64100799003)(40470700004)(46966006)(6666004)(478600001)(41300700001)(70206006)(7696005)(4744005)(8936002)(2906002)(5660300002)(8676002)(110136005)(86362001)(316002)(70586007)(81166007)(356005)(426003)(336012)(2616005)(26005)(16526019)(921011)(82740400003)(1076003)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2024 15:13:14.3026 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e5a1f602-ef32-4fd8-760c-08dc2f01cbfb 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: MN1PEPF0000F0E1.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7702 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" drm_sched_job_add_dependency adds dependencies so use the new trace event. Signed-off-by: Pierre-Eric Pelloux-Prayer --- drivers/gpu/drm/scheduler/sched_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index 7e90c9f95611..6ee49f70d319 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -84,6 +84,8 @@ #include #include +#include + #define CREATE_TRACE_POINTS #include "gpu_scheduler_trace.h" @@ -879,6 +881,8 @@ int drm_sched_job_add_dependency(struct drm_sched_job *job, if (entry->context != fence->context) continue; + trace_dma_fence_used_as_dependency(fence, __func__); + if (dma_fence_is_later(fence, entry)) { dma_fence_put(entry); xa_store(&job->dependencies, index, fence, GFP_KERNEL); From patchwork Fri Feb 16 15:09:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Eric Pelloux-Prayer X-Patchwork-Id: 13560175 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 4A391C48260 for ; Fri, 16 Feb 2024 15:13:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7303810E921; Fri, 16 Feb 2024 15:13:40 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="4Gb3SArz"; dkim-atps=neutral Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2085.outbound.protection.outlook.com [40.107.102.85]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2921810E921; Fri, 16 Feb 2024 15:13:39 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hRs8Ay8aC+C4MVbP91gu62CxtbEZiQpVgkprwOaIt4BtsDzvv7JgJQtCbyEYD3bIylrTTt2OujZQwn5cEqTOaZL/TVvi6JwzXScvkq7fvqBV7c/lI3KIxi8M79yTrG/A6CJ8XGk0KhoFSaywSAB54thcctx5x3yqxf0itICk6IPYZpapR9LWIBmk7sEWLd0Gfq+3tjrQjFWANBsdybwqJltVk/JebaXftQ0GZrs+7mIXgTsdnY3BvCj7Jy0/f4r413msQkPbWAHjDViqnhAXZF+xJ/tIMJTX/n9a5T3ad5zmKp1az55FR9bBcWYuFpukV+OOH0c/Z7A8328MkzUcQA== 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=NizfhWzIYqyvLsqWaAZqleSlU2ZiOpRCsW7ECGyF5a4=; b=aU1+YYrh8vasJkJNk+2UHIDVzZNeBaTXtotRjrIx5WkzHtQ/EcoAhR4Ur3FKpw8YVwLnBdpmZuHyxXpoWEL8kJVCLT/H1HWjve+kkS3So3Jj6ETD3tuX/NwHBzzGJ6rWgsIlAKK6Vq5vk8gm5TUdESGfaHrr4AIX7Jnx0IOtgUjnca/F53NjjVF7tZHHaGFk7MTpAgkFJaQ1SBE/psMYqEDyprStcuB9nI/axixqmePWeLc+67evQT7QGP+BRgR27w9zavXuP2wL4NwVdIT/BOW9oa0g5x00sMeZtO4HrB+EWGGq1oaqzq2lmhCCRqFE47huR+xCZOfZcd6Gck1JrQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linaro.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=NizfhWzIYqyvLsqWaAZqleSlU2ZiOpRCsW7ECGyF5a4=; b=4Gb3SArzdbPT/gR+Oo3Bw9g1pAXCF9/awA/cHAQZ9p+T5CKLJuqSSPrlqFOGH2uPTrimzSOtTjMG8AWxzqiXkBo78jQcPCaqnxK/IWd3aCj0SKcgmncYXFvesM4nqCAQ9drk4TcuAoARBRLCVQpBPmo3wFVG4VkVpyFqqCuBcrM= Received: from BL1P222CA0028.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:2c7::33) by CY5PR12MB6369.namprd12.prod.outlook.com (2603:10b6:930:21::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.15; Fri, 16 Feb 2024 15:13:36 +0000 Received: from MN1PEPF0000F0E3.namprd04.prod.outlook.com (2603:10b6:208:2c7:cafe::e) by BL1P222CA0028.outlook.office365.com (2603:10b6:208:2c7::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.26 via Frontend Transport; Fri, 16 Feb 2024 15:13:36 +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 MN1PEPF0000F0E3.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Fri, 16 Feb 2024 15:13:36 +0000 Received: from patedamande.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; Fri, 16 Feb 2024 09:13:33 -0600 From: Pierre-Eric Pelloux-Prayer To: Pierre-Eric Pelloux-Prayer , "Sumit Semwal" , Gustavo Padovan , =?utf-8?q?Christian_K=C3=B6nig?= , Steven Rostedt , Masami Hiramatsu , "Mathieu Desnoyers" , , , , Alex Deucher , Subject: [PATCH v3 8/8] drm/amdgpu: add devname to trace_amdgpu_sched_run_job Date: Fri, 16 Feb 2024 16:09:57 +0100 Message-ID: <20240216151006.475077-9-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240216151006.475077-1-pierre-eric.pelloux-prayer@amd.com> References: <20240216151006.475077-1-pierre-eric.pelloux-prayer@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: MN1PEPF0000F0E3:EE_|CY5PR12MB6369:EE_ X-MS-Office365-Filtering-Correlation-Id: f02eb48e-4dfb-42d0-5cf5-08dc2f01d93c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9WH4+CinuhI97sf44nIt+e8KIJih/HvGLD2OiXj0+zNs5PWq3wb5a0s/qch5PzHx9hxBMEieKkv0SHu3zh9wqJko/uADO5TpcWsyrpTO4EE9XAn83QteKbppb9+BPR8S2dprp/D0wrKhIFQDHElGmPCA+hGtU5Qj58W5f6Ii9rSt2vfPmhodA0GqyCKWvc4trXRKxqe8SEcBXJ05x91Wf9b9tiVXXN0mPxMHgE19/VBkF8e1B5lryYhj1A+Hfjyx0dsq93GD/6S7jG7OQddbMaWwwLQhr9VHbsG7+Ka6novt/phk3Ru4Gqt3WckydJPfu1d6VTKQNT0w+Iqs518x5Y3N7q1qKuBgBMCsOct4eZRzm6k+/LnNrOtTvAcBbNr69aOj+dyw4aML+Gv0AnihWX+51O62LIX4Q/jQhWDsDgTVCW5TkUt1ZLSLA5veGr5pfZnmaOODrTBDId4qUtYxGW3RviGs2azgbGMt4EzI7rj3PD71MwFqdxrXptghKQKzK37LgK9EAhoDPYz0cnAKIC3xoVWaVb4JJPfCVjtAk5toufylFid3BkMH+FKtzI6pP+XtVpP4Z1wyKg7E6+iZol4z5L3+pM46dYZKOLZ/mdhPdggOlLgI0hjlDJNFa7LI+SMockuQKdwTj9YwYbLNf2DMbFrzsxVpJBX6bBJO6/s= 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)(376002)(136003)(39860400002)(396003)(230922051799003)(82310400011)(64100799003)(186009)(451199024)(36860700004)(1800799012)(40470700004)(46966006)(70206006)(70586007)(5660300002)(8936002)(8676002)(2906002)(86362001)(81166007)(36756003)(356005)(82740400003)(921011)(1076003)(83380400001)(336012)(426003)(16526019)(26005)(2616005)(478600001)(7696005)(316002)(41300700001)(110136005)(6666004); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2024 15:13:36.4914 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f02eb48e-4dfb-42d0-5cf5-08dc2f01d93c 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: MN1PEPF0000F0E3.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6369 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" With the move to work queues for the drm scheduler it becomes impossible for a tool to match the events to the GPU. Before this move, the event source was fixed (eg: gfx_0.0.0-598), so even if the system had multiple GPUs with identical queue names it was possible to map the events using the PID. With work queues, the source is now something like: "kworker/u64:0-15248" (and the PID isn't stable), so the "timeline=gfx_0.0.0" attribute isn't enough in multi-GPU setups. This commit adds a dev=devname attribute to resolve this issue. Signed-off-by: Pierre-Eric Pelloux-Prayer --- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c index 71a5cf37b472..657866a498f1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c @@ -292,7 +292,7 @@ static struct dma_fence *amdgpu_job_run(struct drm_sched_job *sched_job) job = to_amdgpu_job(sched_job); finished = &job->base.s_fence->finished; - trace_amdgpu_sched_run_job(job); + trace_amdgpu_sched_run_job(job, adev); /* Skip job if VRAM is lost and never resubmit gangs */ if (job->generation != amdgpu_vm_generation(adev, job->vm) || diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h index 3f18f570e5ac..1aea1b78747d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h @@ -202,8 +202,8 @@ TRACE_EVENT(amdgpu_cs_start, ); TRACE_EVENT(amdgpu_sched_run_job, - TP_PROTO(struct amdgpu_job *job), - TP_ARGS(job), + TP_PROTO(struct amdgpu_job *job, struct amdgpu_device *adev), + TP_ARGS(job, adev), TP_STRUCT__entry( __field(uint64_t, sched_job_id) __string(timeline, AMDGPU_JOB_GET_TIMELINE_NAME(job)) @@ -211,6 +211,7 @@ TRACE_EVENT(amdgpu_sched_run_job, __field(unsigned int, seqno) __string(ring, to_amdgpu_ring(job->base.sched)->name) __field(u32, num_ibs) + __string(dname, dev_name(adev->dev)) ), TP_fast_assign( @@ -220,10 +221,13 @@ TRACE_EVENT(amdgpu_sched_run_job, __entry->seqno = job->base.s_fence->finished.seqno; __assign_str(ring, to_amdgpu_ring(job->base.sched)->name); __entry->num_ibs = job->num_ibs; + __assign_str(dname, dev_name(adev->dev)); ), - TP_printk("sched_job=%llu, timeline=%s, context=%u, seqno=%u, ring_name=%s, num_ibs=%u", + TP_printk("sched_job=%llu, timeline=%s, context=%u, seqno=%u, " + "ring_name=%s, num_ibs=%u, dev=%s", __entry->sched_job_id, __get_str(timeline), __entry->context, - __entry->seqno, __get_str(ring), __entry->num_ibs) + __entry->seqno, __get_str(ring), __entry->num_ibs, __get_str(dname)) + );