Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5841143rwl; Tue, 11 Apr 2023 10:40:16 -0700 (PDT) X-Google-Smtp-Source: AKy350ZnTX5HhsmjhESBKVwre1wu5u9T3eOYHwbMTMT8sq/xtmtTGCWdDzO4uVqGY0y72c0WIqjz X-Received: by 2002:a05:6a20:be1e:b0:db:e054:826a with SMTP id ge30-20020a056a20be1e00b000dbe054826amr18858763pzb.5.1681234816098; Tue, 11 Apr 2023 10:40:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681234816; cv=none; d=google.com; s=arc-20160816; b=dMOGUObOUBsH5huhvsSdeEkFAprYSET9pNkpLujT++bkdWizSg5kUPEPG20Lx1QUG0 VDg509DDME1y6/wRMr/T5JacHtC/eNFRbK4kDYrXyIjjWoSkeSjHZBKZbMh5w9vhB0Hy EaoFYvUTjpZzjAyjN+DhR5e6R66Iu9axp26C//AMdq+kVDOL4NOjb5ebwPj0Zez1VoX3 NDnB34zclmKl3fVGcB/gprfaNdO8ON0N0Dsh119QrP4s+0P1FuX0x/oL+tbLSOP5EUpm s4lUc7mB2Fo3/mdjhcCuOGbt6LF8RAiBZEW6NM+iBNKgo0/5xri1bsJu0hAmbePBKQnD PVxA== 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=+kyBvTzdzIu1H+Ec72ru36ICQw3wemFp5ak3AycFoQ8=; b=mm1z3BiGzcuOFqcYBWgePlipsuTieaiWNoKph4ep1/CXGgZjcAyDn/P+fHcdF/xIDk VtsbjPTkWut2XlG3yWz9+toA6naZwzFKTd/n49aPXCInfj+R391zYuqf9b0jLUbppE0D 6QZv2DPJR2aChlOxgn3hHSVkCotz1UPCsXEZWLcrk0cMqOtX0xmVws3etT7uNWgx9mNJ qzdHvEVrMmjUCnvy5/xzffsBlzK+fNxL2vg+Jyvf7FfDmJDuFEiSXLk+zkVH+IlmVC3g XqOpQJ7EAUCtlPtJGGx8pqztv842aJGDSPG2Bu2NA/i8dk67o+dI8j+SwKm9vLHrHvB3 jtjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="oP5s/x3I"; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a21-20020aa795b5000000b00637aea0b243si5886860pfk.77.2023.04.11.10.40.03; Tue, 11 Apr 2023 10:40:16 -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=@linaro.org header.s=google header.b="oP5s/x3I"; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229968AbjDKRgF (ORCPT + 99 others); Tue, 11 Apr 2023 13:36:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbjDKRgC (ORCPT ); Tue, 11 Apr 2023 13:36:02 -0400 Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A8A96A54 for ; Tue, 11 Apr 2023 10:36:00 -0700 (PDT) Received: by mail-yb1-xb35.google.com with SMTP id y69so15921737ybe.2 for ; Tue, 11 Apr 2023 10:36:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681234559; 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=+kyBvTzdzIu1H+Ec72ru36ICQw3wemFp5ak3AycFoQ8=; b=oP5s/x3IrjFEbxhZPWV3IVDz/ByDv2Ls5x0O904x2AuYnjvT2xICE5jp4Tqycen2Q0 doWB5C4gJbHjt9YBfJZZ74qhwDSO3keTBaDVOCqmLMK1KqZX+5iIVtXBR873RnMbYtQN 6qhq10qLHF5GjQwzQRpQcqE40Zs9A5kSMovizD+QwySni7mjunbPGP0Mx1H6jwk8yYqJ MlIgwBp/dj6LRDnIcO8xxmjGN2EN2EcUy1cMHEOv0gC/M9temGqgAVyIuqZbdYacn2av AX0UDtOnbtdAnhuxSth4XG1PDFyojl13Jw2ik9uGUyRJ5joiPzEI+YJz+yPFcLTtnDcj IkVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681234559; 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=+kyBvTzdzIu1H+Ec72ru36ICQw3wemFp5ak3AycFoQ8=; b=g1fIXNkn8Sdv3teFqZwI9zoww1OFigyrUNh4ZrzNMAglfFlxq+qjOaOnKd3m+FaNWk JzAjSl7oUileqMZ3zdhVG6/kaCDRmh6kFRhkqC4TUEaOxsda2u0JTVo/bWkFmxM2siYR UxPft6ZMdkiQrpsELBbNX6AO4gTBu+2ZaGBwnyJ2xY06oUUTfWLR6Ial+qEYd6Cy7I/E YLurkNzSfZqL8qfq31riFRvvnjYf3sGFfjclZ8+v8/9hfpiXwfD2E4m3+mH0dHqJ9n+j 016bU4qliLDAUeYULmvuD55jTxMnmcAFWR1dLrG/eul9YNYl2sL1Hn5XMesFeliCQQyt 4D3Q== X-Gm-Message-State: AAQBX9fxx61g8BEaJ8prosM754RXv/nGqN0+cgtNXKN6H1o9/gUZG/Ef mY9kRLKsB3OfwLS8V7DjpqPTkQfNyEuRYOH/m7ex4w== X-Received: by 2002:a25:d649:0:b0:b8a:7b2d:6555 with SMTP id n70-20020a25d649000000b00b8a7b2d6555mr2048091ybg.9.1681234559624; Tue, 11 Apr 2023 10:35:59 -0700 (PDT) MIME-Version: 1.0 References: <20230410210608.1873968-1-robdclark@gmail.com> In-Reply-To: From: Dmitry Baryshkov Date: Tue, 11 Apr 2023 20:35:48 +0300 Message-ID: Subject: Re: [Freedreno] [PATCH v2 0/2] drm: fdinfo memory stats To: Rob Clark 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,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, 11 Apr 2023 at 20:13, Rob Clark wrote: > > On Tue, Apr 11, 2023 at 9:53=E2=80=AFAM Daniel Vetter w= rote: > > > > 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 documentatio= n. > > > > > > > > It is probably a bit UMA-centric, I guess devices with VRAM might w= ant > > > > some placement stats as well. But this seems like a reasonable sta= rt. > > > > > > > > Basic gputop support: https://patchwork.freedesktop.org/series/1162= 36/ > > > > And already nvtop support: https://github.com/Syllo/nvtop/pull/204 > > > > > > 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 specific > > > ways. But maybe it makes sense to have these sort of things reported > > > 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 to > > reinvent the hwmon sysfs uapi in fdinfo. Not really a business I want t= o > > 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-cont= roller/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. > > > What might be needed is better glue to go from the fd or fdinfo to the > > right hw device and then crawl around the hwmon in sysfs automatically.= I > > would not be surprised at all if we really suck on this, probably more > > likely on SoC than pci gpus where at least everything should be under t= he > > 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 --=20 With best wishes Dmitry