Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5893272rwl; Tue, 11 Apr 2023 11:26:33 -0700 (PDT) X-Google-Smtp-Source: AKy350ZALH/iUDv5J5UkuA6Sfp7o2qVixUF5uz1iE7+gmVuOVat4/rhdI7UJeNtcLS/bFqhhseLC X-Received: by 2002:a05:6a20:7a96:b0:bc:a257:5b2a with SMTP id u22-20020a056a207a9600b000bca2575b2amr15636700pzh.31.1681237593562; Tue, 11 Apr 2023 11:26:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681237593; cv=none; d=google.com; s=arc-20160816; b=X6eIMXvhJBPTmXXfTgmysj4zpVE6iSzOBM142pxY5RIVKBrtikrdUO7Ywiuc2K+0D4 OY6viIm4zxBK4uBaoGSqeG4fRlnAgWbVzdotbKajMo0nPsGTiazD9Yxk9PglL9P2wf5X DNjCVfO3vQNYWCrNPCLcbVK6FjE6ifiNFglEg66T+HmXV42pD0GE1D3LgO4o9BkYC91M 3iH2PJfuR/Aj0yIN07NyOUiIg0+QopfGiJ/KypoOF1kv8hNFbtmaZByk826wA5zDRsnm 68BhxA5qZ63sz7gYEENxmDBHFCKw5F53j84OwoKdS87XNzVIGohGrQgXMBt2zrebataN ye7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=6V2fpjYPL3sTmtLv/4ao+yq+fKEhSjDDl7REJsXZ3TQ=; b=EH6FY5KpxkDRBemQjUquIMISb+Ot0lByWAT3yRVWZGpb3Zvvq1tysAeoF7PwHQux9x k5FX6hNsX62elJFIN8/5v3I1tcLU4WBsMMQf1H1/7iq21LSkhX28jcBzREB5+V1xyoCq bRK0rVmNHS4UA/JKRTZeoze0hGGH3732KPBUeKaoV5p11u7ec3PbGHO/NxRaG0FVakAI uVe8xy3GX5Q+Ad6p+GL3QB0PUbD8ZrJyRNSpL4lsbBChghET0rP4LIOEak7fjb5FM3KD /U3y1hmWPKe2ab2BRKbwNFRPcYUKNx92VMQKk1Q1Mz8Nl/gfIvB1idTrX8YppTX0lfTr /3ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b="d/zOnJVc"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk13-20020a056a02028d00b00518bedc505dsi7470727pgb.360.2023.04.11.11.26.21; Tue, 11 Apr 2023 11:26:33 -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=@ffwll.ch header.s=google header.b="d/zOnJVc"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229738AbjDKS0M (ORCPT + 99 others); Tue, 11 Apr 2023 14:26:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229598AbjDKS0I (ORCPT ); Tue, 11 Apr 2023 14:26:08 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 527FC49E1 for ; Tue, 11 Apr 2023 11:26:06 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-2f4130b898cso34154f8f.0 for ; Tue, 11 Apr 2023 11:26:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; t=1681237565; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:from:to:cc:subject:date:message-id:reply-to; bh=6V2fpjYPL3sTmtLv/4ao+yq+fKEhSjDDl7REJsXZ3TQ=; b=d/zOnJVcqw74lXkfDZZyDOVgxROdHfNZVnimMK9k8hdpWl8ptHninUwzQqSnylc6dk AU95xm0qZ6TRmNZQU99Z6CrtzJgV9caG2BvHZ6TRGN1s+zeYiCvssaQ4OA7xsnluWqZn 73hAIpcEjxwsKFiU3uqOeohoLEUmcBu3NCKFc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681237565; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6V2fpjYPL3sTmtLv/4ao+yq+fKEhSjDDl7REJsXZ3TQ=; b=cAMnQUkEarTn2JBmROEwvYP2vA5puMl1ujn23cwfEpmzPevfEM/adkl4n0toFcCJf5 gw6CUlCNErwL6FiPnMqW77DFMoH3UtdUTF8FoDhHHxDRO2XSX6Da2jabicJKxu/U2Mn+ UQ3y+pIYknkHX9KS58LaPljmNHkrz65ykdtlKGttF32u/fYZbYyGvxrMhnxY2f8UKRFx oJQOlYz3CKOIUe7kYMccq23n9+dj9s+504dZ/cTO8b64yuO2cTMLPS/Wihb49ieI4qbc yEND1d4WWaLKoF8lpa5cBBoOtayY+Af69CDjS05p4bQYn7xpEVfbWNVchNJYwuzpK+OO htFQ== X-Gm-Message-State: AAQBX9ct6sIPYfqMKbChZrEqTGPB7B7pfKnN5vYak327cvbVAByOH0q/ wFcUUW3HvpG1BVyvjkkV6exeLA== X-Received: by 2002:a5d:644c:0:b0:2ef:9699:f906 with SMTP id d12-20020a5d644c000000b002ef9699f906mr39023wrw.7.1681237564706; Tue, 11 Apr 2023 11:26:04 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-33.fiber7.init7.net. [212.51.149.33]) by smtp.gmail.com with ESMTPSA id e17-20020adffc51000000b002ef2e148d59sm14493882wrs.16.2023.04.11.11.26.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Apr 2023 11:26:04 -0700 (PDT) Date: Tue, 11 Apr 2023 20:26:02 +0200 From: Daniel Vetter To: Dmitry Baryshkov Cc: Rob Clark , Rob Clark , Tvrtko Ursulin , "open list:DOCUMENTATION" , linux-arm-msm@vger.kernel.org, Emil Velikov , Christopher Healy , dri-devel@lists.freedesktop.org, open list , Boris Brezillon , freedreno@lists.freedesktop.org, Sean Paul Subject: Re: [Freedreno] [PATCH v2 0/2] drm: fdinfo memory stats Message-ID: Mail-Followup-To: Dmitry Baryshkov , Rob Clark , Rob Clark , Tvrtko Ursulin , "open list:DOCUMENTATION" , linux-arm-msm@vger.kernel.org, Emil Velikov , Christopher Healy , dri-devel@lists.freedesktop.org, open list , Boris Brezillon , freedreno@lists.freedesktop.org, Sean Paul References: <20230410210608.1873968-1-robdclark@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Operating-System: Linux phenom 6.1.0-7-amd64 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_NONE 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 08:35:48PM +0300, Dmitry Baryshkov wrote: > On Tue, 11 Apr 2023 at 20:13, Rob Clark wrote: > > > > On Tue, Apr 11, 2023 at 9:53 AM Daniel Vetter wrote: > > > > > > On Tue, Apr 11, 2023 at 09:47:32AM -0700, Rob Clark wrote: > > > > On Mon, Apr 10, 2023 at 2:06 PM 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 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 > > > > > > > > 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 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). There's not even sysfs links to connect the pieces in both ways? > > 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-controller/drm/card0) > to /sys/devices/platform/soc@0/3d00000.gpu, the GPU unit. Hm ... do we need to make component more visible in sysfs, with _looooots_ of links? Atm it's just not even there. > Getting all these items together in a platform-independent way would > be definitely an important but complex topic. Yeah this sounds like some work. But also sounds like it's all generic issues (thermal zones above and component here) that really should be fixed at that level? Cheers, Daniel > > > 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 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 -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch