From patchwork Tue Feb 13 15:50:26 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: 13555294 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 9E81DC4829A for ; Tue, 13 Feb 2024 15:52:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED80C10E817; Tue, 13 Feb 2024 15:52:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="Pu6lod6S"; dkim-atps=neutral Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2074.outbound.protection.outlook.com [40.107.92.74]) by gabe.freedesktop.org (Postfix) with ESMTPS id D6A2F10E801; Tue, 13 Feb 2024 15:52:38 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VBpyvLmCroPSNw1PU18Apg7fWORfmqbsh3Z4b79d42Z4/gBzCx9lEHUscIoxFBNhGmE7EPoPSLuZfJ0BmIgszFBKSTYsdVXJ5qLFoU4UW09gX9c2OdN4Pl7P3YV1LX7rFpiIn2KG7Dun8hBzb37zfezqD0Eszub3sqlMtdXuYMiXL7I2YowjW5kG81x2LDSG6q0mydaOJTV57DyyKrEv2V0FoBM7kEvvc+IQp6kRisfEBX+16RDdiSBOL5E5JSas4q8E6JvqK2LUqJMYgyTUfe4EjB80q3EER9wA2pHCrxw7Qg1hD4AR3NIEpK7BA9ivA9lnpcCtBdNWBNpAtu+rHQ== 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=SkHdrvI3DsMYDSedNs3o7WAG7SDc933OwvrnkgGc8CI=; b=kEysHbz/vWU1lbPP04W7/IFRQHRIFaqVkkdOijedSei+coqRaLM9D9n5j8LWJXvJsLz9Mt5ISNHgTonlyA39OCXhrbASF34tU9ps/jMAxir6ULE8yts4tVMfD+xpwey0cYc8G5OSN+O0+hHKeS92+DpvKplWUrYT98do2Blh+0jBWvI+tlPoDKqqjSuI4PNmLILHIycaTBXJP0nMAY83gRcNiGggmmlQPWAsYl4JEggIGTNKUf+E5TkdK9xqW8Z0gEKGYnv+10G5IubTnNnDvnNbGMHiitjmdig9hqfrqs3BAiJRSdCXOi1ej/CmuxbekmW2/B2U32D/GiJHRaO6zQ== 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=SkHdrvI3DsMYDSedNs3o7WAG7SDc933OwvrnkgGc8CI=; b=Pu6lod6SJoXtXXm+y1jKPgNS8pVvs0rwaEtTeK96AGvPAl8Z3T0j3JsogaimmQXE0oyJ/eV/gD1X6oXMqRlnbiLDUsIbR+GQPaUgBVvqdVumt6Y0WQhvVCQ2AF16leKWfHtLGrNPh0INOZ0EfCEBqVl/jWNhNDTvQDgOcInPy2E= Received: from DM6PR05CA0053.namprd05.prod.outlook.com (2603:10b6:5:335::22) by LV3PR12MB9235.namprd12.prod.outlook.com (2603:10b6:408:1a4::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.24; Tue, 13 Feb 2024 15:52:35 +0000 Received: from DS3PEPF000099E0.namprd04.prod.outlook.com (2603:10b6:5:335:cafe::10) by DM6PR05CA0053.outlook.office365.com (2603:10b6:5:335::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25 via Frontend Transport; Tue, 13 Feb 2024 15:52:35 +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 DS3PEPF000099E0.mail.protection.outlook.com (10.167.17.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Tue, 13 Feb 2024 15:52:35 +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; Tue, 13 Feb 2024 09:52:31 -0600 From: Pierre-Eric Pelloux-Prayer To: Sumit Semwal , Gustavo Padovan , =?utf-8?q?Christian_K=C3=B6nig?= , Steven Rostedt , "Masami Hiramatsu" , Mathieu Desnoyers , , , , "Alex Deucher" , CC: Pierre-Eric Pelloux-Prayer Subject: [PATCH v2 1/6] tracing, dma-buf: add a trace_dma_fence_sync_to event Date: Tue, 13 Feb 2024 16:50:26 +0100 Message-ID: <20240213155112.156537-2-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240213155112.156537-1-pierre-eric.pelloux-prayer@amd.com> References: <20240117184329.479554-1-pierre-eric.pelloux-prayer@amd.com> <20240213155112.156537-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: DS3PEPF000099E0:EE_|LV3PR12MB9235:EE_ X-MS-Office365-Filtering-Correlation-Id: fd020c71-8a06-487f-395f-08dc2cabcbdc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vJkVWn9UmWhybI+G/6vO+6lIO/PC+wGedzsp78TfOKOWPAmm9LwL7GkYnKVeq0cnUQzaP45MEkd7qqJBpodONg1we/zgqoTuG1E8AtSW/SF6lcgYEvSrA8JAeblP4RE7ZYiG4r/dtubk43O8ViPv5iwvBR8h3tdwoTRH3Els1IlLZCgCybbUfNwwwqc8zf3ZfzPoYO7MezU3h5IYTD+exNCHZ+m2vH/IGsDVfEEv57rZ7uk5WCjs9S2rgjGjT4RQp1hhcuDIUOeiBfoKtJz/kJwZPXaaYyfLeddzc5BIWa3YPtv7D6hqiCk1ptUUt3bRvfkFfO7YDrrPsW1t9kYdEqzs1VZY74kn9olYao7jOqr01c9lr5wBxlgdJ/cUP8r7feyJQ0v3+gabmH1/4Dgia6Y9weLsA86BT9MD9M9CTkgIaG3ZKbATiT2RKTuYAHaO4cF3Rp2Hq7TZ3xDq7kVUX8bHNCq7Hmd8AfucHjfNkkT4ylsavgYnQtIXNlaEhe1NZ5Q16gj0roTkx5spdU05ivd9ii+OsZCMh9ZT+mexKOj0+m/4bnaCWcjkB1y2S019mtfKEHBsusV9Ec0iDGCrXSV3WXWU/NegATTihY8jEUWZcCRgn2swdka9azEwCQ1StGOfwwPEU1nBWc+OolqTDg== 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)(39860400002)(396003)(136003)(230922051799003)(82310400011)(451199024)(64100799003)(186009)(1800799012)(46966006)(36840700001)(40470700004)(86362001)(41300700001)(83380400001)(16526019)(921011)(316002)(1076003)(6666004)(26005)(2616005)(7696005)(110136005)(478600001)(36756003)(5660300002)(70206006)(4326008)(8676002)(8936002)(70586007)(426003)(2906002)(336012)(81166007)(82740400003)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2024 15:52:35.0223 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fd020c71-8a06-487f-395f-08dc2cabcbdc 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: DS3PEPF000099E0.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9235 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 | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c index e0fd99e61a2d..671a499a5ccd 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_sync_to); 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..9b3875f7aa79 100644 --- a/include/trace/events/dma_fence.h +++ b/include/trace/events/dma_fence.h @@ -83,6 +83,40 @@ DEFINE_EVENT(dma_fence, dma_fence_wait_end, TP_ARGS(fence) ); +DECLARE_EVENT_CLASS(dma_fence_from, + + 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)) +); + +DEFINE_EVENT(dma_fence_from, dma_fence_sync_to, + + TP_PROTO(struct dma_fence *fence, const char *reason), + + TP_ARGS(fence, reason) +); + #endif /* _TRACE_DMA_FENCE_H */ /* This part must be outside protection */ From patchwork Tue Feb 13 15:50:27 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: 13555295 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 92AFAC48260 for ; Tue, 13 Feb 2024 15:52:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CE08010E80F; Tue, 13 Feb 2024 15:52:46 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="lo6qjdGs"; dkim-atps=neutral Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id DD9C310E80F; Tue, 13 Feb 2024 15:52:45 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lk6ROejYYmKyYhGRGXakh9j9JNxhgApTIsjA2yygFwOAV0G0TBJrl1/UCJHN9blX9siYvrAbPhMmuWj1+rXYEdJU71mEqOZ35QL4FtPc4bIU+qRI9sEhxH4udzyTmQviuKRLUCBm48td12/NztfhQlaSsxtd+lAh3ZCoPXMgPPo5IiM11u4gyi2IJkhQJ3NUT2JdgVRmQ+KPpVTCxSJ55WoIY42604eK/ttrAthmfXb5cbEhXNuKgmIWmJgQhtQiPo40oYMOQOEJDc4qBxrbKmGw+zbrAJHll3t/sP/muC4S3s77A0F6ehOXErD4y6qCW0H0QNfQ61l+pIR92sxq5w== 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=L+mYUlwTc4LQ6XmpWOwDvyMPEPfSEwsozW4U5VTJwQc=; b=Nq9VfpxeM9YWIsYpwNYzZcsyqkn8lom/PD+U1ULjO4exOfDzlqx8ywoc0KjTcIkmFIRA6Ih/TnTcvcSHLh3ZkqCnBcS4YzDNNrFwBvRnW1/OLyoi79aVovMTZnbE0b9pQVevwossoBOO41VRqu7S3Hs1LJwuo+4AP5vjdtoLfF0PyBJec/0USYNsAXN/KEO41LxLspZz7kZ5IDKtE6glpFb/TwypXUI8zu/Z90kaFAcIaxvJNqQRfntBOrft/KL6UDiRq728SeC0eC2R7GbyGqJ+4kPgR+KCk0w7hDrOzzxa6Ck8uahyIAv8aJ0MlH8pK4zPrkJmgguiKN8t75X3jQ== 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=L+mYUlwTc4LQ6XmpWOwDvyMPEPfSEwsozW4U5VTJwQc=; b=lo6qjdGs488RZVmtEJ16HotYl96duv8CdfZpQSj2iJs+k7bMsrP5jx6H0l8X+rGbBv10hCveBh9+oIfKOH1BBGNf2ZY/5grjLh/1ADkCU9tflrB3DhhGOLUMWzRONTTOYzx+O+hAcAy7JtrEX8cBYVOi6ATgauWgDvXeNei+a90= Received: from CH2PR07CA0040.namprd07.prod.outlook.com (2603:10b6:610:5b::14) by CH3PR12MB8582.namprd12.prod.outlook.com (2603:10b6:610:163::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.23; Tue, 13 Feb 2024 15:52:43 +0000 Received: from DS3PEPF000099E1.namprd04.prod.outlook.com (2603:10b6:610:5b:cafe::59) by CH2PR07CA0040.outlook.office365.com (2603:10b6:610:5b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.39 via Frontend Transport; Tue, 13 Feb 2024 15:52:43 +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 DS3PEPF000099E1.mail.protection.outlook.com (10.167.17.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Tue, 13 Feb 2024 15:52:42 +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; Tue, 13 Feb 2024 09:52:39 -0600 From: Pierre-Eric Pelloux-Prayer To: Sumit Semwal , Gustavo Padovan , =?utf-8?q?Christian_K=C3=B6nig?= , Steven Rostedt , "Masami Hiramatsu" , Mathieu Desnoyers , , , , "Alex Deucher" , CC: Pierre-Eric Pelloux-Prayer Subject: [PATCH v2 2/6] dma-buf/fence-chain: use trace_dma_fence_sync_to Date: Tue, 13 Feb 2024 16:50:27 +0100 Message-ID: <20240213155112.156537-3-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240213155112.156537-1-pierre-eric.pelloux-prayer@amd.com> References: <20240117184329.479554-1-pierre-eric.pelloux-prayer@amd.com> <20240213155112.156537-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: DS3PEPF000099E1:EE_|CH3PR12MB8582:EE_ X-MS-Office365-Filtering-Correlation-Id: 00715424-6bf9-47ec-3202-08dc2cabd093 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IRYf1pXGWvuxUatWQ+wasov3s81/5FxRRSrDYhCQCMKRVWuFI0ErCvqc8aNVmXxkzPl/mApANmoP7cg97/UFlm6/BaAeRsRK4ILjTyiTM4MnjcK6rvlmuD2l7cGz+JFsiuMy9D6IPmuTj6CeVOhEeuMDSN2lRsK2Dq8IeskEWK4utTsxVFVkXy++ME+RzCzzgPyzaTBMvepMJL1puDHwrKQ6Gpqa5LMLkB2IgKVdweGa4hDddALwQsnx4waHznkhE6eg8oYsVBYVmFNlX4LzI0ShhPV7VfrBVaQdFTJkVVfuWcbbdQVhMe9thiySZmEhsZuxPCTkn+3vqiQI/3rLIGDbvllpUb94EEkPFYUTSgDNkbHYgAkYOPQKi/K6GJMp9G6hMnD6JamGoJXSc+5dexYOI5QjzGhEheBBO4pKkctrhqouKXJLYGF7hE6qkaLQyE9r53Fsxsp5oquGZgNuB10bM45L1MQ3PD1OA7nsSZgn5ICUKwH3xLSmOkUsuZk0Wd9UOvqJzePGwxdWejAw4BfPGsWLbiPPQ17nVdnfQ9Xjd6TU4OjCwH2+XwSh3ur27pr9A3sn9a/u5fzv63rm6w65rWbZP11+bi6HELforRjtQ6HTsIyxyhwygGtT8YQoETO4cHpsgEdENjcgBGg4TQ== 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)(396003)(39860400002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(82310400011)(186009)(46966006)(36840700001)(40470700004)(478600001)(41300700001)(2906002)(4326008)(8936002)(8676002)(5660300002)(4744005)(70586007)(356005)(7696005)(6666004)(110136005)(316002)(1076003)(426003)(26005)(2616005)(336012)(81166007)(86362001)(82740400003)(70206006)(16526019)(36756003)(921011); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2024 15:52:42.9167 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 00715424-6bf9-47ec-3202-08dc2cabd093 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: DS3PEPF000099E1.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8582 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 --- 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..a211b3d4156a 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_sync_to(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 Tue Feb 13 15:50:28 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: 13555296 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 862CBC48260 for ; Tue, 13 Feb 2024 15:52:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BA3AE10E82A; Tue, 13 Feb 2024 15:52:53 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="FNyno0Uq"; dkim-atps=neutral Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2073.outbound.protection.outlook.com [40.107.243.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3927710E82A; Tue, 13 Feb 2024 15:52:53 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NEmaoDN3xZa7Gj62He8mjhjM+n8jmzVo/PSi7OP2bGRsp3bClP5sQqt2Ff/X3DFDsE17RhIjgGVpCIwPkK3UyZbEBXMQErB8//kfegFm7mxCk1yat0H1o1loOKw8mTXEaM1sBUKyjNKN/fRInIoF8c9JmlopNAYHXGo+adDLShYSJWbMZCXXulqpu0vymtDVh3LtQJ+0JMru1kOL6PpVvfdyjX0N13l+LmEtfsMuC68wp03y9T4FZOkN88E1D9PorOGO/fOfZd/DO37bllhXAlGOo+EX4KfyTTUYbXFFH4KZ9zax463SA9ki39siLcGVJ+mSb4rUw11wv2arj8CLiw== 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=FJeu1+MHgDOUz1vgUQ9hlUpREKJ+teczytM2qNiTZDw=; b=gsIC+cV9UGrqggWe2fUcRBbwY8HZKqQEZdW1FvoN92mKI7JWcsHuY+CqdLXddOe6pH97DFHi+OyPQpz+BGsoArquoy9bCjKakvn9N/c6TLQ+r4VWJDTzLBrllBVCC0zrCnPkgsX521KJg3WuKrijpiP+h4k0oUYbBUEFcd6p4Niy2wSBqh/kvmb9sdPtH4zleGSyEH1No9WNBU4TKq7bANdcMLnLOKG1YOasmZhVodnmnTLQ1QuXyt86D0ih3urfhBD0N8ad0PPf4D86ZR3hX9oONPSrZH4T2Uue5GSLzQ/cWw30Bxav9eAdkJSodqwIzgmU0vxuvoaRNmDllU+XTw== 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=FJeu1+MHgDOUz1vgUQ9hlUpREKJ+teczytM2qNiTZDw=; b=FNyno0Uqdu0yimp4/HxuiLktE/7nCkveuGoR/QVu0+JBwpQJ30NDHKzNWGxBYbCI5i8aYz4ao2QLz7rH/XH/C3Ja1LWRbofCYkoTvDgYHwOyjDqnauM8lblrMl2246kLSpj8KT9MXIaIn4QAY87qNqNWpjC5VFYQs1K09RLrew8= Received: from DM6PR08CA0041.namprd08.prod.outlook.com (2603:10b6:5:1e0::15) by BY5PR12MB4145.namprd12.prod.outlook.com (2603:10b6:a03:212::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25; Tue, 13 Feb 2024 15:52:49 +0000 Received: from DS3PEPF000099DD.namprd04.prod.outlook.com (2603:10b6:5:1e0:cafe::42) by DM6PR08CA0041.outlook.office365.com (2603:10b6:5:1e0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.40 via Frontend Transport; Tue, 13 Feb 2024 15:52:49 +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 DS3PEPF000099DD.mail.protection.outlook.com (10.167.17.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Tue, 13 Feb 2024 15:52:49 +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; Tue, 13 Feb 2024 09:52:46 -0600 From: Pierre-Eric Pelloux-Prayer To: Sumit Semwal , Gustavo Padovan , =?utf-8?q?Christian_K=C3=B6nig?= , Steven Rostedt , "Masami Hiramatsu" , Mathieu Desnoyers , , , , "Alex Deucher" , CC: Pierre-Eric Pelloux-Prayer Subject: [PATCH v2 3/6] amdgpu: use trace_dma_fence_sync_to in amdgpu_fence_sync Date: Tue, 13 Feb 2024 16:50:28 +0100 Message-ID: <20240213155112.156537-4-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240213155112.156537-1-pierre-eric.pelloux-prayer@amd.com> References: <20240117184329.479554-1-pierre-eric.pelloux-prayer@amd.com> <20240213155112.156537-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: DS3PEPF000099DD:EE_|BY5PR12MB4145:EE_ X-MS-Office365-Filtering-Correlation-Id: cce827b4-c864-450a-904e-08dc2cabd49a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pStlXDTTB+hl19e7Lck5E741mDMjpLMjYiCRSx26heCdDYhGz05Y973dghijUxHS1OrfejXtUzOx6j3qeuJWU8Rrh4rzeYOJ5+S9kfHHFjzpr3NKa1H9opXDOb5g2CXoETFNHHHRiCLPDolac0DS5jxWu2XCeZp4agG9gTQ1ZJzXWi1w9IYU788T6VFPa+w+Vkz0U68JeDPO4oa2oPhlYT1EgNBToXXoI6y3vX5ueaudMNii8QHgW5tdqWzOTFwR5P0RMb9+LVkLUNSg/bSLdhw6zfeaSrLdrPgsTn6AkZpgVefsFFyWWZjd0Vfv46pvyCGUcFOOjzuUmd6wf5kQs22l3P2NfNvDDchaMl9p31p67KWght7B1j1+pCi+mrdclBAV1Ia5wMa4e32LFuJ5sxOp+XmTbmGeDtAc3JR4wQBd1YJSV2tIPl6JQIV32KIWQ1KYId6SI4fAMGr7ES9sixoEA45I125SR0poArUOH8kmFCVGr+SW9Y4SSuegWu9HnnZ8zf4V+ehjaDIfvWwiTxxYZnKxrzUceUJgLiCZU0dN9LCzTXCVNL19tZVLeCrIshrCASYN34P6bU9nJ0uYFlbnf2eFZywqt6glcdolkKMjjEWKgqvWas7ctrdXMX+n 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)(39850400004)(396003)(136003)(376002)(230922051799003)(64100799003)(186009)(82310400011)(1800799012)(451199024)(36840700001)(46966006)(40470700004)(478600001)(966005)(41300700001)(5660300002)(8676002)(8936002)(4326008)(2906002)(70586007)(70206006)(7696005)(6666004)(316002)(26005)(83380400001)(336012)(426003)(86362001)(82740400003)(356005)(16526019)(81166007)(2616005)(110136005)(921011)(1076003)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2024 15:52:49.6759 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cce827b4-c864-450a-904e-08dc2cabd49a 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: DS3PEPF000099DD.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4145 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 The 'reason' param currently uses __func__ but I didn't add a macro for this because it'd be interesting to use more descriptive names for each use of amdgpu_fence_sync. Signed-off-by: Pierre-Eric Pelloux-Prayer --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 14 +++++++------- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 8 +++----- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 11 ++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c | 4 ++-- 7 files changed, 28 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index d17b2452cb1f..fde98e48c84b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -491,7 +491,7 @@ static int vm_update_pds(struct amdgpu_vm *vm, struct amdgpu_sync *sync) if (ret) return ret; - return amdgpu_sync_fence(sync, vm->last_update); + return amdgpu_sync_fence(sync, vm->last_update, __func__); } static uint64_t get_pte_flags(struct amdgpu_device *adev, struct kgd_mem *mem) @@ -1251,7 +1251,7 @@ static void unmap_bo_from_gpuvm(struct kgd_mem *mem, amdgpu_vm_clear_freed(adev, vm, &bo_va->last_pt_update); - amdgpu_sync_fence(sync, bo_va->last_pt_update); + amdgpu_sync_fence(sync, bo_va->last_pt_update, __func__); } static int update_gpuvm_pte(struct kgd_mem *mem, @@ -1273,7 +1273,7 @@ static int update_gpuvm_pte(struct kgd_mem *mem, return ret; } - return amdgpu_sync_fence(sync, bo_va->last_pt_update); + return amdgpu_sync_fence(sync, bo_va->last_pt_update, __func__); } static int map_bo_to_gpuvm(struct kgd_mem *mem, @@ -2910,7 +2910,7 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info, struct dma_fence **ef) } dma_resv_for_each_fence(&cursor, bo->tbo.base.resv, DMA_RESV_USAGE_KERNEL, fence) { - ret = amdgpu_sync_fence(&sync_obj, fence); + ret = amdgpu_sync_fence(&sync_obj, fence, __func__); if (ret) { pr_debug("Memory eviction: Sync BO fence failed. Try again\n"); goto validate_map_fail; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 6adeddfb3d56..6830892383c3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -423,7 +423,7 @@ static int amdgpu_cs_p2_dependencies(struct amdgpu_cs_parser *p, dma_fence_put(old); } - r = amdgpu_sync_fence(&p->sync, fence); + r = amdgpu_sync_fence(&p->sync, fence, __func__); dma_fence_put(fence); if (r) return r; @@ -445,7 +445,7 @@ static int amdgpu_syncobj_lookup_and_add(struct amdgpu_cs_parser *p, return r; } - r = amdgpu_sync_fence(&p->sync, fence); + r = amdgpu_sync_fence(&p->sync, fence, __func__); dma_fence_put(fence); return r; } @@ -1101,7 +1101,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p) if (r) return r; - r = amdgpu_sync_fence(&p->sync, fpriv->prt_va->last_pt_update); + r = amdgpu_sync_fence(&p->sync, fpriv->prt_va->last_pt_update, __func__); if (r) return r; @@ -1112,7 +1112,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p) if (r) return r; - r = amdgpu_sync_fence(&p->sync, bo_va->last_pt_update); + r = amdgpu_sync_fence(&p->sync, bo_va->last_pt_update, __func__); if (r) return r; } @@ -1131,7 +1131,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p) if (r) return r; - r = amdgpu_sync_fence(&p->sync, bo_va->last_pt_update); + r = amdgpu_sync_fence(&p->sync, bo_va->last_pt_update, __func__); if (r) return r; } @@ -1144,7 +1144,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p) if (r) return r; - r = amdgpu_sync_fence(&p->sync, vm->last_update); + r = amdgpu_sync_fence(&p->sync, vm->last_update, __func__); if (r) return r; @@ -1225,7 +1225,7 @@ static int amdgpu_cs_sync_rings(struct amdgpu_cs_parser *p) continue; } - r = amdgpu_sync_fence(&p->gang_leader->explicit_sync, fence); + r = amdgpu_sync_fence(&p->gang_leader->explicit_sync, fence, __func__); dma_fence_put(fence); if (r) return r; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c index ddd0891da116..96f68e025d8e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c @@ -309,7 +309,7 @@ static int amdgpu_vmid_grab_reserved(struct amdgpu_vm *vm, /* Good we can use this VMID. Remember this submission as * user of the VMID. */ - r = amdgpu_sync_fence(&(*id)->active, &job->base.s_fence->finished); + r = amdgpu_sync_fence(&(*id)->active, &job->base.s_fence->finished, __func__); if (r) return r; @@ -369,8 +369,7 @@ static int amdgpu_vmid_grab_used(struct amdgpu_vm *vm, /* Good, we can use this VMID. Remember this submission as * user of the VMID. */ - r = amdgpu_sync_fence(&(*id)->active, - &job->base.s_fence->finished); + r = amdgpu_sync_fence(&(*id)->active, &job->base.s_fence->finished, __func__); if (r) return r; @@ -421,8 +420,7 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring, id = idle; /* Remember this submission as user of the VMID */ - r = amdgpu_sync_fence(&id->active, - &job->base.s_fence->finished); + r = amdgpu_sync_fence(&id->active, &job->base.s_fence->finished, __func__); if (r) goto error; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c index da48b6da0107..0f85370f69fa 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c @@ -1219,14 +1219,14 @@ int amdgpu_mes_ctx_map_meta_data(struct amdgpu_device *adev, DRM_ERROR("failed to do vm_bo_update on meta data\n"); goto error_del_bo_va; } - amdgpu_sync_fence(&sync, bo_va->last_pt_update); + amdgpu_sync_fence(&sync, bo_va->last_pt_update, __func__); r = amdgpu_vm_update_pdes(adev, vm, false); if (r) { DRM_ERROR("failed to update pdes on meta data\n"); goto error_del_bo_va; } - amdgpu_sync_fence(&sync, vm->last_update); + amdgpu_sync_fence(&sync, vm->last_update, __func__); amdgpu_sync_wait(&sync, false); drm_exec_fini(&exec); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c index 1b013a44ca99..b6538f73eee9 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" @@ -149,10 +150,12 @@ static bool amdgpu_sync_add_later(struct amdgpu_sync *sync, struct dma_fence *f) * * @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(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_sync_to(f, reason); + hash_add(sync->fences, &e->node, f->context); e->fence = dma_fence_get(f); return 0; @@ -249,7 +254,7 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, struct amdgpu_sync *sync, struct dma_fence *tmp = dma_fence_chain_contained(f); if (amdgpu_sync_test_fence(adev, mode, owner, tmp)) { - r = amdgpu_sync_fence(sync, f); + r = amdgpu_sync_fence(sync, f, __func__); dma_fence_put(f); if (r) return r; @@ -358,7 +363,7 @@ int amdgpu_sync_clone(struct amdgpu_sync *source, struct amdgpu_sync *clone) hash_for_each_safe(source->fences, i, tmp, e, node) { f = e->fence; if (!dma_fence_is_signaled(f)) { - r = amdgpu_sync_fence(clone, f); + r = amdgpu_sync_fence(clone, f, __func__); if (r) return r; } else { diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h index cf1e9e858efd..0c58d6120053 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h @@ -47,7 +47,8 @@ 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(struct amdgpu_sync *sync, struct dma_fence *f, + const char *reason); int amdgpu_sync_resv(struct amdgpu_device *adev, struct amdgpu_sync *sync, struct dma_resv *resv, enum amdgpu_sync_mode mode, void *owner); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c index bfbf59326ee1..5e30b371b956 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c @@ -117,13 +117,13 @@ static int map_ring_data(struct amdgpu_device *adev, struct amdgpu_vm *vm, if (r) goto error_del_bo_va; - amdgpu_sync_fence(&sync, (*bo_va)->last_pt_update); + amdgpu_sync_fence(&sync, (*bo_va)->last_pt_update, __func__); r = amdgpu_vm_update_pdes(adev, vm, false); if (r) goto error_del_bo_va; - amdgpu_sync_fence(&sync, vm->last_update); + amdgpu_sync_fence(&sync, vm->last_update, __func__); amdgpu_sync_wait(&sync, false); drm_exec_fini(&exec); From patchwork Tue Feb 13 15:50:29 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: 13555297 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 83F7BC4829A for ; Tue, 13 Feb 2024 15:53:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A4A7510E833; Tue, 13 Feb 2024 15:53:00 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="YL3w7a4+"; dkim-atps=neutral Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2056.outbound.protection.outlook.com [40.107.92.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5FE1610E833; Tue, 13 Feb 2024 15:52:59 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TGUqls3gWWX2Ko7hAjqV8kuIMPVWnXI9exuhlbT+HItTxDM75TIho6oszQ8lNiFjXx1RCXvgwPUxdHMvp9MfykozuCvHquc7vC3ijdzSo7CN2XgOZGwglmLleiTnrYZFXrd+i9OpEH/d6Fv52C2iigq6zO0v4HlfdhbrMeAlIsCwcv+JD2R6np0KPaDTDHVJVx/9bNK536qV5ZM2h3coHGynAZdoJwOqPisVpvxvLSWTFz+QEc9iWx4fXsjMmZhKo/KfR73nY6EoKfCE252+fnNbKInCsYxecanDgoLpdzXx/fSUqB+4P/8UZMp0oALNjcdDMUIE01BEKJbssfXO4w== 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=zEEFCReCDBgqHrLx317RvjPACbCy+vsGW7UPa1jC/dc=; b=lthswKtDCj3HrC2mghUEbrFL2enrskbSg3RyciJc7Ra4MyKhv0bIRFpW//YOKyIyedQSq1xCG4N7mBy7sR7DegolbzjoCunBpd8n7bfNtVmK822Nx2lVQfZ1+B036z+JLL2UtjXcVJdgMWDYYytqosOcmtWI/yAduEvElyhK9fPHwSVuniPfGim/Dofb6pHUop5LuD59Ce4KmsKysgyl9/9VaDZdIeRZdfDkh/6160nzpQ63Q9L2UxmmDXCj3RrlZ5juEQACLnkgmjwDLNiqWfnq/jvSPnYyILLI0LOaQXwW+I29QyCVWFJu7qBLrh9Q6Pg0gyCK+1ZCV2Odz4Cz4w== 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=zEEFCReCDBgqHrLx317RvjPACbCy+vsGW7UPa1jC/dc=; b=YL3w7a4+0Y3RYdzK+DGycOzrpxKqxx3UorvLTz/FfLbwSgCD5xafTNy8Kzjiz0My4q74pX2mv/rDDOMDwoI9urdcjVRSAmxH2oIFU42SRlXLZIb2PYYo0cFLvD0IQ4VWupfdM9YCxNVmulgeGDtDj+zaptNohzTs6a+gqXNKsDo= Received: from CH2PR07CA0058.namprd07.prod.outlook.com (2603:10b6:610:5b::32) by BL3PR12MB6404.namprd12.prod.outlook.com (2603:10b6:208:3b4::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.10; Tue, 13 Feb 2024 15:52:55 +0000 Received: from DS3PEPF000099E1.namprd04.prod.outlook.com (2603:10b6:610:5b:cafe::50) by CH2PR07CA0058.outlook.office365.com (2603:10b6:610:5b::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.37 via Frontend Transport; Tue, 13 Feb 2024 15:52: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 DS3PEPF000099E1.mail.protection.outlook.com (10.167.17.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Tue, 13 Feb 2024 15:52: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; Tue, 13 Feb 2024 09:52:52 -0600 From: Pierre-Eric Pelloux-Prayer To: Sumit Semwal , Gustavo Padovan , =?utf-8?q?Christian_K=C3=B6nig?= , Steven Rostedt , "Masami Hiramatsu" , Mathieu Desnoyers , , , , "Alex Deucher" , CC: Pierre-Eric Pelloux-Prayer Subject: [PATCH v2 4/6] drm/amdgpu: add BO clear event Date: Tue, 13 Feb 2024 16:50:29 +0100 Message-ID: <20240213155112.156537-5-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240213155112.156537-1-pierre-eric.pelloux-prayer@amd.com> References: <20240117184329.479554-1-pierre-eric.pelloux-prayer@amd.com> <20240213155112.156537-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: DS3PEPF000099E1:EE_|BL3PR12MB6404:EE_ X-MS-Office365-Filtering-Correlation-Id: aac209f4-3634-4c3a-34ef-08dc2cabd817 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wU8edDcM2sno8Ltn1hCILIocYo7QlZw9cq0RYVYgyJz5EjBVM1+lr6iX65vcZJcjoxlArq9/nFlS9edIXRWy2yGfwxHZ4ReOgI53agKqz8k+BlxvMo8d+KMfCSTK6gx7Mg2Co2tWuV/fVQNH2D9+OD4QANE3BLtimmo9O42CZm0S9zMy6k4pxQhIyxVLQH7wdgjQN1NOLMGL5bdo9wAcFJStOPq44/XCiPdIgnnjbILlfADJI7ijUhahcXmVjCzienOA4uvEUBxGbChFXN2mZErb3hLprGsgQpgB2Rn+wZtD+nYQvuYhXJ4iXzR9eKsBlcUvK9OLZwbvz9pVsLcK2E60DtMnKqTLOMkxjKyTEBhQXvqpOvXOldFZZkgLaK1RVvsGv8sGa/ZTrLIMKsY476lc55WNrXmK6ydAmrd+GAE8x7TugYdCU3Mlif1iaU5aT3OALc+PHYa4rRSJ/4aKvOG/ynLBq2lDMetY4dOt+1TTtJPccHU6v/mplyCgr8FwDdr5cXXDNLPEC2/kPovZyOZsf+SOMWmCt1Vdm/eHvnXq6uwSz88YI2rHL65Iwe135gYCdEzkm2t4ggTfK+tP4E2MCmXc4aLYsyduw7sJArD6M2QIkNlvYuwJGyhWqrjNsBNFOYIeW8wXUOaroqa4Wg== 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)(39860400002)(396003)(136003)(230922051799003)(451199024)(1800799012)(82310400011)(64100799003)(186009)(46966006)(36840700001)(40470700004)(316002)(5660300002)(110136005)(70586007)(41300700001)(2906002)(36756003)(2616005)(16526019)(1076003)(82740400003)(26005)(81166007)(356005)(336012)(70206006)(426003)(8936002)(4326008)(8676002)(86362001)(478600001)(921011)(7696005)(6666004); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2024 15:52:55.5259 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aac209f4-3634-4c3a-34ef-08dc2cabd817 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: DS3PEPF000099E1.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6404 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. Signed-off-by: Pierre-Eric Pelloux-Prayer --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 425cebcc5cbf..7219f329d6f0 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -631,6 +631,8 @@ int amdgpu_bo_create(struct amdgpu_device *adev, bo->tbo.resource->mem_type == TTM_PL_VRAM) { struct dma_fence *fence; + trace_amdgpu_bo_clear(bo); + r = amdgpu_fill_buffer(bo, 0, bo->tbo.base.resv, &fence, true); if (unlikely(r)) goto fail_unreserve; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h index f539b1d00234..e8ea1cfe7027 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h @@ -514,6 +514,22 @@ TRACE_EVENT(amdgpu_bo_move, __entry->new_placement, __entry->bo_size) ); +TRACE_EVENT(amdgpu_bo_clear, + TP_PROTO(struct amdgpu_bo *bo), + TP_ARGS(bo), + TP_STRUCT__entry( + __field(struct amdgpu_bo *, bo) + __field(u64, bo_size) + ), + + TP_fast_assign( + __entry->bo = bo; + __entry->bo_size = amdgpu_bo_size(bo); + ), + TP_printk("bo=%p, size=%lld", + __entry->bo, __entry->bo_size) +); + TRACE_EVENT(amdgpu_ib_pipe_sync, TP_PROTO(struct amdgpu_job *sched_job, struct dma_fence *fence), TP_ARGS(sched_job, fence), From patchwork Tue Feb 13 15:50:30 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: 13555298 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 7A740C4829A for ; Tue, 13 Feb 2024 15:53:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 90DCA10E83B; Tue, 13 Feb 2024 15:53:18 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="T1NDcGrX"; dkim-atps=neutral Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2061.outbound.protection.outlook.com [40.107.220.61]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5097B10E837; Tue, 13 Feb 2024 15:53:17 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JO8Jp4RG/qUoL+W8s1clLJ5BSBK6Sh2IveoSQLt937ui3Bhn2Yiou/uFd0xe7x8RO//P8yzHOyLZS5Cpb4PL2pcWIf4N+Fd+30wmTVWc3lz/KiantZrz2e0wxQMq4S/zJQFXHTlYyrDqKgIxiDzXqtWBLVzkV2Q0+lPls78rAGKZroHLJW6LgiNzmfrnmIiKcJKzYFfNEXX6CzFt+Vbd6gErx7nHHBqmXbQ9Dhbw9Zu9XWJJyqvsJhIEx7XdIkopMgGMMhhmChXhz0x3l13ED/lpQZgPZ+CEA1JGgey7uGL2HXEEsVRHpMPsLjotkWBNsM6ZVx9BLnd1ubE7F1EtPw== 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=Ej94dIoLfuB8DjPgfxYfwN3IhhVQaxWcWhfsOXlYPQc=; b=X5/AXbk2flgfJWOw39PtNw29wfRwvphxwskyKbVDWnSCUsxooISMSiUVFyfQ36krgNcGE10KfT05ptDfU8qcbYdZHNYgpGbDoj73lbgMW3wmZMXZBp67Kq01nFvQPK4GTZHNyCTHN5fkEeHjA27N2FvvFaHSCDPTfCwXsdC5LujEwaR7ZQ8Sh1Y/0FBmNo2IMFE9SgHV5uwyReFqBJ//6J655cvTPJ/1zPdsAM30iUztTkyJKHgsaZIlOMegQOQjeMXoCqNxByhsC3oAYBgSs7nsAyEU34EZT8U0rOMUMpFKuSre7Zxot5Xih6ZAyDryqBxuj944z9bH2Cjc+5k24Q== 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=Ej94dIoLfuB8DjPgfxYfwN3IhhVQaxWcWhfsOXlYPQc=; b=T1NDcGrXHfK1JqNuKhb2QohoQ1PdLHNTXq7L3z5dRzQKfDTyS0mxt+85L56/LNmNJHPOHgj51e9wut1bWe9OHNpWt6Anzp/Iy3p8x53LGuPSlH+ymVTZfwAkaY+ykK0hhHRwGVDkStIdNQa/Wux7M+sNUgHHQD44Qekb4uzRbLc= Received: from DS7PR05CA0018.namprd05.prod.outlook.com (2603:10b6:5:3b9::23) by SA3PR12MB9106.namprd12.prod.outlook.com (2603:10b6:806:37e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25; Tue, 13 Feb 2024 15:53:15 +0000 Received: from DS3PEPF000099DC.namprd04.prod.outlook.com (2603:10b6:5:3b9:cafe::e6) by DS7PR05CA0018.outlook.office365.com (2603:10b6:5:3b9::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.38 via Frontend Transport; Tue, 13 Feb 2024 15:53:15 +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 DS3PEPF000099DC.mail.protection.outlook.com (10.167.17.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Tue, 13 Feb 2024 15:53:15 +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; Tue, 13 Feb 2024 09:53:11 -0600 From: Pierre-Eric Pelloux-Prayer To: Sumit Semwal , Gustavo Padovan , =?utf-8?q?Christian_K=C3=B6nig?= , Steven Rostedt , "Masami Hiramatsu" , Mathieu Desnoyers , , , , "Alex Deucher" , CC: Pierre-Eric Pelloux-Prayer Subject: [PATCH v2 5/6] drm/amdgpu: add a amdgpu_cs_ioctl2 event Date: Tue, 13 Feb 2024 16:50:30 +0100 Message-ID: <20240213155112.156537-6-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240213155112.156537-1-pierre-eric.pelloux-prayer@amd.com> References: <20240117184329.479554-1-pierre-eric.pelloux-prayer@amd.com> <20240213155112.156537-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: DS3PEPF000099DC:EE_|SA3PR12MB9106:EE_ X-MS-Office365-Filtering-Correlation-Id: 0902db57-d82c-4a33-3147-08dc2cabe3dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DOmw76whJN4g5lbPsUaJqGAlq5P/uqmTr7pMHrwSY5mVRct0WwdDyjXlZkA3ofsuXb/5A4QblKcA2btrjBVrYudYeI4qoP/egb1veAyUVaDJK8lf9R+/mRtCSpwpBUocs4U2Mt9iwJKrp385TOaoTvRwDSm+fjfhPqH+v/CEjkHwsnen22FRgqeR6wmgXBS21ujDeNl/nZDR2t0CTguvEu/StdClJG4WW6kqXg7g0LOwOPOly6vF3WVl465ywHClAjCe88O0Ffybt+879rIX8bFisPfjS5pdTlJl2iky8VRFLGc4XBiGCapQwLLPt1pdx6N8dL3j4s5KxR+R+zve8svw+uuFoc88PN5HUh5OXyoj6rXhdSu62A3SLbTYzmMTbsGOx0PihRAlU2IWBb7ARxEQOKAEvms/msT4dQhzT/7y96yd95U1oN4XWuhGV07R2nx9wwtZXB1d8lD4Dd5kSDxYH9W9FGStBLat6SZ0UkSyxEE82oOtdFpYjjPbK5eDgQfHTeZ9yWT+lEID37niDA5Th/OnUB3ZK2rTMujdsQOb6euSt33uvL8X7nvzFJ1IAwQhJjC/0fm4JKv+EgpqNwIJ5h3+lhuu7l9B3tiTlXSuw0/20tidHKZZhn3dIv4Krt5Sm1lgCaBEa0XOVmebdg== 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)(376002)(136003)(346002)(230922051799003)(1800799012)(451199024)(64100799003)(82310400011)(186009)(40470700004)(46966006)(36840700001)(2906002)(6666004)(356005)(478600001)(7696005)(36756003)(1076003)(8936002)(82740400003)(81166007)(8676002)(336012)(2616005)(426003)(16526019)(70206006)(86362001)(70586007)(26005)(4326008)(5660300002)(921011)(110136005)(316002)(41300700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2024 15:53:15.2718 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0902db57-d82c-4a33-3147-08dc2cabe3dc 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: DS3PEPF000099DC.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB9106 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_ioctl2 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). 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 6830892383c3..29e43a66d0d6 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_ioctl2(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 e8ea1cfe7027..24e95560ede5 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_ioctl2, + 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 Tue Feb 13 15:50:31 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: 13555299 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 662FBC48260 for ; Tue, 13 Feb 2024 15:53:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B3A7C10E837; Tue, 13 Feb 2024 15:53:34 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="oRRCEYFA"; dkim-atps=neutral Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2078.outbound.protection.outlook.com [40.107.244.78]) by gabe.freedesktop.org (Postfix) with ESMTPS id 201E710E837; Tue, 13 Feb 2024 15:53:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d6lgsLUJ+K0KzZgQDEWEQG3qnuSkB0OPM2Y54Z294SmylyFnyK/d0NsmJWXsDWbnYEwW30rsRBuro3fczUdUxfN22dm0FSAFUbRlgt/YmcufAbDW/26NiLBJGdhOMjDTdSWXuCvl2y0YGhaia0fn097hP8do1l+HvR+tWiO68o77yFyqqA71BRFgX1e7G0bXKUN3sUJE9bp+Zw5b+86yH6BAxWd48Ze9z6mM4tBjZjgYa9r3dCK5nnVLzs1QIUdrD6DMq8pG0rAetzBGF+rERbB8/Il0x4jNUqMOqZ8lFoMHpu5GaNnmQsqEgkJt84REv/hvy+plwOu+tGZpmofwDw== 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=K5CLAmhZZ4kC1eRhs1ZqqqMPtuS3yf/pWWaOlISVwKI=; b=OJyeAwne2PqB/bJ0ngHWZb6N16MPvl69Fr9ebKPRl8zDxAUnbeaUaoDps0vpLG1+QSllTSPDGj63/bWRnytFKL4lBXHIlXNyGEd7pR6pdk8py0go0oPvMy4d8xFolEWU9su3pyyHNh79Pxt6h9cHFr/pP3WX745DeMIRT5QvWye4u9m4Muh7DFQug4EkY4xU5TjJnqak8R9y0pBIqiZBtemnvjoX1+endRv3xGuVvRpZFobIAe8xccf5OVXIs2coFcjJbQftHSN6ZiQKuzv4LipTNEIamI/VnOH/UC2Vfd+YqDHIEXPluNvTPDy4Aq7vb+zhD5Io5pzcx13EbwBqow== 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=K5CLAmhZZ4kC1eRhs1ZqqqMPtuS3yf/pWWaOlISVwKI=; b=oRRCEYFAGRwZCk6yO8o9+Sfx/r+e3FdSEIKV9VnJ0udjV3pHkf18nbLtHokrKZXokiTgEsRDvhaLcAc58pjwTxxKknXvAMpoMXPccit8re2JEtoM7wdp6RgMGzoKbFT1E7ZUPwM4u8J/hEKUNRGV+7foaGEJnmeFWSM959L7ku4= Received: from DM6PR05CA0051.namprd05.prod.outlook.com (2603:10b6:5:335::20) by IA1PR12MB6387.namprd12.prod.outlook.com (2603:10b6:208:389::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25; Tue, 13 Feb 2024 15:53:30 +0000 Received: from DS3PEPF000099E0.namprd04.prod.outlook.com (2603:10b6:5:335:cafe::1d) by DM6PR05CA0051.outlook.office365.com (2603:10b6:5:335::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25 via Frontend Transport; Tue, 13 Feb 2024 15:53:30 +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 DS3PEPF000099E0.mail.protection.outlook.com (10.167.17.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Tue, 13 Feb 2024 15:53:30 +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; Tue, 13 Feb 2024 09:53:26 -0600 From: Pierre-Eric Pelloux-Prayer To: Sumit Semwal , Gustavo Padovan , =?utf-8?q?Christian_K=C3=B6nig?= , Steven Rostedt , "Masami Hiramatsu" , Mathieu Desnoyers , , , , "Alex Deucher" , CC: Pierre-Eric Pelloux-Prayer Subject: [PATCH v2 6/6] drm: add drm_mode_atomic_commit event Date: Tue, 13 Feb 2024 16:50:31 +0100 Message-ID: <20240213155112.156537-7-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240213155112.156537-1-pierre-eric.pelloux-prayer@amd.com> References: <20240117184329.479554-1-pierre-eric.pelloux-prayer@amd.com> <20240213155112.156537-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: DS3PEPF000099E0:EE_|IA1PR12MB6387:EE_ X-MS-Office365-Filtering-Correlation-Id: 343361ec-ffcf-4ef1-07cf-08dc2cabecae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +75ziyafi8j8DgVNKkCk04+olWJF2yc3K1QcHiUh09HFQmYL8dU/jJhP/5BoJC9uYzbOkFkZ0PCmYw8D7jDqtbvpTwzAj4bR2MeToO+GlNJqqUkbiXsBor37FFV+UiBOL0bvynpyULSieqIhhhFutT71w4d034QvIovB2pKikIKADqD3u38k9Su3sPh60Uffp4HxgOoHLfhAGwgGanaHTXzlIUPyqMoBCbpOUinLwRzV675ME1hLFOqjXOr6iTMz0o4rvV+Wft6auQTbr8c0JjxIpZKHelhONuxLIfmbM069rd3Y4KNs/rXgPRi3YN8bE41kTbupBRXDpwkn+UnwCwo7cR8ydCwihjnkzzrlcO9gV86zF4BG1vvHuwKFmbEK9E/Mynb/b09aauRcn5eEunL+N9rS2kyjLomiF+2O0XlAMRYiffIg7ImFAQal5XdqAS1Ha7QtKCL1quwvS7cuBROjNBm+5l/wpFlimRFZFp9ZvNlLb21BMF1SRUGi409VfJI+Y6sgs+TG5Ja6TfF24dP7Y4WRRqt/pjyQKeIqKR2iKo/7OqNU3WKDB/UptYyr/BL48VThpA5YrpGTk5Wc06a1Zb8/bF5EfGmzIoxpiuOUFpiSCe+HcdyPrCLGnSb27bREnCagc4ps70Nh/48pNg== 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)(396003)(136003)(230922051799003)(1800799012)(82310400011)(186009)(64100799003)(451199024)(40470700004)(36840700001)(46966006)(8936002)(921011)(4326008)(16526019)(26005)(336012)(1076003)(426003)(41300700001)(2616005)(83380400001)(70206006)(70586007)(8676002)(478600001)(6666004)(110136005)(316002)(82740400003)(81166007)(36756003)(86362001)(356005)(7696005)(2906002)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2024 15:53:30.0844 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 343361ec-ffcf-4ef1-07cf-08dc2cabecae 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: DS3PEPF000099E0.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6387 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_sync_to 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_sync_to: 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_sync_to: 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 Signed-off-by: Pierre-Eric Pelloux-Prayer --- drivers/gpu/drm/drm_atomic_uapi.c | 19 +++++++++++++++++++ drivers/gpu/drm/drm_trace.h | 28 ++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index 29d4940188d4..0d3767cd155a 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,24 @@ 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); + + 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..b62a44cb1270 100644 --- a/drivers/gpu/drm/drm_trace.h +++ b/drivers/gpu/drm/drm_trace.h @@ -62,8 +62,32 @@ TRACE_EVENT(drm_vblank_event_delivered, __entry->crtc = crtc; __entry->seq = seq; ), - TP_printk("file=%p, crtc=%d, seq=%u", __entry->file, __entry->crtc, \ - __entry->seq) + TP_printk("file=%p, crtc=%d, seq=%u, pid=%8d", \ + __entry->file, __entry->crtc, __entry->seq, \ + pid_nr(__entry->file->pid)) +); + +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_ */