Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2123410rwd; Mon, 15 May 2023 07:34:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/xcUJaUCrUlOhnjxAQLgnLuZjM0Hex+sFV2FlwZP27P60SCjXqFSmipqbQhBO7ECO9KMZ X-Received: by 2002:a17:903:338e:b0:1a8:ce:afd1 with SMTP id kb14-20020a170903338e00b001a800ceafd1mr31173630plb.20.1684161248398; Mon, 15 May 2023 07:34:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684161248; cv=none; d=google.com; s=arc-20160816; b=rM7tHW1IsObXhuJ66TCEnKKzXO72zvPrFPMJ+pt8jwjcQwiIwWk4dHC6vV9SJZhYNS mjsY3zJIshcfznooaQ1PqCcpQkKXLv0+5Z38OogYEnOF3hgSc6/GhLdb8n1f/9ZQbk9e 2jO+Zsi4WdLIfcPm81mQGS3tqKVVgEaK2NSmVbSVixgPMjcBcougmV6eT0CqK3kMjn0q ZFWYC6BTjHN/NIL7DkWnPwlSaplYRDi/i4eqaz851osxK2qnf0l0crPcbk5wzFOD7YAL gr8YTq0VV67fc6xsJtYe6c5eO75A3g4UAR81uy6I0Wv+OdwpmVpJiitjiKPc4iNPyXwr iSnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=wnZ9D21xzUPORZdBoaAd712UMhIWRfvjN7BdaMIkqdk=; b=FOPi7GZ6SGsdeeupu4XJsDlWGUv9MV0CC3GRc+hsfI3Qtt/L7UDSgC22yhYpdR2fCb dvfPTxdiNL1FTn4m2BUUvZrU8ntcgFUfVH5D1KE4OAmEW6I9kVFTSlRbT2h4kvmkTLTh EKP1FibmaEPQdw8w2wi34C8z40bxNjWL2vxmFmvbNB5ug6IB6rXL2kWEF6aW++focdj7 KJFMQWqq625/U6SOVBe0jdHhJs1jfcTgW+H1lQlrCGZxTuNEuau/h8ACFnyJry/5Sx3I G/T3dAAVlBE6JDMCU1+edu1F/AKE2/xh2xD7df9Tp9DVYfh7uV9gaTPma10CcJRhGLb3 LleA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=jsjrWitf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h13-20020a170902680d00b001a6556cf95esi11329827plk.170.2023.05.15.07.33.53; Mon, 15 May 2023 07:34:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=jsjrWitf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238175AbjEOOat (ORCPT + 99 others); Mon, 15 May 2023 10:30:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232072AbjEOOar (ORCPT ); Mon, 15 May 2023 10:30:47 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B50E11D; Mon, 15 May 2023 07:30:45 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-51f1b6e8179so9069157a12.3; Mon, 15 May 2023 07:30:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684161045; x=1686753045; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=wnZ9D21xzUPORZdBoaAd712UMhIWRfvjN7BdaMIkqdk=; b=jsjrWitfOWbVsXPs6B5Lia8wkg2dLmz6o1d406QcFVfo+pyvuvyJUDtrVrDpo/x51a iUa7DRKHwe+Y2TYOh6H7L7rJBd8pZRgLa3kotBIFD06zze2ApQWxZrM2yzbSsnqGdws3 hB1E9KHVnknZjM8apmNiuBCAODD+L13Fcr5+7UOnasTmc5gVCqNDJJok5hG9lTQFzSsI 47Y0FVm+ddZICgDFbREMkvMQ/ZcCD3jE5hkRDfNFpaYibHWTOrI7kTQRxbZCp4MVl3Uh vapTVORVVlzm24Z4RNvraER4YgtSeUjYDoCIpROMsN47KKOZBGd7rtydXTkojkexyeLA DKpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684161045; x=1686753045; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wnZ9D21xzUPORZdBoaAd712UMhIWRfvjN7BdaMIkqdk=; b=klMGzvTej/i1u0QCh2QwlwfA2BdG+I0RMfjeeOH6Mi9uQPVWGD1GRvDXpU2klQlfGG CwNySVrpj3R5T0RoZcpmnmlkuR7ZUMOjPDgoGP9l3EhYotT8JuhG1XhKj62aeAToHuMh FTH8eioBVscCA5CZLNsCAUHa3UnOHu2AOAj5fK4W5AKKlpHxUg+EKDC3kaFbuo/ZnGnT kYO98xgk6RFZJ7T4uXNk14mhzUFiy6W17mUaz7JTuLKeccCb5LLI2pJTOOTBd8IpMoCL udJxOuSjff7waKy8xhwo2eRm8IpGjdZ3z6r6i1X6O6Eyf1y/k4BqBpZVDA8vUq33clJE pRLQ== X-Gm-Message-State: AC+VfDyvRK9W/jMceZlnPiR3iuPCA2GrhJuh43UWvZNEXiqRHJe4QKDM aGxwyiqfxebxIgSlVDXVfWY= X-Received: by 2002:a05:6a20:7fa3:b0:ef:f558:b76 with SMTP id d35-20020a056a207fa300b000eff5580b76mr42340931pzj.5.1684161044688; Mon, 15 May 2023 07:30:44 -0700 (PDT) Received: from localhost ([2a00:79e1:abd:4a00:61b:48ed:72ab:435b]) by smtp.gmail.com with ESMTPSA id e4-20020aa78244000000b0064928cb5f03sm2590440pfn.69.2023.05.15.07.30.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 07:30:44 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: freedreno@lists.freedesktop.org, Daniel Vetter , Tvrtko Ursulin , Boris Brezillon , Christopher Healy , Emil Velikov , =?UTF-8?q?Christian=20K=C3=B6nig?= , Rob Clark , Akhil P Oommen , Alex Deucher , amd-gfx@lists.freedesktop.org (open list:RADEON and AMDGPU DRM DRIVERS), Arunpravin Paneer Selvam , Bjorn Andersson , Chia-I Wu , Dmitry Baryshkov , Elliot Berman , Guchun Chen , Jim Cromie , Konrad Dybcio , Lijo Lazar , linux-arm-msm@vger.kernel.org (open list:DRM DRIVER FOR MSM ADRENO GPU), linux-doc@vger.kernel.org (open list:DOCUMENTATION), linux-kernel@vger.kernel.org (open list), Mario Limonciello , Maximilian Luz , =?UTF-8?q?Michel=20D=C3=A4nzer?= , Peter Maucher , Sean Paul , Shashank Sharma , Tvrtko Ursulin , YiPeng Chai Subject: [PATCH v4 0/9] drm: fdinfo memory stats Date: Mon, 15 May 2023 07:30:07 -0700 Message-Id: <20230515143023.801167-1-robdclark@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rob Clark Similar motivation to other similar recent attempt[1]. But with an attempt to have some shared code for this. As well as documentation. It is probably a bit UMA-centric, I guess devices with VRAM might want some placement stats as well. But this seems like a reasonable start. Basic gputop support: https://patchwork.freedesktop.org/series/116236/ And already nvtop support: https://github.com/Syllo/nvtop/pull/204 I've combined the separate series to add comm/cmdline override onto the end of this, simply out of convenience (they would otherwise conflict in a bunch of places). v2: Extend things to allow for multiple regions other than just system "memory", make drm_show_memory_stats() a helper so that, drivers can use it or not based on their needs (but in either case, re- use drm_print_memory_stats() v3: Docs fixes v4: use u64 for drm_memory_stats, small docs update and collected Tvrtko's a-b [1] https://patchwork.freedesktop.org/series/112397/ Rob Clark (9): drm/docs: Fix usage stats typos drm: Add common fdinfo helper drm/msm: Switch to fdinfo helper drm/amdgpu: Switch to fdinfo helper drm: Add fdinfo memory stats drm/msm: Add memory stats to fdinfo drm/doc: Relax fdinfo string constraints drm/fdinfo: Add comm/cmdline override fields drm/msm: Wire up comm/cmdline override for fdinfo Documentation/gpu/drm-usage-stats.rst | 101 ++++++++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c | 16 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.h | 2 +- drivers/gpu/drm/drm_file.c | 147 +++++++++++++++++++++ drivers/gpu/drm/msm/adreno/adreno_gpu.c | 24 +++- drivers/gpu/drm/msm/msm_drv.c | 15 ++- drivers/gpu/drm/msm/msm_gem.c | 15 +++ drivers/gpu/drm/msm/msm_gpu.c | 2 - drivers/gpu/drm/msm/msm_gpu.h | 10 ++ include/drm/drm_drv.h | 7 + include/drm/drm_file.h | 51 +++++++ include/drm/drm_gem.h | 32 +++++ 13 files changed, 378 insertions(+), 47 deletions(-) -- 2.40.1