From patchwork Mon May 15 14:30:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 9360 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6976441vqo; Mon, 15 May 2023 07:47:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5gF7K7+58WNsA1uHl/xr2A2HkMplq3dFrff5i4JgMfaFaACxDQhka0fK0lkNbQM9Ss6jHi X-Received: by 2002:a05:6a20:160c:b0:100:e1f3:9bd2 with SMTP id l12-20020a056a20160c00b00100e1f39bd2mr32557225pzj.40.1684162025847; Mon, 15 May 2023 07:47:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684162025; cv=none; d=google.com; s=arc-20160816; b=hanTQjY9P4+FfgRCmk8Trb2TRG9VJh2mRlgMb59RX8RP10EI7XvoBYCsiGA6NnbgXy g6iycADcIy/IUdURlDUg2aOAwpC6TP6FbXdoym4b3YiWrlZH7Ru8CV9E1++YK5nGLuTX 83BmLj35lv0TaFCeLJaXCcO5jN27HpcyYAsSG2ZSxmL9+TTCXJ1rhVCiZ5y5/sU/QYrh 3AK2TB/TRXg3OZUY21seVvuxg5kzBP/hHZhnWO5cMjvxiia9ari2xpXrlFvpl3959Uo5 CR7UI7GlX1JgDkgNydgYsCXl1721KAoN7pKaqvuo0IfsXLm8AbZ4W5Z7O1d9maYrNFwu tutA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v1-20020a637a01000000b0053007fe33aasi16155316pgc.425.2023.05.15.07.46.50; Mon, 15 May 2023 07:47:05 -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 S240587AbjEOOat (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_K=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_D=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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765971880478857213?= X-GMAIL-MSGID: =?utf-8?q?1765971880478857213?= 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(-) Acked-by: Dave Airlie if that is the plan.