From patchwork Wed Apr 17 00:53:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13632794 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 3F3DDC4345F for ; Wed, 17 Apr 2024 01:11:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B47010F469; Wed, 17 Apr 2024 01:11:04 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="XVMmncuM"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by gabe.freedesktop.org (Postfix) with ESMTPS id C5DBF112FFD for ; Wed, 17 Apr 2024 01:10:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=APtxS9+t4Z7TBA/o+AReb2t/bjN5NuUC2RKGGZz1N04=; b=XVMmncuMwzCo+GbfOeiO+GtAR4 g19oIaJ3whB3dVptuLHV+U/SMK61rr5neST/6hJD4xjppEfnAoZdmFPe/PPikT589iPcwBglHxfJi 56Mekd2QlWD5eCj1DanHRVl21T7HjaBW0TPwPAuholWhP2cxwhGa3c0vuqC0+XoJpD893oXR0TEYr PqNLrV67WezMREcoi1/2p6twBMOjBlYiButh6CBNcdXiA5+N0XGi38yjj6IipjHKFzZwT6XMYJzpi LuwnpV7GosPqB3sQX0GONM72rMRP0khhfCZ4gzVjWvvKdSlbTeeQ5nEWtWQf2HqZDsjT0or2R3qlX bqY7SrEQ==; Received: from [177.34.169.177] (helo=localhost.localdomain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1rwtoy-005Mj1-W2; Wed, 17 Apr 2024 03:10:45 +0200 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Melissa Wen , Chema Casanova , Tvrtko Ursulin , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, kernel-dev@igalia.com, =?utf-8?q?Ma?= =?utf-8?q?=C3=ADra_Canal?= Subject: [PATCH v2 0/4] drm/v3d: Fix GPU stats inconsistencies and race-condition Date: Tue, 16 Apr 2024 21:53:05 -0300 Message-ID: <20240417011021.600889-1-mcanal@igalia.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 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" The first version of this series had the intention to fix two major issues with the GPU stats: 1. We were incrementing `enabled_ns` twice by the end of each job. 2. There is a race-condition between the IRQ handler and the users The first of the issues was already addressed and the fix was applied to drm-misc-fixes. Now, what is left, addresses the second issue. Apart from addressing this issue, this series improved the GPU stats code as a whole. We reduced code repetition as a whole, creating functions to start and update the GPU stats. This will likely reduce the odds of issue #1 happen again. Best Regards, - Maíra v1 -> v2: https://lore.kernel.org/dri-devel/20240403203517.731876-1-mcanal@igalia.com/T/ * As the first patch was a bugfix, it was pushed to drm-misc-fixes. * [1/4]: Add Chema Casanova's R-b * [2/4]: s/jobs_sent/jobs_completed and add the reasoning in the commit message (Chema Casanova) * [2/4]: Add Chema Casanova's and Tvrtko Ursulin's R-b * [3/4]: Call `local_clock()` only once, by adding a new parameter to the `v3d_stats_update` function (Chema Casanova) * [4/4]: Move new line to the correct patch (2/4) (Tvrtko Ursulin) * [4/4]: Use `seqcount_t` as locking primitive instead of a `rw_lock` (Tvrtko Ursulin) Maíra Canal (4): drm/v3d: Create two functions to update all GPU stats variables drm/v3d: Create a struct to store the GPU stats drm/v3d: Create function to update a set of GPU stats drm/v3d: Fix race-condition between sysfs/fdinfo and interrupt handler drivers/gpu/drm/v3d/v3d_drv.c | 19 +++---- drivers/gpu/drm/v3d/v3d_drv.h | 40 +++++++++++--- drivers/gpu/drm/v3d/v3d_gem.c | 9 ++-- drivers/gpu/drm/v3d/v3d_irq.c | 48 ++--------------- drivers/gpu/drm/v3d/v3d_sched.c | 94 +++++++++++++++++---------------- drivers/gpu/drm/v3d/v3d_sysfs.c | 13 ++--- 6 files changed, 105 insertions(+), 118 deletions(-)