From patchwork Thu Jun 6 13:06:22 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: 13688454 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 8BDE7C25B75 for ; Thu, 6 Jun 2024 13:08:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C743D10E04D; Thu, 6 Jun 2024 13:08:02 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="B/PQEmOU"; dkim-atps=neutral Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2045.outbound.protection.outlook.com [40.107.244.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1765610E04D for ; Thu, 6 Jun 2024 13:08:01 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d3MrywoSYEtPzVLkONxo8k4y+WQNCrC6/AitTTh6NQ+NipIZ6a4f5pYw5Uk62fmj/HWDbpsdTZtH8wHG1TiKlDPTYTmpKnNT0UsRrrzgWkTRMOB5IUCZ2pR6XsvQ5DMqw4r5vrggghiibwxhxWVXtjmFtUygwd+3x85gTY0YB6pNzD2nJ3m7gUcGcAYzO2Xvu0/B+8NZXXspkFX1LqCSrQzmLQquJNoiOf0hL80jIrLQuSclJ3zdoFyWKCgPuUDbjiDy1j5QmvX/HVbDmFV9U/OQckNd35zN27YtQVjKs576sCFcZO89wBUwI4G3E03VhLq1e9mZ1/o/MdFf9TgyoA== 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=xeVw3heQwJbmFhudJXIL3VBl2U30QID1ZAMUAJy0AWM=; b=QpQFlyrABV2Ok0l3hNh3I3Av71UoFdVpcJfBlraOwCq16U14nH+bvl0bdhqNTcsX5G6LRB6OdWjFokGJSPz+POY7k6RUxfkTg6n3TxqqcJLc/uAfnc/Xk4BdynOppydAJ1fgzRl0x087OJbBexRKO8IHBPLJ1C0r7UilYZ3l0mO+Po702NgsTXhPAJLuh53yZAI2uj8O1kxLONbvAMPqtxOuAg5NW3fYV8mOVscTNu0wLKebq8EGc/xi2t+RikcCHay360Engeu1GiMkhFsUFitXdvtATW+KRifONiPf7Ix/IR24xQzLJQs3ClZxYAN/DdM6KWxvoaHm/yP2fKlfZw== 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=xeVw3heQwJbmFhudJXIL3VBl2U30QID1ZAMUAJy0AWM=; b=B/PQEmOUJ45syoMFxPKYaAgXD/X1OpCdQBrzGxHk31njhwjfoeCQQPZPDPog2ATs6ms+hNlIG9SXfkNpBgWodz6kGTt5fUjUDtsCDMZjCKkF9I8uTW0yd/cQGw72amEQ0FvSts0lQtyuwoEyaW0FNr4Rt0zqnHj31Y2lyJk7OU8= Received: from MW4P223CA0005.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::10) by SN7PR12MB7369.namprd12.prod.outlook.com (2603:10b6:806:298::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.27; Thu, 6 Jun 2024 13:07:55 +0000 Received: from CO1PEPF000075F0.namprd03.prod.outlook.com (2603:10b6:303:80:cafe::73) by MW4P223CA0005.outlook.office365.com (2603:10b6:303:80::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.18 via Frontend Transport; Thu, 6 Jun 2024 13:07: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 CO1PEPF000075F0.mail.protection.outlook.com (10.167.249.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Thu, 6 Jun 2024 13:07: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; Thu, 6 Jun 2024 08:07:51 -0500 From: Pierre-Eric Pelloux-Prayer To: , , , , , , , , , , , CC: Pierre-Eric Pelloux-Prayer Subject: [PATCH v3 1/4] drm/sched: store the drm_device instead of the device Date: Thu, 6 Jun 2024 15:06:22 +0200 Message-ID: <20240606130629.214827-2-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240606130629.214827-1-pierre-eric.pelloux-prayer@amd.com> References: <20240606130629.214827-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: CO1PEPF000075F0:EE_|SN7PR12MB7369:EE_ X-MS-Office365-Filtering-Correlation-Id: ff6bd971-ecca-4a36-77c3-08dc8629ae68 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|1800799015|36860700004|376005|7416005|921011; X-Microsoft-Antispam-Message-Info: i87k2Jrnn59w47qHKEzfA9VfBmhC/3pBXJkJDVwVr+Um960OAc6Cky0NoHX+ZKkDfnGCKPY4OKAyFN+Aa/1y4s5OEjmEv7/CF5t163nG7+1wcgZdJ57oE8mCqllzuIWMedHSj2rOOK+lhmq6ndj3icFkWAqGWdcd3NS7GeDJheNHMsu6GUNAIUlSgLv0TQKvZK3M+kXzXn4e4ZOlO0TaeisrlR3UmXTPm354BeGAXRyO6cvUMUKR8eDOn+f1zfH6kA0H3JGiXhkYBf7yO7cq/KgM/7wcGMbbfJ9bba24YbzfThz/QUksIHLmX1rnJcgHOFwD0KNd4cinAec5NJmV5VIKQAGP6yM5X0+/cvIGXHBtXydsQnewQhDg0GvtJU0dHp5z1nTTN033kZFkrTzfEk7U3/xMfNsNOIIDnKBnEBrnbsZWxbvfJSTxK2MPDSBdztAIdpWcvTy4IrHpUVdIGuT/eb6ZuPxnEHK5veFkRpmsDL/eBCmbSH9RhFNn9wdAI/FMsmbR1jXFsoQ6Eo6vtoW/cnXnq/8BV7jz7pBxjf8v8qrQOKSw78Ae9yGkpS10AKVRRzmd0Ji4sfs62NOLKtOWwh902GMarDf80wPosO4TJP3NWmUs3U0TLMbZwdw1RvGqkvq6aPEX64gAVFo1A+5XwgmcfqFhKlqqLxJdub13LKMYaNDnzFfMPf3z/btI2F3NtJuqZo/ISShd6kyZPber6+/rydKbg7sU6v10TFJKlactKuKDa3iAX7/tuQL2c5l0A4BePFFM7P/wNJ35aXB3HrWSt2Gmwr4cuOdAz9liUyKed78ryio/hVdiQqVuegzqn+8LsbK36nPaJ+fhLcyX3n53jE/oiUSi8Z/RxufG1ey6DbY2JWLQRltVX9Etg4jB92qGqNqeAVGGKf5m2/vQi+q+E6Cx130faPXUAiNrnky0LW5YFYvwmPdWhlcquN7zm85SGR9IpoORV0MEyGJlF4JNSo5RC7VcLIeI2kKatO/5uXqfKfI17m5Q5Om5Ts/zpjeJINguxEBmzQyKMVfc7qFo9JhINsKSOOp/zdpN6G/kRKoNdiRwdIweEBxGUqwhQFF1Dl9bvJtoaOTnp4bA/RznuhVWl1vSuK4D0BatSRFDbdyryr0Aq2+cqjZUdqkmmfPfqIObWsXxOFmTEddjcuViUZ3jcfTXazdgGCj44mYidy1P3w1BsYuEkycoy249xS2PJ94qmLUBObAgUMku8B23fsEZQGTo9J/b9MY26IZlLAnvMcs1mPE9xtw2urF8Q1ncDIt1DwZ8qbgwKDw5BezH5JaWV8u74AqhrhS7WoiMcgpIwtgo+EvowXvr8kHB4FVe/jhsbeZQ/pTTTeiHTyFQavnZX0gFM0PGHXF6y7oh5g0IP23L/8LmDd3f5jCEWK9Vnyya6jXwGvctL4w9nEueRYIGv7oktp7eZsw= 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)(82310400017)(1800799015)(36860700004)(376005)(7416005)(921011); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2024 13:07:55.5287 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff6bd971-ecca-4a36-77c3-08dc8629ae68 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: CO1PEPF000075F0.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7369 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When tracing is enabled, being able to identify which device is sending events is useful; for this the next commit will extend events to include drm_device::primary::index. Since the device member is only used in the drm_* log macros, we can replace it by a drm_device pointer. Signed-off-by: Pierre-Eric Pelloux-Prayer --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- drivers/gpu/drm/etnaviv/etnaviv_sched.c | 2 +- drivers/gpu/drm/imagination/pvr_queue.c | 2 +- drivers/gpu/drm/lima/lima_sched.c | 2 +- drivers/gpu/drm/msm/msm_ringbuffer.c | 2 +- drivers/gpu/drm/nouveau/nouveau_sched.c | 2 +- drivers/gpu/drm/panfrost/panfrost_job.c | 2 +- drivers/gpu/drm/panthor/panthor_mmu.c | 2 +- drivers/gpu/drm/panthor/panthor_sched.c | 2 +- drivers/gpu/drm/scheduler/sched_entity.c | 2 +- drivers/gpu/drm/scheduler/sched_main.c | 26 +++++++++++----------- drivers/gpu/drm/v3d/v3d_sched.c | 12 +++++----- drivers/gpu/drm/xe/xe_execlist.c | 2 +- drivers/gpu/drm/xe/xe_gpu_scheduler.c | 2 +- drivers/gpu/drm/xe/xe_gpu_scheduler.h | 2 +- drivers/gpu/drm/xe/xe_guc_submit.c | 2 +- include/drm/gpu_scheduler.h | 4 ++-- 17 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 932dc93b2e63..7f2a68ad8034 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -2738,7 +2738,7 @@ static int amdgpu_device_init_schedulers(struct amdgpu_device *adev) ring->num_hw_submission, 0, timeout, adev->reset_domain->wq, ring->sched_score, ring->name, - adev->dev); + &adev->ddev); if (r) { DRM_ERROR("Failed to create scheduler on ring %s.\n", ring->name); diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c b/drivers/gpu/drm/etnaviv/etnaviv_sched.c index c4b04b0dee16..c4345b68a51f 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c @@ -138,7 +138,7 @@ int etnaviv_sched_init(struct etnaviv_gpu *gpu) DRM_SCHED_PRIORITY_COUNT, etnaviv_hw_jobs_limit, etnaviv_job_hang_limit, msecs_to_jiffies(500), NULL, NULL, - dev_name(gpu->dev), gpu->dev); + dev_name(gpu->dev), gpu->drm); if (ret) return ret; diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imagination/pvr_queue.c index 5ed9c98fb599..cdbb6c01e952 100644 --- a/drivers/gpu/drm/imagination/pvr_queue.c +++ b/drivers/gpu/drm/imagination/pvr_queue.c @@ -1287,7 +1287,7 @@ struct pvr_queue *pvr_queue_create(struct pvr_context *ctx, pvr_dev->sched_wq, 1, 64 * 1024, 1, msecs_to_jiffies(500), pvr_dev->sched_wq, NULL, "pvr-queue", - pvr_dev->base.dev); + &pvr_dev->base); if (err) goto err_release_ufo; diff --git a/drivers/gpu/drm/lima/lima_sched.c b/drivers/gpu/drm/lima/lima_sched.c index bbf3f8feab94..db6ee7650468 100644 --- a/drivers/gpu/drm/lima/lima_sched.c +++ b/drivers/gpu/drm/lima/lima_sched.c @@ -526,7 +526,7 @@ int lima_sched_pipe_init(struct lima_sched_pipe *pipe, const char *name) 1, lima_job_hang_limit, msecs_to_jiffies(timeout), NULL, - NULL, name, pipe->ldev->dev); + NULL, name, pipe->ldev->ddev); } void lima_sched_pipe_fini(struct lima_sched_pipe *pipe) diff --git a/drivers/gpu/drm/msm/msm_ringbuffer.c b/drivers/gpu/drm/msm/msm_ringbuffer.c index 9d6655f96f0c..3a4b3816f2c9 100644 --- a/drivers/gpu/drm/msm/msm_ringbuffer.c +++ b/drivers/gpu/drm/msm/msm_ringbuffer.c @@ -101,7 +101,7 @@ struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int id, ret = drm_sched_init(&ring->sched, &msm_sched_ops, NULL, DRM_SCHED_PRIORITY_COUNT, num_hw_submissions, 0, sched_timeout, - NULL, NULL, to_msm_bo(ring->bo)->name, gpu->dev->dev); + NULL, NULL, to_msm_bo(ring->bo)->name, gpu->dev); if (ret) { goto fail; } diff --git a/drivers/gpu/drm/nouveau/nouveau_sched.c b/drivers/gpu/drm/nouveau/nouveau_sched.c index 32fa2e273965..386839bed8a2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sched.c +++ b/drivers/gpu/drm/nouveau/nouveau_sched.c @@ -419,7 +419,7 @@ nouveau_sched_init(struct nouveau_sched *sched, struct nouveau_drm *drm, ret = drm_sched_init(drm_sched, &nouveau_sched_ops, wq, NOUVEAU_SCHED_PRIORITY_COUNT, credit_limit, 0, job_hang_limit, - NULL, NULL, "nouveau_sched", drm->dev->dev); + NULL, NULL, "nouveau_sched", drm->dev); if (ret) goto fail_wq; diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c index a61ef0af9a4e..28c7680a8dbf 100644 --- a/drivers/gpu/drm/panfrost/panfrost_job.c +++ b/drivers/gpu/drm/panfrost/panfrost_job.c @@ -875,7 +875,7 @@ int panfrost_job_init(struct panfrost_device *pfdev) nentries, 0, msecs_to_jiffies(JOB_TIMEOUT_MS), pfdev->reset.wq, - NULL, "pan_js", pfdev->dev); + NULL, "pan_js", pfdev->ddev); if (ret) { dev_err(pfdev->dev, "Failed to create scheduler: %d.", ret); goto err_sched; diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c index fa0a002b1016..b9c5b500b7d1 100644 --- a/drivers/gpu/drm/panthor/panthor_mmu.c +++ b/drivers/gpu/drm/panthor/panthor_mmu.c @@ -2293,7 +2293,7 @@ panthor_vm_create(struct panthor_device *ptdev, bool for_mcu, ret = drm_sched_init(&vm->sched, &panthor_vm_bind_ops, ptdev->mmu->vm.wq, 1, 1, 0, MAX_SCHEDULE_TIMEOUT, NULL, NULL, - "panthor-vm-bind", ptdev->base.dev); + "panthor-vm-bind", &ptdev->base); if (ret) goto err_free_io_pgtable; diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c index 79ffcbc41d78..47e52f61571b 100644 --- a/drivers/gpu/drm/panthor/panthor_sched.c +++ b/drivers/gpu/drm/panthor/panthor_sched.c @@ -3043,7 +3043,7 @@ group_create_queue(struct panthor_group *group, args->ringbuf_size / (NUM_INSTRS_PER_SLOT * sizeof(u64)), 0, msecs_to_jiffies(JOB_TIMEOUT_MS), group->ptdev->reset.wq, - NULL, "panthor-queue", group->ptdev->base.dev); + NULL, "panthor-queue", &group->ptdev->base); if (ret) goto err_free_queue; diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c index 58c8161289fe..194798b9ce09 100644 --- a/drivers/gpu/drm/scheduler/sched_entity.c +++ b/drivers/gpu/drm/scheduler/sched_entity.c @@ -92,7 +92,7 @@ int drm_sched_entity_init(struct drm_sched_entity *entity, * the lowest priority available. */ if (entity->priority >= sched_list[0]->num_rqs) { - drm_err(sched_list[0], "entity with out-of-bounds priority:%u num_rqs:%u\n", + drm_err(sched_list[0]->dev, "entity with out-of-bounds priority:%u num_rqs:%u\n", entity->priority, sched_list[0]->num_rqs); entity->priority = max_t(s32, (s32) sched_list[0]->num_rqs - 1, (s32) DRM_SCHED_PRIORITY_KERNEL); diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index 7e90c9f95611..74a2fe51e653 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -103,9 +103,9 @@ static u32 drm_sched_available_credits(struct drm_gpu_scheduler *sched) { u32 credits; - drm_WARN_ON(sched, check_sub_overflow(sched->credit_limit, - atomic_read(&sched->credit_count), - &credits)); + drm_WARN_ON(sched->dev, check_sub_overflow(sched->credit_limit, + atomic_read(&sched->credit_count), + &credits)); return credits; } @@ -130,14 +130,14 @@ static bool drm_sched_can_queue(struct drm_gpu_scheduler *sched, if (sched->ops->update_job_credits) { s_job->credits = sched->ops->update_job_credits(s_job); - drm_WARN(sched, !s_job->credits, + drm_WARN(sched->dev, !s_job->credits, "Jobs with zero credits bypass job-flow control.\n"); } /* If a job exceeds the credit limit, truncate it to the credit limit * itself to guarantee forward progress. */ - if (drm_WARN(sched, s_job->credits > sched->credit_limit, + if (drm_WARN(sched->dev, s_job->credits > sched->credit_limit, "Jobs may not exceed the credit limit, truncate.\n")) s_job->credits = sched->credit_limit; @@ -701,7 +701,7 @@ void drm_sched_start(struct drm_gpu_scheduler *sched, bool full_recovery) if (r == -ENOENT) drm_sched_job_done(s_job, fence->error); else if (r) - DRM_DEV_ERROR(sched->dev, "fence add callback failed (%d)\n", + DRM_DEV_ERROR(sched->dev->dev, "fence add callback failed (%d)\n", r); } else drm_sched_job_done(s_job, -ECANCELED); @@ -797,7 +797,7 @@ int drm_sched_job_init(struct drm_sched_job *job, * or worse--a blank screen--leave a trail in the * logs, so this can be debugged easier. */ - drm_err(job->sched, "%s: entity has no rq!\n", __func__); + drm_err(job->sched->dev, "%s: entity has no rq!\n", __func__); return -ENOENT; } @@ -1215,7 +1215,7 @@ static void drm_sched_run_job_work(struct work_struct *w) if (r == -ENOENT) drm_sched_job_done(sched_job, fence->error); else if (r) - DRM_DEV_ERROR(sched->dev, "fence add callback failed (%d)\n", r); + DRM_DEV_ERROR(sched->dev->dev, "fence add callback failed (%d)\n", r); } else { drm_sched_job_done(sched_job, IS_ERR(fence) ? PTR_ERR(fence) : 0); @@ -1240,7 +1240,7 @@ static void drm_sched_run_job_work(struct work_struct *w) * used * @score: optional score atomic shared with other schedulers * @name: name used for debugging - * @dev: target &struct device + * @dev: target &struct drm_device * * Return 0 on success, otherwise error code. */ @@ -1249,7 +1249,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, struct workqueue_struct *submit_wq, u32 num_rqs, u32 credit_limit, unsigned int hang_limit, long timeout, struct workqueue_struct *timeout_wq, - atomic_t *score, const char *name, struct device *dev) + atomic_t *score, const char *name, struct drm_device *dev) { int i; @@ -1265,7 +1265,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, if (num_rqs > DRM_SCHED_PRIORITY_COUNT) { /* This is a gross violation--tell drivers what the problem is. */ - drm_err(sched, "%s: num_rqs cannot be greater than DRM_SCHED_PRIORITY_COUNT\n", + drm_err(dev, "%s: num_rqs cannot be greater than DRM_SCHED_PRIORITY_COUNT\n", __func__); return -EINVAL; } else if (sched->sched_rq) { @@ -1273,7 +1273,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, * fine-tune their DRM calling order, and return all * is good. */ - drm_warn(sched, "%s: scheduler already initialized!\n", __func__); + drm_warn(dev, "%s: scheduler already initialized!\n", __func__); return 0; } @@ -1322,7 +1322,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, Out_check_own: if (sched->own_submit_wq) destroy_workqueue(sched->submit_wq); - drm_err(sched, "%s: Failed to setup GPU scheduler--out of memory\n", __func__); + drm_err(dev, "%s: Failed to setup GPU scheduler--out of memory\n", __func__); return -ENOMEM; } EXPORT_SYMBOL(drm_sched_init); diff --git a/drivers/gpu/drm/v3d/v3d_sched.c b/drivers/gpu/drm/v3d/v3d_sched.c index 7cd8c335cd9b..73383b6ef9bb 100644 --- a/drivers/gpu/drm/v3d/v3d_sched.c +++ b/drivers/gpu/drm/v3d/v3d_sched.c @@ -740,7 +740,7 @@ v3d_sched_init(struct v3d_dev *v3d) DRM_SCHED_PRIORITY_COUNT, hw_jobs_limit, job_hang_limit, msecs_to_jiffies(hang_limit_ms), NULL, - NULL, "v3d_bin", v3d->drm.dev); + NULL, "v3d_bin", &v3d->drm); if (ret) return ret; @@ -749,7 +749,7 @@ v3d_sched_init(struct v3d_dev *v3d) DRM_SCHED_PRIORITY_COUNT, hw_jobs_limit, job_hang_limit, msecs_to_jiffies(hang_limit_ms), NULL, - NULL, "v3d_render", v3d->drm.dev); + NULL, "v3d_render", &v3d->drm); if (ret) goto fail; @@ -758,7 +758,7 @@ v3d_sched_init(struct v3d_dev *v3d) DRM_SCHED_PRIORITY_COUNT, hw_jobs_limit, job_hang_limit, msecs_to_jiffies(hang_limit_ms), NULL, - NULL, "v3d_tfu", v3d->drm.dev); + NULL, "v3d_tfu", &v3d->drm); if (ret) goto fail; @@ -768,7 +768,7 @@ v3d_sched_init(struct v3d_dev *v3d) DRM_SCHED_PRIORITY_COUNT, hw_jobs_limit, job_hang_limit, msecs_to_jiffies(hang_limit_ms), NULL, - NULL, "v3d_csd", v3d->drm.dev); + NULL, "v3d_csd", &v3d->drm); if (ret) goto fail; @@ -777,7 +777,7 @@ v3d_sched_init(struct v3d_dev *v3d) DRM_SCHED_PRIORITY_COUNT, hw_jobs_limit, job_hang_limit, msecs_to_jiffies(hang_limit_ms), NULL, - NULL, "v3d_cache_clean", v3d->drm.dev); + NULL, "v3d_cache_clean", &v3d->drm); if (ret) goto fail; } @@ -787,7 +787,7 @@ v3d_sched_init(struct v3d_dev *v3d) DRM_SCHED_PRIORITY_COUNT, 1, job_hang_limit, msecs_to_jiffies(hang_limit_ms), NULL, - NULL, "v3d_cpu", v3d->drm.dev); + NULL, "v3d_cpu", &v3d->drm); if (ret) goto fail; diff --git a/drivers/gpu/drm/xe/xe_execlist.c b/drivers/gpu/drm/xe/xe_execlist.c index dece2785933c..dc81e9f39727 100644 --- a/drivers/gpu/drm/xe/xe_execlist.c +++ b/drivers/gpu/drm/xe/xe_execlist.c @@ -336,7 +336,7 @@ static int execlist_exec_queue_init(struct xe_exec_queue *q) q->lrc[0].ring.size / MAX_JOB_SIZE_BYTES, XE_SCHED_HANG_LIMIT, XE_SCHED_JOB_TIMEOUT, NULL, NULL, q->hwe->name, - gt_to_xe(q->gt)->drm.dev); + >_to_xe(q->gt)->drm); if (err) goto err_free; diff --git a/drivers/gpu/drm/xe/xe_gpu_scheduler.c b/drivers/gpu/drm/xe/xe_gpu_scheduler.c index e4ad1d6ce1d5..66d36cac82a0 100644 --- a/drivers/gpu/drm/xe/xe_gpu_scheduler.c +++ b/drivers/gpu/drm/xe/xe_gpu_scheduler.c @@ -61,7 +61,7 @@ int xe_sched_init(struct xe_gpu_scheduler *sched, uint32_t hw_submission, unsigned hang_limit, long timeout, struct workqueue_struct *timeout_wq, atomic_t *score, const char *name, - struct device *dev) + struct drm_device *dev) { sched->ops = xe_ops; INIT_LIST_HEAD(&sched->msgs); diff --git a/drivers/gpu/drm/xe/xe_gpu_scheduler.h b/drivers/gpu/drm/xe/xe_gpu_scheduler.h index 10c6bb9c9386..9a75457813f2 100644 --- a/drivers/gpu/drm/xe/xe_gpu_scheduler.h +++ b/drivers/gpu/drm/xe/xe_gpu_scheduler.h @@ -16,7 +16,7 @@ int xe_sched_init(struct xe_gpu_scheduler *sched, uint32_t hw_submission, unsigned hang_limit, long timeout, struct workqueue_struct *timeout_wq, atomic_t *score, const char *name, - struct device *dev); + struct drm_device *dev); void xe_sched_fini(struct xe_gpu_scheduler *sched); void xe_sched_submission_start(struct xe_gpu_scheduler *sched); diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c index e4e3658e6a13..b9c114f2c715 100644 --- a/drivers/gpu/drm/xe/xe_guc_submit.c +++ b/drivers/gpu/drm/xe/xe_guc_submit.c @@ -1208,7 +1208,7 @@ static int guc_exec_queue_init(struct xe_exec_queue *q) get_submit_wq(guc), q->lrc[0].ring.size / MAX_JOB_SIZE_BYTES, 64, timeout, guc_to_gt(guc)->ordered_wq, NULL, - q->name, gt_to_xe(q->gt)->drm.dev); + q->name, >_to_xe(q->gt)->drm); if (err) goto err_free; diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index 5acc64954a88..0ba8716ec069 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h @@ -539,7 +539,7 @@ struct drm_gpu_scheduler { bool free_guilty; bool pause_submit; bool own_submit_wq; - struct device *dev; + struct drm_device *dev; }; int drm_sched_init(struct drm_gpu_scheduler *sched, @@ -547,7 +547,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, struct workqueue_struct *submit_wq, u32 num_rqs, u32 credit_limit, unsigned int hang_limit, long timeout, struct workqueue_struct *timeout_wq, - atomic_t *score, const char *name, struct device *dev); + atomic_t *score, const char *name, struct drm_device *dev); void drm_sched_fini(struct drm_gpu_scheduler *sched); int drm_sched_job_init(struct drm_sched_job *job, From patchwork Thu Jun 6 13:06:23 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: 13688455 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 7935CC27C55 for ; Thu, 6 Jun 2024 13:08:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5A58410E942; Thu, 6 Jun 2024 13:08:04 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="Gkw8jhgZ"; dkim-atps=neutral Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2081.outbound.protection.outlook.com [40.107.212.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id 99C0610E942 for ; Thu, 6 Jun 2024 13:08:03 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cNS+iE+yFcpRPBc1hwhY5LNsAKhh9mo+yXtZMfChp7xzPU79rkzVhMP+W+FTLMvHnDGSbJzlCiD2ssGxYiFNrSYOMAbcxNeDc6ekkLpsX83AX6LKnIZ84nKGNfaIk6haAsSADjkFfUpmIbKYvJGA++awb+JsFjKwWRgsFETu2JPxjJAP49MbnGNQBP4t+v6d1g4Mv6J4+dQ9BH9AjGYubgwTHlGCtnudnE33csRR5Z84GLhIyuipB/QoYDct9T0cuCRkXAvzAoP2Q20yPxREMByW7kM/SCpGkML5mrTnc2d+NvuCiXDEghFCmdaCaawyNDBJQZ7nz+xOWJevDn6hyA== 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=RSETJAHvqBwWDm5S1kh8Fkq6AAVWjWbCPKfjkAalKU8=; b=laBRQhDt4ryyGuMpmc8n8KydSWbMWA7MH6k9bV5r/swTaw4ImHZ1KOsVS8Jd2aIfXVc2eeLfrsOD0+gTwfycReo8+6qOndwY4s0HEiLmiAiiPvbgkJ5pBWI7TlXszXv6qQIphdzBzmGo8lDskvfS33ZkCIjQFPaltaEEk/+tMEZwdtJgjrOyFWbutiRXSyuykoKE8X8PXc13RtswqIw0XW941/BZYDe+VoIKfSwyW0zTDGZIWBF6VfWrL3Ng4t6XPoZX58qfyr/Ucao4rv2c2HwVVi/Xu2FsL/ep6jrzSr1kny/HWrBTIJShSFOaOQFVWk2M1ziyuPYErZrIxOLMBg== 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=RSETJAHvqBwWDm5S1kh8Fkq6AAVWjWbCPKfjkAalKU8=; b=Gkw8jhgZ/9TAoNiDQ5bjfzVi5TU4Hls0nDWcApuHU1gCtVjXzZLF/aMvCjyKr4VbU6ywfrCNhP4CXEklGVhQodq7+JXAKY43XQIIB2Yjaaj/1JFznUUA8sVJAt3H7YGohPjQMWCtDHrjBcGT1tfSFUUKKfPbValk7KOMfraNTDo= Received: from MW4P223CA0012.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::17) by MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.33; Thu, 6 Jun 2024 13:08:00 +0000 Received: from CO1PEPF000075F0.namprd03.prod.outlook.com (2603:10b6:303:80:cafe::50) by MW4P223CA0012.outlook.office365.com (2603:10b6:303:80::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.20 via Frontend Transport; Thu, 6 Jun 2024 13:08:00 +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 CO1PEPF000075F0.mail.protection.outlook.com (10.167.249.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Thu, 6 Jun 2024 13:08:00 +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; Thu, 6 Jun 2024 08:07:54 -0500 From: Pierre-Eric Pelloux-Prayer To: , , , , , , , , , , , CC: Pierre-Eric Pelloux-Prayer Subject: [PATCH v3 2/4] drm/sched: add dev_index=xx to the drm_sched_process_job event Date: Thu, 6 Jun 2024 15:06:23 +0200 Message-ID: <20240606130629.214827-3-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240606130629.214827-1-pierre-eric.pelloux-prayer@amd.com> References: <20240606130629.214827-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: CO1PEPF000075F0:EE_|MN2PR12MB4373:EE_ X-MS-Office365-Filtering-Correlation-Id: 0026fd3f-ac53-4fc1-5aad-08dc8629b131 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|1800799015|36860700004|376005|7416005|82310400017|921011; X-Microsoft-Antispam-Message-Info: 4WYYnyWbRLf1f4EHxY9OiweAtr2eyg2vvLl9ezEBHm0gTnwhNBKjpaM3BFVRuz9guQhKA2V8x9BcDuQ5u5jZnFytU42ZhzkpTRJwux7TlhpvqoKivyuzbFjVLYQ/ozHLd+miabieXq/jfRVxUQ34RRbCrfRzwAOPNUkW2MQAjW4yJBxcOKgBZpPz+SU8scDKojmLFHG6BNEiqg6oFZAYSbyHR8kvSygn7W55yBDt61PS/3o8awfVY9ifwcxPm656tdtZzBdOaW3O7rqkULIU4sP6KS9z4oC4QhdP7IAML5i5EC+wWXOUCZbzgJyDBQM0/BUfOPwrza4okdjl3x1wG8PDJvD0ILMYpGu4BbTTl42ejYkL6IeDWbODioYviibXF6vIWC9EHGA9L/L+9F4Bnftowk4LbaPFrkAlf7Oc4QD52/tZMk2rL4BioOhycqc0hflLNZmyR0reInSFT4JYjDH6+kqbQjtNznIVdZV6ttHBOcwCEVKlXbDrdO0ZFgmARJ9tBeOYKst7Yjotz2PX0apRAEPqNPri+T5wV7fRIsHCvG5MrcjwBmXjqPpPskjGHLrXRNXsnJNVeM8wYKfjy7t967RQvarT+sxIohCSIdXA6aBKJbtMZJTaEU9FSqahnGPqWgIdpq4MxZpiXyh/DUB1lf48gWi55uSNMbPkJyTgiPgWdok3Ake1eoz/gb9+shiSL7gwHMmOIJgFmwrhXVZDhgC33vnVRvV2wlTpfKcAxxpuZq8YujrORRzC9qjKwUEpEewD7nbUkbiNG2qaTTBtZfwWz0wb5kMxzceXBRWXfaT5KO5uB1k48vXFV6ULeao8pJdnAtik2JMNJmlNH9x/t+gUXS7TOhnumrb1qNV159lBnUko9fVg10oDRWlkcCxTm49a2kP8TBZKp0S5jCzz3+cyOHCF/YEdprzxBjpunHd8SOunNIJidi4Hf686W0q6SIRkhL4Vc8jDbGX4ynYUpFMctp77+hUqbMyQQYrzcVf8zup+/1KUaan/SBUkeBIdxmCAXw9YUFbRkwghX3/CqYVy/304N0clKCE+IQb+XHa4dj0tJhC9y2AvYFByIswvBlqJU3LisvQp/oWb2rwcbXbyXyKbhOjXr/b66hplGjI+w9bQU9z+r58N5nt+fWIx2+c9gpXYMfwcI9wHQQHiATFrwQqc24Ge40OazauvNP2aW340swT4rQeIUjssoTyVpY+digA/5z2TCVcWwb8gASS59WsujOLBSPDsJEsV3X6EPvyoDIB0kRXPmh5KAQHjCl46JRKanmnMzzKD3GQ9ZE7r0z0b+YXy7iSgh3Urd8uIpcn8xcaUDZ1xgDbtxZk0Sfyx4csFw6nYf62q0nIrRTTd/56ow+n+hKDEMdau37vdSonFgheHEeye2Cwi7fS7expF8oyD0LJhwjID9faO92YrTHedgiE3D08jQKw= 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)(1800799015)(36860700004)(376005)(7416005)(82310400017)(921011); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2024 13:08:00.0444 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0026fd3f-ac53-4fc1-5aad-08dc8629b131 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: CO1PEPF000075F0.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4373 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 device index from the pid of the thread sending this event. With workqueues this is not possible anymore, so the event needs to contain this information (the ring name alone is not enough, because they're not unique). Signed-off-by: Pierre-Eric Pelloux-Prayer --- drivers/gpu/drm/scheduler/gpu_scheduler_trace.h | 13 +++++++++++-- 1 file changed, 11 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..0a19c121bda5 100644 --- a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h +++ b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h @@ -28,6 +28,9 @@ #include #include +#include "drm/drm_device.h" +#include "drm/drm_file.h" + #undef TRACE_SYSTEM #define TRACE_SYSTEM gpu_scheduler #define TRACE_INCLUDE_FILE gpu_scheduler_trace @@ -42,6 +45,7 @@ DECLARE_EVENT_CLASS(drm_sched_job, __field(uint64_t, id) __field(u32, job_count) __field(int, hw_job_count) + __field(int, dev_index) ), TP_fast_assign( @@ -52,6 +56,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); + __entry->dev_index = sched_job->sched->dev->primary->index; ), TP_printk("entity=%p, id=%llu, fence=%p, ring=%s, job count:%u, hw job count:%d", __entry->entity, __entry->id, @@ -64,9 +69,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_index=%d entity=%p id=%llu, fence=%p, ring=%s, job count:%u, hw job count:%d", + __entry->dev_index, __entry->entity, __entry->id, + __entry->fence, __get_str(name), + __entry->job_count, __entry->hw_job_count) ); TRACE_EVENT(drm_sched_process_job, From patchwork Thu Jun 6 13:06:24 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: 13688456 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 9501EC27C54 for ; Thu, 6 Jun 2024 13:08:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E6C1E10E94A; Thu, 6 Jun 2024 13:08:15 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="e723LxGU"; dkim-atps=neutral Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2082.outbound.protection.outlook.com [40.107.243.82]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2A25110E94A for ; Thu, 6 Jun 2024 13:08:15 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IbwJNVvEfQIusHjtTG7GtHmDmvAwDUPJ/ZwocOTyzLCZ6vumu7shh3Pr26wRT+3FFswwHxvEHJpRSCQ1dMCi/YRemFQLI6qb8N8GhNL8GlbRPJgaRrlP/KdCLYQuYPiPJPaLD2vJK919c650ON4wso+RVfMIOBYokG3HiFut5St34W2KeZeIBClNreftNz1p+y5bYv2l3uiRDQStVBAjh3+EiblaaPvrPa1TDrqnYitVNY4Sdt7/WPJes2E51IgOJE2wpmddNTW5gzLz3EjOsk4INUGHcvF5AKNUMU2f6n6HcHx0pSpKV9gT1ZGUKwW5DwpDpJO6o3csgfHGXGDmVA== 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=nM8lcc0CQiiCTPkzGUA4cZTDbu38/mkFeukQPRMIFTM=; b=HvyZkUF/iYDHdD45qpfvVJ+rtbo96gm4rW3kYEhL6KVIm52CgF77Qte47JVvnT/2qAGG+0dMAZmA/VX22tYPBWGEC9L7tU3HV5y7zYnbcEOahrApco6wGIZIAuB51Y/ng3KdDTmgQ7AU3g/DouFmqmKrr9iji1ujeIbNZ8DuFcURyiiX2B7SeH5BrJqtYWwzKP+NXM6krb35E9eeh4TDohwgVOZ7/eHODkep06UnxsKj+0zbmH3jdEWA9DdvSaKwGMOj9icCKYNM+6BJ9YCFImAkOHD0r8HHyGLyNVd9NckEymeUkyecu+GRz2TNgVL8yQLUEcjX2ATphYI4nupvvw== 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=nM8lcc0CQiiCTPkzGUA4cZTDbu38/mkFeukQPRMIFTM=; b=e723LxGUSnBJUZKD+SAFKgYItfVi7Yc+g21lCfTKEybdbCkxZXqhjkBOBw3++NwGdIzjz9qXilOnokqCxF/NJIG92eFrW9Gku/P2EcxrzqI2tKi/PY6oROvsnRISNuBLGKgIPSZM8eD3XvZHP8nQUeQSTyrQm4fVzT+8LNo0hRw= Received: from SJ0PR03CA0185.namprd03.prod.outlook.com (2603:10b6:a03:2ef::10) by DM6PR12MB4187.namprd12.prod.outlook.com (2603:10b6:5:212::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.33; Thu, 6 Jun 2024 13:08:09 +0000 Received: from CO1PEPF000075ED.namprd03.prod.outlook.com (2603:10b6:a03:2ef:cafe::f5) by SJ0PR03CA0185.outlook.office365.com (2603:10b6:a03:2ef::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.20 via Frontend Transport; Thu, 6 Jun 2024 13:08:08 +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 CO1PEPF000075ED.mail.protection.outlook.com (10.167.249.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Thu, 6 Jun 2024 13:08:08 +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; Thu, 6 Jun 2024 08:07:58 -0500 From: Pierre-Eric Pelloux-Prayer To: , , , , , , , , , , , CC: Pierre-Eric Pelloux-Prayer Subject: [PATCH v3 3/4] drm/sched: cleanup gpu_scheduler trace events Date: Thu, 6 Jun 2024 15:06:24 +0200 Message-ID: <20240606130629.214827-4-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240606130629.214827-1-pierre-eric.pelloux-prayer@amd.com> References: <20240606130629.214827-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: CO1PEPF000075ED:EE_|DM6PR12MB4187:EE_ X-MS-Office365-Filtering-Correlation-Id: 3cf68ecd-ba78-4206-c6a6-08dc8629b607 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|376005|82310400017|36860700004|1800799015|7416005|921011; X-Microsoft-Antispam-Message-Info: NibOJyUduYnC237Fw/OWZHVCv5+QAhrKDM1apCGE0xBIRFaVLo/hx9phiHpVI+qlJe/ywkPFw7SgqMtdVINzJYb0FwuJ1O/3bRrh9ttmUaLWrN8QzoC7nqo1hxWnfg8kPUzVP5aL3rulfAR88Jx9OndgiWmzzdNwjnds2ZSfjGnJQPTtYZK+Y4waSX1oXPmpobXkL/O/hZLcG3ValxHeYTQyQXNlI5xWWVj0LM8Uo/CR0bkRNVNda483Z50xJCdkvYaTKrkXHwJNaLXc0/oRZUrJ117tbG1wt7SX/suTlI14zVD6QEbQfx85uwzzOFLNMDRnfuVQVbudm5wkPfmYuUaXEXVbZetVnLGgtqjvDZtkwgBX70z+gVr+e2tMJAwGVVi4jWHYCy0qrmbegRKBL88yGluHvXe7/A5OmndaX8DVz3ORTwdbcmpxW34RXsqqKriuCJysbdl/mPzYo2ARnnX0Pf2W6/2hiRo6BHPUHbW/NvefcI8cXpLos246LhHDUQAnY8CZ5gTWLU+wx4eHMXfxTuXWuU51tM+leLj1mg4BgveLhLZPFBHJWEIrIm6LJ5zOxhCKT6ZlcX0id9w0QxL991TsW+/riUBeF2Y/zCVkYl2cWof0mI5ks9IZuCgjuGk5lWOZ6M8+4JiaNxeZLtRFcXGENH6kQMlQHlouVwunx22InD4T0M0tvHSMMvKu0NtjL1VMtxk0vmiDm4gqUNjtVE+sxw276gn07KuVOjDXYB2dNsq1v1EZt0rE32hHz7hOM4P1fH2D0Sqi9QbNWvVm1mJsJtLS5b/4KijazDlwwc5/NJpFuLuzpUQFAsehHBY8R/kAhdHk9Fk5qL0RTKyv4ogbclhDZf76ZEWl4hhNraSUfikqewZjzFJm4gfaIf21YoXP82UU0mClt9f/m2v4F1eKMGsdkMkN3NTqFMPhozlG7285WjjckfXvVCb4KxSEvVs1nxfbaVACT0Qma3QMryxriYBZNNM8QrUtxT4MWNAavlhVL+rKH0ScXDqre3sMMQfrDbA7hI19Uq6Ih+i3R4LNXAjKiweWziHAuJyyQDWN4wmJUDH+Nb7QRoTsWBxrLfVPTTkgeeGgJphJPkPTvV/ea8YaX/jDzP9b3e9xJsG0ZRI1Brnow2Vf/s2eBCMl1UcqelMPi+hEwdj4toDvGNOazYM+LrVZSJb5jrGxBvVxcV2n2LDgDvmwSjyI3j5X36wvezZWH/iJIBOuv7sMz7p2XY3S0aCirXgIjfSqvZWaagN2PE4193aOnPH/L6lBoP1S14ZXNQFQI9M5gqinGLXiWnoGJA1RbxAhDaZecLqQZ6k9xxrsNQzffKXSiA0HijRpOYXmTxCTBdx/U1nt/FBysAyZJsOT2x+/adOJ7/AJh1nWayT/gwPFb1rNA3Y/v6NXyM5Ps0WY6ZvYRd3wOi38/DpBAZVNlHXqhko= 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)(376005)(82310400017)(36860700004)(1800799015)(7416005)(921011); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2024 13:08:08.3636 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3cf68ecd-ba78-4206-c6a6-08dc8629b607 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: CO1PEPF000075ED.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4187 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" Print identifiers instead of pointers: * "fence=%p" is replaced by "fence=(context:%llu, seqno:%lld)" to have a coherent way to print the fence. A possible follow up change would be to use the same format in traces/../dma-fence.h. * "entity=%p" is removed because the fence's context is already an identifier of the job owner. Signed-off-by: Pierre-Eric Pelloux-Prayer --- .../gpu/drm/scheduler/gpu_scheduler_trace.h | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h index 0a19c121bda5..2d7f2252eb5d 100644 --- a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h +++ b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h @@ -58,9 +58,9 @@ DECLARE_EVENT_CLASS(drm_sched_job, &sched_job->sched->credit_count); __entry->dev_index = sched_job->sched->dev->primary->index; ), - 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) ); @@ -72,9 +72,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_index=%d entity=%p id=%llu, fence=%p, ring=%s, job count:%u, hw job count:%d", - __entry->dev_index, __entry->entity, __entry->id, - __entry->fence, __get_str(name), + TP_printk("dev_index=%d id=%llu, fence=(context:%llu, seqno:%lld), ring=%s, job count:%u, hw job count:%d", + __entry->dev_index, __entry->id, + __entry->fence->context, __entry->fence->seqno, __get_str(name), __entry->job_count, __entry->hw_job_count) ); @@ -88,7 +88,8 @@ TRACE_EVENT(drm_sched_process_job, TP_fast_assign( __entry->fence = &fence->finished; ), - 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, @@ -96,23 +97,25 @@ TRACE_EVENT(drm_sched_job_wait_dep, TP_ARGS(sched_job, fence), TP_STRUCT__entry( __string(name, sched_job->sched->name) + __field(uint64_t, fence_context) __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); + /* Store the hw exec fence context. */ + __entry->fence_context = sched_job->entity->fence_context + 1; __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("job ring=%s, fence_context=%llu, id=%llu, depends fence=(context:%llu, seqno:%lld)", + __get_str(name), __entry->fence_context, __entry->id, + __entry->ctx, __entry->seqno) ); #endif From patchwork Thu Jun 6 13:06:25 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: 13688457 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 54107C27C54 for ; Thu, 6 Jun 2024 13:08:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 890A110E947; Thu, 6 Jun 2024 13:08:24 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="AZOR3pLl"; dkim-atps=neutral Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2046.outbound.protection.outlook.com [40.107.244.46]) by gabe.freedesktop.org (Postfix) with ESMTPS id B469210E947 for ; Thu, 6 Jun 2024 13:08:23 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VCzrgfF1DgFvwJwJS/82zSwxtJIf06Flon117GwhNn5POFh+gaGO34DbxnwPtekbTpwx/J1PhZW3TmDQHbdOIfZpqjmwDm7gjjNoUzh6mGmCFr1J2QoHMtOKN/HSJ8jvJ8xMzD96vFK+8FjcqhwPWMDPpHFZl8e/KXqCDgUjJj35IBolo3UinxI3RDQ5Sam9olgCG3nd7izSsb1a/aEgtnCUeOJKurPFTw/BZId7uhP7VXZhZldNyzQxJfk/GqH4U6H5pLZzKzLUi+/Zp5SVbQ7bEsF4sjweZetUVPtlzp1SkWOO2A5GwiYTg8wBEhTVEjE9mrWlEr3mXQSf1WALaQ== 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=sIQKmQtQR53NBfqt/4xELQNRXqEZckHTu3tHFvKbGmI=; b=CEIJX9jWJ5uv2FTxpDdzfzb2lgljrPPSZGeFbxSHxo7o37buppdEwGZ1xyF7du3YWitspu02B/+MQI3upBfR/bykd+UB8wzHIaXnMbvGP5JjwK1Y7TIVjFkkmZtY3/NBpDFVLLKCBMl6TUNMvTxLVGjFkvZmcNXw4IQgDC8N6uXKSXl9KOgmAL/zyFNmG6b14OuvIBLrI6M5zNP0DkfGTawrdegepFwlUTCRiPAB9t7ugpqGNoBulf3XL/EIsCAFGj0U0Njz9Ux0pvimIDrHaFP6DQW0nM2sMIPGLtBJ6fToapIybjnSk+KhpqxAWdORtesqF2PUfrtczLDRH8EK7w== 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=sIQKmQtQR53NBfqt/4xELQNRXqEZckHTu3tHFvKbGmI=; b=AZOR3pLln6BhdqaTEU26nNQvXx7tassA7avFbcQ18pIyyEimTqzD42YnteHyh8RdvRcLrMjtOJZA+TYrxf4Eyf4vZiYTexucang4Z3R8SLgHIIAvufGItZzVbFPv1OSFemyZ9sj4ljRq4/G7yv6eu2AU279nMunj4S6G29PJx1U= Received: from SJ0PR03CA0197.namprd03.prod.outlook.com (2603:10b6:a03:2ef::22) by SJ0PR12MB5676.namprd12.prod.outlook.com (2603:10b6:a03:42e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.22; Thu, 6 Jun 2024 13:08:10 +0000 Received: from CO1PEPF000075ED.namprd03.prod.outlook.com (2603:10b6:a03:2ef:cafe::bc) by SJ0PR03CA0197.outlook.office365.com (2603:10b6:a03:2ef::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.18 via Frontend Transport; Thu, 6 Jun 2024 13:08:09 +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 CO1PEPF000075ED.mail.protection.outlook.com (10.167.249.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Thu, 6 Jun 2024 13:08:09 +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; Thu, 6 Jun 2024 08:08:01 -0500 From: Pierre-Eric Pelloux-Prayer To: , , , , , , , , , , , CC: Pierre-Eric Pelloux-Prayer Subject: [PATCH v3 4/4] drm/sched: trace dependencies for gpu jobs Date: Thu, 6 Jun 2024 15:06:25 +0200 Message-ID: <20240606130629.214827-5-pierre-eric.pelloux-prayer@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240606130629.214827-1-pierre-eric.pelloux-prayer@amd.com> References: <20240606130629.214827-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: CO1PEPF000075ED:EE_|SJ0PR12MB5676:EE_ X-MS-Office365-Filtering-Correlation-Id: 54ec1457-f44d-449a-96ba-08dc8629b6ba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|36860700004|376005|82310400017|1800799015|7416005|921011; X-Microsoft-Antispam-Message-Info: Hn9s8M6nKf/CAnPhV3ezaTrYFw0W965SES24smIb2P+6KwqGGowTH4H1ERvqfU2c6a0EvyMy03UTvmvb1jmvtOhA9+TkPnQIzk9OswyInhD/Uj84vqV2s2FjkAhl0WcXpRw+8RICMoPWxpLJ8zF9t3Isblo4kmj3UWDLdoEz0z4FDd2jo55fbFSlKOKNtd72DHSA2ToEAHyvVB6hCBhFPwCXL/VsGJyD0hKeTg0TfDB45I5gVy5t4CPpYWQbJMRyK7vjlyEyYUdjSgINs5QV7TljnC3Cri2eQP2Eol5LLq6Unubqe6+B6ACLdu1iDmrjzmvTgF65fQQTBWVb6q0Swn9q6eBECfMtbbe/fgtsHWsp/LNyevb2qPRGRyd6Roqdm8RkScchB+z7XZy86WGv6geTD3+ZrZnEzRqHgrs87DEF9npYDNYu0IQvVJqpBKu+8thmxMflReDMmWgZSI60Y6cKr16Srk5YuirzgnDjhXuk2a5z3vmoEzWUuf6CYok3XPbXLuFmAKtqqkP9KQCruV6jWXgFdqGuoUrXEcwbzJPl7bKQFeyiheAxH6quLOBd3bTjNd8UyxuS48CrtzJqpZI9mNLdQHSdppth354WkFZx34STp1jOZHFG99u+fu+JO3tAe4/mHWcU6TrtHUhJRKcZQN2iGKvBJhx5gfvkOh1V1Py5jA0wEqm98vNh+h0ExsJZ+pTaNQfkG7E3ddqgC7E32Ed7u10BLkco4+3qZEeV4nRBXCEu43L6InSrPvKkITohVu/3fsuQ88OfItsXfFBeQqSPtSUIlT/Y+Nt6A/hn3dPgj8bqxRYYoR6r6EWnGR0phs6rF3vSU2k419ij5zTw9woTCZMwn+w0a5eUaJjGZgsG069XG1u9DzUVmgSxNQK+Fyhd8YVh3Ym5L6Vvw7C2RgVIuCmRIoGwxozHrWA1dEUg9xvb9So3yeLs4tCJeCKhwD8BBCgkCC43yUeEnX1OLvEQ1cZwkFgE7fbL6Jw3UwKhKO82P+FU/jQeOVcwuody/PegcmcRtHToFk8FppmKbc6UgcdB0Jq1CEdlDuYm45NMmu84DeKHuRmaXVfWV75Ic+ulQ5N0VKOpda4jHv4afLsbWbkeOy9whHqJv8cZzB0iNwHnUq/McU/lHYtUf8uwMPQBUir/3unC417NgjprGJdHtUcbnuSF+bXVeZTUvm4PktbjFEE38LkkBlsSS9d41UN71FlJuP2HiexppsvIfVFEcrhAeaiuOxh3D04SM3nqydoLNSsWDWcw4/mqIy6ioJ1RTb5rQz9c8F72eOSccii30h4vmhQsPl0TZr61G5ev6XiooD8Y97a/SEXkQYV3EZHFOOG8SzEkU6UHQtbWxVRs9NnJzVkDZrF263+1BScasuCnKJwd2/mpNkqyhvQLFOhYh5CFOiebInazfClK/ZrM6gzAk1PQ5UXlqgQ= 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)(36860700004)(376005)(82310400017)(1800799015)(7416005)(921011); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2024 13:08:09.5355 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 54ec1457-f44d-449a-96ba-08dc8629b6ba 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: CO1PEPF000075ED.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB5676 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 | 58 ++++++++++++++++--- drivers/gpu/drm/scheduler/sched_entity.c | 8 ++- drivers/gpu/drm/scheduler/sched_main.c | 2 +- 3 files changed, 58 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h index 2d7f2252eb5d..9d90237793a1 100644 --- a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h +++ b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h @@ -26,6 +26,7 @@ #include #include +#include #include #include "drm/drm_device.h" @@ -35,9 +36,34 @@ #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( __field(struct drm_sched_entity *, entity) __field(struct dma_fence *, fence) @@ -46,9 +72,14 @@ DECLARE_EVENT_CLASS(drm_sched_job, __field(u32, job_count) __field(int, hw_job_count) __field(int, dev_index) + __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->entity = entity; __entry->id = sched_job->id; __entry->fence = &sched_job->s_fence->finished; @@ -57,21 +88,32 @@ DECLARE_EVENT_CLASS(drm_sched_job, __entry->hw_job_count = atomic_read( &sched_job->sched->credit_count); __entry->dev_index = sched_job->sched->dev->primary->index; + __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_index=%d id=%llu, fence=(context:%llu, seqno:%lld), ring=%s, job count:%u, hw job count:%d", __entry->dev_index, __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 194798b9ce09..d252f3aeed47 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 74a2fe51e653..b3b89ea0d96d 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);