Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5903667rwl; Tue, 11 Apr 2023 11:35:21 -0700 (PDT) X-Google-Smtp-Source: AKy350atvsGqMy2hAaGOKCyQ6LWp+KZmaGEfzNbVRGlCAYsnVvJMFV4s5m8hYYBato9Gm7c2C/Bc X-Received: by 2002:a17:906:381b:b0:947:c221:eb38 with SMTP id v27-20020a170906381b00b00947c221eb38mr12793810ejc.13.1681238121622; Tue, 11 Apr 2023 11:35:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681238121; cv=none; d=google.com; s=arc-20160816; b=cjKwGYCHvd2LcEatzHUsShuCyf5SOrY+FSvyUYdZsmhqbag/0pBGWQxbioKBGGHD23 xQ7mmeI4sYIbxHFKPedfDfSYP8cKJhMC1hYhjn+qab5q/3XKSXmRtuhokKJYRDtuODae 3wviSuLUIjBXH7UwYkX8ywOUoOFWuQmZ9DfNn6uUqHUnNniQDqTNtDKmyESM+cukCkJ+ zZW5Fa/MahQodwyq7n+pnEBZ0dKxdBSsz4ka1VCEMzgVnR6Z2f0FL/Ich8bplW64Zuow p2tEmdTtGQ6zp5LEUS4h/SmiS1WKdmd9rXqRW+n2d+HpEp3sOgUngu2BH+zpTFO1cz8d YAww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=04BQWUwBxDZ2Ggq7BQgfuwgR7cIa0rI/ETFyOfLGigY=; b=KREJl2z6EdMkqYFY+kWYChlb5BO5I4cjYLCt7xj3iMEY/KKlQka5qHfMslzMUB8YTi Tp8R05kaRqFR4lhLY0KrpU7zmjFnlhqoVO2aDcmd1zrXk7Bf1tVJ1ovc5H5FmxSREBCS E1eTUX+cRkjzsBcY0zVoLKt022i8bd4QDi2xTOPXRkir+ZroqfDB5/Cs8fsBSxuEVNGk W9bqkkstgslwGcknIfqAak0BfJ/XDO1lwMM0s3W3vee5Mmmr8GcX/4A9u4hSvmL2kKL8 pUhZ/sZAqorKyGNPsVPmk3GLWGNl8woU0aBC22GRJ4y8Vc5X01JhUTaEH4NL6w2qxjMw 8T8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=adR1pap5; 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 g5-20020a17090670c500b008d78cb027b7si135546ejk.667.2023.04.11.11.34.54; Tue, 11 Apr 2023 11:35:21 -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=20210112 header.b=adR1pap5; 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 S229561AbjDKS3I (ORCPT + 99 others); Tue, 11 Apr 2023 14:29:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbjDKS3G (ORCPT ); Tue, 11 Apr 2023 14:29:06 -0400 Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A74CEA; Tue, 11 Apr 2023 11:29:05 -0700 (PDT) Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-1842e8a8825so10804954fac.13; Tue, 11 Apr 2023 11:29:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1681237745; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=04BQWUwBxDZ2Ggq7BQgfuwgR7cIa0rI/ETFyOfLGigY=; b=adR1pap581Si5eUy20kOKPZF+9sdl0vkghbMvZWluaR2MaugneQRN0zU6SAi61kDzv ohsvMWx6DU8krs4e8Dw4ch9e8pRuumtRyYCsKqJlA06lAH/aPab1WpvVhY1U49ZL+oRu 9LUBqPrlgzx5AdGz/Q9Yo6f4UCetoXT/KbTydaEjGgWeF5w2JnYXC1Wq3XhPN3aeNfuW yBR5C6+erhkLFaNIU1IELQQ9xcyrjuk1g/OqGArd0vezAII6GLja7T+jBA3oXTRjSpiE I9gnuKtw3R3ImHTkbN1ygQumqawu50x7d6BsG2aTr9fdhTAzfo8R5pqNv6qkQY2bnqet j/vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681237745; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=04BQWUwBxDZ2Ggq7BQgfuwgR7cIa0rI/ETFyOfLGigY=; b=43WL2AbqAu7iv3SkPZ58L/QNGBzUHZHDJbMbQ62MNk8+IG0ZfM2HYUXCeWr6iuLtVi WZcTZmLiXlZUTJyH4BnKaL9ZTkTOXO2KxB39M9KcHx3/AxixmCtYzLRlI7ZbD40t33IZ jb2jQEYaDp/p9rATOs6Ej6zBe27s+lEaun0E8BzW/pSoWkcNs5ZCrOEOAJiqv9DMRuza weIcQcl9IjsP3zCXXqdSBLaJ12ZFtkraTMxLNeqgSo8su8ljt7RR0ZAPhVBJ8TT/qwg5 hV5x7T+krdLANW+F7J0JyVV4xWo8LOx7gNAqGYQnlpp0ARUg2qY7tlbQzswuTlSL9ZAD SqQw== X-Gm-Message-State: AAQBX9fkXXU5cifb5ctZ80KxIzu9O2ERcQr1vW3UdCYyzF+AyTwSv7ON NVtJxvCFsRtOly45X89bIbCE+RPfXi31uZnBROw= X-Received: by 2002:a05:6870:5625:b0:180:b4c1:dfce with SMTP id m37-20020a056870562500b00180b4c1dfcemr5580747oao.5.1681237744881; Tue, 11 Apr 2023 11:29:04 -0700 (PDT) MIME-Version: 1.0 References: <20230410210608.1873968-1-robdclark@gmail.com> In-Reply-To: From: Rob Clark Date: Tue, 11 Apr 2023 11:28:53 -0700 Message-ID: Subject: Re: [Freedreno] [PATCH v2 0/2] drm: fdinfo memory stats To: Dmitry Baryshkov Cc: dri-devel@lists.freedesktop.org, Rob Clark , Tvrtko Ursulin , "open list:DOCUMENTATION" , linux-arm-msm@vger.kernel.org, Emil Velikov , Christopher Healy , open list , Sean Paul , Boris Brezillon , freedreno@lists.freedesktop.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 On Tue, Apr 11, 2023 at 10:36=E2=80=AFAM Dmitry Baryshkov wrote: > > On Tue, 11 Apr 2023 at 20:13, Rob Clark wrote: > > > > On Tue, Apr 11, 2023 at 9:53=E2=80=AFAM Daniel Vetter = wrote: > > > > > > On Tue, Apr 11, 2023 at 09:47:32AM -0700, Rob Clark wrote: > > > > On Mon, Apr 10, 2023 at 2:06=E2=80=AFPM Rob Clark wrote: > > > > > > > > > > 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 documentat= ion. > > > > > > > > > > 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 s= tart. > > > > > > > > > > Basic gputop support: https://patchwork.freedesktop.org/series/11= 6236/ > > > > > And already nvtop support: https://github.com/Syllo/nvtop/pull/20= 4 > > > > > > > > On a related topic, I'm wondering if it would make sense to report > > > > some more global things (temp, freq, etc) via fdinfo? Some of this= , > > > > tools like nvtop could get by trawling sysfs or other driver specif= ic > > > > ways. But maybe it makes sense to have these sort of things report= ed > > > > in a standardized way (even though they aren't really per-drm_file) > > > > > > I think that's a bit much layering violation, we'd essentially have t= o > > > reinvent the hwmon sysfs uapi in fdinfo. Not really a business I want= to > > > be in :-) > > > > I guess this is true for temp (where there are thermal zones with > > potentially multiple temp sensors.. but I'm still digging my way thru > > the thermal_cooling_device stuff) > > It is slightly ugly. All thermal zones and cooling devices are virtual > devices (so, even no connection to the particular tsens device). One > can either enumerate them by checking > /sys/class/thermal/thermal_zoneN/type or enumerate them through > /sys/class/hwmon. For cooling devices again the only enumeration is > through /sys/class/thermal/cooling_deviceN/type. > > Probably it should be possible to push cooling devices and thermal > zones under corresponding providers. However I do not know if there is > a good way to correlate cooling device (ideally a part of GPU) to the > thermal_zone (which in our case is provided by tsens / temp_alarm > rather than GPU itself). > > > > > But what about freq? I think, esp for cases where some "fw thing" is > > controlling the freq we end up needing to use gpu counters to measure > > the freq. > > For the freq it is slightly easier: /sys/class/devfreq/*, devices are > registered under proper parent (IOW, GPU). So one can read > /sys/class/devfreq/3d00000.gpu/cur_freq or > /sys/bus/platform/devices/3d00000.gpu/devfreq/3d00000.gpu/cur_freq. > > However because of the components usage, there is no link from > /sys/class/drm/card0 > (/sys/devices/platform/soc@0/ae00000.display-subsystem/ae01000.display-co= ntroller/drm/card0) > to /sys/devices/platform/soc@0/3d00000.gpu, the GPU unit. > > Getting all these items together in a platform-independent way would > be definitely an important but complex topic. But I don't believe any of the pci gpu's use devfreq ;-) And also, you can't expect the CPU to actually know the freq when fw is the one controlling freq. We can, currently, have a reasonable approximation from devfreq but that stops if IFPC is implemented. And other GPUs have even less direct control. So freq is a thing that I don't think we should try to get from "common frameworks" BR, -R > > > > > What might be needed is better glue to go from the fd or fdinfo to th= e > > > right hw device and then crawl around the hwmon in sysfs automaticall= y. I > > > would not be surprised at all if we really suck on this, probably mor= e > > > likely on SoC than pci gpus where at least everything should be under= the > > > main pci sysfs device. > > > > yeah, I *think* userspace would have to look at /proc/device-tree to > > find the cooling device(s) associated with the gpu.. at least I don't > > see a straightforward way to figure it out just for sysfs > > > > BR, > > -R > > > > > -Daniel > > > > > > > > > > > BR, > > > > -R > > > > > > > > > > > > > [1] https://patchwork.freedesktop.org/series/112397/ > > > > > > > > > > Rob Clark (2): > > > > > drm: Add fdinfo memory stats > > > > > drm/msm: Add memory stats to fdinfo > > > > > > > > > > Documentation/gpu/drm-usage-stats.rst | 21 +++++++ > > > > > drivers/gpu/drm/drm_file.c | 79 +++++++++++++++++++++= ++++++ > > > > > drivers/gpu/drm/msm/msm_drv.c | 25 ++++++++- > > > > > drivers/gpu/drm/msm/msm_gpu.c | 2 - > > > > > include/drm/drm_file.h | 10 ++++ > > > > > 5 files changed, 134 insertions(+), 3 deletions(-) > > > > > > > > > > -- > > > > > 2.39.2 > > > > > > > > > > > -- > > > Daniel Vetter > > > Software Engineer, Intel Corporation > > > http://blog.ffwll.ch > > > > -- > With best wishes > Dmitry