From patchwork Fri Jun 14 08:16: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: 13698168 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 5255FC27C6E for ; Fri, 14 Jun 2024 08:17:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6CD1510EC93; Fri, 14 Jun 2024 08:17:43 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="MCnpiyUY"; dkim-atps=neutral Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2069.outbound.protection.outlook.com [40.107.95.69]) by gabe.freedesktop.org (Postfix) with ESMTPS id C97CB10E18A for ; Fri, 14 Jun 2024 08:17:41 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TnrhpsSxT7GhaDlie3Rruy2Rm6/YCDWRBBJCbozPsiRhvquXj91WzK+gR00dayd399k1HuGo4o5jggHePho12EZ2ewC3baQVWBPwXO/BaXANrXmyRno/vkm1RIObGsgB9LBNcAM8WrkWPDaHNZRITYr2FNiBrju6N09vyFsDwqWz3rJj7KT3rGp3D/xznx1kEvXKvX4pnWFRraauqYwltyKmBVXuSe9cdSZ4PdQx1xzJNvc9ELpIIWkMYaHYAZXqyoZRB7gSsoCKFPmdL0M0DuTcshA5+3CJmMmZ39sTiDtH5/rBVszNAMWZsyqTU/a40ZAFTRJLnFmsli/2kl4v2g== 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=R5jjL2nkC/J+3hwvcjLHk4K7DLKJJXc/Lfbemc4YRqc=; b=X2fWrHLD8Nxc3xeuc7tdF7Z4slJ0L7H327V6Vn3aiH8tupLLFK04fhnebUEeF2Rlzcqne0YfzQeI984x9U0Lm442Qirk2caPf19K+1sRa6CtbDpH3vLJrthpjYugVel65AoWlCSvI0SjKpVLXyIEpF8i0uHQRmriOLC+wi2JWMSCTneqHwDKi5UFwKkMsCBrJWObczIEWTO3Bdtb3swwSgtENNnP1YmT7ZFUyhH2D8fP2BTKQeFWu3pd/CyV6gOH14zaxXg4ESONHHgkoXHpRn9+ri7H1KbgME18gA/BpE5wu0qiQYTVGMJWUFML+JmuYodF06vDWCUdz9yFgDQkmw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com 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=R5jjL2nkC/J+3hwvcjLHk4K7DLKJJXc/Lfbemc4YRqc=; b=MCnpiyUYZhn2EKkXKSo+wksbEH3MnU5lM+fLjRmDqGN2bcDWe3rfEga7iWxVq7w25LMzs3uS9hxv3rPbP2+kLWARHfHSlrGl00KlBirtEIIxEZPdUK78175EeyXFsabDRZZf/OGvak3G4Eopktl91mqy7/JF+a2/zJc4Y8zYU3E= Received: from PH8PR22CA0006.namprd22.prod.outlook.com (2603:10b6:510:2d1::10) by SN7PR12MB6689.namprd12.prod.outlook.com (2603:10b6:806:273::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.25; Fri, 14 Jun 2024 08:17:39 +0000 Received: from SN1PEPF000397B1.namprd05.prod.outlook.com (2603:10b6:510:2d1:cafe::79) by PH8PR22CA0006.outlook.office365.com (2603:10b6:510:2d1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.25 via Frontend Transport; Fri, 14 Jun 2024 08:17:39 +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 SN1PEPF000397B1.mail.protection.outlook.com (10.167.248.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Fri, 14 Jun 2024 08:17:38 +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.39; Fri, 14 Jun 2024 03:17:35 -0500 From: Pierre-Eric Pelloux-Prayer To: , , , , , , , , , , , CC: Pierre-Eric Pelloux-Prayer Subject: [PATCH v5 1/4] drm/sched: add device name to the drm_sched_process_job event Date: Fri, 14 Jun 2024 10:16:27 +0200 Message-ID: <20240614081657.408397-2-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240614081657.408397-1-pierre-eric.pelloux-prayer@amd.com> References: <20240614081657.408397-1-pierre-eric.pelloux-prayer@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000397B1:EE_|SN7PR12MB6689:EE_ X-MS-Office365-Filtering-Correlation-Id: 7abcba95-28ad-4451-6086-08dc8c4a748b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230035|82310400021|376009|7416009|1800799019|36860700008|921015; X-Microsoft-Antispam-Message-Info: VBTuQZJBWPsUrDDlcAMkRphApVBvKglVJJ0yTLqJV/g9MAUsXCtNeGj8ctyr4bght0TC7t3ZZBEmBmk09rLtHhA1owH5qcmE7H2rdA+ay+oDU9JSvcVNvWE1Ha5GgzRF1SkqCZz1QUV3EpkonOGa6C/N0Sux3quo8jm4dW7DWC3B96I0OUKqeYgIwjznkEfUtjCbHVTJRgc5BFG/GcJgMkNCR9OHVPpnfkyxTVZKmOd1p7Wr8qZ21jfo/gzqix5KOMeREjm1eHbwKnNdUB/LGzfR4KaFQ9yAxzhh2325qQR5kSsnWi//2ABBmIz6+eFRb+WTnWAejoHgzz8x0zqwSPDfkUy3aa6yR4YP3bD+E6pzS3vovy6hiWoL3YSMe89KGxKbjJtR4+LuCwhKvDh+VgV//i+yBCKNkteH+5WGLaoNF+5jGJEfUSfQwEIYnTJmcnmauaC/+iRBm5sL/r5qI91wV3GEvcb4XBv3kDsTAbZxa7/En0tlvb1om89CdaWFWUuBSI0SoiP1DrBjG4tSMdM7hP4GsepjNJD3g2PYaOThj4peitIM959rCoA1Ou0tPZN/v+xWneAeEMpGC0SoVo/S4KEy++j51swcGWY/f7+fthtABPqMC8Ag0wRcBfY/egfIFpdF6TiLC2HgEbC1z7KSF0dtYLhtyRG6xwwFkvq6O5Gy+mCy8vN8gsr1ra5ITPGJEo1lsVYoHaHgh4AsNY+uIolgqidaxiPaqZd1s711tLCfKdvTL3b7mS29rKsTCl/Fzj8X+gcxyxY+4EFqJ0igRl0FBqwI0fXOtGtpYNJCl9S/1qsH4P4cbj/UqqPaVybBU2oHNPu5RZ9PAzEm+XF3/oMY3ai5AS5fzOTw2Na1uqANoCXQqcZFY7IRjcicqHNsDeWf/OZemqk3fqadNckUpnKOPJvLZS1Py3aoIxpgUIn9rCZ1ABX/jRmnf3kJrCMm5vMrsawXIUuwnREVoEc4zdaQGUYELgccDFtOrSMlT5JKsFOgnbhqcs2GBjGBDLOOrFFdEKi02qfw4GRBhUSt+7ioeAH13gux/d3tTwptqHxqGweapvAoVWvI0oMTETHVnIGCbVHrzaGR9ca0MRLNmNk0joX309oefNc+tuObQq5VqnirqqV1rtdT0KaGx2kkupGL+GBmQTmJTw4s5YDVmjRpY84a/tvsnT3FHf5y+Q+mjVBfHb2ltesXthmSKgkO/CAtZ8I7PdNl9ilcRC/swY4P07OWvtPJ4oyMp92+MHvDb4aWd2eTgDhieJwn8a9BFAm0512JbOtdJfcNCSrGPZlXbhgckAlNAajEnOyROOmT6Jh3jail3lsvgVqrOBE+VApEjDx4HDnEv5qZL+hxhDJqX+6CswMZ3kgOzqJWAAeLRCrGDilICYUWbQ/0uAYyG+qrUiYMRWHO9DdzBUffd95EWT2ndqMg1/0WQT8= 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:(13230035)(82310400021)(376009)(7416009)(1800799019)(36860700008)(921015); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2024 08:17:38.8027 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7abcba95-28ad-4451-6086-08dc8c4a748b 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: SN1PEPF000397B1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6689 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" Until the switch from kthread to workqueue, a userspace application could determine the source device from the pid of the thread sending the event. With workqueues this is not possible anymore, so the event needs to contain the dev_name() to identify the device. Signed-off-by: Pierre-Eric Pelloux-Prayer --- drivers/gpu/drm/scheduler/gpu_scheduler_trace.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h index c75302ca3427..1f9c5a884487 100644 --- a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h +++ b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h @@ -42,6 +42,7 @@ DECLARE_EVENT_CLASS(drm_sched_job, __field(uint64_t, id) __field(u32, job_count) __field(int, hw_job_count) + __string(dev, dev_name(sched_job->sched->dev)) ), TP_fast_assign( @@ -52,6 +53,7 @@ DECLARE_EVENT_CLASS(drm_sched_job, __entry->job_count = spsc_queue_count(&entity->job_queue); __entry->hw_job_count = atomic_read( &sched_job->sched->credit_count); + __assign_str(dev); ), TP_printk("entity=%p, id=%llu, fence=%p, ring=%s, job count:%u, hw job count:%d", __entry->entity, __entry->id, @@ -64,9 +66,13 @@ DEFINE_EVENT(drm_sched_job, drm_sched_job, TP_ARGS(sched_job, entity) ); -DEFINE_EVENT(drm_sched_job, drm_run_job, +DEFINE_EVENT_PRINT(drm_sched_job, drm_run_job, TP_PROTO(struct drm_sched_job *sched_job, struct drm_sched_entity *entity), - TP_ARGS(sched_job, entity) + TP_ARGS(sched_job, entity), + TP_printk("dev=%s, entity=%p id=%llu, fence=%p, ring=%s, job count:%u, hw job count:%d", + __get_str(dev), __entry->entity, __entry->id, + __entry->fence, __get_str(name), + __entry->job_count, __entry->hw_job_count) ); TRACE_EVENT(drm_sched_process_job, From patchwork Fri Jun 14 08:16: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: 13698169 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 CB43FC27C75 for ; Fri, 14 Jun 2024 08:17:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E886310EC92; Fri, 14 Jun 2024 08:17:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="pEFrp11d"; dkim-atps=neutral Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2086.outbound.protection.outlook.com [40.107.101.86]) by gabe.freedesktop.org (Postfix) with ESMTPS id 49B3510EC92 for ; Fri, 14 Jun 2024 08:17:49 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g+2AZ83sRn8cE2oJR9zE1rVGXnFxT2iOnIfCdEETeCvEi/jz+PhpDcYZK/ml8W8bi6oQS1FX28QkuACfs8TsBAdISaIig3sAkvNAYvLSMFUOSDpHkCZtWtX9920dzymQAX+39BIw5hYLftSJbz/KAlQs+CF4jwIRHArD8RyZ6pAXbqG/5gVoaFlzJPOBIGTgmEjcnCE1Ulzyf6Cayk5In4tMbBLLYiOBwjwdZc3zWrRU6Ct6mW8XTuXROMbnzyaeU433q5F45i+ltmP8dvGs8xszHnKK9fNWN/ExKznEmb/Zt9YvEVIbmz/L8MRQrIBSERTFaUDA0jPbGFlH0dtq8g== 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=K0veTHPXEpYQ6QnLLr65WWc/pdNUbOBSCmkjT/jlrQ4=; b=fW/lCV7KflKLWFdtiPKlxlRiXaxB/m1qpLDPxvskTyalELwg0otzWFiTmB/UC0jtr0ylARVPKpBs9WJZTPFxsihUX9eT1JE8ADQYRKI3PnZuh3qVzsiog9tB+FEoBKNVjERtRoBmoQCxMZ+PSR2RaeIVxDuE0y810EOvNjU3+ASql854/PLBfgm4eZ4aEEBWuMlbrc8pFum5brGVA15U2jz9miDg+cVXBjnnFVtdrGFy1SjrcB/LAs+vxBdv1IqayvN3iMVba55gdEyNsLW3wp/rFcoRDXC2i/HsBhrbcfpLyi+Qgs5tBFEnSskgSWuVuWB06b8qpqvHjNPZTcZJbg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com 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=K0veTHPXEpYQ6QnLLr65WWc/pdNUbOBSCmkjT/jlrQ4=; b=pEFrp11dDIMPjw+YwnQ/2PyNFZCTjzL69zyG4x5gEB5m00cVRlyeeFf8Bzi7a1HJtK/Voppxe0QI65ug2t735YYuTXujaJgjC5NZMoMIOGmhZKIQSSJCdrZRi7ZRl/15EuguA0wI5E0NjXQDBDFyfhx6K08RhIgVDPA6oNm0X3c= Received: from PH8PR07CA0007.namprd07.prod.outlook.com (2603:10b6:510:2cd::23) by LV3PR12MB9332.namprd12.prod.outlook.com (2603:10b6:408:20f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.36; Fri, 14 Jun 2024 08:17:45 +0000 Received: from SN1PEPF000397AF.namprd05.prod.outlook.com (2603:10b6:510:2cd:cafe::43) by PH8PR07CA0007.outlook.office365.com (2603:10b6:510:2cd::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.26 via Frontend Transport; Fri, 14 Jun 2024 08:17:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF000397AF.mail.protection.outlook.com (10.167.248.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Fri, 14 Jun 2024 08:17:44 +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.39; Fri, 14 Jun 2024 03:17:41 -0500 From: Pierre-Eric Pelloux-Prayer To: , , , , , , , , , , , CC: Pierre-Eric Pelloux-Prayer Subject: [PATCH v5 2/4] drm/sched: cleanup gpu_scheduler trace events Date: Fri, 14 Jun 2024 10:16:28 +0200 Message-ID: <20240614081657.408397-3-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240614081657.408397-1-pierre-eric.pelloux-prayer@amd.com> References: <20240614081657.408397-1-pierre-eric.pelloux-prayer@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000397AF:EE_|LV3PR12MB9332:EE_ X-MS-Office365-Filtering-Correlation-Id: fff0c60f-e604-45db-a48d-08dc8c4a7838 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230035|82310400021|376009|7416009|1800799019|36860700008|921015; X-Microsoft-Antispam-Message-Info: asu/A48DQ3bvcueXqkdZeW84lHdCVoS7J6d6BlZqVR+e5uAEWnsKkVLrE9nOcZLxSEWmWpljUSAcQOj632rokWu4ECaFpjt5gSolNSFovvdMGPFNS4HZb+mkWmMz8rGsI8Cf3DMZ2Xyz6fcV/WHR3LzAyWMerxOky2IkL2R3XFP+b1dURKjrEP1jOiLOpuULWu+H1C8313unMewPKT1STwZrG0JlX2Kwpzroi3Sp/FZFTYTGOu3+0LRuiyvYFPIufGyYG776bsqJkA07zqKJTi2gaM8xz3yl/rlsP6/PD2gQ9qJigt5tgB1YmYlmzuZm8tuhHBm1K2+XY4KOgl/yVtQxoU9Jrb4AgvmBTmztp+3PXXKAU/+2xQz/a4UvxHBPT3yU1IndtXRByGDXroaT6utgB2COT2hmXljW8TBHI4WHkNLY0V7avHYG7/Un4SHVBwghSJtp3+VYVB2L+p4iDe9rRRCijoahnSyk7uJZrhrZzv5a9ajrMtJuw6wjXOZbdYf+52IJxb0P37U5WItOseIhImDDDSd2pBEArUsx4xfNwO9fZ808cFNt3Hlsngn4/09TwXFX8Je/gPNnB/a9gaQwEe0XqPjtP0XxVC5OJ1r7eNIEdHlEnCJ0v3vARoHPd7jr6WooIK44eHdCOHGKz/18bcsj0hKyIuOVvjZDfVPVqlE67BKkSIWt5aj5Fa71p1uZb949l1ZlRRAS1lVtFHClmzudzdceNexPDptqyalrKpW9OuIJg4UU7Gy4LnQvubHlNFjcwBLiByVMbXn1I83J2SWuZG+ztzLIcZh6b26TKZnYHQGzZBrveMVwaPFwioEEqawwR0kdQ1Wrw7Qelj9/HIAB4f5MsEb+2cMpkQ4PzcfhGnZRtZ+uYNk1ie4dBtHW9qFEYfW7NFzolhh2J4/GjALxIKZUO4exoCtYdUeKOnTNwP/0UzFHxY0JROLsWRIcOGQOllnyoB2VGCg0g6nimmFEGqg9lPJf/w8GLrwEoySZXF16/+n3+ENB0DY9Av3C6by5PCE59WqU7zd+q6NcGpceuVRJ4NOOQKmDWM1M9FeDNaMexrHStNFzdsI7hWf27D7zSPhoF3Meq7vHeSQ5CKDjgjLx/JKbh1nco6XnXaS0R8PA3bfZuf/huZRyxhTI2OzgUT98pGrGFfbGQ40ozXWO/TyvvlA1TPgmqynskj7UHFddpX10AkUmQvM1cS2P1k1u+t9vxdn1lK+PHPuilTUTVouhhyG6eFvvKDsCdiy/lQPiLqXDJXUGaPQ66ubZ8xrtnZ6w7qlHBFHYiMSDnyYuMSicXpJuplTgNetJPfjEP5IMktlZcbAUU0f+F0vBg+07b9Jgoe3WhrTGI8SN01XJ2uhrcaFp+SjN2/14kD2b62cNNhCOpRhQZbDsOr/AK4Vf34PmhB+mGrKXwQ6RpTdJoBuRpzn7o5MedxA= 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:(13230035)(82310400021)(376009)(7416009)(1800799019)(36860700008)(921015); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2024 08:17:44.8151 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fff0c60f-e604-45db-a48d-08dc8c4a7838 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: SN1PEPF000397AF.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9332 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" A fence uniquely identify a job, so this commits updates the places where a kernel pointer was used as an identifier by: "fence=(context:%llu, seqno:%lld)" Signed-off-by: Pierre-Eric Pelloux-Prayer --- .../gpu/drm/scheduler/gpu_scheduler_trace.h | 45 ++++++++++--------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h index 1f9c5a884487..f6da377cdb99 100644 --- a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h +++ b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h @@ -36,28 +36,29 @@ DECLARE_EVENT_CLASS(drm_sched_job, TP_PROTO(struct drm_sched_job *sched_job, struct drm_sched_entity *entity), TP_ARGS(sched_job, entity), TP_STRUCT__entry( - __field(struct drm_sched_entity *, entity) - __field(struct dma_fence *, fence) __string(name, sched_job->sched->name) __field(uint64_t, id) __field(u32, job_count) __field(int, hw_job_count) __string(dev, dev_name(sched_job->sched->dev)) + __field(uint64_t, fence_context) + __field(uint64_t, fence_seqno) ), TP_fast_assign( - __entry->entity = entity; __entry->id = sched_job->id; - __entry->fence = &sched_job->s_fence->finished; __assign_str(name); __entry->job_count = spsc_queue_count(&entity->job_queue); __entry->hw_job_count = atomic_read( &sched_job->sched->credit_count); __assign_str(dev); + __entry->fence_context = sched_job->s_fence->finished.context; + __entry->fence_seqno = sched_job->s_fence->finished.seqno; + ), - TP_printk("entity=%p, id=%llu, fence=%p, ring=%s, job count:%u, hw job count:%d", - __entry->entity, __entry->id, - __entry->fence, __get_str(name), + TP_printk("id=%llu, fence=(context:%llu, seqno:%lld), ring=%s, job count:%u, hw job count:%d", + __entry->id, + __entry->fence_context, __entry->fence_seqno, __get_str(name), __entry->job_count, __entry->hw_job_count) ); @@ -69,9 +70,9 @@ DEFINE_EVENT(drm_sched_job, drm_sched_job, DEFINE_EVENT_PRINT(drm_sched_job, drm_run_job, TP_PROTO(struct drm_sched_job *sched_job, struct drm_sched_entity *entity), TP_ARGS(sched_job, entity), - TP_printk("dev=%s, entity=%p id=%llu, fence=%p, ring=%s, job count:%u, hw job count:%d", - __get_str(dev), __entry->entity, __entry->id, - __entry->fence, __get_str(name), + TP_printk("dev=%s, id=%llu, fence=(context:%llu, seqno:%lld), ring=%s, job count:%u, hw job count:%d", + __get_str(dev), __entry->id, + __entry->fence_context, __entry->fence_seqno, __get_str(name), __entry->job_count, __entry->hw_job_count) ); @@ -79,37 +80,41 @@ TRACE_EVENT(drm_sched_process_job, TP_PROTO(struct drm_sched_fence *fence), TP_ARGS(fence), TP_STRUCT__entry( - __field(struct dma_fence *, fence) + __field(uint64_t, fence_context) + __field(uint64_t, fence_seqno) ), TP_fast_assign( - __entry->fence = &fence->finished; + __entry->fence_context = fence->finished.context; + __entry->fence_seqno = fence->finished.seqno; ), - TP_printk("fence=%p signaled", __entry->fence) + TP_printk("fence=(context:%llu, seqno:%lld) signaled", + __entry->fence_context, __entry->fence_seqno) ); TRACE_EVENT(drm_sched_job_wait_dep, TP_PROTO(struct drm_sched_job *sched_job, struct dma_fence *fence), TP_ARGS(sched_job, fence), TP_STRUCT__entry( - __string(name, sched_job->sched->name) + __field(uint64_t, fence_context) + __field(uint64_t, fence_seqno) __field(uint64_t, id) __field(struct dma_fence *, fence) __field(uint64_t, ctx) - __field(unsigned, seqno) + __field(uint64_t, seqno) ), TP_fast_assign( - __assign_str(name); + __entry->fence_context = sched_job->s_fence->finished.context; + __entry->fence_seqno = sched_job->s_fence->finished.seqno; __entry->id = sched_job->id; __entry->fence = fence; __entry->ctx = fence->context; __entry->seqno = fence->seqno; ), - TP_printk("job ring=%s, id=%llu, depends fence=%p, context=%llu, seq=%u", - __get_str(name), __entry->id, - __entry->fence, __entry->ctx, - __entry->seqno) + TP_printk("fence=(context:%llu, seqno:%lld), id=%llu, dependencies:{(context:%llu, seqno:%lld)}", + __entry->fence_context, __entry->fence_seqno, __entry->id, + __entry->ctx, __entry->seqno) ); #endif From patchwork Fri Jun 14 08:16: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: 13698170 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 55631C27C6E for ; Fri, 14 Jun 2024 08:18:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 720E410EC94; Fri, 14 Jun 2024 08:18:18 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="xNrW+pPH"; dkim-atps=neutral Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2052.outbound.protection.outlook.com [40.107.236.52]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5AF4510E18A for ; Fri, 14 Jun 2024 08:18:16 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LDVrGHhG5tYLgNAdPKvr+V7+mAZPl8FzQZIKUlG36tXrycOVAOE8e6XdnKTpsvEsl37B8rozh6mNz8ssgQNQxocNmguAoLqrLqHIkpdu3tKFEroZ8gN6GtkLNpPzdjBB9vgRsxwNu9KIkYzDyEexsTph6BaNn5YyPjug9eBr6t6nQj9Hs/zQqUt27g4zPHn2HjX0IIYW6c+wJwvJqcZYilttC6F1SdDP/plF8GfcW5YSJVO9NtWXEviGZkZzn7MVm3L3MEh9xBdawJWZP471lVXNoD9l5vys0q3dWOA4ApcTbMu/TGowui+WvWZQsh+y92kK3hFdKtjDK44jbeCqDA== 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=SgftwvbEQfbya9lBT90EKcYbAZCHYzasg69HMAm3tAU=; b=gXtMZG5sdC3NAiAFbzhiXJNwO/KjKm3qRwNDOo6UzuihCDTKQLySw7r3t2foq2JoDK9WfdiaElFMMw8DaYspqe0vnj62RXeEh4LWVGI8i2yV1xbkdWfc9u42fIF6pXTuFbLpMe+XdMs6FR32OS+gHdoJs4u0JPTphPb487+HogPBi1yGI+8GExaC684gn1FEMqoVFPxTwvCDW8zhzK6qE3AFOArfivuSMCnswPokThbkjJ5gx3uSXgo4DFYsDbesZD0x+1g3wS+r2xhWDBo1WhKyY8avqg17SXnN06TvjlmzanWHQWgvu+9iZ+G0JZbXrj2nme3s7vamtZsK5Websw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com 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=SgftwvbEQfbya9lBT90EKcYbAZCHYzasg69HMAm3tAU=; b=xNrW+pPHlhgVvm2L/5da66vSc+ZPK8Pmhcy6NgWkLg3oSmObpRrAuOnXnS4JQBtkiVyhUtUUYplJWKPqFNxplDWOWwjmd2WUD8GBiranOyesHfIKwVfPvA8w5SwhYApLN+5fYwC0yOQSSPvVknJYTtRwMQX+HJdJxnLt4fGlQgg= Received: from PH8PR15CA0002.namprd15.prod.outlook.com (2603:10b6:510:2d2::29) by SN7PR12MB6840.namprd12.prod.outlook.com (2603:10b6:806:264::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.37; Fri, 14 Jun 2024 08:18:12 +0000 Received: from SN1PEPF000397B4.namprd05.prod.outlook.com (2603:10b6:510:2d2:cafe::6e) by PH8PR15CA0002.outlook.office365.com (2603:10b6:510:2d2::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.25 via Frontend Transport; Fri, 14 Jun 2024 08:18:12 +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 SN1PEPF000397B4.mail.protection.outlook.com (10.167.248.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Fri, 14 Jun 2024 08:18:11 +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.39; Fri, 14 Jun 2024 03:18:04 -0500 From: Pierre-Eric Pelloux-Prayer To: , , , , , , , , , , , CC: Pierre-Eric Pelloux-Prayer Subject: [PATCH v5 3/4] drm/sched: trace dependencies for gpu jobs Date: Fri, 14 Jun 2024 10:16:29 +0200 Message-ID: <20240614081657.408397-4-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240614081657.408397-1-pierre-eric.pelloux-prayer@amd.com> References: <20240614081657.408397-1-pierre-eric.pelloux-prayer@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000397B4:EE_|SN7PR12MB6840:EE_ X-MS-Office365-Filtering-Correlation-Id: b728312d-6a68-4087-f352-08dc8c4a8844 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230035|82310400021|7416009|1800799019|36860700008|376009|921015; X-Microsoft-Antispam-Message-Info: McAIzSS1h0nYkmlPLlCJPWVu6u24g6XzJYdjeXufwVnAbPq88SuUjmOdiuNL+T/iWct6qBvsg4GBzAyA5vQMoginSIBTyK7X+S+ljJm50E2SdtcSyJiwnXuaAXA1A+gBW5DJOjua4lSv0/dO/HkBzVrMJkxKIZ4xwCH57eKvVsH1okjI8iUL0d+d4oLHq3OtF+fbN0m68VRD9um3F1mkrtbBzLBBRaSC0ind7AEh0ozn4C29uRKKTxcz/A/Gz0ZwD/6ap4QWC6pSt9gakAfujcm/otzzfKLkgqK0vnXH5XwSPJtvf+4DQQKGIs4TvBYVY2hOuh4gBgSyVz51VrNH398PJ5ea5U+jxhRVCZ6c7HYkf9lYdxdVAuNt/ZRK7izgwSlSv6lm/8cOF0ZTSVyBCRxr6JVuLA7mZBBJCUCqi10Dmy4+XgoYjKKsoAeJdcWd4yL+8ASHqvjigemMEOy4VJdxD08z45hLT+sCqjOYrVyTTvABJwn2FmLMWHN2i7Pzju1Us+Osr6Jb4M0bNdPQUlNRk22XYT6mf0r2I5LqAvc2R6VixT1FskcaSzY2G6YYzfK0YQfcVN3bJAidPx7HykQ/lrsAC/WMOYRqGvgM3vhHXDN/3Tr1TePC+OlBYX3MmkfRCHlRpc0tphk3mwa2W73Uja6ytK2z3JbKpXqOSOJpTI2nPpCPvOpABopg5tydh26I+CiEO2ZG/cRwCfySRVt2NtY/bwxOCTyq4Tpp9OTSYYq91sbWVANq8/xaTGDVZwHkBdg/0jk8aRY8S9FEtpgMHH11UcKV8uCxrCrVJxReJrc6t0cE/V3/pDUf329i/IireieBOnZjNpv8TmyKR2BqtyO7SfaODfI+L+kB32sKTCL4x6/xj317+XQqMGh5l5P6VyK4U8ZaEjf/TVWHXUbUOx2RkISGvXG2AP2mIyCq6CVcA3xit8813Nrais0yaF2N5ntUEU56WBY9taSjfcVAhenpi0wXPbXQB7HIqQdV8erh4/BKyL0IuEA42yWEgHl6CMbcogbywEFHwXqz1wU0mM0fOThKBXYFjUYIHDUWXGJ2dSwF7lCB/CKB/G+JfY5O4fgBtruQje9+AuS0pQr2bzbqfdL6eIBTSmioYOdJ3dRFEM3aETVfG1vRHyIjNuElQ2VfRwd5gQ68PvLWWfcC7V5KtE/ab10yi6xY82jOyZ4oy5L0PfIHnLMnrwehLevIjdIaKvzpb0dyWqx0z6LIOGKqwgHP1zNMjm3SWEbnhsukShwJd2FRjsydLwdArD0Ixi3/u0T+6odxk7hoTvGNkdVZYI1jpC0MI0fFmfHavJmeSj2JakTy0DJyurMYB+ykpf6LRANbRoneh8W2tyZ0uwZFTMgpKnlH1IlLRK81+Z/WseAhwKn5w/cTjCOj3GcXTHtlBFk+uZ5P1FKNMiAy/+R+K+4F6HXhtyv/Wlc= 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:(13230035)(82310400021)(7416009)(1800799019)(36860700008)(376009)(921015); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2024 08:18:11.8643 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b728312d-6a68-4087-f352-08dc8c4a8844 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: SN1PEPF000397B4.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6840 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" Trace the fence dependencies similarly to how we print fences: ... , dependencies:{(context:606, seqno:38006)} This allows tools to analyze the dependencies between the jobs (previously it was only possible for fences traced by drm_sched_job_wait_dep). Since drm_sched_job and drm_run_job use the same base event class, the caller of trace_drm_run_job have to pass a dep_count of 0 (which is ignored because dependencies are only considered at submit time). Signed-off-by: Pierre-Eric Pelloux-Prayer --- .../gpu/drm/scheduler/gpu_scheduler_trace.h | 59 ++++++++++++++++--- drivers/gpu/drm/scheduler/sched_entity.c | 8 ++- drivers/gpu/drm/scheduler/sched_main.c | 2 +- 3 files changed, 58 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h index f6da377cdb99..0abcad26839c 100644 --- a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h +++ b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h @@ -26,15 +26,41 @@ #include #include +#include #include #undef TRACE_SYSTEM #define TRACE_SYSTEM gpu_scheduler #define TRACE_INCLUDE_FILE gpu_scheduler_trace +#ifndef __TRACE_EVENT_GPU_SCHEDULER_PRINT_FN +#define __TRACE_EVENT_GPU_SCHEDULER_PRINT_FN +/* Similar to trace_print_array_seq but for fences. */ +static inline const char *__print_dma_fence_array(struct trace_seq *p, const void *buf, int count) +{ + const char *ret = trace_seq_buffer_ptr(p); + u64 *fences = (u64 *) buf; + const char *prefix = ""; + + trace_seq_putc(p, '{'); + for (int i = 0; i < count; i++) { + u64 context = fences[2 * i], seqno = fences[2 * i + 1]; + + trace_seq_printf(p, "%s(context:%llu, seqno:%lld)", + prefix, context, seqno); + prefix = ","; + } + trace_seq_putc(p, '}'); + trace_seq_putc(p, 0); + + return ret; +} +#endif + DECLARE_EVENT_CLASS(drm_sched_job, - TP_PROTO(struct drm_sched_job *sched_job, struct drm_sched_entity *entity), - TP_ARGS(sched_job, entity), + TP_PROTO(struct drm_sched_job *sched_job, struct drm_sched_entity *entity, + unsigned int dep_count), + TP_ARGS(sched_job, entity, dep_count), TP_STRUCT__entry( __string(name, sched_job->sched->name) __field(uint64_t, id) @@ -43,9 +69,14 @@ DECLARE_EVENT_CLASS(drm_sched_job, __string(dev, dev_name(sched_job->sched->dev)) __field(uint64_t, fence_context) __field(uint64_t, fence_seqno) + __field(int, n_deps) + __dynamic_array(u64, deps, dep_count * 2) ), TP_fast_assign( + unsigned long idx; + struct dma_fence *fence; + u64 *dyn_arr; __entry->id = sched_job->id; __assign_str(name); __entry->job_count = spsc_queue_count(&entity->job_queue); @@ -54,22 +85,32 @@ DECLARE_EVENT_CLASS(drm_sched_job, __assign_str(dev); __entry->fence_context = sched_job->s_fence->finished.context; __entry->fence_seqno = sched_job->s_fence->finished.seqno; - + __entry->n_deps = dep_count; + if (dep_count) { + dyn_arr = __get_dynamic_array(deps); + xa_for_each(&sched_job->dependencies, idx, fence) { + dyn_arr[2 * idx] = fence->context; + dyn_arr[2 * idx + 1] = fence->seqno; + } + } ), - TP_printk("id=%llu, fence=(context:%llu, seqno:%lld), ring=%s, job count:%u, hw job count:%d", + TP_printk("id=%llu, fence=(context:%llu, seqno:%lld), ring=%s, job count:%u, hw job count:%d, dependencies:%s", __entry->id, __entry->fence_context, __entry->fence_seqno, __get_str(name), - __entry->job_count, __entry->hw_job_count) + __entry->job_count, __entry->hw_job_count, + __print_dma_fence_array(p, __get_dynamic_array(deps), __entry->n_deps)) ); DEFINE_EVENT(drm_sched_job, drm_sched_job, - TP_PROTO(struct drm_sched_job *sched_job, struct drm_sched_entity *entity), - TP_ARGS(sched_job, entity) + TP_PROTO(struct drm_sched_job *sched_job, struct drm_sched_entity *entity, + unsigned int dep_count), + TP_ARGS(sched_job, entity, dep_count) ); DEFINE_EVENT_PRINT(drm_sched_job, drm_run_job, - TP_PROTO(struct drm_sched_job *sched_job, struct drm_sched_entity *entity), - TP_ARGS(sched_job, entity), + TP_PROTO(struct drm_sched_job *sched_job, struct drm_sched_entity *entity, + unsigned int dep_count), + TP_ARGS(sched_job, entity, 0), TP_printk("dev=%s, id=%llu, fence=(context:%llu, seqno:%lld), ring=%s, job count:%u, hw job count:%d", __get_str(dev), __entry->id, __entry->fence_context, __entry->fence_seqno, __get_str(name), diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c index 58c8161289fe..aa33a9d29b14 100644 --- a/drivers/gpu/drm/scheduler/sched_entity.c +++ b/drivers/gpu/drm/scheduler/sched_entity.c @@ -583,7 +583,13 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job) bool first; ktime_t submit_ts; - trace_drm_sched_job(sched_job, entity); + if (trace_drm_sched_job_enabled()) { + unsigned long index; + void *f; + + xa_for_each(&sched_job->dependencies, index, f) { } + trace_drm_sched_job(sched_job, entity, index); + } atomic_inc(entity->rq->sched->score); WRITE_ONCE(entity->last_user, current->group_leader); diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index 7e90c9f95611..0bc9b7b24b34 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -1201,7 +1201,7 @@ static void drm_sched_run_job_work(struct work_struct *w) atomic_add(sched_job->credits, &sched->credit_count); drm_sched_job_begin(sched_job); - trace_drm_run_job(sched_job, entity); + trace_drm_run_job(sched_job, entity, 0); fence = sched->ops->run_job(sched_job); complete_all(&entity->entity_idle); drm_sched_fence_scheduled(s_fence, fence); From patchwork Fri Jun 14 08:16:30 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: 13698171 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 5F370C27C6E for ; Fri, 14 Jun 2024 08:18:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A5B4F10EC98; Fri, 14 Jun 2024 08:18:32 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="oi50Ar9J"; dkim-atps=neutral Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2083.outbound.protection.outlook.com [40.107.237.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id 99EE410E18A for ; Fri, 14 Jun 2024 08:18:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hYu6pPGclnLMFTFFnxhc7w2kjL+XF+s6Shu3wmWlFhpZb21lfoPPD8YxA6t7L7v0QVaQQhzEoV0UUwszTQU5VaDsu/KtujbLtRs/o2NPGhCkbeLYS55B5mTzXiMzuNbMLyA6JZOoZnw+Jdw/G8RmbvRoJIqbQkddMERXcehGeh3zz/XaRKm9AKKT9AvHSPSMJx/fGuypJegx0uqjFNvi11SHss+dnMFNbKoUqpUjTvHnGk9jnyr2i8ZZzX62XuH4iLJ33MddwcWC81SHpfANQ4F+acJfBQnV4RqsQLBSJpJx1ieaSBP+QrGqImVSPiZ+10ODXYITfI6oOrhO7zXcKg== 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=zhpfcrPtJUGHsIQ6J/VfJOHVZUZSokPu5gYEkYQJdkM=; b=Ysdq+QRSJGOh2i0mtgpujvrV51xeUepU3hTrzDoj/OAo/MeFSCTyiFw8Xcsjlz2TcEfpmtnruO2B70Ipx3QbAehrY8F4ZG+dL+oXNxfPMVCSm8JfaOn3Iyaa8en+0GNHhGhZXrQ2kfjNfnqD45AEFF+MHUL3OIQTLl5voGSBvO/t43s8F0YOuR0LXjLyvt9aJB2gFz/u+OBGbiDyDC55mz7cogjTWOV5/sN0x95D0rxhutiqvFOa7mpjtf8i4O2x4gzZZs7YVV2U8zrgOKt8yJhgoYXHNtQsr53QBaPxn4++QnwRSwCk+H1O3CZsPcYP4uhJ4cpCfotP95v+6UiSTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com 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=zhpfcrPtJUGHsIQ6J/VfJOHVZUZSokPu5gYEkYQJdkM=; b=oi50Ar9JF9SLKTlfN0Gpzw4jX9OqnpQw3RM8fuq+hsILz5ZCrorBuJfZd/DKD064W9rfWHyuRcELp0kcYhR20cOt/SNI3bSQuruzehQbuGTuLICtBKrDz65kRGWDwEpCdFV2+igESMuKGCOMpLnM+5ycZSkKotgv0PMtf89kDFo= Received: from SN7P222CA0026.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:124::24) by IA0PR12MB7555.namprd12.prod.outlook.com (2603:10b6:208:43d::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.24; Fri, 14 Jun 2024 08:18:26 +0000 Received: from SN1PEPF000397B5.namprd05.prod.outlook.com (2603:10b6:806:124:cafe::ef) by SN7P222CA0026.outlook.office365.com (2603:10b6:806:124::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.26 via Frontend Transport; Fri, 14 Jun 2024 08:18:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF000397B5.mail.protection.outlook.com (10.167.248.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Fri, 14 Jun 2024 08:18:26 +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.39; Fri, 14 Jun 2024 03:18:22 -0500 From: Pierre-Eric Pelloux-Prayer To: , , , , , , , , , , , CC: Pierre-Eric Pelloux-Prayer Subject: [PATCH v5 4/4] drm/doc: document some tracepoints as uAPI Date: Fri, 14 Jun 2024 10:16:30 +0200 Message-ID: <20240614081657.408397-5-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240614081657.408397-1-pierre-eric.pelloux-prayer@amd.com> References: <20240614081657.408397-1-pierre-eric.pelloux-prayer@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000397B5:EE_|IA0PR12MB7555:EE_ X-MS-Office365-Filtering-Correlation-Id: 932ff18d-cbec-45e7-a4bb-08dc8c4a90f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230035|82310400021|376009|7416009|1800799019|36860700008|921015; X-Microsoft-Antispam-Message-Info: 6S4RqUTMW441n+m3Aq/dePhuxgZFsu/xS5usLH0a+QaHR+/QIaPXAOrTV6OmAU8EOFpEKymmgMfN8DZmre9AsQ3CkAtK/jqQe4cchwvIHrRQolWL2RceaTrBTJJ6vhfhaandD+mY3UG13SsxBAnmU4xc6YT0iNtgxDqecg7vwAK8g+1RSeCAjskthTBQFVpeEufrH4xE6vSSsDoMYJPmempau5xAIV37cO5GWEwSRlwmwITy2DRmGo/x3d9oTrGXluUDE9AIW8ypVX6jBaU4ZGD4tIxWZhfrlQawduD7ponjZonEBJYm/nSkYuOXKAy6virCuwJPGfwY3da1050xCH/avm873ogG0y6nIkefoCeT9Zi/sS7jsKUeCSMpwrB8J2wj6SQtmxSeCTnjaiOA8g0eFseA6rPyN11GL66uUBWLdT/MCphIa7kLET8POJ6beaXY484on1mtX/sWt7UwlvrnMHuabIfc/0yZ7KYDyD8IQJziPUbAiN1LpM5hh8LTinTCsTieljCz8n45LBaMYXATSQu46X8bTdF9kL3DY5dGqPYZ4g8A04nT+8SzGxN5A3COAatexZunw9ClYjLboHKHEjzAPnCGwlVSQLrnvUoNPbp9y8FnZP3DpIVQlta/8LMPXP2O3t81Sz5aWullmDF/J4fxAK9sTrok5xGHqgSC24Q50eVniseCxu2tsLe2sPHt0g94o5vuL5048V1hegtjAIQJLEwnxXDY14sq0IV/9UpvBjseePdKuPfcmJ65CvWklDueqoFvMX5XBL0rS9jmjABLMAix+jVJg2glfw5ANMRHv/8arN8YwiSbDfSgnI7l+hShWvuiuJxvAEpWfvuj6MRQquUOY56q5ZClGJgtI/CBB9PQjX2zViQxHdUF5Q/6Lk0a9OUtxLyqSChzyP9ewIbjEEePQiiRaizW/Hs+l/RB3FMJn5YBClCcLcbpehZJBrkqbdraWDKy91wX9tmh7xtmSIQk5RCXqXwN6+jfjublSX6ISZn3v5x+9zdkorMjZkcHOYLaecQ6PlR/LJ1sdHn60IoeNXRiWd4V6brTmxqd+tyGOUNmu59oaVxii7KmovadyyUG7tkg2rocWFsTkyqazgFt50UBKpPnGNYR6P2xxH2s0maxTK2XfCrFExSyc4ghss5TcLlCHFllVEMtcwTwU36ZARNpYJvCi3+PLXYeW4LvZifrEFCySG4IaoTCQDWVBxrmF6sszWIq5gvZIxTY/nDgjZ7XXaKFqWQsC9Rnp19B58ULFXeWld80XCLfqM8PXJRnYQuXZ1QDnJBhD2GY//tyhYk0Je9NUOFNmKx4oxxLgVCRswgrtqb5dMpHseeJHaHimpy5D/bpHO9LD6VQ3ExifxApAx/DFjV6V1cgupQOxWEc/T6gCpAoVFjzPpqDOh1oV5Yyvi+3hCmZjsvZm9KXoIdZSj1nyTs= 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:(13230035)(82310400021)(376009)(7416009)(1800799019)(36860700008)(921015); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2024 08:18:26.1210 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 932ff18d-cbec-45e7-a4bb-08dc8c4a90f1 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: SN1PEPF000397B5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7555 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 commit adds a document section in drm-uapi.rst about tracepoints, and mark the events gpu_scheduler_trace.h as stable uAPI. The goal is to explicitly state that tools can rely on the fields, formats and semantics of these events. Signed-off-by: Pierre-Eric Pelloux-Prayer Acked-by: Lucas Stach Acked-by: MaĆ­ra Canal --- Documentation/gpu/drm-uapi.rst | 19 ++++++++++++++++ .../gpu/drm/scheduler/gpu_scheduler_trace.h | 22 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/Documentation/gpu/drm-uapi.rst b/Documentation/gpu/drm-uapi.rst index 370d820be248..78496793a8f0 100644 --- a/Documentation/gpu/drm-uapi.rst +++ b/Documentation/gpu/drm-uapi.rst @@ -570,3 +570,22 @@ dma-buf interoperability Please see Documentation/userspace-api/dma-buf-alloc-exchange.rst for information on how dma-buf is integrated and exposed within DRM. + + +Trace events +============ + +See Documentation/trace/tracepoints.rst for the tracepoints documentation. +In the drm subsystem, some events are considered stable uAPI to avoid +breaking tools (eg: gpuvis, umr) relying on them. Stable means that fields +cannot be removed, nor their formatting updated. Adding new fields is +possible, under the normal uAPI requirements. + +Stable uAPI events +------------------ + +From ``drivers/gpu/drm/scheduler/gpu_scheduler_trace.h`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. kernel-doc:: drivers/gpu/drm/scheduler/gpu_scheduler_trace.h + :doc: uAPI trace events \ No newline at end of file diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h index 0abcad26839c..63113803cdd5 100644 --- a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h +++ b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h @@ -33,6 +33,28 @@ #define TRACE_SYSTEM gpu_scheduler #define TRACE_INCLUDE_FILE gpu_scheduler_trace + +/** + * DOC: uAPI trace events + * + * ``drm_sched_job``, ``drm_run_job``, ``drm_sched_process_job``, + * and ``drm_sched_job_wait_dep`` are considered stable uAPI. + * + * Common trace events attributes: + * + * * ``id`` - this is &drm_sched_job->id. It uniquely idenfies a job + * inside a &struct drm_gpu_scheduler. + * + * * ``dev`` - the dev_name() of the device running the job. + * + * * ``ring`` - the hardware ring running the job. Together with ``dev`` it + * uniquely identifies where the job is going to be executed. + * + * * ``fence`` - the &dma_fence.context and the &dma_fence.seqno of + * &drm_sched_fence.finished + * + */ + #ifndef __TRACE_EVENT_GPU_SCHEDULER_PRINT_FN #define __TRACE_EVENT_GPU_SCHEDULER_PRINT_FN /* Similar to trace_print_array_seq but for fences. */